?? tntstdctrls.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 TntStdCtrls;
{$INCLUDE TntCompilers.inc}
interface
{ TODO: Implement TCustomListBox.KeyPress, OnDataFind. }
uses
Windows, Messages, Classes, Controls, TntControls, StdCtrls, Graphics,
TntClasses, TntSysUtils;
{TNT-WARN TCustomEdit}
type
TTntCustomEdit = class(TCustomEdit{TNT-ALLOW TCustomEdit})
private
FPasswordChar: WideChar;
procedure SetSelText(const Value: WideString);
function GetText: WideString;
procedure SetText(const Value: WideString);
function GetHint: WideString;
procedure SetHint(const Value: WideString);
function IsHintStored: Boolean;
function GetPasswordChar: WideChar;
procedure SetPasswordChar(const Value: WideChar);
protected
procedure CreateWindowHandle(const Params: TCreateParams); override;
procedure CreateWnd; override;
procedure DefineProperties(Filer: TFiler); override;
function GetActionLinkClass: TControlActionLinkClass; override;
procedure ActionChange(Sender: TObject; CheckDefaults: Boolean); override;
function GetSelStart: Integer; reintroduce; virtual;
procedure SetSelStart(const Value: Integer); reintroduce; virtual;
function GetSelLength: Integer; reintroduce; virtual;
procedure SetSelLength(const Value: Integer); reintroduce; virtual;
function GetSelText: WideString; reintroduce; virtual;
property PasswordChar: WideChar read GetPasswordChar write SetPasswordChar default #0;
public
property SelText: WideString read GetSelText write SetSelText;
property SelStart: Integer read GetSelStart write SetSelStart;
property SelLength: Integer read GetSelLength write SetSelLength;
property Text: WideString read GetText write SetText;
published
property Hint: WideString read GetHint write SetHint stored IsHintStored;
end;
{TNT-WARN TEdit}
TTntEdit = class(TTntCustomEdit)
published
property Align;
property Anchors;
property AutoSelect;
property AutoSize;
property BevelEdges;
property BevelInner;
property BevelKind default bkNone;
property BevelOuter;
property BevelWidth;
property BiDiMode;
property BorderStyle;
property CharCase;
property Color;
property Constraints;
property Ctl3D;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property Font;
property HideSelection;
property ImeMode;
property ImeName;
property MaxLength;
property OEMConvert;
property ParentBiDiMode;
property ParentColor;
property ParentCtl3D;
property ParentFont;
property ParentShowHint;
property PasswordChar;
property PopupMenu;
property ReadOnly;
property ShowHint;
property TabOrder;
property TabStop;
property Text;
property Visible;
property OnChange;
property OnClick;
property OnContextPopup;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
{$IFDEF COMPILER_9_UP}
property OnMouseActivate;
{$ENDIF}
property OnMouseDown;
{$IFDEF COMPILER_10_UP}
property OnMouseEnter;
property OnMouseLeave;
{$ENDIF}
property OnMouseMove;
property OnMouseUp;
property OnStartDock;
property OnStartDrag;
end;
type
TTntCustomMemo = class;
TTntMemoStrings = class(TTntStrings)
protected
FMemo: TCustomMemo{TNT-ALLOW TCustomMemo};
FMemoLines: TStrings{TNT-ALLOW TStrings};
FRichEditMode: Boolean;
FLineBreakStyle: TTntTextLineBreakStyle;
function Get(Index: Integer): WideString; override;
function GetCount: Integer; override;
function GetTextStr: WideString; override;
procedure Put(Index: Integer; const S: WideString); override;
procedure SetUpdateState(Updating: Boolean); override;
public
constructor Create;
procedure SetTextStr(const Value: WideString); override;
procedure Clear; override;
procedure Delete(Index: Integer); override;
procedure Insert(Index: Integer; const S: WideString); override;
end;
{TNT-WARN TCustomMemo}
TTntCustomMemo = class(TCustomMemo{TNT-ALLOW TCustomMemo})
private
FLines: TTntStrings;
procedure SetSelText(const Value: WideString);
function GetText: WideString;
procedure SetText(const Value: WideString);
function GetHint: WideString;
procedure SetHint(const Value: WideString);
function IsHintStored: Boolean;
protected
procedure CreateWindowHandle(const Params: TCreateParams); override;
procedure DefineProperties(Filer: TFiler); override;
function GetActionLinkClass: TControlActionLinkClass; override;
procedure ActionChange(Sender: TObject; CheckDefaults: Boolean); override;
procedure SetLines(const Value: TTntStrings); virtual;
function GetSelStart: Integer; reintroduce; virtual;
procedure SetSelStart(const Value: Integer); reintroduce; virtual;
function GetSelLength: Integer; reintroduce; virtual;
procedure SetSelLength(const Value: Integer); reintroduce; virtual;
function GetSelText: WideString; reintroduce;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
property SelText: WideString read GetSelText write SetSelText;
property SelStart: Integer read GetSelStart write SetSelStart;
property SelLength: Integer read GetSelLength write SetSelLength;
property Text: WideString read GetText write SetText;
property Lines: TTntStrings read FLines write SetLines;
published
property Hint: WideString read GetHint write SetHint stored IsHintStored;
end;
{TNT-WARN TMemo}
TTntMemo = class(TTntCustomMemo)
published
property Align;
property Alignment;
property Anchors;
property BevelEdges;
property BevelInner;
property BevelKind default bkNone;
property BevelOuter;
property BiDiMode;
property BorderStyle;
property Color;
property Constraints;
property Ctl3D;
property DragCursor;
property DragKind;
property DragMode;
property Enabled;
property Font;
property HideSelection;
property ImeMode;
property ImeName;
property Lines;
property MaxLength;
property OEMConvert;
property ParentBiDiMode;
property ParentColor;
property ParentCtl3D;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ReadOnly;
property ScrollBars;
property ShowHint;
property TabOrder;
property TabStop;
property Visible;
property WantReturns;
property WantTabs;
property WordWrap;
property OnChange;
property OnClick;
property OnContextPopup;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDock;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
{$IFDEF COMPILER_9_UP}
property OnMouseActivate;
{$ENDIF}
property OnMouseDown;
{$IFDEF COMPILER_10_UP}
property OnMouseEnter;
property OnMouseLeave;
{$ENDIF}
property OnMouseMove;
property OnMouseUp;
property OnStartDock;
property OnStartDrag;
end;
TTntComboBoxStrings = class(TTntStrings)
protected
function Get(Index: Integer): WideString; override;
function GetCount: Integer; override;
function GetObject(Index: Integer): TObject; override;
procedure PutObject(Index: Integer; AObject: TObject); override;
procedure SetUpdateState(Updating: Boolean); override;
public
ComboBox: TCustomComboBox{TNT-ALLOW TCustomComboBox};
function Add(const S: WideString): Integer; override;
procedure Clear; override;
procedure Delete(Index: Integer); override;
function IndexOf(const S: WideString): Integer; override;
procedure Insert(Index: Integer; const S: WideString); override;
end;
type
TWMCharMsgHandler = procedure(var Message: TWMChar) of object;
{$IFDEF DELPHI_7} // fix for Delphi 7 only
{ TD7PatchedComboBoxStrings }
type
TD7PatchedComboBoxStrings = class(TCustomComboBoxStrings)
protected
function Get(Index: Integer): string{TNT-ALLOW string}; override;
public
function Add(const S: string{TNT-ALLOW string}): Integer; override;
procedure Insert(Index: Integer; const S: string{TNT-ALLOW string}); override;
end;
{$ENDIF}
type
ITntComboFindString = interface
['{63BEBEF4-B1A2-495A-B558-7487B66F6827}']
function FindString(const Value: WideString; StartPos: Integer): Integer;
end;
{TNT-WARN TCustomComboBox}
type
TTntCustomComboBox = class(TCustomComboBox{TNT-ALLOW TCustomComboBox},
IWideCustomListControl)
private
FItems: TTntStrings;
FSaveItems: TTntStrings;
FSaveItemIndex: Integer;
FFilter: WideString;
FLastTime: Cardinal;
function GetItems: TTntStrings;
function GetSelStart: Integer;
procedure SetSelStart(const Value: Integer);
function GetSelLength: Integer;
procedure SetSelLength(const Value: Integer);
function GetSelText: WideString;
procedure SetSelText(const Value: WideString);
function GetText: WideString;
procedure SetText(const Value: WideString);
procedure CNCommand(var Message: TWMCommand); message CN_COMMAND;
function GetHint: WideString;
procedure SetHint(const Value: WideString);
function IsHintStored: Boolean;
procedure WMChar(var Message: TWMChar); message WM_CHAR;
protected
procedure CreateWindowHandle(const Params: TCreateParams); override;
procedure DefineProperties(Filer: TFiler); override;
function GetActionLinkClass: TControlActionLinkClass; override;
procedure ActionChange(Sender: TObject; CheckDefaults: Boolean); override;
procedure DestroyWnd; override;
function GetAutoComplete_UniqueMatchOnly: Boolean; dynamic;
function GetAutoComplete_PreserveDataEntryCase: Boolean; dynamic;
procedure DoEditCharMsg(var Message: TWMChar); virtual;
procedure CreateWnd; override;
procedure ComboWndProc(var Message: TMessage; ComboWnd: HWnd; ComboProc: Pointer); override;
procedure DrawItem(Index: Integer; Rect: TRect; State: TOwnerDrawState); override;
procedure KeyPress(var Key: AnsiChar); override;
{$IFDEF DELPHI_7} // fix for Delphi 7 only
function GetItemsClass: TCustomComboBoxStringsClass; override;
{$ENDIF}
procedure SetItems(const Value: TTntStrings); reintroduce; virtual;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure CopySelection(Destination: TCustomListControl); override;
procedure AddItem(const Item: WideString; AObject: TObject); reintroduce; virtual;
public
property SelText: WideString read GetSelText write SetSelText;
property SelStart: Integer read GetSelStart write SetSelStart;
property SelLength: Integer read GetSelLength write SetSelLength;
property Text: WideString read GetText write SetText;
property Items: TTntStrings read GetItems write SetItems;
published
property Hint: WideString read GetHint write SetHint stored IsHintStored;
end;
{TNT-WARN TComboBox}
TTntComboBox = class(TTntCustomComboBox)
published
property Align;
property AutoComplete default True;
{$IFDEF COMPILER_9_UP}
property AutoCompleteDelay default 500;
{$ENDIF}
property AutoDropDown default False;
{$IFDEF COMPILER_7_UP}
property AutoCloseUp default False;
{$ENDIF}
property BevelEdges;
property BevelInner;
property BevelKind default bkNone;
property BevelOuter;
property Style; {Must be published before Items}
property Anchors;
property BiDiMode;
property CharCase;
property Color;
property Constraints;
property Ctl3D;
property DragCursor;
property DragKind;
property DragMode;
property DropDownCount;
property Enabled;
property Font;
property ImeMode;
property ImeName;
property ItemHeight;
property ItemIndex default -1;
property MaxLength;
property ParentBiDiMode;
property ParentColor;
property ParentCtl3D;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ShowHint;
property Sorted;
property TabOrder;
property TabStop;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -