summaryrefslogtreecommitdiff
path: root/Editor/Scripting/Window/Window.bind.cpp
blob: a3610fc08c879ff82b2c19a73a651eea80d63a21 (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
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
75
76
77
78
79
#include "Editor/GUI/EditorWindows.h"
#include "Runtime/GUI/Font.h"
#include "Runtime/Graphics/Shader.h"
#include "Runtime/Debug/Log.h"
#include "Runtime/Graphics/GfxDevice.h"
#include "Runtime/Common/DataBuffer.h"
#include "Runtime/GUI/utf8.h"
#include "Runtime/Utilities/StaticInitiator.h"
#include "Runtime/GUI/UITextMesh.h"
#include "Runtime/Math/Math.h"
#include "Runtime/GUI/TextMeshGenerator.h"
#include "Runtime/Utilities/AutoInvoke.h"
#include "Editor/Win/Win.h"

using namespace LuaBind;
using namespace Win;

static int SetCursor(lua_State* L)
{
	LUA_BIND_STATE(L);
	LUA_BIND_CHECK(state, "N");

	int type = state.GetValue<int>(state, 1);
	Win::SetCursor((ECursor)type);

	return 0;
}

static luaL_Reg guiFuncs[] = {
	{"SetCursor", SetCursor},
    {0, 0}
};

// GameLab.Editor.Window
int luaopen_GameLab_Editor_Window(lua_State* L) 
{
	log_info_tag("Scripting", "luaopen_GameLab_Editor_Window()");

	LUA_BIND_STATE(L);

	state.PushGlobalNamespace();
	state.PushNamespace("GameLab");
	state.PushNamespace("Editor");
	state.PushNamespace("Window");

	state.PushNamespace("Internal");
    state.RegisterNativeClass<ContainerWindow>();
    state.RegisterNativeClass<GUIWindow>();
	state.PopNamespace();

	LUA_BIND_REGISTER_ENUM(state, "EShowMode",
		{ "NormalWindow", ContainerWindow::kShowNormalWindow },
		{ "ShowPopupMenu", ContainerWindow::kShowPopupMenu },
		{ "Utility ", ContainerWindow::kShowUtility },
		{ "NoShadow", ContainerWindow::kShowNoShadow },
		{ "MainWindow", ContainerWindow::kShowMainWindow },
		{ "AuxWindow", ContainerWindow::kShowAuxWindow }
	);

	LUA_BIND_REGISTER_ENUM(state, "ECursor",
		{ "AppStarting", Cursor_AppStarting },
		{ "Arrow", Cursor_Arrow },
		{ "Cross", Cursor_Cross },
		{ "Help", Cursor_Help },
		{ "IBeam", Cursor_IBeam },
		{ "NO", Cursor_NO },
		{ "SizeAll", Cursor_SizeAll },
		{ "SizeNESW", Cursor_SizeNESW },
		{ "SizeNS", Cursor_SizeNS },
		{ "SizeNWSE", Cursor_SizeNWSE },
		{ "SizeWE", Cursor_SizeWE },
		{ "UpArrow", Cursor_UpArrow },
		{ "Wait", Cursor_Wait }
	);

    state.RegisterMethods(guiFuncs);

	return 1;
}