📄 jvexcontrols.pas
字号:
{-----------------------------------------------------------------------------
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: JvExControls.pas, released on 2004-01-04
The Initial Developer of the Original Code is Andreas Hausladen [Andreas dott Hausladen att gmx dott de]
Portions created by Andreas Hausladen are Copyright (C) 2004 Andreas Hausladen.
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: JvExControls.pas,v 1.83 2005/03/09 07:25:02 marquardt Exp $
unit JvExControls;
{$I jvcl.inc}
{*****************************************************************************
* WARNING: Do not edit this file.
* This file is autogenerated from the source in devtools/JvExVCL/src.
* If you do it despite this warning your changes will be discarded by the next
* update of this file. Do your changes in the template files.
****************************************************************************}
interface
uses
Windows, Messages,
{$IFDEF HAS_UNIT_TYPES}
Types,
{$ENDIF HAS_UNIT_TYPES}
SysUtils, Classes, Graphics, Controls, Forms,
{$IFDEF UNITVERSIONING}
JclUnitVersioning,
{$ENDIF UNITVERSIONING}
JvTypes, JvThemes, JVCLVer;
type
TDlgCode =
(dcWantAllKeys, dcWantArrows, dcWantChars, dcButton, dcHasSetSel, dcWantTab,
dcNative); // if dcNative is in the set the native allowed keys are used and GetDlgCode is ignored
TDlgCodes = set of TDlgCode;
const
dcWantMessage = dcWantAllKeys;
const
CM_DENYSUBCLASSING = JvThemes.CM_DENYSUBCLASSING;
{$IFDEF VisualCLX}
CM_PERFORM = CM_BASE + $500 + 0; // LParam: "Msg: ^TMessage"
{$ENDIF VisualCLX}
CM_SETAUTOSIZE = CM_BASE + $500 + 1; // WParam: "Value: Boolean"
type
{ IJvExControl is used for the identification of an JvExXxx control. }
IJvExControl = interface
['{8E6579C3-D683-4562-AFAB-D23C8526E386}']
end;
{ Add IJvDenySubClassing to the base class list if the control should not
be themed by the ThemeManager (http://www.soft-gems.net Mike Lischke).
This only works with JvExVCL derived classes. }
IJvDenySubClassing = interface
['{76942BC0-2A6E-4DC4-BFC9-8E110DB7F601}']
end;
function ShiftStateToKeyData(Shift: TShiftState): Longint;
function GetFocusedControl(AControl: TControl): TWinControl;
function DlgcToDlgCodes(Value: Longint): TDlgCodes;
function DlgCodesToDlgc(Value: TDlgCodes): Longint;
procedure GetHintColor(var HintInfo: THintInfo; AControl: TControl; HintColor: TColor);
{$IFDEF COMPILER5}
procedure TOpenControl_SetAutoSize(AControl: TControl; Value: Boolean);
{$ENDIF COMPILER5}
{$IFDEF VisualCLX}
function Perform(AControl: TControl; Msg: Integer; WParam, LParam: Integer): Integer;
{$ENDIF VisualCLX}
type
TJvExControl = class(TControl, IJvExControl)
private
FAboutJVCL: TJVCLAboutInfo;
FHintColor: TColor;
FMouseOver: Boolean;
{$IFDEF VCL}
FOnMouseEnter: TNotifyEvent;
FOnMouseLeave: TNotifyEvent;
{$ENDIF VCL}
FOnParentColorChanged: TNotifyEvent;
function BaseWndProc(Msg: Integer; WParam: Integer = 0; LParam: Integer = 0): Integer;
protected
procedure WndProc(var Msg: TMessage); override;
procedure FocusChanged(AControl: TWinControl); dynamic;
procedure VisibleChanged; reintroduce; dynamic;
procedure EnabledChanged; reintroduce; dynamic;
procedure TextChanged; reintroduce; virtual;
procedure ColorChanged; reintroduce; dynamic;
procedure FontChanged; reintroduce; dynamic;
procedure ParentFontChanged; reintroduce; dynamic;
procedure ParentColorChanged; reintroduce; dynamic;
procedure ParentShowHintChanged; reintroduce; dynamic;
function WantKey(Key: Integer; Shift: TShiftState; const KeyText: WideString): Boolean; reintroduce; virtual;
function HintShow(var HintInfo: THintInfo): Boolean; reintroduce; dynamic;
function HitTest(X, Y: Integer): Boolean; reintroduce; virtual;
procedure MouseEnter(AControl: TControl); reintroduce; dynamic;
procedure MouseLeave(AControl: TControl); reintroduce; dynamic;
{$IFDEF COMPILER5}
{$IFNDEF HASAUTOSIZE}
procedure CMSetAutoSize(var Msg: TMessage); message CM_SETAUTOSIZE;
procedure SetAutoSize(Value: Boolean); virtual;
{$ENDIF !HASAUTOSIZE}
{$ENDIF COMPILER5}
property MouseOver: Boolean read FMouseOver write FMouseOver;
property HintColor: TColor read FHintColor write FHintColor default clDefault;
{$IFDEF VCL}
property OnMouseEnter: TNotifyEvent read FOnMouseEnter write FOnMouseEnter;
property OnMouseLeave: TNotifyEvent read FOnMouseLeave write FOnMouseLeave;
{$ENDIF VCL}
property OnParentColorChange: TNotifyEvent read FOnParentColorChanged write FOnParentColorChanged;
public
constructor Create(AOwner: TComponent); override;
published
property AboutJVCL: TJVCLAboutInfo read FAboutJVCL write FAboutJVCL stored False;
end;
TJvExWinControl = class(TWinControl, IJvExControl)
private
FAboutJVCL: TJVCLAboutInfo;
FHintColor: TColor;
FMouseOver: Boolean;
{$IFDEF VCL}
FOnMouseEnter: TNotifyEvent;
FOnMouseLeave: TNotifyEvent;
{$ENDIF VCL}
FOnParentColorChanged: TNotifyEvent;
function BaseWndProc(Msg: Integer; WParam: Integer = 0; LParam: Integer = 0): Integer;
protected
procedure WndProc(var Msg: TMessage); override;
procedure FocusChanged(AControl: TWinControl); dynamic;
procedure VisibleChanged; reintroduce; dynamic;
procedure EnabledChanged; reintroduce; dynamic;
procedure TextChanged; reintroduce; virtual;
procedure ColorChanged; reintroduce; dynamic;
procedure FontChanged; reintroduce; dynamic;
procedure ParentFontChanged; reintroduce; dynamic;
procedure ParentColorChanged; reintroduce; dynamic;
procedure ParentShowHintChanged; reintroduce; dynamic;
function WantKey(Key: Integer; Shift: TShiftState; const KeyText: WideString): Boolean; reintroduce; virtual;
function HintShow(var HintInfo: THintInfo): Boolean; reintroduce; dynamic;
function HitTest(X, Y: Integer): Boolean; reintroduce; virtual;
procedure MouseEnter(AControl: TControl); reintroduce; dynamic;
procedure MouseLeave(AControl: TControl); reintroduce; dynamic;
{$IFDEF COMPILER5}
{$IFNDEF HASAUTOSIZE}
procedure CMSetAutoSize(var Msg: TMessage); message CM_SETAUTOSIZE;
procedure SetAutoSize(Value: Boolean); virtual;
{$ENDIF !HASAUTOSIZE}
{$ENDIF COMPILER5}
property MouseOver: Boolean read FMouseOver write FMouseOver;
property HintColor: TColor read FHintColor write FHintColor default clDefault;
{$IFDEF VCL}
property OnMouseEnter: TNotifyEvent read FOnMouseEnter write FOnMouseEnter;
property OnMouseLeave: TNotifyEvent read FOnMouseLeave write FOnMouseLeave;
{$ENDIF VCL}
property OnParentColorChange: TNotifyEvent read FOnParentColorChanged write FOnParentColorChanged;
public
constructor Create(AOwner: TComponent); override;
published
property AboutJVCL: TJVCLAboutInfo read FAboutJVCL write FAboutJVCL stored False;
protected
procedure BoundsChanged; reintroduce; virtual;
procedure CursorChanged; reintroduce; dynamic;
procedure ShowingChanged; reintroduce; dynamic;
procedure ShowHintChanged; reintroduce; dynamic;
procedure ControlsListChanging(Control: TControl; Inserting: Boolean); reintroduce; dynamic;
procedure ControlsListChanged(Control: TControl; Inserting: Boolean); reintroduce; dynamic;
procedure GetDlgCode(var Code: TDlgCodes); virtual;
procedure FocusSet(PrevWnd: HWND); virtual;
procedure FocusKilled(NextWnd: HWND); virtual;
function DoEraseBackground(Canvas: TCanvas; Param: Integer): Boolean; virtual;
{$IFDEF JVCLThemesEnabledD56}
private
function GetParentBackground: Boolean;
protected
procedure SetParentBackground(Value: Boolean); virtual;
property ParentBackground: Boolean read GetParentBackground write SetParentBackground;
{$ENDIF JVCLThemesEnabledD56}
end;
TJvExCustomControl = class(TCustomControl, IJvExControl)
private
FAboutJVCL: TJVCLAboutInfo;
FHintColor: TColor;
FMouseOver: Boolean;
{$IFDEF VCL}
FOnMouseEnter: TNotifyEvent;
FOnMouseLeave: TNotifyEvent;
{$ENDIF VCL}
FOnParentColorChanged: TNotifyEvent;
function BaseWndProc(Msg: Integer; WParam: Integer = 0; LParam: Integer = 0): Integer;
protected
procedure WndProc(var Msg: TMessage); override;
procedure FocusChanged(AControl: TWinControl); dynamic;
procedure VisibleChanged; reintroduce; dynamic;
procedure EnabledChanged; reintroduce; dynamic;
procedure TextChanged; reintroduce; virtual;
procedure ColorChanged; reintroduce; dynamic;
procedure FontChanged; reintroduce; dynamic;
procedure ParentFontChanged; reintroduce; dynamic;
procedure ParentColorChanged; reintroduce; dynamic;
procedure ParentShowHintChanged; reintroduce; dynamic;
function WantKey(Key: Integer; Shift: TShiftState; const KeyText: WideString): Boolean; reintroduce; virtual;
function HintShow(var HintInfo: THintInfo): Boolean; reintroduce; dynamic;
function HitTest(X, Y: Integer): Boolean; reintroduce; virtual;
procedure MouseEnter(AControl: TControl); reintroduce; dynamic;
procedure MouseLeave(AControl: TControl); reintroduce; dynamic;
{$IFDEF COMPILER5}
{$IFNDEF HASAUTOSIZE}
procedure CMSetAutoSize(var Msg: TMessage); message CM_SETAUTOSIZE;
procedure SetAutoSize(Value: Boolean); virtual;
{$ENDIF !HASAUTOSIZE}
{$ENDIF COMPILER5}
property MouseOver: Boolean read FMouseOver write FMouseOver;
property HintColor: TColor read FHintColor write FHintColor default clDefault;
{$IFDEF VCL}
property OnMouseEnter: TNotifyEvent read FOnMouseEnter write FOnMouseEnter;
property OnMouseLeave: TNotifyEvent read FOnMouseLeave write FOnMouseLeave;
{$ENDIF VCL}
property OnParentColorChange: TNotifyEvent read FOnParentColorChanged write FOnParentColorChanged;
public
constructor Create(AOwner: TComponent); override;
published
property AboutJVCL: TJVCLAboutInfo read FAboutJVCL write FAboutJVCL stored False;
protected
procedure BoundsChanged; reintroduce; virtual;
procedure CursorChanged; reintroduce; dynamic;
procedure ShowingChanged; reintroduce; dynamic;
procedure ShowHintChanged; reintroduce; dynamic;
procedure ControlsListChanging(Control: TControl; Inserting: Boolean); reintroduce; dynamic;
procedure ControlsListChanged(Control: TControl; Inserting: Boolean); reintroduce; dynamic;
procedure GetDlgCode(var Code: TDlgCodes); virtual;
procedure FocusSet(PrevWnd: HWND); virtual;
procedure FocusKilled(NextWnd: HWND); virtual;
function DoEraseBackground(Canvas: TCanvas; Param: Integer): Boolean; virtual;
{$IFDEF JVCLThemesEnabledD56}
private
function GetParentBackground: Boolean;
protected
procedure SetParentBackground(Value: Boolean); virtual;
property ParentBackground: Boolean read GetParentBackground write SetParentBackground;
{$ENDIF JVCLThemesEnabledD56}
end;
TJvExGraphicControl = class(TGraphicControl, IJvExControl)
private
FAboutJVCL: TJVCLAboutInfo;
FHintColor: TColor;
FMouseOver: Boolean;
{$IFDEF VCL}
FOnMouseEnter: TNotifyEvent;
FOnMouseLeave: TNotifyEvent;
{$ENDIF VCL}
FOnParentColorChanged: TNotifyEvent;
function BaseWndProc(Msg: Integer; WParam: Integer = 0; LParam: Integer = 0): Integer;
protected
procedure WndProc(var Msg: TMessage); override;
procedure FocusChanged(AControl: TWinControl); dynamic;
procedure VisibleChanged; reintroduce; dynamic;
procedure EnabledChanged; reintroduce; dynamic;
procedure TextChanged; reintroduce; virtual;
procedure ColorChanged; reintroduce; dynamic;
procedure FontChanged; reintroduce; dynamic;
procedure ParentFontChanged; reintroduce; dynamic;
procedure ParentColorChanged; reintroduce; dynamic;
procedure ParentShowHintChanged; reintroduce; dynamic;
function WantKey(Key: Integer; Shift: TShiftState; const KeyText: WideString): Boolean; reintroduce; virtual;
function HintShow(var HintInfo: THintInfo): Boolean; reintroduce; dynamic;
function HitTest(X, Y: Integer): Boolean; reintroduce; virtual;
procedure MouseEnter(AControl: TControl); reintroduce; dynamic;
procedure MouseLeave(AControl: TControl); reintroduce; dynamic;
{$IFDEF COMPILER5}
{$IFNDEF HASAUTOSIZE}
procedure CMSetAutoSize(var Msg: TMessage); message CM_SETAUTOSIZE;
procedure SetAutoSize(Value: Boolean); virtual;
{$ENDIF !HASAUTOSIZE}
{$ENDIF COMPILER5}
property MouseOver: Boolean read FMouseOver write FMouseOver;
property HintColor: TColor read FHintColor write FHintColor default clDefault;
{$IFDEF VCL}
property OnMouseEnter: TNotifyEvent read FOnMouseEnter write FOnMouseEnter;
property OnMouseLeave: TNotifyEvent read FOnMouseLeave write FOnMouseLeave;
{$ENDIF VCL}
property OnParentColorChange: TNotifyEvent read FOnParentColorChanged write FOnParentColorChanged;
public
constructor Create(AOwner: TComponent); override;
published
property AboutJVCL: TJVCLAboutInfo read FAboutJVCL write FAboutJVCL stored False;
end;
TJvExHintWindow = class(THintWindow, IJvExControl)
private
FAboutJVCL: TJVCLAboutInfo;
FHintColor: TColor;
FMouseOver: Boolean;
{$IFDEF VCL}
FOnMouseEnter: TNotifyEvent;
FOnMouseLeave: TNotifyEvent;
{$ENDIF VCL}
FOnParentColorChanged: TNotifyEvent;
function BaseWndProc(Msg: Integer; WParam: Integer = 0; LParam: Integer = 0): Integer;
protected
procedure WndProc(var Msg: TMessage); override;
procedure FocusChanged(AControl: TWinControl); dynamic;
procedure VisibleChanged; reintroduce; dynamic;
procedure EnabledChanged; reintroduce; dynamic;
procedure TextChanged; reintroduce; virtual;
procedure ColorChanged; reintroduce; dynamic;
procedure FontChanged; reintroduce; dynamic;
procedure ParentFontChanged; reintroduce; dynamic;
procedure ParentColorChanged; reintroduce; dynamic;
procedure ParentShowHintChanged; reintroduce; dynamic;
function WantKey(Key: Integer; Shift: TShiftState; const KeyText: WideString): Boolean; reintroduce; virtual;
function HintShow(var HintInfo: THintInfo): Boolean; reintroduce; dynamic;
function HitTest(X, Y: Integer): Boolean; reintroduce; virtual;
procedure MouseEnter(AControl: TControl); reintroduce; dynamic;
procedure MouseLeave(AControl: TControl); reintroduce; dynamic;
{$IFDEF COMPILER5}
{$IFNDEF HASAUTOSIZE}
procedure CMSetAutoSize(var Msg: TMessage); message CM_SETAUTOSIZE;
procedure SetAutoSize(Value: Boolean); virtual;
{$ENDIF !HASAUTOSIZE}
{$ENDIF COMPILER5}
property MouseOver: Boolean read FMouseOver write FMouseOver;
property HintColor: TColor read FHintColor write FHintColor default clDefault;
{$IFDEF VCL}
property OnMouseEnter: TNotifyEvent read FOnMouseEnter write FOnMouseEnter;
property OnMouseLeave: TNotifyEvent read FOnMouseLeave write FOnMouseLeave;
{$ENDIF VCL}
property OnParentColorChange: TNotifyEvent read FOnParentColorChanged write FOnParentColorChanged;
public
constructor Create(AOwner: TComponent); override;
published
property AboutJVCL: TJVCLAboutInfo read FAboutJVCL write FAboutJVCL stored False;
protected
procedure BoundsChanged; reintroduce; virtual;
procedure CursorChanged; reintroduce; dynamic;
procedure ShowingChanged; reintroduce; dynamic;
procedure ShowHintChanged; reintroduce; dynamic;
procedure ControlsListChanging(Control: TControl; Inserting: Boolean); reintroduce; dynamic;
procedure ControlsListChanged(Control: TControl; Inserting: Boolean); reintroduce; dynamic;
procedure GetDlgCode(var Code: TDlgCodes); virtual;
procedure FocusSet(PrevWnd: HWND); virtual;
procedure FocusKilled(NextWnd: HWND); virtual;
function DoEraseBackground(Canvas: TCanvas; Param: Integer): Boolean; virtual;
{$IFDEF JVCLThemesEnabledD56}
private
function GetParentBackground: Boolean;
protected
procedure SetParentBackground(Value: Boolean); virtual;
property ParentBackground: Boolean read GetParentBackground write SetParentBackground;
{$ENDIF JVCLThemesEnabledD56}
end;
TJvExPubGraphicControl = class(TJvExGraphicControl)
published
property BiDiMode;
property DragCursor;
property DragKind;
property DragMode;
property ParentBiDiMode;
property OnEndDock;
property OnStartDock;
end;
{$IFDEF UNITVERSIONING}
const
UnitVersioning: TUnitVersionInfo = (
RCSfile: '$RCSfile: JvExControls.pas,v $';
Revision: '$Revision: 1.83 $';
Date: '$Date: 2005/03/09 07:25:02 $';
LogPath: 'JVCL\run'
);
{$ENDIF UNITVERSIONING}
implementation
function ShiftStateToKeyData(Shift: TShiftState): Longint;
const
AltMask = $20000000;
CtrlMask = $10000000;
ShiftMask = $08000000;
begin
Result := 0;
if ssAlt in Shift then
Result := Result or AltMask;
if ssCtrl in Shift then
Result := Result or CtrlMask;
if ssShift in Shift then
Result := Result or ShiftMask;
end;
function GetFocusedControl(AControl: TControl): TWinControl;
var
Form: TCustomForm;
begin
Result := nil;
Form := GetParentForm(AControl);
if Assigned(Form) then
{$IFDEF VCL}
Result := Form.ActiveControl;
{$ENDIF VCL}
{$IFDEF VisualCLX}
Result := Form.FocusedControl;
{$ENDIF VisualCLX}
end;
function DlgcToDlgCodes(Value: Longint): TDlgCodes;
begin
Result := [];
if (Value and DLGC_WANTARROWS) <> 0 then
Include(Result, dcWantArrows);
if (Value and DLGC_WANTTAB) <> 0 then
Include(Result, dcWantTab);
if (Value and DLGC_WANTALLKEYS) <> 0 then
Include(Result, dcWantAllKeys);
if (Value and DLGC_WANTCHARS) <> 0 then
Include(Result, dcWantChars);
if (Value and DLGC_BUTTON) <> 0 then
Include(Result, dcButton);
if (Value and DLGC_HASSETSEL) <> 0 then
Include(Result, dcHasSetSel);
end;
function DlgCodesToDlgc(Value: TDlgCodes): Longint;
begin
Result := 0;
if dcWantAllKeys in Value then
Result := Result or DLGC_WANTALLKEYS;
if dcWantArrows in Value then
Result := Result or DLGC_WANTARROWS;
if dcWantTab in Value then
Result := Result or DLGC_WANTTAB;
if dcWantChars in Value then
Result := Result or DLGC_WANTCHARS;
if dcButton in Value then
Result := Result or DLGC_BUTTON;
if dcHasSetSel in Value then
Result := Result or DLGC_HASSETSEL;
end;
procedure GetHintColor(var HintInfo: THintInfo; AControl: TControl; HintColor: TColor);
var
AHintInfo: THintInfo;
begin
case HintColor of
clNone:
HintInfo.HintColor := Application.HintColor;
clDefault:
begin
if Assigned(AControl) and Assigned(AControl.Parent) then
begin
AHintInfo := HintInfo;
{$IFDEF VCL}
AControl.Parent.Perform(CM_HINTSHOW, 0, Integer(@AHintInfo));
{$ENDIF VCL}
{$IFDEF VisualCLX}
Perform(AControl.Parent, CM_HINTSHOW, 0, Integer(@AHintInfo));
{$ENDIF VisualCLX}
HintInfo.HintColor := AHintInfo.HintColor;
end;
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -