Initial commit
This commit is contained in:
@@ -0,0 +1,108 @@
|
||||
//---------------------------------------------------------------------------
|
||||
/////////////////////////////////
|
||||
////////安装 可以不用安装,直接用原来的 .pas文件安装
|
||||
/////////////////////////////////
|
||||
|
||||
/////////////////////////////////
|
||||
/////////使用
|
||||
//--》供新的包使用
|
||||
//把.cpp 中 #pragma package(smart_init) 去掉
|
||||
//新包.cpp #include "PNGButton.cpp"
|
||||
/////////////////////////////////
|
||||
|
||||
#ifndef PNGButtonH
|
||||
#define PNGButtonH
|
||||
//---------------------------------------------------------------------------
|
||||
#include <SysUtils.hpp>
|
||||
#include <Classes.hpp>
|
||||
#include <Vcl.Controls.hpp>
|
||||
#include <Vcl.Imaging.pngimage.hpp>
|
||||
#include <Vcl.Imaging.pnglang.hpp>
|
||||
|
||||
//---------------------------------------------------------------------------
|
||||
//class PACKAGE TPNGButton : public TGraphicControl
|
||||
|
||||
class CBTPNButton : 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:
|
||||
|
||||
int EtatBtn; // 0=Normal 1=Mouse entered 2=Pressed 3=Disabled
|
||||
int FStateCount;
|
||||
Vcl::Imaging::Pngimage::TPngImage *FPngImg; //our 4 states image
|
||||
bool FDown; // value to know if we painting mouse down
|
||||
TColor FBkColor;
|
||||
|
||||
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);
|
||||
|
||||
public:
|
||||
|
||||
__fastcall virtual CBTPNButton(System::Classes::TComponent* AOwner);
|
||||
__fastcall virtual ~CBTPNButton(void);
|
||||
|
||||
void __fastcall SetStateCount( int count );
|
||||
void __fastcall SetPngImg(Vcl::Imaging::Pngimage::TPngImage *value); // we set the png image
|
||||
void __fastcall SetDown(bool value); // to know if mouse is down or not
|
||||
void __fastcall SetColor( TColor value );
|
||||
|
||||
virtual void __fastcall Paint(void); // override the painting of the component
|
||||
DYNAMIC void __fastcall Click(void);
|
||||
|
||||
|
||||
__published:
|
||||
|
||||
__property Action;
|
||||
__property Anchors = {default=3};
|
||||
__property bool Down = {read=FDown, write=SetDown, default=False};
|
||||
__property Enabled = {default=1};
|
||||
__property int ImgStates = {read=FStateCount, write=SetStateCount, default=4};
|
||||
// __property System::Uitypes::TModalResult ModalResult = {read=FModalResult, write=FModalResult, default=0};
|
||||
__property TModalResult ModalResult = {read=FModalResult, write=FModalResult, default=0};
|
||||
__property ParentShowHint = {default=1};
|
||||
__property Vcl::Imaging::Pngimage::TPngImage *PngImg = {read=FPngImg, write=SetPngImg};
|
||||
__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};
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
#endif
|
||||
Reference in New Issue
Block a user