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/binding/_button.cpp | |
parent | 82956beb1fe17e1226327638c8ab22b5f5adfc1d (diff) |
*misc
Diffstat (limited to 'source/Asura.Editor/widgets/binding/_button.cpp')
-rw-r--r-- | source/Asura.Editor/widgets/binding/_button.cpp | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/source/Asura.Editor/widgets/binding/_button.cpp b/source/Asura.Editor/widgets/binding/_button.cpp new file mode 100644 index 0000000..463aef6 --- /dev/null +++ b/source/Asura.Editor/widgets/binding/_button.cpp @@ -0,0 +1,60 @@ +#include "../button.h" + +using namespace Luax; + +namespace AsuraEditor +{ + + LUAX_REGISTRY(Button) + { + + // Button.EStatus.xxx + LUAX_REGISTER_ENUM(state, "EStatus", + { "NORMAL", BUTTON_STATUS_NORMAL }, + { "PUSHED", BUTTON_STATUS_PUSHED }, + { "HOVER", BUTTON_STATUS_HOVER }, + { "DISABLED", BUTTON_STATUS_DISABLED }, + { "FOCUSED", BUTTON_STATUS_FOCUSED } + ); + + // Button.EMsg.xxx + LUAX_REGISTER_ENUM(state, "EMessage", + { "CLICK", BUTTON_MSG_CLICK }, + { "HOVER", BUTTON_MSG_HOVER }, + { "FOCUS", BUTTON_MSG_KILLFOCUS } + ); + + } + + LUAX_POSTPROCESS(Button) + { + + } + + // button:Connect(msg, callback) + LUAX_IMPL_METHOD(Button, _Connect) + { + LUAX_STATE(L); + + Button* self = state.GetUserdata<Button>(1); + int msg = state.CheckParam<int>(2); + if (!lua_isfunction(L, 3)) + return state.ErrorType(3, "callback"); + + LuaxMemberRef ref; + self->SetLuaxMemberRef(state, ref, 3); + if (ref) + { + self->mCallbacksRef.push_back(ref); + Slot slot = Slot(state, (*self), ref.refID); + self->Connect(msg, slot); + } + } + + // button:SetImage(image) + LUAX_IMPL_METHOD(Button, _SetImage) + { + + } + +}
\ No newline at end of file |