diff options
Diffstat (limited to 'source/Asura.Editor/core/slot.h')
-rw-r--r-- | source/Asura.Editor/core/slot.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/source/Asura.Editor/core/slot.h b/source/Asura.Editor/core/slot.h new file mode 100644 index 0000000..ff565cf --- /dev/null +++ b/source/Asura.Editor/core/slot.h @@ -0,0 +1,43 @@ +#ifndef __ASURA_EDITOR_SLOT_H__ +#define __ASURA_EDITOR_SLOT_H__ + +#include <asura-lib-utils/scripting/portable.hpp> +#include <asura-lib-core/input/event.h> + +#include "../widgets/widget.h" + +namespace AsuraEditor +{ + + /// + /// Ӧsignalıհ + /// + class Slot + { + public: + Slot(Luax::LuaxState& state, Widget& widget, int refID) + : mState(state) + , mRefID(refID) + , mWidget(widget) + { + } + + void operator()() + { + mWidget.PushLuaxMemberRef(mState, mRefID); + if (lua_isfunction(mState, -1)) // callback + { + mState.Call(0, 0); + } + } + + private: + Luax::LuaxState& mState; + Widget& mWidget; + int mRefID; + + }; + +} + +#endif
\ No newline at end of file |