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/GUI | |
parent | 9b1f8214eea0c86d41f903a5feba9aac78603df1 (diff) |
* split
Diffstat (limited to 'Editor/GUI')
-rw-r--r-- | Editor/GUI/ContainerWindow.cpp | 21 | ||||
-rw-r--r-- | Editor/GUI/ContainerWindow.h | 6 | ||||
-rw-r--r-- | Editor/GUI/GUIWindow.cpp | 4 |
3 files changed, 17 insertions, 14 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"; |