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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
#include "Editor/GUI/EditorWindows.h"
#include "Runtime/Math/Math.h"
using namespace LuaBind;
LUA_BIND_REGISTRY(ContainerWindow)
{
LUA_BIND_REGISTER_METHODS(state,
{ "New", _New },
{ "SetTitle", _SetTitle },
{ "SetIcon", _SetIcon },
{ "DoPaint", _DoPaint },
{ "GetSize", _GetSize }
);
}
LUA_BIND_POSTPROCESS(ContainerWindow)
{
}
LUA_BIND_IMPL_METHOD(ContainerWindow, _SetTitle)
{
LUA_BIND_PREPARE(L, ContainerWindow);
cc8* title = state.GetValue<cc8*>(2, "");
self->SetTitle(title);
return 0;
}
LUA_BIND_IMPL_METHOD(ContainerWindow, _SetIcon)
{
LUA_BIND_PREPARE(L, ContainerWindow);
cc8* path = state.GetValue<cc8*>(2, "");
self->SetIcon(path);
return 0;
}
LUA_BIND_IMPL_METHOD(ContainerWindow, _GetSize)
{
LUA_BIND_PREPARE(L, ContainerWindow);
state.PushLuaObject(self->GetSize());
return 1;
}
LUA_BIND_IMPL_METHOD(ContainerWindow, _DoPaint)
{
LUA_BIND_PREPARE(L, ContainerWindow);
self->DoPaint();
return 0;
}
LUA_BIND_IMPL_METHOD(ContainerWindow, ContainerWindow::_New)
{
LUA_BIND_STATE(L, ContainerWindow);
LUA_BIND_CHECK(L, "TNTT");
ContainerWindow* wnd = new ContainerWindow(state.GetVM());
Rect rect = state.GetValue<Rect>(state, Rect());
int showMode = state.GetValue<int>(2, 0);
Vector2 min = state.GetValue<Vector2>(state, Vector2());
Vector2 max = state.GetValue<Vector2>(state, Vector2());
wnd->Init(rect, showMode, min, max);
wnd->PushUserdata(state);
return 1;
}
|