diff options
author | chai <chaifix@163.com> | 2021-11-08 09:23:38 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-11-08 09:23:38 +0800 |
commit | 138d3f4d3d6e2aaf5ba34f89af15ef85ea074357 (patch) | |
tree | 31ca6e8ea6d2e960e8d35f801bd92555942822e2 /Editor/GUI/ContainerWindow.h | |
parent | efce5b6bd5c9d4f8214a71e0f7a7c35751710a4c (diff) |
*misc
Diffstat (limited to 'Editor/GUI/ContainerWindow.h')
-rw-r--r-- | Editor/GUI/ContainerWindow.h | 82 |
1 files changed, 82 insertions, 0 deletions
diff --git a/Editor/GUI/ContainerWindow.h b/Editor/GUI/ContainerWindow.h new file mode 100644 index 0000000..140748d --- /dev/null +++ b/Editor/GUI/ContainerWindow.h @@ -0,0 +1,82 @@ +#pragma once + +#include <windows.h> +#include <vector> + +#include "Runtime/Math/Rect.h" +#include "Runtime/Lua/LuaBind/LuaBind.h" +#include "Runtime/Lua/LuaHelper.h" +#include "Runtime/Utilities/Singleton.h" +#include "Runtime/Debug/Log.h" +#include "Runtime/Graphics/OpenGL.h" +#include "Runtime/Utilities/UtilMacros.h" +#include "Editor/Utils/HelperFuncs.h" +#include "Runtime/Math/Math.h" +#include "Runtime/Utilities/Exception.h" + +// 一个containner window中有多个viewport +class ContainerWindow + : public LuaBind::NativeClass<ContainerWindow> +{ +public: + static LRESULT CALLBACK ContainerWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); + + enum ShowMode { + kShowNormalWindow = 0, // normal window with max/min/close buttons + kShowPopupMenu = 1, // popup menu - no title bar + kShowUtility = 2, // tool window - floats in the app, and hides when the app deactivates + kShowNoShadow = 3, // no shadow/decorations + kShowMainWindow = 4, // main Unity window. On Mac does not have close button; on Windows has menu bar etc. + kShowAuxWindow = 5, // Popup windows like the color picker, gradient editor, etc. Drawn with black background on Mac + }; + + ContainerWindow(LuaBind::VM* vm); + ~ContainerWindow(); + + void Init(Rect size, int showMode, const Vector2& minSize, const Vector2& maxSize, std::string name = ""); + void SetTitle(const char* title); + void SetIcon(LPCSTR iconName); + void SetAsRenderContext(); + void DoPaint(); + void Close(); + + GET_SET(std::string, Name, m_Name); + + GET(HWND, WindowHandle, m_Window); + GET(HDC, DC, m_DC); + + void OnRectChanged(); + void OnActivateApplication(bool active); + +private: + bool SetRenderContext(); + + //-------------------------------------------------------- + + std::string m_Name; + + POINT m_Size; + ShowMode m_ShowMode; // 窗口类型 + bool m_IsClosing; + bool m_InMenuLoop; + bool m_CloseFromScriptDontShutdown; + Rect m_InternalRect; + 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); + LUA_BIND_DECL_METHOD(_SetTitle); + LUA_BIND_DECL_METHOD(_SetIcon); + LUA_BIND_DECL_METHOD(_DoPaint); + +}; + |