blob: f569cfe78c33eeec62e6774a194d4e7a35652072 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
#ifndef __ASURA_EDITOR_SLOT_H__
#define __ASURA_EDITOR_SLOT_H__
#include <asura-utils/scripting/portable.hpp>
#include <asura-core/input/event.h>
#include "../controls/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
|