summaryrefslogtreecommitdiff
path: root/Editor/GUI/ContainerWindow.h
diff options
context:
space:
mode:
Diffstat (limited to 'Editor/GUI/ContainerWindow.h')
-rw-r--r--Editor/GUI/ContainerWindow.h82
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);
+
+};
+