📄 jvqxpcore.pas
字号:
{******************************************************************************}
{* WARNING: JEDI VCL To CLX Converter generated unit. *}
{* Manual modifications will be lost on next release. *}
{******************************************************************************}
{-----------------------------------------------------------------------------
The contents of this file are subject to the Mozilla Public License
Version 1.1 (the "License"); you may not use this file except in compliance
with the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/MPL-1.1.html
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either expressed or implied. See the License for
the specific language governing rights and limitations under the License.
The Original Code is: JvXPCore.PAS, released on 2004-01-01.
The Initial Developer of the Original Code is Marc Hoffman.
Portions created by Marc Hoffman are Copyright (C) 2002 APRIORI business solutions AG.
Portions created by APRIORI business solutions AG are Copyright (C) 2002 APRIORI business solutions AG
All Rights Reserved.
Contributor(s):
You may retrieve the latest version of this file at the Project JEDI's JVCL home page,
located at http://jvcl.sourceforge.net
Known Issues:
-----------------------------------------------------------------------------}
// $Id: JvQXPCore.pas,v 1.20 2005/02/06 14:06:32 asnepvangers Exp $
unit JvQXPCore;
{$I jvcl.inc}
interface
uses
QWindows, QControls, QGraphics, QForms, QMessages, // asn: messages after controls for clx
JvQComponent,
Classes;
const
{ color constants.
these constants are used as default colors for descendant controls
and may be replaced with other (common) values.
syntax: JvXPColor_[Control]_[Enabled: Enb, Dis]_[Type]_[Theme: WXP, OXP] }
{ button colors - WindowsXP }
dxColor_Btn_Enb_Border_WXP = TColor($00733800); // border line
dxColor_Btn_Dis_Border_WXP = TColor($00BDC7CE); // border line (disabled)
dxColor_Btn_Enb_Edges_WXP = TColor($00AD9E7B); // border edges
dxColor_Btn_Dis_Edges_WXP = TColor($00BDC7CE); // border edges (disabled)
dxColor_Btn_Enb_BgFrom_WXP = TColor($00FFFFFF); // background from
dxColor_Btn_Enb_BgTo_WXP = TColor($00E7EBEF); // background to
dxColor_Btn_Enb_CkFrom_WXP = TColor($00C6CFD6); // clicked from
dxColor_Btn_Enb_CkTo_WXP = TColor($00EBF3F7); // clicked to
dxColor_Btn_Enb_FcFrom_WXP = TColor($00FFE7CE); // focused from
dxColor_Btn_Enb_FcTo_WXP = TColor($00EF846D); // focused to
dxColor_Btn_Enb_HlFrom_WXP = TColor($00CEF3FF); // highlight from
dxColor_Btn_Enb_HlTo_WXP = TColor($000096E7); // highlight to
{ checkbox colors - WindowsXP }
dxColor_Chk_Enb_Border_WXP = TColor($00845118); // border line
dxColor_Chk_Enb_NmSymb_WXP = TColor($0021A621); // symbol normal
{ misc colors - WindowsXP }
dxColor_Msc_Dis_Caption_WXP = TColor($0094A6A5); // caption color (disabled)
dxColor_DotNetFrame = TColor($00F7FBFF); // $00E7EBEF;
dxColor_BorderLineOXP = TColor($00663300);
dxColor_BgOXP = TColor($00D6BEB5);
dxColor_BgCkOXP = TColor($00CC9999);
type
TJvXPCustomStyleControl = class;
TJvXPBoundLines = set of
(
blLeft, // left line
blTop, // top line
blRight, // right line
blBottom // bottom line
);
TJvXPControlStyle = set of
(
csRedrawCaptionChanged, // (default)
csRedrawBorderChanged, //
csRedrawEnabledChanged, // (default)
csRedrawFocusedChanged, // (default)
csRedrawMouseDown, // (default)
csRedrawMouseEnter, // (default)
csRedrawMouseLeave, // (default)
csRedrawMouseMove, //
csRedrawMouseUp, // (default)
csRedrawParentColorChanged, // (default)
csRedrawParentFontChanged, //
csRedrawPosChanged, //
csRedrawResized //
);
TJvXPDrawState = set of
(
dsDefault, // default
dsHighlight, // highlighted
dsClicked, // clicked
dsFocused // focused
);
TJvXPGlyphLayout =
(
glBottom, // bottom glyph
glCenter, // centered glyph
glTop // top glyph
);
TJvXPTheme =
(
WindowsXP, // WindowsXP theme
OfficeXP // OfficeXP theme
);
{ baseclass for non-focusable component descendants. }
TJvXPCustomComponent = class(TJvComponent)
public
constructor Create(AOwner: TComponent); override;
end;
TJvXPWinControl = class(TJvWinControl)
published
property Color;
end;
{ baseclass for focusable control descendants. }
TJvXPCustomControl = class(TJvCustomControl)
private
FClicking: Boolean;
FDrawState: TJvXPDrawState;
FIsLocked: Boolean;
FIsSibling: Boolean;
FModalResult: TModalResult;
FOnMouseLeave: TNotifyEvent;
FOnMouseEnter: TNotifyEvent;
procedure CMFocusChanged(var Msg: TMessage); message CM_FOCUSCHANGED;
protected
ExControlStyle: TJvXPControlStyle;
procedure InternalRedraw; dynamic;
procedure HookBorderChanged; dynamic;
procedure HookEnabledChanged; dynamic;
procedure HookFocusedChanged; dynamic;
procedure HookMouseDown; dynamic;
procedure HookMouseEnter; dynamic;
procedure HookMouseLeave; dynamic;
procedure HookMouseMove(X: Integer = 0; Y: Integer = 0); dynamic;
procedure HookMouseUp; dynamic;
procedure HookParentColorChanged; dynamic;
procedure HookParentFontChanged; dynamic;
procedure HookPosChanged; dynamic;
procedure HookResized; dynamic;
procedure HookTextChanged; dynamic;
procedure BeginUpdate; dynamic;
procedure EndUpdate; dynamic;
procedure LockedInvalidate; dynamic;
procedure AdjustSize; override;
procedure BorderChanged; dynamic;
procedure EnabledChanged; override;
procedure TextChanged; override;
procedure ParentColorChanged; override;
procedure ParentFontChanged; override;
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
procedure MouseEnter(AControl: TControl); override;
procedure MouseLeave(AControl: TControl); override;
function WantKey(Key: Integer; Shift: TShiftState; const KeyText: WideString): Boolean; override;
procedure Loaded; override;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure Click; override;
property ModalResult: TModalResult read FModalResult write FModalResult default 0;
property OnMouseEnter: TNotifyEvent read FOnMouseEnter write FOnMouseEnter;
property OnMouseLeave: TNotifyEvent read FOnMouseLeave write FOnMouseLeave;
public
constructor Create(AOwner: TComponent); override;
property Canvas;
property DrawState: TJvXPDrawState read FDrawState write FDrawState;
property IsLocked: Boolean read FIsLocked write FIsLocked;
property IsSibling: Boolean read FIsSibling write FIsSibling;
published
end;
TJvXPUnlimitedControl = class(TJvXPCustomControl)
published
//property BevelInner;
//property BevelOuter;
//property BevelWidth;
//property BiDiMode;
//property Ctl3D;
//property DockSite;
//property ParentBiDiMode;
//property ParentCtl3D;
//property TabOrder;
//property TabStop;
//property UseDockManager default True;
property Align;
property Anchors;
//property AutoSize;
property Constraints;
property DragMode;
//property Enabled;
property Font;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property Visible;
//property OnDockDrop;
//property OnDockOver;
//property OnEndDock;
//property OnGetSiteInfo;
//property OnStartDock;
//property OnUnDock;
property OnClick;
property OnConstrainedResize;
property OnContextPopup;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseEnter;
property OnMouseLeave;
property OnMouseMove;
property OnMouseUp;
property OnStartDrag;
end;
TJvXPStyle = class(TPersistent)
private
FTheme: TJvXPTheme;
FUseStyleManager: Boolean;
protected
Parent: TJvXPCustomStyleControl;
procedure SetTheme(Value: TJvXPTheme); virtual;
procedure SetUseStyleManager(Value: Boolean); virtual;
public
constructor Create(AOwner: TComponent);
function GetTheme: TJvXPTheme;
published
property Theme: TJvXPTheme read FTheme write SetTheme default WindowsXP;
property UseStyleManager: Boolean read FUseStyleManager write SetUseStyleManager default True;
end;
TJvXPStyleManager = class(TJvXPCustomComponent)
private
FControls: TList;
FTheme: TJvXPTheme;
FOnThemeChanged: TNotifyEvent;
procedure InvalidateControls;
protected
procedure SetTheme(Value: TJvXPTheme); virtual;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure RegisterControls(const AControls: array of TJvXPCustomControl);
procedure UnregisterControls(const AControls: array of TJvXPCustomControl);
published
property Theme: TJvXPTheme read FTheme write SetTheme default WindowsXP;
property OnThemeChanged: TNotifyEvent read FOnThemeChanged write FOnThemeChanged;
end;
TJvXPCustomStyleControl = class(TJvXPCustomControl)
private
FStyle: TJvXPStyle;
FStyleManager: TJvXPStyleManager;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
protected
procedure SetStyleManager(Value: TJvXPStyleManager); virtual;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
property Style: TJvXPStyle read FStyle write FStyle;
property StyleManager: TJvXPStyleManager read FStyleManager write SetStyleManager;
end;
TJvXPGradientColors = 2..255;
TJvXPGradientStyle = (gsLeft, gsTop, gsRight, gsBottom);
TJvXPGradient = class(TPersistent)
private
FColors: TJvXPGradientColors;
FDithered: Boolean;
FEnabled: Boolean;
FEndColor: TColor;
FStartColor: TColor;
FGradientStyle: TJvXPGradientStyle;
protected
Parent: TJvXPCustomControl;
procedure SetDithered(Value: Boolean); virtual;
procedure SetColors(Value: TJvXPGradientColors); virtual;
procedure SetEnabled(Value: Boolean); virtual;
procedure SetEndColor(Value: TColor); virtual;
procedure SetGradientStyle(Value: TJvXPGradientStyle); virtual;
procedure SetStartColor(Value: TColor); virtual;
public
Bitmap: TBitmap;
constructor Create(AOwner: TControl);
destructor Destroy; override;
procedure RecreateBands; virtual;
published
property Dithered: Boolean read FDithered write SetDithered default True;
property Colors: TJvXPGradientColors read FColors write SetColors default 16;
property Enabled: Boolean read FEnabled write SetEnabled default False;
property EndColor: TColor read FEndColor write SetEndColor default clSilver;
property StartColor: TColor read FStartColor write SetStartColor default clGray;
property Style: TJvXPGradientStyle read FGradientStyle write SetGradientStyle default gsLeft;
end;
implementation
uses
{$IFDEF UNITVERSIONING}
JclUnitVersioning,
{$ENDIF UNITVERSIONING}
JvQResources,
JvQXPCoreUtils;
{$IFDEF MSWINDOWS}
{$R ..\Resources\JvXPCore.res}
{$ENDIF MSWINDOWS}
{$IFDEF UNIX}
{$R ../Resources/JvXPCore.res}
{$ENDIF UNIX}
//=== { TJvXPCustomComponent } ===============================================
constructor TJvXPCustomComponent.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
end;
//=== { TJvXPCustomControl } =================================================
constructor TJvXPCustomControl.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
ControlStyle := ControlStyle + [csOpaque, csReplicatable];
DoubleBuffered := True;
ExControlStyle := [csRedrawEnabledChanged, csRedrawFocusedChanged,
csRedrawMouseDown, csRedrawMouseEnter, csRedrawMouseLeave, csRedrawMouseUp,
csRedrawParentColorChanged, csRedrawCaptionChanged];
FClicking := False;
FDrawState := [dsDefault];
FIsLocked := False;
FIsSibling := False;
FModalResult := 0;
end;
procedure TJvXPCustomControl.BeginUpdate;
begin
FIsLocked := True;
end;
procedure TJvXPCustomControl.EndUpdate;
begin
FIsLocked := False;
InternalRedraw;
end;
procedure TJvXPCustomControl.LockedInvalidate;
begin
if not IsLocked then
Invalidate;
end;
procedure TJvXPCustomControl.InternalRedraw;
begin
if not FIsLocked then
Invalidate;
end;
procedure TJvXPCustomControl.CMFocusChanged(var Msg: TMessage);
begin
// delegate message "FocusChanged" to hook.
inherited;
HookFocusedChanged;
end;
function TJvXPCustomControl.WantKey(Key: Integer; Shift: TShiftState;
const KeyText: WideString): Boolean;
begin
Result := IsAccel(Key, Caption) and Enabled and not (ssCtrl in Shift);
if Result then
Click
else
Result := inherited WantKey(Key, Shift, KeyText);
end;
procedure TJvXPCustomControl.Loaded;
begin
inherited Loaded;
AdjustSize;
end;
procedure TJvXPCustomControl.BorderChanged;
begin
// delegate message "BorderChanged" to hook.
// inherited BorderChanged;
HookBorderChanged;
end;
procedure TJvXPCustomControl.EnabledChanged;
begin
// delegate message "EnabledChanged" to hook.
inherited EnabledChanged;
HookEnabledChanged;
end;
procedure TJvXPCustomControl.MouseEnter(AControl: TControl);
begin
// delegate message "MouseEnter" to hook.
inherited MouseEnter(AControl);
HookMouseEnter;
end;
procedure TJvXPCustomControl.MouseLeave(AControl: TControl);
begin
// delegate message "MouseLeave" to hook.
inherited MouseLeave(AControl);
HookMouseLeave;
end;
procedure TJvXPCustomControl.ParentColorChanged;
begin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -