advtouchkeyboard.hpp

来自「TMSPack基本上涵盖了Delphi所有的基础控件」· HPP 代码 · 共 466 行 · 第 1/2 页

HPP
466
字号
	HIDESBASE void __fastcall SetItem(int Index, const TAdvTouchKeyItem* Value);
	
protected:
	DYNAMIC Classes::TPersistent* __fastcall GetOwner(void);
	
public:
	__fastcall TAdvTouchKeyCollection(Classes::TComponent* AOwner);
	HIDESBASE TAdvTouchKeyItem* __fastcall Add(void);
	HIDESBASE TAdvTouchKeyItem* __fastcall Insert(int index);
	__property TAdvTouchKeyItem* Items[int Index] = {read=GetItem, write=SetItem/*, default*/};
public:
	#pragma option push -w-inl
	/* TCollection.Destroy */ inline __fastcall virtual ~TAdvTouchKeyCollection(void) { }
	#pragma option pop
	
};


#pragma option push -b-
enum TKeyboardType { ktQWERTY, ktAZERTY, ktDVORAK, ktNUMERIC, ktCELLPHONE, ktQWERTZ, ktCustom };
#pragma option pop

typedef void __fastcall (__closure *TDrawKeyEvent)(System::TObject* Sender, TAdvTouchKeyItem* Key, Graphics::TCanvas* Canvas, bool Down, const Types::TRect &Rect, bool &DefaultDraw);

class DELPHICLASS TAdvTouchKeyboard;
class PASCALIMPLEMENTATION TAdvTouchKeyboard : public Extctrls::TCustomPanel 
{
	typedef Extctrls::TCustomPanel inherited;
	
private:
	TAdvTouchKeyCollection* FKeys;
	Controls::TKeyEvent FOnKeyDown;
	Graphics::TBitmap* FPictureNormalState;
	Graphics::TBitmap* FPictureDownState;
	Graphics::TFont* FSmallFont;
	TKeyboardType FKeyboardType;
	TDrawKeyEvent FOnDrawKey;
	Controls::TImageList* FImages;
	Classes::TShiftState FShift;
	bool FAutoPostKey;
	Graphics::TColor FHighlightCaps;
	bool FAutoCapsDisplay;
	Graphics::TColor FHighlightAltGr;
	bool FDisableErase;
	Extctrls::TTimer* FRepeatTimer;
	int FRepeatTimerCount;
	int FRepeatItemIndex;
	TTouchKeyEvent FOnKeyClick;
	int FKeyDistance;
	int FOldW;
	int FOldH;
	bool FPostWMCharOnly;
	HIDESBASE MESSAGE void __fastcall WMSize(Messages::TWMSize &Message);
	HIDESBASE MESSAGE void __fastcall WMEraseBkGnd(Messages::TMessage &Msg);
	void __fastcall SetKeys(const TAdvTouchKeyCollection* Value);
	void __fastcall SetPictureDownState(const Graphics::TBitmap* Value);
	void __fastcall SetPictureNormalState(const Graphics::TBitmap* Value);
	void __fastcall SetSmallFont(const Graphics::TFont* Value);
	void __fastcall SetKeyboardType(const TKeyboardType Value);
	void __fastcall AddKey( System::ShortString &Caption,  System::ShortString &ShiftCaption,  System::ShortString &AltGrCaption, int KeyValue, int ShiftKeyValue, int AltGrKeyValue, int ImageIndex, int Width, int Height, int &X, int Y, TSpecialKey SpecialKey, Graphics::TColor Color = (Graphics::TColor)(0xc0c0c0));
	void __fastcall NewRow(int &X, int &Y, int Size);
	void __fastcall SetImages(const Controls::TImageList* Value);
	void __fastcall PostNormalKeys(int Index);
	void __fastcall PostSpecialKeys(Word Key, const Classes::TShiftState pShift, bool SpecialKey);
	HWND __fastcall GetKeybdInputHandle(void);
	void __fastcall PictureChanged(System::TObject* Sender);
	AnsiString __fastcall GetVersion();
	void __fastcall SetVersion(const AnsiString Value);
	int __fastcall GetVersionNr(void);
	void __fastcall SetAutoCapsDisplay(const bool Value);
	void __fastcall SetHighlightAltGr(const Graphics::TColor Value);
	void __fastcall SetHighlightCaps(const Graphics::TColor Value);
	void __fastcall SetKeyDistance(int Value);
	
protected:
	void __fastcall ItemKeyDown(int Index);
	void __fastcall SyncEqualKeys(int Index);
	void __fastcall TurnOffShifts(void);
	void __fastcall DrawKey(System::TObject* Sender, TAdvTouchKeyItem* Key, Graphics::TCanvas* Canvas, bool Down, const Types::TRect &Rect, bool &DefaultDraw);
	void __fastcall BuildQWERTYKeyBoard(void);
	void __fastcall BuildQWERTZKeyBoard(void);
	void __fastcall BuildAZERTYKeyBoard(void);
	void __fastcall BuildDVORAKKeyBoard(void);
	void __fastcall BuildNumericKeyBoard(void);
	void __fastcall BuildCellPhoneKeyboard(void);
	__property Classes::TShiftState Shift = {read=FShift, write=FShift, nodefault};
	__property HWND KeybdInputHandle = {read=GetKeybdInputHandle, nodefault};
	void __fastcall PaintAllKeys(void);
	virtual void __fastcall Paint(void);
	void __fastcall StartTimer(int index);
	void __fastcall StopTimer(void);
	void __fastcall RepeatTimerProc(System::TObject* Sender);
	
public:
	__fastcall virtual TAdvTouchKeyboard(Classes::TComponent* AOwner);
	__fastcall virtual ~TAdvTouchKeyboard(void);
	void __fastcall Zoom(double fhorz, double fvert, bool keysonly = false, bool absoluteZoom = false);
	void __fastcall SaveKeybdLayout(AnsiString FileName);
	void __fastcall LoadKeybdLayout(AnsiString FileName);
	void __fastcall PostKey(Word Key, const Classes::TShiftState pShift, bool ExtendedKeyBD, int Index);
	__property bool PostWMCharOnly = {read=FPostWMCharOnly, write=FPostWMCharOnly, nodefault};
	
__published:
	__property Align  = {default=0};
	__property Font ;
	__property Color  = {default=-16777201};
	__property bool AutoPostKey = {read=FAutoPostKey, write=FAutoPostKey, default=1};
	__property bool AutoCapsDisplay = {read=FAutoCapsDisplay, write=SetAutoCapsDisplay, default=0};
	__property Graphics::TColor HighlightCaps = {read=FHighlightCaps, write=SetHighlightCaps, default=536870911};
	__property Graphics::TColor HighlightAltGr = {read=FHighlightAltGr, write=SetHighlightAltGr, default=536870911};
	__property Controls::TImageList* Images = {read=FImages, write=SetImages};
	__property TKeyboardType KeyboardType = {read=FKeyboardType, write=SetKeyboardType, nodefault};
	__property int KeyDistance = {read=FKeyDistance, write=SetKeyDistance, default=0};
	__property TAdvTouchKeyCollection* Keys = {read=FKeys, write=SetKeys};
	__property Graphics::TBitmap* PictureDownState = {read=FPictureDownState, write=SetPictureDownState};
	__property Graphics::TBitmap* PictureNormalState = {read=FPictureNormalState, write=SetPictureNormalState};
	__property Graphics::TFont* SmallFont = {read=FSmallFont, write=SetSmallFont};
	__property AnsiString Version = {read=GetVersion, write=SetVersion};
	__property Visible  = {default=1};
	__property TTouchKeyEvent OnKeyClick = {read=FOnKeyClick, write=FOnKeyClick};
	__property Controls::TKeyEvent OnKeyDown = {read=FOnKeyDown, write=FOnKeyDown};
	__property TDrawKeyEvent OnDrawKey = {read=FOnDrawKey, write=FOnDrawKey};
public:
	#pragma option push -w-inl
	/* TWinControl.CreateParented */ inline __fastcall TAdvTouchKeyboard(HWND ParentWindow) : Extctrls::TCustomPanel(ParentWindow) { }
	#pragma option pop
	
};


class DELPHICLASS TKeyboardToolForm;
class PASCALIMPLEMENTATION TKeyboardToolForm : public Forms::TCustomForm 
{
	typedef Forms::TCustomForm inherited;
	
private:
	bool FShowCaption;
	bool FShowClose;
	HIDESBASE MESSAGE void __fastcall WMActivate(Messages::TMessage &Message);
	HIDESBASE MESSAGE void __fastcall WMMouseActivate(Messages::TMessage &Message);
	
protected:
	virtual void __fastcall CreateParams(Controls::TCreateParams &Params);
	
__published:
	__property bool ShowClose = {read=FShowClose, write=FShowClose, nodefault};
	__property bool ShowCaption = {read=FShowCaption, write=FShowCaption, nodefault};
public:
	#pragma option push -w-inl
	/* TCustomForm.Create */ inline __fastcall virtual TKeyboardToolForm(Classes::TComponent* AOwner) : Forms::TCustomForm(AOwner) { }
	#pragma option pop
	#pragma option push -w-inl
	/* TCustomForm.CreateNew */ inline __fastcall virtual TKeyboardToolForm(Classes::TComponent* AOwner, int Dummy) : Forms::TCustomForm(AOwner, Dummy) { }
	#pragma option pop
	#pragma option push -w-inl
	/* TCustomForm.Destroy */ inline __fastcall virtual ~TKeyboardToolForm(void) { }
	#pragma option pop
	
public:
	#pragma option push -w-inl
	/* TWinControl.CreateParented */ inline __fastcall TKeyboardToolForm(HWND ParentWindow) : Forms::TCustomForm(ParentWindow) { }
	#pragma option pop
	
};


class DELPHICLASS TAdvPopupTouchKeyBoard;
class PASCALIMPLEMENTATION TAdvPopupTouchKeyBoard : public Classes::TComponent 
{
	typedef Classes::TComponent inherited;
	
private:
	Extctrls::TTimer* FTimer;
	TKeyboardToolForm* FFrm;
	TAdvTouchKeyboard* FKbd;
	Forms::TCustomForm* FOwnerform;
	bool FAutoCapsDisplay;
	bool FAutoPostKey;
	Graphics::TColor FHighlightCaps;
	TKeyboardType FKeyboardType;
	Graphics::TColor FHighlightAltGr;
	bool FAutoFollowFocus;
	bool FAutoHide;
	bool FShowCaption;
	bool FShowClose;
	void __fastcall SetAutoCapsDisplay(const bool Value);
	void __fastcall SetAutoPostKey(const bool Value);
	void __fastcall SetHighlightAltGr(const Graphics::TColor Value);
	void __fastcall SetHighlightCaps(const Graphics::TColor Value);
	void __fastcall SetKeyboardType(const TKeyboardType Value);
	void __fastcall KeyboardSizeChanged(System::TObject* Sender);
	
protected:
	void __fastcall TimerProc(System::TObject* Sender);
	void __fastcall FormCloseQuery(System::TObject* Sender, bool &CanClose);
	
public:
	__fastcall virtual TAdvPopupTouchKeyBoard(Classes::TComponent* AOwner);
	__fastcall virtual ~TAdvPopupTouchKeyBoard(void);
	virtual void __fastcall CreateForm(void);
	void __fastcall Show(void);
	void __fastcall ShowAtXY(int x, int y);
	void __fastcall Hide(void);
	__property TAdvTouchKeyboard* Keyboard = {read=FKbd};
	
__published:
	__property bool ShowCaption = {read=FShowCaption, write=FShowCaption, default=1};
	__property bool ShowClose = {read=FShowClose, write=FShowClose, default=1};
	__property bool AutoFollowFocus = {read=FAutoFollowFocus, write=FAutoFollowFocus, default=0};
	__property bool AutoHide = {read=FAutoHide, write=FAutoHide, default=0};
	__property bool AutoPostKey = {read=FAutoPostKey, write=SetAutoPostKey, default=1};
	__property bool AutoCapsDisplay = {read=FAutoCapsDisplay, write=SetAutoCapsDisplay, default=0};
	__property Graphics::TColor HighlightCaps = {read=FHighlightCaps, write=SetHighlightCaps, default=536870911};
	__property Graphics::TColor HighlightAltGr = {read=FHighlightAltGr, write=SetHighlightAltGr, default=536870911};
	__property TKeyboardType KeyboardType = {read=FKeyboardType, write=SetKeyboardType, nodefault};
};


//-- var, const, procedure ---------------------------------------------------
static const Shortint MAJ_VER = 0x1;
static const Shortint MIN_VER = 0x2;
static const Shortint REL_VER = 0x1;
static const Shortint BLD_VER = 0x5;

}	/* namespace Advtouchkeyboard */
using namespace Advtouchkeyboard;
#pragma pack(pop)
#pragma option pop

#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif	// Advtouchkeyboard

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?