diff options
author | chai <chaifix@163.com> | 2019-03-25 23:46:59 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2019-03-25 23:46:59 +0800 |
commit | 03b3b8ae80559745f98ef94569b421adddeb441f (patch) | |
tree | 7bf46892fef7453d4c25172333bd4fbddb29ee16 /source/Asura.Editor/widgets/button.h | |
parent | 82956beb1fe17e1226327638c8ab22b5f5adfc1d (diff) |
*misc
Diffstat (limited to 'source/Asura.Editor/widgets/button.h')
-rw-r--r-- | source/Asura.Editor/widgets/button.h | 54 |
1 files changed, 47 insertions, 7 deletions
diff --git a/source/Asura.Editor/widgets/button.h b/source/Asura.Editor/widgets/button.h index 00f1c99..8edc919 100644 --- a/source/Asura.Editor/widgets/button.h +++ b/source/Asura.Editor/widgets/button.h @@ -1,29 +1,69 @@ #ifndef __ASURA_EDITOR_BUTTON_H__ #define __ASURA_EDITOR_BUTTON_H__ -// Asura.Engine Headers -#include <Scripting/Luax.hpp> +#include <vector> -#include "Widget.h" +#include <asura-lib-utils/scripting/portable.hpp> +#include <asura-lib-core/graphics/image.h> + +#include "../core/signal.h" +#include "widget.h" 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> { - public: Button(); + ~Button(); + + 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(); + + int GetStatus(); + void SetImage(int status, AEGraphics::Image* image); + + LUAX_DECL_FACTORY(Button); private: - // Image mIcon; // ͼ꣬Ҫ - // Text mText; //ť + 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״̬ͼ - LUAX_DECL_FACTORY(Button); // AsuraEditor.Button + Luax::LuaxMemberRef mImageRef[_BUTTON_STATUS_COUNT];// ͼ + std::vector<Luax::LuaxMemberRef> mCallbacksRef; // ص }; |