📄 tntjvtooledit.pas
字号:
procedure CreateAutoComplete; virtual;
procedure UpdateAutoComplete; virtual;
function GetAutoCompleteSource: IEnumString; virtual;
{$ENDIF VCL}
procedure DefineProperties(Filer: TFiler); override;
procedure DoChange; virtual; //virtual Polaris
procedure KeyDown(var Key: Word; Shift: TShiftState); override;
procedure KeyPress(var Key: Char); override;
procedure Loaded; override;
procedure LocalKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); // RDB
procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override;
procedure Notification(AComponent: TComponent; Operation: TOperation); override;
procedure PopupChange; virtual;
procedure PopupCloseUp(Sender: TObject; Accept: Boolean); virtual; //virtual Polaris
procedure AsyncPopupCloseUp(Accept: Boolean); virtual;
procedure PopupDropDown(DisableEdit: Boolean); virtual;
procedure SetClipboardCommands(const Value: TJvClipboardCommands); override; // RDB
procedure SetDirectInput(Value: Boolean); // Polaris
procedure SetDisabledColor(const Value: TColor); virtual; // RDB
procedure SetDisabledTextColor(const Value: TColor); virtual; // RDB
procedure SetGroupIndex(const Value: Integer); // RDB
procedure SetPopupValue(const Value: Variant); virtual;
procedure SetReadOnly(Value: Boolean); virtual;
procedure SetShowCaret; // Polaris
procedure UpdatePopupVisible;
{$IFDEF VCL}
property Alignment: TAlignment read FAlignment write SetAlignment default taLeftJustify;
{$ENDIF VCL}
{$IFDEF VisualCLX}
property Alignment;
{$ENDIF VisualCLX}
property AlwaysEnableButton: Boolean read FAlwaysEnableButton write FAlwaysEnableButton default False;
property AlwaysShowPopup: Boolean read FAlwaysShowPopup write FAlwaysShowPopup default False;
{$IFDEF VCL}
property AutoCompleteItems: TTntStrings read FAutoCompleteItems write SetAutoCompleteItems;
property AutoCompleteOptions: TJvAutoCompleteOptions read FAutoCompleteOptions write SetAutoCompleteOptions default [];
{$ENDIF VCL}
property Button: TTntJvEditButton read FButton;
property ButtonFlat: Boolean read GetButtonFlat write SetButtonFlat default False;
property ButtonHint: WideString read GetButtonHint write SetButtonHint;
property ButtonWidth: Integer read GetButtonWidth write SetButtonWidth stored BtnWidthStored;
property ClickKey: TShortCut read FClickKey write FClickKey default scAltDown;
property DirectInput: Boolean read GetDirectInput write SetDirectInput default True;
property DisabledColor: TColor read FDisabledColor write SetDisabledColor default clWindow; // RDB
property DisabledTextColor: TColor read FDisabledTextColor write SetDisabledTextColor default clGrayText; // RDB
{$IFDEF VCL}
property Flat: Boolean read GetFlat write SetFlat {$IFDEF VisualCLX}default False;{$ENDIF VisualCLX}{$IFDEF VCL}stored IsFlatStored;{$ENDIF VCL}
{$ENDIF VCL}
property Glyph: TBitmap read GetGlyph write SetGlyph stored IsCustomGlyph;
property GroupIndex: Integer read FGroupIndex write SetGroupIndex default -1;
property ImageIndex: TImageIndex read FImageIndex write SetImageIndex stored IsImageIndexStored default -1;
property ImageKind: TJvImageKind read FImageKind write SetImageKind default ikCustom;
property Images: TCustomImageList read FImages write SetImages;
property NumGlyphs: TNumGlyphs read GetNumGlyphs write SetNumGlyphs default 1;
property OnButtonClick: TNotifyEvent read FOnButtonClick write FOnButtonClick;
property OnKeyDown: TKeyEvent read FOnKeyDown write FOnKeyDown;
property PopupAlign: TPopupAlign read FPopupAlign write FPopupAlign default epaRight;
property PopupVisible: Boolean read GetPopupVisible;
property ReadOnly: Boolean read GetReadOnly write SetReadOnly default False;
property SettingCursor: Boolean read GetSettingCursor;
property ShowButton: Boolean read GetShowButton write SetShowButton default True;
property OnEnabledChanged: TNotifyEvent read FOnEnabledChanged write FOnEnabledChanged;
property OnPopupShown: TNotifyEvent read FOnPopupShown write FOnPopupShown;
property OnPopupHidden: TNotifyEvent read FOnPopupHidden write FOnPopupHidden;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
class function DefaultImageIndex: TImageIndex; virtual;
class function DefaultImages: TCustomImageList; virtual;
procedure DoClick;
procedure SelectAll;
{$IFDEF VisualCLX}
procedure SetBounds(ALeft, ATop, AWidth, AHeight: Integer); override;
{$ENDIF VisualCLX}
{ Backwards compatibility; moved to public&published; eventually remove }
property GlyphKind: TGlyphKind read GetGlyphKind write SetGlyphKind;
{$IFDEF VCL}
property Ctl3D;
{$ENDIF VCL}
end;
TTntJvComboEdit = class(TTntJvCustomComboEdit)
public
property Button;
published
//Polaris
property Action;
property Align;
property Alignment;
property AlwaysEnableButton;
property AlwaysShowPopup;
property Anchors;
property AutoSelect;
property AutoSize;
{$IFDEF VCL}
property AutoCompleteItems;
property AutoCompleteOptions;
property BiDiMode;
property DragCursor;
property DragKind;
property Flat;
property ImeMode;
property ImeName;
property OEMConvert;
property ParentBiDiMode;
property ParentCtl3D;
property OnEndDock;
property OnStartDock;
{$ENDIF VCL}
property BorderStyle;
property ButtonFlat;
property ButtonHint;
property ButtonWidth;
property CharCase;
property ClickKey;
property ClipboardCommands; // RDB
property Color;
property Constraints;
property DirectInput;
property DisabledColor; // RDB
property DisabledTextColor; // RDB
property DragMode;
property EditMask;
property Enabled;
property Font;
property Glyph;
property HideSelection;
property HintColor;
property ImageIndex;
property ImageKind;
property Images;
property MaxLength;
property NumGlyphs;
property ParentColor;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ReadOnly;
property ShowHint;
property ShowButton;
property TabOrder;
property TabStop;
property Text;
property Visible;
property OnButtonClick;
property OnChange;
property OnClick;
property OnContextPopup;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnKeyDown; // RDB
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseEnter;
property OnMouseLeave;
property OnMouseMove;
property OnMouseUp;
property OnStartDrag;
end;
{ TTntJvFileDirEdit }
{ The common parent of TTntJvFilenameEdit and TTntJvDirectoryEdit }
{ For internal use only; it's not intended to be used separately }
type
TExecOpenDialogEventW = procedure(Sender: TObject; var Name: WideString;
var AAction: Boolean) of object;
TTntJvFileDirEdit = class(TTntJvCustomComboEdit)
private
FErrMode: Cardinal;
FMultipleDirs: Boolean;
FOnDropFiles: TNotifyEvent;
FOnBeforeDialog: TExecOpenDialogEventW;
FOnAfterDialog: TExecOpenDialogEventW;
{$IFDEF VCL}
FAcceptFiles: Boolean;
FMRUList: IUnknown;
FHistoryList: IUnknown;
FFileSystemList: IUnknown;
FAutoCompleteFileOptions: TJvAutoCompleteFileOptions;
FAutoCompleteSourceIntf: IEnumString;
procedure SetAutoCompleteFileOptions(const Value: TJvAutoCompleteFileOptions);
procedure SetDragAccept(Value: Boolean);
procedure SetAcceptFiles(Value: Boolean);
procedure WMDropFiles(var Msg: TWMDropFiles); message WM_DROPFILES;
{$IFDEF JVCLThemesEnabled}
procedure CMSysColorChange(var Msg: TMessage); message CM_SYSCOLORCHANGE;
{$ENDIF JVCLThemesEnabled}
{$ENDIF VCL}
protected
{$IFDEF VCL}
procedure CreateHandle; override;
procedure DestroyWindowHandle; override;
procedure UpdateAutoComplete; override;
function GetAutoCompleteSource: IEnumString; override;
{$ENDIF VCL}
function GetLongName: WideString; virtual; abstract;
function GetShortName: WideString; virtual; abstract;
procedure DoAfterDialog(var FileName: WideString; var Action: Boolean); dynamic;
procedure DoBeforeDialog(var FileName: WideString; var Action: Boolean); dynamic;
procedure ReceptFileDir(const AFileName: WideString); virtual; abstract;
procedure ClearFileList; virtual;
procedure Change; override;
procedure DisableSysErrors;
procedure EnableSysErrors;
{$IFDEF VCL}
property AutoCompleteFileOptions: TJvAutoCompleteFileOptions read FAutoCompleteFileOptions write
SetAutoCompleteFileOptions;
property AutoCompleteOptions default [acoAutoSuggest];
{$ENDIF VCL}
property ImageKind default ikDefault;
property MaxLength;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
property LongName: WideString read GetLongName;
property ShortName: WideString read GetShortName;
published
{$IFDEF VCL}
property AcceptFiles: Boolean read FAcceptFiles write SetAcceptFiles default True;
{$ENDIF VCL}
property OnBeforeDialog: TExecOpenDialogEventW read FOnBeforeDialog write FOnBeforeDialog;
property OnAfterDialog: TExecOpenDialogEventW read FOnAfterDialog write FOnAfterDialog;
property OnDropFiles: TNotifyEvent read FOnDropFiles write FOnDropFiles;
property OnButtonClick;
property ClipboardCommands; // RDB
property DisabledTextColor; // RDB
property DisabledColor; // RDB
property OEMConvert;
end;
(**
TFileDialogKind = (dkOpen, dkSave, dkOpenPicture, dkSavePicture);
**)
TTntJvFilenameEdit = class(TTntJvFileDirEdit)
private
FDialog: TTntOpenDialog;
FDialogKind: TFileDialogKind;
FAddQuotes: Boolean;
procedure CreateEditDialog;
function GetFileName: WideString;
function GetDefaultExt: TFileExtW;
{$IFDEF VCL}
function GetFileEditStyle: TFileEditStyle;
{$ENDIF VCL}
function GetFilter: WideString;
function GetFilterIndex: Integer;
function GetInitialDir: WideString;
function GetHistoryList: TStrings;
function GetOptions: TOpenOptions;
function GetDialogTitle: WideString;
function GetDialogFiles: TTntStrings;
procedure SetDialogKind(Value: TFileDialogKind);
procedure SetFileName(const Value: WideString);
procedure SetDefaultExt(Value: TFileExtW);
{$IFDEF VCL}
procedure SetFileEditStyle(Value: TFileEditStyle);
{$ENDIF VCL}
procedure SetFilter(const Value: WideString);
procedure SetFilterIndex(Value: Integer);
procedure SetInitialDir(const Value: WideString);
procedure SetHistoryList(Value: TStrings);
procedure SetOptions(Value: TOpenOptions);
procedure SetDialogTitle(const Value: WideString);
function IsCustomTitle: Boolean;
function IsCustomFilter: Boolean;
protected
procedure PopupDropDown(DisableEdit: Boolean); override;
procedure ReceptFileDir(const AFileName: WideString); override;
procedure ClearFileList; override;
function GetLongName: WideString; override;
function GetShortName: WideString; override;
public
constructor Create(AOwner: TComponent); override;
class function DefaultImageIndex: TImageIndex; override;
property Dialog: TTntOpenDialog read FDialog;
property DialogFiles: TTntStrings read GetDialogFiles;
published
//Polaris
property Action;
property Align;
property AutoSize;
property AddQuotes: Boolean read FAddQuotes write FAddQuotes default True;
property DialogKind: TFileDialogKind read FDialogKind write SetDialogKind
default dkOpen;
property DefaultExt: TFileExtW read GetDefaultExt write SetDefaultExt;
{$IFDEF VCL}
property AutoCompleteOptions;
property AutoCompleteFileOptions default [acfFileSystem];
property Flat;
property ParentCtl3D;
{ (rb) Obsolete; added 'stored False', eventually remove }
property FileEditStyle: TFileEditStyle read GetFileEditStyle write SetFileEditStyle stored False;
{$ENDIF VCL}
property FileName: WideString read GetFileName write SetFileName stored False;
property Filter: WideString read GetFilter write SetFilter stored IsCustomFilter;
property FilterIndex: Integer read GetFilterIndex write SetFilterIndex default 1;
property InitialDir: WideString read GetInitialDir write SetInitialDir;
{ (rb) Obsolete; added 'stored False', eventually remove }
property HistoryList: TStrings read GetHistoryList write SetHistoryList stored False;
property DialogOptions: TOpenOptions read GetOptions write SetOptions
default [ofHideReadOnly];
property DialogTitle: WideString read GetDialogTitle write SetDialogTitle
stored IsCustomTitle;
property AutoSelect;
property ButtonHint;
property ButtonFlat;
property BorderStyle;
property CharCase;
property ClickKey;
property Color;
property DirectInput;
{$IFDEF VCL}
property DragCursor;
property BiDiMode;
property DragKind;
property ParentBiDiMode;
property ImeMode;
property ImeName;
property OnEndDock;
property OnStartDock;
{$ENDIF VCL}
property DragMode;
property EditMask;
property Enabled;
property Font;
property Glyph;
property GroupIndex;
property ImageIndex;
property Images;
property ImageKind;
property NumGlyphs;
property ButtonWidth;
property HideSelection;
property Anchors;
property Constraints;
property ParentColor;
property ParentFont;
property ParentShowHint;
property PopupMenu;
property ReadOnly;
property ShowHint;
property ShowButton;
property TabOrder;
property TabStop;
property Text;
property Visible;
property OnChange;
property OnClick;
property OnDblClick;
property OnDragDrop;
property OnDragOver;
property OnEndDrag;
property OnEnter;
property OnExit;
property OnKeyDown;
property OnKeyPress;
property OnKeyUp;
property OnMouseDown;
property OnMouseEnter;
property OnMouseLeave;
property OnMouseMove;
property OnMouseUp;
property OnStartDrag;
property OnContextPopup;
end;
//TDirDialogKind = (dkVCL, dkWin32);
{Incorrect!}
TTntJvDirectoryEdit = class(TTntJvFileDirEdit)
private
{$IFDEF VCL}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -