diff options
author | chai <chaifix@163.com> | 2021-11-13 17:29:45 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-11-13 17:29:45 +0800 |
commit | 73dc62da054cbc18afc694f803ebff7fe24f4eca (patch) | |
tree | 5ed1fa0166891569e3dd6f3fa9d2ec2a83754624 /Editor | |
parent | 9b1f8214eea0c86d41f903a5feba9aac78603df1 (diff) |
* split
Diffstat (limited to 'Editor')
-rw-r--r-- | Editor/GUI/ContainerWindow.cpp | 21 | ||||
-rw-r--r-- | Editor/GUI/ContainerWindow.h | 6 | ||||
-rw-r--r-- | Editor/GUI/GUIWindow.cpp | 4 | ||||
-rw-r--r-- | Editor/Scripting/Window/ContainerWindow.bind.cpp | 39 |
4 files changed, 37 insertions, 33 deletions
diff --git a/Editor/GUI/ContainerWindow.cpp b/Editor/GUI/ContainerWindow.cpp index 59cd008..f76ac73 100644 --- a/Editor/GUI/ContainerWindow.cpp +++ b/Editor/GUI/ContainerWindow.cpp @@ -96,19 +96,12 @@ LRESULT CALLBACK ContainerWindow::ContainerWndProc(HWND hWnd, UINT message, WPAR case WM_WINDOWPOSCHANGED: // 窗口大小、位置、z层级改变,即窗口区域改变 { + //log_info_tag("WndProc", "WM_WINDOWPOSCHANGED" ); + if (!self->m_IsClosing && !IsIconic(hWnd)) //IsIconic 窗口是否是最小化(图标化) { - // OnRectChanged()回调 - self->OnRectChanged(); + self->OnSizeChanged(); } - // WM_WINDOWPOSCHANGED 消息触发后且调用了DefWindowProc会接着发送WM_SIZE和WM_MOVE消息。在WM_WINDOWPOSCHANGED - // 中一起处理大小和位置改变更高效 - /* - By default, the DefWindowProc function sends the WM_SIZE and WM_MOVE messages to the window. - The WM_SIZE and WM_MOVE messages are not sent if an application handles the WM_WINDOWPOSCHANGED - message without calling DefWindowProc. It is more efficient to perform any move or size change - processing during the WM_WINDOWPOSCHANGED message without calling DefWindowProc. - */ break; } @@ -441,9 +434,15 @@ Vector2f ContainerWindow::GetSize() return size; } -void ContainerWindow::OnRectChanged() +void ContainerWindow::OnSizeChanged() { + LuaBind::State state = GetVM()->GetCurThread(); + LuaBind::MemberInvoker invoker = MemberInvoker(state, this); + invoker.member = m_Script; + invoker.method = "OnSizeChanged"; + invoker.AddMember(m_Script); + invoker.Invoke(0); } void ContainerWindow::OnActivateApplication(bool active) diff --git a/Editor/GUI/ContainerWindow.h b/Editor/GUI/ContainerWindow.h index 08f08fe..09a1f0f 100644 --- a/Editor/GUI/ContainerWindow.h +++ b/Editor/GUI/ContainerWindow.h @@ -47,7 +47,7 @@ public: GET(HWND, WindowHandle, m_Window); GET(HDC, DC, m_DC); - void OnRectChanged(); + void OnSizeChanged(); void OnActivateApplication(bool active); private: @@ -66,10 +66,10 @@ private: POINT m_MinSize; POINT m_MaxSize; -#ifdef GAMELAB_WIN HWND m_Window; HDC m_DC; -#endif + + LuaBind::MemberRef m_Script; //-------------------------------------------------------- diff --git a/Editor/GUI/GUIWindow.cpp b/Editor/GUI/GUIWindow.cpp index aaab6a8..19ceb85 100644 --- a/Editor/GUI/GUIWindow.cpp +++ b/Editor/GUI/GUIWindow.cpp @@ -168,6 +168,8 @@ LRESULT CALLBACK GUIWindow::GUIViewWndProc(HWND hWnd, UINT message, WPARAM wPara // self->RequestRepaint(); // } + self->DoPaint(); + // // Update the scene so that scripts marked with [ExecuteInEditMode] are able to react to screen size changes // GetApplication().SetSceneRepaintDirty(); //} @@ -269,6 +271,8 @@ void GUIWindow::ProcessEventMessages(UINT message, WPARAM wParam, LPARAM lParam) SCRIPT_GLOBAL.guiBeginOnGUI.Invoke(state, 0); + SetAsRenderContext(); + LuaBind::MemberInvoker invoker = LuaBind::MemberInvoker(state, this); invoker.member = m_Script; invoker.method = "OnGUI"; diff --git a/Editor/Scripting/Window/ContainerWindow.bind.cpp b/Editor/Scripting/Window/ContainerWindow.bind.cpp index 5e7319b..f459c85 100644 --- a/Editor/Scripting/Window/ContainerWindow.bind.cpp +++ b/Editor/Scripting/Window/ContainerWindow.bind.cpp @@ -18,6 +18,26 @@ LUA_BIND_POSTPROCESS(ContainerWindow) { } +// self, position, showMode, min, max +LUA_BIND_IMPL_METHOD(ContainerWindow, ContainerWindow::_New) +{ + LUA_BIND_STATE(L, ContainerWindow); + LUA_BIND_CHECK(L, "TTNTT"); + + ContainerWindow* wnd = new ContainerWindow(state.GetVM()); + + wnd->SetMemberRef(state, wnd->m_Script, 1); + Rect rect = state.GetValue<Rect>(2, Rect()); + int showMode = state.GetValue<int>(3, 0); + Vector2 min = state.GetValue<Vector2>(4, Vector2(50, 50)); + Vector2 max = state.GetValue<Vector2>(5, Vector2(10000, 10000)); + + wnd->Init(rect, showMode, min, max); + wnd->PushUserdata(state); + + return 1; +} + LUA_BIND_IMPL_METHOD(ContainerWindow, _SetTitle) { LUA_BIND_PREPARE(L, ContainerWindow); @@ -53,22 +73,3 @@ LUA_BIND_IMPL_METHOD(ContainerWindow, _DoPaint) 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; -} |