diff options
author | chai <chaifix@163.com> | 2019-04-02 21:45:33 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-04-02 21:45:33 +0800 |
commit | af7bdaa10ee71a319dc55c3c7556fa43a95c9dc9 (patch) | |
tree | 58611985001b78c5a76b78ae146fdb07dde31c1d /source/Asura.Editor/controls/button.h | |
parent | 250e30d73f09e9da2b5a81d0fbae63744ae12a73 (diff) |
*misc
Diffstat (limited to 'source/Asura.Editor/controls/button.h')
-rw-r--r-- | source/Asura.Editor/controls/button.h | 99 |
1 files changed, 51 insertions, 48 deletions
diff --git a/source/Asura.Editor/controls/button.h b/source/Asura.Editor/controls/button.h index 3f07c1c..656d7d8 100644 --- a/source/Asura.Editor/controls/button.h +++ b/source/Asura.Editor/controls/button.h @@ -11,69 +11,72 @@ namespace AsuraEditor { - - enum ButtonStatus - { - BUTTON_STATUS_NORMAL = 0, - BUTTON_STATUS_PUSHED = 1, - BUTTON_STATUS_HOVER = 2, - BUTTON_STATUS_DISABLED = 3, - BUTTON_STATUS_FOCUSED = 4, - _BUTTON_STATUS_COUNT = 5, - }; - - enum ButtonMessage - { - BUTTON_MSG_CLICK = 0, - BUTTON_MSG_HOVER = 1, - BUTTON_MSG_KILLFOCUS = 2, - _BUTTON_MSG_COUNT = 3, - }; - - class Button - : public Widget - , public AEScripting::Portable<Button> + namespace Controls { - public: - LUAX_DECL_FACTORY(Button); + enum ButtonStatus + { + BUTTON_STATUS_NORMAL = 0, + BUTTON_STATUS_PUSHED = 1, + BUTTON_STATUS_HOVER = 2, + BUTTON_STATUS_DISABLED = 3, + BUTTON_STATUS_FOCUSED = 4, + _BUTTON_STATUS_COUNT = 5, + }; + + enum ButtonMessage + { + BUTTON_MSG_CLICK = 0, + BUTTON_MSG_HOVER = 1, + BUTTON_MSG_KILLFOCUS = 2, + _BUTTON_MSG_COUNT = 3, + }; + + class Button + : public Widget + , public AEScripting::Portable<Button> + { + public: + + LUAX_DECL_FACTORY(Button); - Button(); - ~Button(); + Button(); + ~Button(); - void OnEvent(AEInput::Event& e) override; - void OnPaint() override; + void OnEvent(AEInput::Event& e) override; + void OnPaint() override; - void Connect(int msg, Slot callback); - void Disconnect(int msg); - void DisconnectAll(int msg); - void DisconnectAllMsg(); + void Connect(int msg, Slot callback); + void Disconnect(int msg); + void DisconnectAll(int msg); + void DisconnectAllMsg(); - int GetStatus(); - void SetImage(int status, AEGraphics::Image* image); + int GetStatus(); + void SetImage(int status, AEGraphics::Image* image); - private: + private: - //------------------------------------------------------------------------------// + //------------------------------------------------------------------------------// - LUAX_DECL_ENUM(ButtonStatus); - LUAX_DECL_ENUM(ButtonMessage); + LUAX_DECL_ENUM(ButtonStatus, 1); + LUAX_DECL_ENUM(ButtonMessage, 1); - LUAX_DECL_METHOD(_Connect); - LUAX_DECL_METHOD(_Disconnect); - LUAX_DECL_METHOD(_SetImage); + LUAX_DECL_METHOD(_Connect); + LUAX_DECL_METHOD(_Disconnect); + LUAX_DECL_METHOD(_SetImage); - //------------------------------------------------------------------------------// + //------------------------------------------------------------------------------// - int mStatus; // ǰ״̬ - Signal mSignals[_BUTTON_MSG_COUNT]; // 3Ϣsignal - AEGraphics::Image* mImage[_BUTTON_STATUS_COUNT]; // 5״̬ͼ + int mStatus; // ǰ״̬ + Signal mSignals[_BUTTON_MSG_COUNT]; // 3Ϣsignal + AEGraphics::Image* mImage[_BUTTON_STATUS_COUNT]; // 5״̬ͼ - Luax::LuaxMemberRef mImageRef[_BUTTON_STATUS_COUNT];// ͼ - std::vector<Luax::LuaxMemberRef> mCallbacksRef; // ص + Luax::LuaxMemberRef mImageRef[_BUTTON_STATUS_COUNT];// ͼ + std::vector<Luax::LuaxMemberRef> mCallbacksRef; // ص - }; + }; + } } #endif
\ No newline at end of file |