📄 skinctrls.pas
字号:
end;
TspExPanelRollKind = (rkRollHorizontal, rkRollVertical);
TspSkinExPanel = class(TspSkinCustomControl)
private
FCMaxWidth, FCMinWidth, FCMaxHeight, FCMinHeight: Integer;
FGlyph: TBitMap;
FNumGlyphs: TspSkinPanelNumGlyphs;
FSpacing: Integer;
FOnChangeRollState: TNotifyEvent;
FOnClose: TNotifyEvent;
StopCheckSize: Boolean;
FRollState: Boolean;
FRollKind: TspExPanelRollKind;
FDefaultCaptionHeight: Integer;
FRealWidth, FRealHEight: Integer;
FShowRollButton: Boolean;
FShowCloseButton: Boolean;
FCaptionImageList: TCustomImageList;
FCaptionImageIndex: Integer;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure SetCaptionImageIndex(Value: Integer);
function GetRollWidth: Integer;
function GetRollHeight: Integer;
procedure SetShowRollButton(Value: Boolean);
procedure SetShowCloseButton(Value: Boolean);
procedure SetGlyph(Value: TBitMap);
procedure SetNumGlyphs(Value: TspSkinPanelNumGlyphs);
procedure SetSpacing(Value: Integer);
protected
Buttons: array[0..1] of TspControlButton;
OldActiveButton, ActiveButton, CaptureButton: Integer;
procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;
procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer); override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer); override;
procedure MouseMove(Shift: TShiftState; X, Y: Integer); override;
procedure CreateControlDefaultImage(B: TBitMap); override;
procedure CreateControlSkinImage(B: TBitMap); override;
procedure SetDefaultCaptionHeight(Value: Integer);
procedure AdjustClientRect(var Rect: TRect); override;
procedure HideControls;
procedure ShowControls;
procedure SetRollState(Value: Boolean);
procedure SetRollKind(Value: TspExPanelRollKind);
//
procedure ButtonDown(I: Integer; X, Y: Integer);
procedure ButtonUp(I: Integer; X, Y: Integer);
procedure ButtonEnter(I: Integer);
procedure ButtonLeave(I: Integer);
procedure DrawButton(Cnvs: TCanvas; i: Integer);
procedure TestActive(X, Y: Integer);
procedure CMTextChanged(var Message: TMessage); message CM_TEXTCHANGED;
procedure GetSkinData; override;
public
//
RollHSkinRect, RollVSkinRect: TRect;
RollLeftOffset, RollRightOffset,
RollTopOffset, RollBottomOffset: Integer;
RollVCaptionRect, RollHCaptionRect: TRect;
CloseButtonRect, CloseButtonActiveRect, CloseButtonDownRect: TRect;
HRollButtonRect, HRollButtonActiveRect, HRollButtonDownRect: TRect;
HRestoreButtonRect, HRestoreButtonActiveRect, HRestoreButtonDownRect: TRect;
VRollButtonRect, VRollButtonActiveRect, VRollButtonDownRect: TRect;
VRestoreButtonRect, VRestoreButtonActiveRect, VRestoreButtonDownRect: TRect;
CaptionRect: TRect;
FontName: String;
FontStyle: TFontStyles;
FontHeight: Integer;
FontColor: TColor;
//
ButtonsTransparent: Boolean;
ButtonsTransparentColor: TColor;
//
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer); override;
procedure ChangeSkinData; override;
procedure Close;
published
property CaptionImageList: TCustomImageList read FCaptionImageList write FCaptionImageList;
property CaptionImageIndex: Integer read FCaptionImageIndex write SetCaptionImageIndex;
property Glyph: TBitMap read FGlyph write SetGlyph;
property NumGlyphs: TspSkinPanelNumGlyphs read FNumGlyphs write SetNumGlyphs;
property Spacing: Integer read FSpacing write SetSpacing;
property RealWidth: Integer read FRealWidth write FRealWidth;
property RealHeight: Integer read FRealHeight write FRealHeight;
property ShowRollButton: Boolean
read FShowRollButton write SetShowRollButton;
property ShowCloseButton: Boolean
read FShowCloseButton write SetShowCloseButton;
property DefaultCaptionHeight: Integer
read FDefaultCaptionHeight write SetDefaultCaptionHeight;
property RollState: Boolean read FRollState write SetRollState;
property RollKind: TspExPanelRollKind read FRollKind write SetRollKind;
property Align;
property Caption;
property Constraints;
property DockSite;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
property OnCanResize;
property OnClick;
property OnConstrainedResize;
property OnDockDrop;
property OnDockOver;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnGetSiteInfo;
property OnMouseDown;
property OnMouseMove;
property OnMouseUp;
property OnResize;
property OnStartDock;
property OnStartDrag;
property OnUnDock;
property OnChangeRollState: TNotifyEvent
read FOnChangeRollState write FOnChangeRollState;
property OnClose: TNotifyEvent read FOnClose write FOnClose;
end;
TspSkinStatusBar = class(TspSkinPanel)
private
FSizeGrip: Boolean;
FShowGrip: Boolean;
procedure SetSizeGrip(Value: Boolean);
procedure SetShowGrip(Value: Boolean);
protected
procedure SetSkinData(Value: TspSkinData); override;
procedure GetSkinData; override;
procedure AdjustClientRect(var Rect: TRect); override;
procedure DrawDefaultGripper(R: TRect; Cnvs: TCanvas; C1, C2: TColor);
procedure CreateControlDefaultImage(B: TBitMap); override;
procedure CreateControlSkinImage(B: TBitMap); override;
function GetGripRect: TRect;
procedure WMNCHitTest(var Message: TWMNCHitTest); message WM_NCHITTEST;
public
GripperRect: TRect;
GripperTransparent: Boolean;
GripperTransparentColor: TColor;
constructor Create(AOwner: TComponent); override;
property ShowGrip: Boolean read FShowGrip write SetShowGrip;
published
property SizeGrip: Boolean read FSizeGrip write SetSizeGrip;
end;
TspSkinToolBar = class(TspSkinPanel)
private
FAdjustControls: Boolean;
// scroll
FCanScroll: Boolean;
FHotScroll: Boolean;
TimerMode: Integer;
SMax, SPosition, SPage, SOldPosition: Integer;
FHSizeOffset: Integer;
FScrollOffset: Integer;
FScrollTimerInterval: Integer;
Buttons: array[0..1] of TspControlButton;
ButtonData: TspDataSkinButtonControl;
//
FImages: TCustomImageList;
FDisabledImages: TCustomImageList;
FHotImages: TCustomImageList;
FFlat: Boolean;
FAutoShowHideCaptions: Boolean;
FShowCaptions: Boolean;
FWidthWithCaptions: Integer;
FWidthWithoutCaptions: Integer;
procedure SetFlat(Value: Boolean);
procedure SetDisabledImages(Value: TCustomImageList);
procedure SetHotImages(Value: TCustomImageList);
procedure SetImages(Value: TCustomImageList);
procedure SetShowCaptions(Value: Boolean);
// scroll
procedure SetScrollOffset(Value: Integer);
procedure SetScrollTimerInterval(Value: Integer);
procedure DrawButton(Cnvs: TCanvas; i: Integer);
protected
procedure CreateControlSkinImage(B: TBitMap); override;
procedure GetSkinData; override;
procedure Notification(AComponent: TComponent;
Operation: TOperation); override;
procedure SetSkinData(Value: TspSkinData); override;
procedure SetSkinDataName(Value: String); override;
// scroll
procedure WMSETCURSOR(var Message: TWMSetCursor); message WM_SetCursor;
procedure WMTimer(var Message: TWMTimer); message WM_Timer;
procedure WMNCCALCSIZE(var Message: TWMNCCalcSize); message WM_NCCALCSIZE;
procedure WMNCPAINT(var Message: TMessage); message WM_NCPAINT;
procedure WMSIZE(var Message: TWMSIZE); message WM_SIZE;
procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;
procedure WndProc(var Message: TMessage); override;
procedure SetButtonsVisible(AVisible: Boolean);
procedure ButtonClick(I: Integer);
procedure ButtonDown(I: Integer);
procedure ButtonUp(I: Integer);
procedure GetHRange;
procedure GetScrollInfo;
procedure HScrollControls(AOffset: Integer);
procedure AdjustClientRect(var Rect: TRect); override;
procedure StartTimer;
procedure StopTimer;
procedure WMWindowPosChanging(var Message: TWMWindowPosChanging); message WM_WINDOWPOSCHANGING;
procedure AdjustAllControls;
public
constructor Create(AOwner: TComponent); override;
procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer); override;
published
property AdjustControls: Boolean read FAdjustControls write FAdjustControls;
// scroll
property CanScroll: Boolean read FCanScroll write FCanScroll;
property HotScroll: Boolean read FHotScroll write FHotScroll;
property ScrollOffset: Integer read FScrollOffset write SetScrollOffset;
property ScrollTimerInterval: Integer
read FScrollTimerInterval write SetScrollTimerInterval;
//
property WidthWithCaptions: Integer
read FWidthWithCaptions write FWidthWithCaptions;
property WidthWithoutCaptions: Integer
read FWidthWithoutCaptions write FWidthWithoutCaptions;
property AutoShowHideCaptions: Boolean
read FAutoShowHideCaptions write FAutoShowHideCaptions;
property ShowCaptions: Boolean read FShowCaptions write SetShowCaptions;
property Flat: Boolean read FFlat write SetFlat;
property Images: TCustomImageList read FImages write SetImages;
property HotImages: TCustomImageList read FHotImages write SetHotImages;
property DisabledImages: TCustomImageList read FDisabledImages write SetDisabledImages;
end;
TspSkinGroupBox = class(TspSkinPanel)
public
constructor Create(AOwner: TComponent); override;
end;
TspSkinButton = class(TspSkinCustomControl)
protected
// animation
AnimateTimer: TTimer;
CurrentFrame: Integer;
AnimateInc: Boolean;
//
FSkinImagesMenu: TspSkinImagesMenu;
FUseImagesMenuImage: Boolean;
FUseImagesMenuCaption: Boolean;
FSpaceSupport: Boolean;
//
FUseSkinFontColor: Boolean;
FUseSkinSize: Boolean;
RepeatTimer: TTimer;
FRepeatMode: Boolean;
FRepeatInterval: Integer;
FActive: Boolean;
FAllowAllUp: Boolean;
FAllowAllUpCheck: Boolean;
FDefault: Boolean;
FCancel: Boolean;
FModalResult: TModalResult;
FClicksDisabled: Boolean;
FCanFocused: Boolean;
FMorphKf: Double;
FDown: Boolean;
FMouseIn, FMouseDown: Boolean;
FGroupIndex: Integer;
FGlyph: TBitMap;
FNumGlyphs: TspNumGlyphs;
FOnClick: TNotifyEvent;
FMargin: Integer;
FSpacing: Integer;
FLayout: TspButtonLayout;
MorphTimer: TTimer;
//
FImageList: TCustomImageList;
FImageIndex: Integer;
procedure SetImageIndex(Value: Integer);
procedure StartAnimate(AInc: Boolean);
procedure StopAnimate;
procedure DoAnimate(Sender: TObject);
function GetAnimationFrameRect: TRect;
function GetGlyphNum(AIsDown, AIsMouseIn: Boolean): Integer;
//
procedure RepeatTimerProc(Sender: TObject);
procedure BeforeRepeatTimerProc(Sender: TObject);
procedure StartRepeat;
procedure StopRepeat;
procedure StartMorph;
procedure StopMorph;
procedure SetDefault(Value: Boolean);
function IsFocused: Boolean;
procedure SetCanFocused(Value: Boolean);
procedure DoMorph(Sender: TObject);
procedure CreateStrechButtonImage(B: TBitMap; R: TRect;
ADown, AMouseIn: Boolean);
procedure CreateButtonImage(B: TBitMap; R: TRect;
ADown, AMouseIn: Boolean); virtual;
procedure SetLayout(Value : TspButtonLayout);
procedure SetGroupIndex(Value: Integer);
procedure SetDown(Value: Boolean);
procedure SetMargin(Value: Integer);
procedure SetSpacing(Value: Integer);
procedure DoAllUp;
procedure SetNumGlyphs(Value: TspNumGlyphs);
procedure SetGlyph(Value: TBitMap);
procedure GetSkinData; override;
procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE;
procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER;
procedure CMTextChanged(var Message: TMessage); message CM_TEXTCHANGED;
procedure CMFocusChanged(var Message: TCMFocusChanged); message CM_FOCUSCHANGED;
procedure MouseDown(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer); override;
procedure MouseUp(Button: TMouseButton; Shift: TShiftState;
X, Y: Integer); override;
procedure ReDrawControl;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -