From 138d3f4d3d6e2aaf5ba34f89af15ef85ea074357 Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 8 Nov 2021 09:23:38 +0800 Subject: *misc --- Editor/GUI/GUIWindow.h | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 Editor/GUI/GUIWindow.h (limited to 'Editor/GUI/GUIWindow.h') 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 +#include +#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 +{ +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); + +}; + -- cgit v1.1-26-g67d0