diff options
author | chai <chaifix@163.com> | 2021-11-11 18:27:36 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-11-11 18:27:36 +0800 |
commit | 0e0aa82ab2ebc9f15519cea710a52c5895690152 (patch) | |
tree | 57e91039458549dadb4e904d537be26fe792b855 /Editor/Scripting/Window/ContainerWindow.bind.cpp | |
parent | 36f42b74630d4bca2d1d276d57c4c967d0290380 (diff) |
* rename Editor.GUI to Editor.Window
Diffstat (limited to 'Editor/Scripting/Window/ContainerWindow.bind.cpp')
-rw-r--r-- | Editor/Scripting/Window/ContainerWindow.bind.cpp | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/Editor/Scripting/Window/ContainerWindow.bind.cpp b/Editor/Scripting/Window/ContainerWindow.bind.cpp new file mode 100644 index 0000000..6c73116 --- /dev/null +++ b/Editor/Scripting/Window/ContainerWindow.bind.cpp @@ -0,0 +1,64 @@ +#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 } + ); +} + +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, _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; +} |