diff options
author | chai <chaifix@163.com> | 2021-11-05 18:10:01 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-11-05 18:10:01 +0800 |
commit | ed78df90944bbe6b7de7308bda2bf3a7f1bc3de6 (patch) | |
tree | a392ec71c55b5d83d0b7095039304aaca4bc06d5 /Editor/GUI | |
parent | 2b9621a46288532b352b7838f96aca80f971e3d1 (diff) |
*misc
Diffstat (limited to 'Editor/GUI')
-rw-r--r-- | Editor/GUI/ContainerWindow.cpp | 20 | ||||
-rw-r--r-- | Editor/GUI/EditorWindows.h | 33 | ||||
-rw-r--r-- | Editor/GUI/GUIWindow.cpp | 10 |
3 files changed, 41 insertions, 22 deletions
diff --git a/Editor/GUI/ContainerWindow.cpp b/Editor/GUI/ContainerWindow.cpp index f7d9e45..57b1b48 100644 --- a/Editor/GUI/ContainerWindow.cpp +++ b/Editor/GUI/ContainerWindow.cpp @@ -14,10 +14,13 @@ static bool s_IsMainWindowMaximized; extern bool ProcessMainWindowMessages(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam, LRESULT& result); -static PAINTSTRUCT ps; LRESULT CALLBACK ContainerWindow::ContainerWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { - +#if GAMELAB_DEBUG + static int _event_count = 0; + log_info_tag("WndProc", "ContrainerWindow Event %d", ++_event_count); +#endif + ContainerWindow *self = (ContainerWindow*)GetWindowLongPtr(hWnd, GWLP_USERDATA); if (!self) { @@ -25,8 +28,6 @@ LRESULT CALLBACK ContainerWindow::ContainerWndProc(HWND hWnd, UINT message, WPAR return DefWindowProcW(hWnd, message, wParam, lParam); } - //log_info_tag("WndProc", "ContainerWindow::ContainerWndProc(), ContainerWindow name is " + self->GetName()); - switch (message) { case WM_MENUSELECT: @@ -43,6 +44,7 @@ LRESULT CALLBACK ContainerWindow::ContainerWndProc(HWND hWnd, UINT message, WPAR return WM_SETICON; case WM_PAINT: { + static PAINTSTRUCT ps; log_info("WM_PAINT"); self->SetAsRenderContext(); glEnable(GL_BLEND); @@ -343,9 +345,9 @@ void ContainerWindow::Init(Rect pixelRect, int showMode, const Vector2& minSize, // parentWindow = GetMainEditorWindow(); } - bool notSizeable = (minSize == maxSize) && (minSize != Vector2::zero); - if (notSizeable) - windowStyle &= ~(WS_THICKFRAME); + //bool notSizeable = (minSize == maxSize) && (minSize != Vector2::zero); + //if (notSizeable) + // windowStyle &= ~(WS_THICKFRAME); AdjustWindowRectEx(&rect, windowStyle, showMode == kShowMainWindow, extendedStyle); int extraX = rect.right - rect.left - 200; @@ -379,8 +381,8 @@ void ContainerWindow::Init(Rect pixelRect, int showMode, const Vector2& minSize, if (pixelRect.width > 10 || pixelRect.height > 10) { //SetRect(pixelRect); - if (shouldMaximize) - SetWindowLong(m_Window, GWL_STYLE, windowStyle | WS_MAXIMIZE); + //if (shouldMaximize) + // SetWindowLong(m_Window, GWL_STYLE, windowStyle | WS_MAXIMIZE); } if (showMode == kShowMainWindow) diff --git a/Editor/GUI/EditorWindows.h b/Editor/GUI/EditorWindows.h index a8c96ad..d8a3f66 100644 --- a/Editor/GUI/EditorWindows.h +++ b/Editor/GUI/EditorWindows.h @@ -75,10 +75,10 @@ public: private: bool SetRenderContext(); + //-------------------------------------------------------- + std::string m_Name; - HWND m_Window; - HDC m_DC; POINT m_Size; ShowMode m_ShowMode; // 窗口类型 bool m_IsClosing; @@ -88,6 +88,13 @@ private: POINT m_MinSize; POINT m_MaxSize; +#ifdef GAMELAB_WIN + HWND m_Window; + HDC m_DC; +#endif + + //-------------------------------------------------------- + LUA_BIND_DECL_CLASS(ContainerWindow); LUA_BIND_DECL_METHOD(_New); @@ -97,12 +104,11 @@ private: }; -// 窗口基类 class WindowBase { }; -// 抽象窗口,用来做布局 +// 抽象窗口,用来做布局,SplitWindow是嵌套的 class SplitWindow : public WindowBase { public: @@ -119,7 +125,10 @@ public: private: SplitMode m_SplitMode; - GUIWindow* m_GUIWindow; + // 嵌套split + std::vector< SplitWindow*> m_ChildSplitWindows; + + // 最顶层的split window包含的是GUIWindows std::vector<GUIWindow*>* m_GUIWindows; }; @@ -158,12 +167,17 @@ private: std::string m_Name; ContainerWindow* m_ContainerWindow; - HWND m_Handle; - HDC m_DC; - std::vector<LuaBind::MemberRef> m_EditorWindows; + std::vector<LuaBind::MemberRef> m_EditorWindows; LuaBind::MemberRef m_EditorWindow; // EditorWindow脚本 - LuaBind::MemberRef m_Script; // EditorWindow脚本 + LuaBind::MemberRef m_ActiveEditorWindow; // 当前激活的EditorWindow + + LuaBind::MemberRef m_Script; // EditorWindow脚本 + +#if GAMELAB_WIN + HWND m_Handle; + HDC m_DC; +#endif //----------------------------------------------------------------- @@ -174,7 +188,6 @@ private: LUA_BIND_DECL_METHOD(_Focus); LUA_BIND_DECL_METHOD(_SetContainerWindow); LUA_BIND_DECL_METHOD(_SetPosition); - LUA_BIND_DECL_METHOD(_SetInstance); }; diff --git a/Editor/GUI/GUIWindow.cpp b/Editor/GUI/GUIWindow.cpp index cd49445..6bf7fd8 100644 --- a/Editor/GUI/GUIWindow.cpp +++ b/Editor/GUI/GUIWindow.cpp @@ -25,9 +25,13 @@ static bool RedirectMouseWheel(HWND window, WPARAM wParam, LPARAM lParam) return true; } -static PAINTSTRUCT ps; LRESULT CALLBACK GUIWindow::GUIViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { +#if GAMELAB_DEBUG + static int _event_count = 0; + log_info_tag("WndProc", "GUIWindow Event %d", ++_event_count); +#endif + GUIWindow* self = (GUIWindow*)GetWindowLongPtr(hWnd, GWLP_USERDATA); if (!self) { @@ -35,8 +39,6 @@ LRESULT CALLBACK GUIWindow::GUIViewWndProc(HWND hWnd, UINT message, WPARAM wPara return DefWindowProcW(hWnd, message, wParam, lParam); } - //log_info_tag("WndProc", "GUIWindow::GUIViewWndProc(), GUIWindow name is %s", self->GetName()); - switch (message) { case WM_ERASEBKGND: @@ -45,6 +47,8 @@ LRESULT CALLBACK GUIWindow::GUIViewWndProc(HWND hWnd, UINT message, WPARAM wPara case WM_PAINT: { + static PAINTSTRUCT ps; + log_info_tag("WndProc", "WM_PAINT"); self->SetAsRenderContext(); |