📄 cxcontrols.pas
字号:
procedure Paint; override;
procedure ColorChanged; dynamic;
procedure DoScrolling;
procedure ParentBackgroundChanged; virtual;
procedure VisibleChanged; dynamic;
procedure AddChildComponent(AComponent: TcxControlChildComponent); dynamic;
procedure RemoveChildComponent(AComponent: TcxControlChildComponent); dynamic;
property FontListenerList: IInterfaceList read FFontListenerList;
procedure AfterMouseDown(AButton: TMouseButton; X, Y: Integer); virtual;
function AllowAutoDragAndDropAtDesignTime(X, Y: Integer;
Shift: TShiftState): Boolean; virtual;
function AllowDragAndDropWithoutFocus: Boolean; dynamic;
procedure BeforeMouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); virtual;
procedure BoundsChanged; dynamic;
procedure BringInternalControlsToFront; virtual;
procedure CancelMouseOperations; virtual;
function CanDrag(X, Y: Integer): Boolean; dynamic;
function CanFocusOnClick: Boolean; overload; virtual;
function CanFocusOnClick(X, Y: Integer): Boolean; overload; virtual;
procedure CursorChanged; dynamic;
procedure DoCancelMode; dynamic;
procedure FocusChanged; dynamic;
function FocusWhenChildIsClicked(AChild: TControl): Boolean; virtual;
procedure FontChanged; dynamic;
function GetBorderSize: Integer; virtual;
function GetBounds: TRect; virtual;
function GetClientBounds: TRect; virtual;
function GetCursor(X, Y: Integer): TCursor; virtual;
function GetDesignHitTest(X, Y: Integer; Shift: TShiftState): Boolean; dynamic;
function GetDragObjectClass: TDragControlObjectClass; dynamic;
function GetIsDesigning: Boolean; virtual;
function GetIsFocused: Boolean; virtual;
function GetMouseWheelScrollingKind: TcxMouseWheelScrollingKind; virtual;
function HasBackground: Boolean; virtual;
procedure InitControl; virtual;
function IsInternalControl(AControl: TControl): Boolean; virtual;
function MayFocus: Boolean; dynamic;
procedure MouseEnter(AControl: TControl); dynamic;
procedure MouseLeave(AControl: TControl); dynamic;
procedure TextChanged; dynamic;
// IcxLookAndFeelContainer
function IcxLookAndFeelContainer.GetLookAndFeel = GetLookAndFeelValue;
function GetLookAndFeelValue: TcxLookAndFeel; virtual;
// look&feel
function GetLookAndFeelPainter: TcxCustomLookAndFeelPainterClass; virtual;
procedure LookAndFeelChangeHandler(Sender: TcxLookAndFeel;
AChangedValues: TcxLookAndFeelValues);
procedure LookAndFeelChanged(Sender: TcxLookAndFeel;
AChangedValues: TcxLookAndFeelValues); virtual;
property LookAndFeel: TcxLookAndFeel read FLookAndFeel write SetLookAndFeel;
property LookAndFeelPainter: TcxCustomLookAndFeelPainterClass read GetLookAndFeelPainter;
// scrollbars
function CanScrollLineWithoutScrollBars(ADirection: TcxDirection): Boolean; virtual;
procedure CheckNeedsScrollBars;
function GetHScrollBarBounds: TRect; virtual;
function GetSizeGripBounds: TRect; virtual;
function GetVScrollBarBounds: TRect; virtual;
procedure InitScrollBars;
procedure InitScrollBarsParameters; virtual;
function IsPixelScrollBar(AKind: TScrollBarKind): Boolean; virtual;
function NeedsScrollBars: Boolean; virtual;
function NeedsToBringInternalControlsToFront: Boolean; virtual;
procedure Scroll(AScrollBarKind: TScrollBarKind; AScrollCode: TScrollCode;
var AScrollPos: Integer); virtual;
procedure SetInternalControlsBounds; virtual;
procedure UpdateInternalControlsState; virtual;
procedure UpdateScrollBars; virtual;
property CalculatingScrollBarsParams: Boolean read FCalculatingScrollBarsParams;
property HScrollBar: TcxControlScrollBar read FHScrollBar;
property HScrollBarVisible: Boolean read GetHScrollBarVisible;
property ScrollBars: TScrollStyle read FScrollBars write SetScrollBars default ssBoth;
property SizeGrip: TcxSizeGrip read FSizeGrip;
property UpdatingScrollBars: Boolean read FUpdatingScrollBars;
property VScrollBar: TcxControlScrollBar read FVScrollBar;
property VScrollBarVisible: Boolean read GetVScrollBarVisible;
// internal drag and drop (columns moving, ...)
procedure DragAndDrop(const P: TPoint; var Accepted: Boolean); dynamic;
procedure EndDragAndDrop(Accepted: Boolean); dynamic;
function GetDragAndDropObjectClass: TcxDragAndDropObjectClass; virtual;
function StartDragAndDrop(const P: TPoint): Boolean; dynamic;
// delphi drag and drop
procedure DoStartDrag(var DragObject: TDragObject); override;
procedure DoEndDrag(Target: TObject; X, Y: Integer); override;
procedure DragOver(Source: TObject; X, Y: Integer; State: TDragState;
var Accept: Boolean); override;
procedure DrawDragImage(ACanvas: TcxCanvas; const R: TRect); virtual;
function GetDragImagesClass: TcxDragImageListClass; virtual;
function GetDragImagesSize: TPoint; virtual;
function GetIsCopyDragDrop: Boolean; virtual;
function HasDragImages: Boolean; virtual;
procedure HideDragImage;
procedure InitDragImages(ADragImages: TcxDragImageList); virtual;
procedure ShowDragImage;
property DragImages: TcxDragImageList read FDragImages;
property IsCopyDragDrop: Boolean read GetIsCopyDragDrop;
property BorderSize: Integer read GetBorderSize;
property BorderStyle: TcxControlBorderStyle read FBorderStyle write SetBorderStyle;
property CreatingWindow: Boolean read FCreatingWindow;
property FocusOnClick: Boolean read FFocusOnClick write FFocusOnClick default True;
property Keys: TcxKeys read FKeys write SetKeys;
property MouseRightButtonReleased: Boolean read FMouseRightButtonReleased;
property MouseWheelScrollingKind: TcxMouseWheelScrollingKind read GetMouseWheelScrollingKind;
property PopupMenu: TComponent read FPopupMenu write SetPopupMenu;
property IsScrollingContent: Boolean read FIsScrollingContent;
property ParentBackground{$IFNDEF DELPHI7}: Boolean read FParentBackground
write SetParentBackground{$ENDIF} default True;
property OnFocusChanged: TNotifyEvent read FOnFocusChanged write FOnFocusChanged;
property OnMouseEnter: TNotifyEvent read FOnMouseEnter write FOnMouseEnter;
property OnMouseLeave: TNotifyEvent read FOnMouseLeave write FOnMouseLeave;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
function GetDragImages: TDragImageList; override;
{$IFDEF DELPHI4}
procedure BeforeDestruction; override;
{$ENDIF}
function CanFocusEx: Boolean; virtual;
function AcceptMousePosForClick(X, Y: Integer): Boolean; virtual;
procedure InvalidateRect(const R: TRect; EraseBackground: Boolean);
procedure InvalidateRgn(ARegion: TcxRegion; EraseBackground: Boolean);
procedure InvalidateWithChildren;
function IsMouseInPressedArea(X, Y: Integer): Boolean;
procedure PostMouseMove(AMousePos: TPoint); overload;
procedure PostMouseMove; overload;
procedure ScrollContent(ADirection: TcxDirection);
procedure ScrollWindow(DX, DY: Integer; const AScrollRect: TRect);
procedure SetScrollBarInfo(AScrollBarKind: TScrollBarKind;
AMin, AMax, AStep, APage, APos: Integer; AAllowShow, AAllowHide: Boolean);
function StartDrag(DragObject: TDragObject): Boolean; dynamic;
procedure UpdateWithChildren;
// internal drag and drop (columns moving, ...)
procedure BeginDragAndDrop; dynamic;
procedure FinishDragAndDrop(Accepted: Boolean);
property DragAndDropObject: TcxDragAndDropObject read GetDragAndDropObject;
property DragAndDropObjectClass: TcxDragAndDropObjectClass read GetDragAndDropObjectClass
write FDragAndDropObjectClass;
property DragAndDropState: TcxDragAndDropState read FDragAndDropState
write SetDragAndDropState;
procedure AddFontListener(AListener: IcxFontListener);
procedure RemoveFontListener(AListener: IcxFontListener);
procedure LockScrollBars;
procedure UnlockScrollBars;
// IdxLocalizerListener
procedure TranslationChanged; virtual;
property ActiveCanvas: TcxCanvas read GetActiveCanvas;
property Bounds: TRect read GetBounds;
property Canvas: TcxCanvas read FCanvas;
property ClientBounds: TRect read GetClientBounds;
property IsDesigning: Boolean read GetIsDesigning;
property IsDestroying: Boolean read GetIsDestroying;
property IsLoading: Boolean read GetIsLoading;
property IsFocused: Boolean read GetIsFocused;
property MouseCaptureObject: TObject read FMouseCaptureObject write SetMouseCaptureObject;
property MouseDownPos: TPoint read FMouseDownPos write FMouseDownPos;
property TabStop default True; // MayFocus = True
end;
{ customize listbox }
TcxCustomizeListBox = class(TListBox)
private
FDragAndDropItemIndex: Integer;
FMouseDownPos: TPoint;
function GetDragAndDropItemObject: TObject;
function GetItemObject: TObject;
procedure SetItemObject(Value: TObject);
procedure WMCancelMode(var Message: TWMCancelMode); message WM_CANCELMODE;
procedure WMMouseMove(var Message: TWMMouseMove); message WM_MOUSEMOVE;
protected
procedure CreateParams(var Params: TCreateParams); override;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure BeginDragAndDrop; dynamic;
property DragAndDropItemIndex: Integer read FDragAndDropItemIndex;
property DragAndDropItemObject: TObject read GetDragAndDropItemObject;
public
constructor Create(AOwner: TComponent); override;
property ItemObject: TObject read GetItemObject write SetItemObject;
end;
{ TcxMessageWindow }
TcxMessageWindow = class
private
FHandle: HWND;
protected
procedure WndProc(var Message: TMessage); virtual;
public
constructor Create; virtual;
destructor Destroy; override;
property Handle: HWND read FHandle;
end;
{ TcxSystemController }
TcxSystemController = class(TcxMessageWindow)
{$IFDEF DELPHI6}
private
FPrevWakeMainThread: TNotifyEvent;
procedure WakeMainThread(Sender: TObject);
procedure HookSynchronizeWakeup;
procedure UnhookSynchronizeWakeup;
protected
procedure WndProc(var Message: TMessage); override;
public
constructor Create; override;
destructor Destroy; override;
{$ENDIF}
end;
{ TcxBaseHintWindow }
TcxHintAnimationStyle = (cxhaSlideFromLeft, cxhaSlideFromRight, cxhaSlideDownward, cxhaSlideUpward,
cxhaSlideFromCenter, cxhaHide, cxhaActivate, cxhaFadeIn, cxhaAuto, cxhaNone);
TcxBaseHintWindow = class(THintWindow)
private
FAnimationStyle: TcxHintAnimationStyle;
FAnimationDelay: Integer;
FBorderStyle: TBorderStyle;
FNeedEraseBackground: Boolean;
procedure WMEraseBkgnd(var Message: TWmEraseBkgnd); message WM_ERASEBKGND;
protected
FStandardHint: Boolean;
procedure CreateParams(var Params: TCreateParams); override;
function GetAnimationStyle: TcxHintAnimationStyle;
procedure DisableRegion; virtual;
procedure EnableRegion; virtual;
procedure Show; virtual;
public
constructor Create(AOwner: TComponent); override;
procedure ActivateHint(ARect: TRect; const AHint: string); override;
procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer); override;
property AnimationStyle: TcxHintAnimationStyle read FAnimationStyle write FAnimationStyle;
property AnimationDelay: Integer read FAnimationDelay write FAnimationDelay;
property BorderStyle: TBorderStyle read FBorderStyle write FBorderStyle;
property NeedEraseBackground: Boolean read FNeedEraseBackground write FNeedEraseBackground;
end;
{ popup }
TcxPopupAlignHorz = (pahLeft, pahCenter, pahRight);
TcxPopupAlignVert = (pavTop, pavCenter, pavBottom);
TcxPopupDirection = (pdHorizontal, pdVertical);
TcxPopupWindow = class(TForm)
private
FAdjustable: Boolean;
FAlignHorz: TcxPopupAlignHorz;
FAlignVert: TcxPopupAlignVert;
FBorderSpace: Integer;
FBorderStyle: TcxPopupBorderStyle;
FCanvas: TcxCanvas;
FDirection: TcxPopupDirection;
FFrameColor: TColor;
FOwnerBounds: TRect;
FOwnerParent: TControl;
FPrevActiveWindow: HWND;
function GetNCHeight: Integer;
function GetNCWidth: Integer;
procedure SetBorderSpace(Value: Integer);
procedure SetBorderStyle(Value: TcxPopupBorderStyle);
procedure WMActivate(var Message: TWMActivate); message WM_ACTIVATE;
procedure WMActivateApp(var Message: TWMActivateApp); message WM_ACTIVATEAPP;
procedure CMVisibleChanged(var Message: TMessage); message CM_VISIBLECHANGED;
protected
procedure Deactivate; override;
procedure Paint; override;
procedure VisibleChanged; dynamic;
function CalculatePosition: TPoint; virtual;
procedure CalculateSize; virtual;
function GetBorderWidth(ABorder: TcxBorder): Integer; virtual;
function GetClientBounds: TRect; virtual;
function GetFrameWidth(ABorder: TcxBorder): Integer; virtual;
function GetOwnerScreenBounds: TRect; virtual;
procedure InitPopup; virtual;
procedure RestoreControlsBounds;
procedure DrawFrame; virtual;
property BorderWidths[ABorder: TcxBorder]: Integer read GetBorderWidth;
property Canvas: TcxCanvas read FCanvas;
property FrameWidths[ABorder: TcxBorder]: Integer read GetFrameWidth;
property NCHeight: Integer read GetNCHeight;
property NCWidth: Integer read GetNCWidth;
public
constructor Create; reintroduce; virtual;
destructor Destroy; override;
procedure CloseUp; virtual;
procedure Popup; virtual;
property Adjustable: Boolean read FAdjustable write FAdjustable;
property AlignHorz: TcxPopupAlignHorz read FAlignHorz write FAlignHorz;
property AlignVert: TcxPopupAlignVert read FAlignVert write FAlignVert;
property BorderSpace: Integer read FBorderSpace write SetBorderSpace;
property BorderStyle: TcxPopupBorderStyle read FBorderStyle write SetBorderStyle;
property ClientBounds: TRect read GetClientBounds;
property Direction: TcxPopupDirection read FDirection write FDirection;
property FrameColor: TColor read FFrameColor write FFrameColor;
property OwnerBounds: TRect read FOwnerBounds write FOwnerBounds;
property OwnerParent: TControl read FOwnerParent write FOwnerParent;
property OwnerScreenBounds: TRect read GetOwnerScreenBounds;
end;
{ drag image }
TcxCustomDragImage = class(TcxPopupWindow)
private
{$IFNDEF DELPHI9}
FPopupParent: TCustomForm;
{$ENDIF}
FPositionOffset: TPoint;
function GetAlphaBlended: Boolean;
function GetVisible: Boolean;
procedure SetVisible(Value: Boolean);
procedure WMEraseBkgnd(var Message: TWMEraseBkgnd); message WM_ERASEBKGND;
procedure WMNCHitTest(var Message: TWMNCHitTest); message WM_NCHITTEST;
protected
procedure CreateParams(var Params: TCreateParams); override;
public
constructor Create; override;
{$IFDEF DELPHI9}
destructor Destroy; override;
{$ENDIF}
procedure Init(const ASourceBounds: TRect; const ASourcePoint: TPoint);
procedure MoveTo(const APosition: TPoint);
procedure Show;
procedure Hide;
property AlphaBlended: Boolean read GetAlphaBlended;
{$IFNDEF DELPHI9}
property PopupParent: TCustomForm read FPopupParent write FPopupParent;
{$ENDIF}
property PositionOffset: TPoint read FPositionOffset write FPositionOffset;
property Visible: Boolean read GetVisible write SetVisible;
end;
TcxDragImage = class(TcxCustomDragImage)
private
FImage: TBitmap;
FImageCanvas: TcxCanvas;
function GetWindowCanvas: TcxCanvas;
protected
procedure Paint; override;
property Image: TBitmap read FImage;
property WindowCanvas: TcxCanvas read GetWindowCanvas;
public
constructor Create; override;
destructor Destroy; override;
procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer); override;
property Canvas: TcxCanvas read FImageCanvas;
end;
TcxDragImageClass = class of TcxDragImage;
{ TcxSizeFrame }
TcxSizeFrame = class(TcxCustomDragImage)
private
FFillSelection: Boolean;
FFrameWidth: Integer;
FRegion: TcxRegion;
procedure InitializeFrameRegion;
procedure SetWindowRegion;
protected
procedure Paint; override;
property FrameWidth: Integer read FFrameWidth;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -