📄 tntextctrls.pas
字号:
{*****************************************************************************}
{ }
{ Tnt Delphi Unicode Controls }
{ http://www.tntware.com/delphicontrols/unicode/ }
{ Version: 2.3.0 }
{ }
{ Copyright (c) 2002-2007, Troy Wolbrink (troy.wolbrink@tntware.com) }
{ }
{*****************************************************************************}
unit TntExtCtrls;
{$INCLUDE TntCompilers.inc}
interface
uses
Classes, Messages, Controls, ExtCtrls, TntClasses, TntControls, TntStdCtrls, TntGraphics;
type
{TNT-WARN TShape}
TTntShape = class(TShape{TNT-ALLOW TShape})
private
function GetHint: WideString;
procedure SetHint(const Value: WideString);
function IsHintStored: Boolean;
procedure CMHintShow(var Message: TMessage); message CM_HINTSHOW;
protected
procedure DefineProperties(Filer: TFiler); override;
function GetActionLinkClass: TControlActionLinkClass; override;
procedure ActionChange(Sender: TObject; CheckDefaults: Boolean); override;
published
property Hint: WideString read GetHint write SetHint stored IsHintStored;
end;
{TNT-WARN TPaintBox}
TTntPaintBox = class(TPaintBox{TNT-ALLOW TPaintBox})
private
function GetHint: WideString;
procedure SetHint(const Value: WideString);
function IsHintStored: Boolean;
procedure CMHintShow(var Message: TMessage); message CM_HINTSHOW;
protected
procedure DefineProperties(Filer: TFiler); override;
function GetActionLinkClass: TControlActionLinkClass; override;
procedure ActionChange(Sender: TObject; CheckDefaults: Boolean); override;
published
property Hint: WideString read GetHint write SetHint stored IsHintStored;
end;
{TNT-WARN TImage}
TTntImage = class(TImage{TNT-ALLOW TImage})
private
function GetHint: WideString;
procedure SetHint(const Value: WideString);
function IsHintStored: Boolean;
procedure CMHintShow(var Message: TMessage); message CM_HINTSHOW;
function GetPicture: TTntPicture;
procedure SetPicture(const Value: TTntPicture);
protected
procedure DefineProperties(Filer: TFiler); override;
function GetActionLinkClass: TControlActionLinkClass; override;
procedure ActionChange(Sender: TObject; CheckDefaults: Boolean); override;
public
constructor Create(AOwner: TComponent); override;
published
property Hint: WideString read GetHint write SetHint stored IsHintStored;
property Picture: TTntPicture read GetPicture write SetPicture;
end;
{TNT-WARN TBevel}
TTntBevel = class(TBevel{TNT-ALLOW TBevel})
private
function GetHint: WideString;
procedure SetHint(const Value: WideString);
function IsHintStored: Boolean;
procedure CMHintShow(var Message: TMessage); message CM_HINTSHOW;
protected
procedure DefineProperties(Filer: TFiler); override;
function GetActionLinkClass: TControlActionLinkClass; override;
procedure ActionChange(Sender: TObject; CheckDefaults: Boolean); override;
published
property Hint: WideString read GetHint write SetHint stored IsHintStored;
end;
{TNT-WARN TCustomPanel}
TTntCustomPanel = class(TCustomPanel{TNT-ALLOW TCustomPanel})
private
function GetCaption: TWideCaption;
procedure SetCaption(const Value: TWideCaption);
function GetHint: WideString;
procedure SetHint(const Value: WideString);
function IsCaptionStored: Boolean;
function IsHintStored: Boolean;
protected
procedure Paint; override;
procedure CreateWindowHandle(const Params: TCreateParams); override;
procedure DefineProperties(Filer: TFiler); override;
function GetActionLinkClass: TControlActionLinkClass; override;
procedure ActionChange(Sender: TObject; CheckDefaults: Boolean); override;
property Caption: TWideCaption read GetCaption write SetCaption stored IsCaptionStored;
published
property Hint: WideString read GetHint write SetHint stored IsHintStored;
end;
{TNT-WARN TPanel}
TTntPanel = class(TTntCustomPanel)
public
property DockManager;
published
property Align;
property Alignment;
property Anchors;
property AutoSize;
property BevelEdges;
property BevelInner;
property BevelKind;
property BevelOuter;
property BevelWidth;
property BiDiMode;
property BorderWidth;
property BorderStyle;
property Caption;
property Color;
property Constraints;
property Ctl3D;
property UseDockManager default True;
property DockSite;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property FullRepaint;
property Font;
property Locked;
{$IFDEF COMPILER_10_UP}
property Padding;
{$ENDIF}
property ParentBiDiMode;
{$IFDEF COMPILER_7_UP}
property ParentBackground;
{$ENDIF}
property ParentColor;
property ParentCtl3D;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop;
{$IFDEF COMPILER_9_UP}
property VerticalAlignment;
{$ENDIF}
property Visible;
{$IFDEF COMPILER_9_UP}
property OnAlignInsertBefore;
property OnAlignPosition;
{$ENDIF}
property OnCanResize;
property OnClick;
property OnConstrainedResize;
property OnContextPopup;
property OnDockDrop;
property OnDockOver;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnGetSiteInfo;
{$IFDEF COMPILER_9_UP}
property OnMouseActivate;
{$ENDIF}
property OnMouseDown;
{$IFDEF COMPILER_10_UP}
property OnMouseEnter;
property OnMouseLeave;
{$ENDIF}
property OnMouseMove;
property OnMouseUp;
property OnResize;
property OnStartDock;
property OnStartDrag;
property OnUnDock;
end;
{TNT-WARN TCustomControlBar}
TTntCustomControlBar = class(TCustomControlBar{TNT-ALLOW TCustomControlBar})
private
function IsHintStored: Boolean;
function GetHint: WideString;
procedure SetHint(const Value: WideString);
protected
procedure CreateWindowHandle(const Params: TCreateParams); override;
procedure DefineProperties(Filer: TFiler); override;
function GetActionLinkClass: TControlActionLinkClass; override;
procedure ActionChange(Sender: TObject; CheckDefaults: Boolean); override;
published
property Hint: WideString read GetHint write SetHint stored IsHintStored;
end;
{TNT-WARN TControlBar}
TTntControlBar = class(TTntCustomControlBar)
public
property Canvas;
published
property Align;
property Anchors;
property AutoDock;
property AutoDrag;
property AutoSize;
property BevelEdges;
property BevelInner;
property BevelOuter;
property BevelKind;
property BevelWidth;
property BorderWidth;
property Color {$IFDEF COMPILER_7_UP} nodefault {$ENDIF};
property Constraints;
{$IFDEF COMPILER_10_UP}
property CornerEdge;
{$ENDIF}
property DockSite;
property DragCursor;
property DragKind;
property DragMode;
{$IFDEF COMPILER_10_UP}
property DrawingStyle;
{$ENDIF}
property Enabled;
{$IFDEF COMPILER_10_UP}
property GradientDirection;
property GradientEndColor;
property GradientStartColor;
{$ENDIF}
{$IFDEF COMPILER_7_UP}
property ParentBackground default True;
{$ENDIF}
property ParentColor;
property ParentCtl3D;
property ParentFont;
property ParentShowHint;
property Picture;
property PopupMenu;
property RowSize;
property RowSnap;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
{$IFDEF COMPILER_9_UP}
property OnAlignInsertBefore;
property OnAlignPosition;
{$ENDIF}
property OnBandDrag;
property OnBandInfo;
property OnBandMove;
property OnBandPaint;
{$IFDEF COMPILER_9_UP}
property OnBeginBandMove;
property OnEndBandMove;
{$ENDIF}
property OnCanResize;
property OnClick;
property OnConstrainedResize;
property OnContextPopup;
property OnDockDrop;
property OnDockOver;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnGetSiteInfo;
{$IFDEF COMPILER_9_UP}
property OnMouseActivate;
{$ENDIF}
property OnMouseDown;
{$IFDEF COMPILER_10_UP}
property OnMouseEnter;
property OnMouseLeave;
{$ENDIF}
property OnMouseMove;
property OnMouseUp;
property OnPaint;
property OnResize;
property OnStartDock;
property OnStartDrag;
property OnUnDock;
end;
{TNT-WARN TCustomRadioGroup}
TTntCustomRadioGroup = class(TTntCustomGroupBox)
private
FButtons: TList;
FItems: TTntStrings;
FItemIndex: Integer;
FColumns: Integer;
FReading: Boolean;
FUpdating: Boolean;
function GetButtons(Index: Integer): TTntRadioButton;
procedure ArrangeButtons;
procedure ButtonClick(Sender: TObject);
procedure ItemsChange(Sender: TObject);
procedure SetButtonCount(Value: Integer);
procedure SetColumns(Value: Integer);
procedure SetItemIndex(Value: Integer);
procedure SetItems(Value: TTntStrings);
procedure UpdateButtons;
procedure CMEnabledChanged(var Message: TMessage); message CM_ENABLEDCHANGED;
procedure CMFontChanged(var Message: TMessage); message CM_FONTCHANGED;
procedure WMSize(var Message: TWMSize); message WM_SIZE;
protected
procedure Loaded; override;
procedure ReadState(Reader: TReader); override;
function CanModify: Boolean; virtual;
procedure GetChildren(Proc: TGetChildProc; Root: TComponent); override;
property Columns: Integer read FColumns write SetColumns default 1;
property ItemIndex: Integer read FItemIndex write SetItemIndex default -1;
property Items: TTntStrings read FItems write SetItems;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure FlipChildren(AllLevels: Boolean); override;
property Buttons[Index: Integer]: TTntRadioButton read GetButtons;
end;
{TNT-WARN TRadioGroup}
TTntRadioGroup = class(TTntCustomRadioGroup)
published
property Align;
property Anchors;
property BiDiMode;
property Caption;
property Color;
property Columns;
property Ctl3D;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property Font;
property ItemIndex;
property Items;
property Constraints;
property ParentBiDiMode;
{$IFDEF COMPILER_7_UP}
property ParentBackground default True;
{$ENDIF}
property ParentColor;
property ParentCtl3D;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
property OnClick;
property OnContextPopup;
property OnDragDrop;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnStartDock;
property OnStartDrag;
end;
{TNT-WARN TSplitter}
TTntSplitter = class(TSplitter{TNT-ALLOW TSplitter})
private
function GetHint: WideString;
procedure SetHint(const Value: WideString);
function IsHintStored: Boolean;
procedure CMHintShow(var Message: TMessage); message CM_HINTSHOW;
protected
procedure DefineProperties(Filer: TFiler); override;
function GetActionLinkClass: TControlActionLinkClass; override;
procedure ActionChange(Sender: TObject; CheckDefaults: Boolean); override;
published
property Hint: WideString read GetHint write SetHint stored IsHintStored;
end;
implementation
uses
Windows, Graphics, Forms, {$IFDEF THEME_7_UP} Themes, {$ENDIF}
TntSysUtils, TntWindows, TntActnList;
{ TTntShape }
procedure TTntShape.DefineProperties(Filer: TFiler);
begin
inherited;
TntPersistent_AfterInherited_DefineProperties(Filer, Self);
end;
function TTntShape.IsHintStored: Boolean;
begin
Result := TntControl_IsHintStored(Self)
end;
function TTntShape.GetHint: WideString;
begin
Result := TntControl_GetHint(Self)
end;
procedure TTntShape.SetHint(const Value: WideString);
begin
TntControl_SetHint(Self, Value);
end;
procedure TTntShape.CMHintShow(var Message: TMessage);
begin
ProcessCMHintShowMsg(Message);
inherited;
end;
procedure TTntShape.ActionChange(Sender: TObject; CheckDefaults: Boolean);
begin
TntControl_BeforeInherited_ActionChange(Self, Sender, CheckDefaults);
inherited;
end;
function TTntShape.GetActionLinkClass: TControlActionLinkClass;
begin
Result := TntControl_GetActionLinkClass(Self, inherited GetActionLinkClass);
end;
{ TTntPaintBox }
procedure TTntPaintBox.DefineProperties(Filer: TFiler);
begin
inherited;
TntPersistent_AfterInherited_DefineProperties(Filer, Self);
end;
function TTntPaintBox.IsHintStored: Boolean;
begin
Result := TntControl_IsHintStored(Self)
end;
function TTntPaintBox.GetHint: WideString;
begin
Result := TntControl_GetHint(Self)
end;
procedure TTntPaintBox.SetHint(const Value: WideString);
begin
TntControl_SetHint(Self, Value);
end;
procedure TTntPaintBox.CMHintShow(var Message: TMessage);
begin
ProcessCMHintShowMsg(Message);
inherited;
end;
procedure TTntPaintBox.ActionChange(Sender: TObject; CheckDefaults: Boolean);
begin
TntControl_BeforeInherited_ActionChange(Self, Sender, CheckDefaults);
inherited;
end;
function TTntPaintBox.GetActionLinkClass: TControlActionLinkClass;
begin
Result := TntControl_GetActionLinkClass(Self, inherited GetActionLinkClass);
end;
type
{$IFDEF COMPILER_6} // verified against VCL source in Delphi 6 and BCB 6
THackImage = class(TGraphicControl)
protected
FPicture: TPicture{TNT-ALLOW TPicture};
end;
{$ENDIF}
{$IFDEF DELPHI_7} // verified against VCL source in Delphi 7
THackImage = class(TGraphicControl)
protected
FPicture: TPicture{TNT-ALLOW TPicture};
end;
{$ENDIF}
{$IFDEF DELPHI_9} // verified against VCL source in Delphi 9
THackImage = class(TGraphicControl)
private
FPicture: TPicture{TNT-ALLOW TPicture};
end;
{$ENDIF}
{$IFDEF DELPHI_10} // verified against VCL source in Delphi 10
THackImage = class(TGraphicControl)
private
FPicture: TPicture{TNT-ALLOW TPicture};
end;
{$ENDIF}
{ TTntImage }
constructor TTntImage.Create(AOwner: TComponent);
var
OldPicture: TPicture{TNT-ALLOW TPicture};
begin
inherited;
OldPicture := THackImage(Self).FPicture;
THackImage(Self).FPicture := TTntPicture.Create;
Picture.OnChange := OldPicture.OnChange;
Picture.OnProgress := OldPicture.OnProgress;
OldPicture.Free;
end;
function TTntImage.GetPicture: TTntPicture;
begin
Result := inherited Picture as TTntPicture;
end;
procedure TTntImage.SetPicture(const Value: TTntPicture);
begin
inherited Picture := Value;
end;
procedure TTntImage.DefineProperties(Filer: TFiler);
begin
inherited;
TntPersistent_AfterInherited_DefineProperties(Filer, Self);
end;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -