summaryrefslogtreecommitdiff
path: root/Editor/GUI/GUIWindow.h
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-11-08 09:23:38 +0800
committerchai <chaifix@163.com>2021-11-08 09:23:38 +0800
commit138d3f4d3d6e2aaf5ba34f89af15ef85ea074357 (patch)
tree31ca6e8ea6d2e960e8d35f801bd92555942822e2 /Editor/GUI/GUIWindow.h
parentefce5b6bd5c9d4f8214a71e0f7a7c35751710a4c (diff)
*misc
Diffstat (limited to 'Editor/GUI/GUIWindow.h')
-rw-r--r--Editor/GUI/GUIWindow.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/Editor/GUI/GUIWindow.h b/Editor/GUI/GUIWindow.h
new file mode 100644
index 0000000..aa81b38
--- /dev/null
+++ b/Editor/GUI/GUIWindow.h
@@ -0,0 +1,69 @@
+#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"
+
+#include "WindowBase.h"
+
+// GUI窗口,事件相应、绘制、布局的单元
+class GUIWindow
+ : public WindowBase
+ , public LuaBind::NativeClass<GUIWindow>
+{
+public:
+ static LRESULT CALLBACK GUIViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
+ static void RepaintAll();
+
+ GUIWindow(LuaBind::VM* vm, std::string name = ""); //throw WindowException
+
+ void DoPaint();
+ void SetContainerWindow(ContainerWindow* wnd);
+ void Focus();
+ void SetPosition(Rect position);
+ void SetAsRenderContext();
+
+ void OnFocus();
+ void OnLostFocus();
+ void OnPaint();
+
+ GET_SET(std::string, Name, m_Name);
+ GET(HDC, DC, m_DC);
+
+private:
+ void ProcessEventMessages(UINT message, WPARAM wParam, LPARAM lParam);
+ bool SetRenderContext();
+
+ //-----------------------------------------------------------------
+
+ std::string m_Name;
+
+ LuaBind::MemberRef m_Script;
+
+ BOOL m_MouseTracking;
+ DWORD m_MouseHoverTime;
+
+ HWND m_Handle;
+ HDC m_DC;
+
+ //-----------------------------------------------------------------
+
+ LUA_BIND_DECL_CLASS(GUIWindow);
+
+ LUA_BIND_DECL_METHOD(_New);
+ LUA_BIND_DECL_METHOD(_DoPaint);
+ LUA_BIND_DECL_METHOD(_Focus);
+ LUA_BIND_DECL_METHOD(_SetContainerWindow);
+ LUA_BIND_DECL_METHOD(_SetPosition);
+
+};
+