From 03b3b8ae80559745f98ef94569b421adddeb441f Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Mar 2019 23:46:59 +0800 Subject: *misc --- source/Asura.Editor/core/slot.h | 43 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 source/Asura.Editor/core/slot.h (limited to 'source/Asura.Editor/core/slot.h') 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 +#include + +#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 -- cgit v1.1-26-g67d0