Initial commit
This commit is contained in:
+101
@@ -0,0 +1,101 @@
|
||||
//---------------------------------------------------------------------------
|
||||
#ifndef TextButtonH
|
||||
#define TextButtonH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <SysUtils.hpp>
|
||||
#include <Classes.hpp>
|
||||
#include <Vcl.Controls.hpp>
|
||||
#include <Vcl.Imaging.pngimage.hpp>
|
||||
#include <Vcl.Imaging.pnglang.hpp>
|
||||
#include <Vcl.Graphics.hpp>
|
||||
//---------------------------------------------------------------------------
|
||||
class PACKAGE TTextButton : public TGraphicControl
|
||||
{
|
||||
public:
|
||||
enum TModalResult{
|
||||
mrNone = System::Int8(0x0),
|
||||
mrOk = System::Int8(0x1),
|
||||
mrCancel = System::Int8(0x2),
|
||||
mrAbort = System::Int8(0x3),
|
||||
mrRetry = System::Int8(0x4),
|
||||
mrIgnore = System::Int8(0x5),
|
||||
mrYes = System::Int8(0x6),
|
||||
mrNo = System::Int8(0x7),
|
||||
mrClose = System::Int8(0x8),
|
||||
mrHelp = System::Int8(0x9),
|
||||
mrTryAgain = System::Int8(0xa),
|
||||
mrContinue = System::Int8(0xb),
|
||||
mrAll = System::Int8(0xc),
|
||||
mrNoToAll = System::Int8(0xd),
|
||||
mrYesToAll = System::Int8(0xe)
|
||||
};
|
||||
private:
|
||||
|
||||
TNotifyEvent FOnMouseEnter;//on mouse enter notify event
|
||||
TNotifyEvent FOnMouseLeave;//on mouse leave notify event
|
||||
// System::Uitypes::TModalResult FModalResult;
|
||||
TModalResult FModalResult;
|
||||
|
||||
MESSAGE void __fastcall CMMouseEnter(Winapi::Messages::TMessage &Msg); // to know when mouse is entered
|
||||
MESSAGE void __fastcall CMMouseLeave(Winapi::Messages::TMessage &Msg); // to know when mouse is leaved
|
||||
|
||||
BEGIN_MESSAGE_MAP
|
||||
MESSAGE_HANDLER(CM_MOUSEENTER, TMessage, CMMouseEnter)
|
||||
MESSAGE_HANDLER(CM_MOUSELEAVE, TMessage, CMMouseLeave)
|
||||
END_MESSAGE_MAP(TGraphicControl)
|
||||
|
||||
protected:
|
||||
|
||||
bool FDown; // value to know if we painting mouse down
|
||||
int EtatBtn; // 0=Normal 1=Mouse entered 2=Pressed 3=Disabled
|
||||
int FStateCount;
|
||||
String FText;
|
||||
|
||||
DYNAMIC void __fastcall MouseDown(System::Uitypes::TMouseButton Button, System::Classes::TShiftState Shift, int X, int Y);
|
||||
DYNAMIC void __fastcall MouseUp(System::Uitypes::TMouseButton Button, System::Classes::TShiftState Shift, int X, int Y);
|
||||
virtual void __fastcall SetEnabled(bool Value);
|
||||
|
||||
__published:
|
||||
|
||||
__property Action;
|
||||
__property Anchors = {default=3};
|
||||
// __property System::Uitypes::TModalResult ModalResult = {read=FModalResult, write=FModalResult, default=0};
|
||||
__property TModalResult ModalResult = {read=FModalResult, write=FModalResult, default=mrNone};
|
||||
__property ParentShowHint = {default=1};
|
||||
__property PopupMenu;
|
||||
__property ShowHint;
|
||||
__property Visible = {default=1};
|
||||
__property OnClick;
|
||||
__property OnContextPopup;
|
||||
__property OnMouseDown;
|
||||
__property OnMouseMove;
|
||||
__property OnMouseUp;
|
||||
__property System::Classes::TNotifyEvent OnMouseEnter = {read=FOnMouseEnter, write=FOnMouseEnter};
|
||||
__property System::Classes::TNotifyEvent OnMouseLeave = {read=FOnMouseLeave, write=FOnMouseLeave};
|
||||
__property bool Down = {read=FDown, write=SetDown, default=False};
|
||||
__property Enabled = {default=1};
|
||||
__property int ImgStates = {read=FStateCount, write=SetStateCount, default=4};
|
||||
__property String Text = {read=FText, write=FText};
|
||||
__property int FontSize = {write=SetFontSize, default=8};
|
||||
__property System::Uitypes::TFontName FontName = {write=SetFontName};
|
||||
private:
|
||||
|
||||
void __fastcall PaintCustomer(void);
|
||||
void __fastcall PaintCustomerText(void);
|
||||
|
||||
public:
|
||||
|
||||
__fastcall virtual TTextButton(System::Classes::TComponent* AOwner);
|
||||
__fastcall virtual ~TTextButton(void);
|
||||
|
||||
virtual void __fastcall Paint(void); // override the painting of the component
|
||||
DYNAMIC void __fastcall Click(void);
|
||||
|
||||
void __fastcall SetStateCount( int count );
|
||||
void __fastcall SetDown(bool value); // to know if mouse is down or not
|
||||
void __fastcall SetFontSize( int value );
|
||||
void __fastcall SetFontName(System::Uitypes::TFontName value);
|
||||
void __fastcall SetTextFont(String name, int size);
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
Reference in New Issue
Block a user