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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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.CheckValue<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)
{
}
}
|