diff options
author | chai <chaifix@163.com> | 2021-10-23 18:19:18 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-10-23 18:19:18 +0800 |
commit | 7bf672fd0c6211909d94078b448032b1bd0916ef (patch) | |
tree | 655b875b81ec8d0559ca905fb7d37a1d88e6a80d /Editor/GUI | |
parent | df0444f85f9bf623cc886e1632e624ef20cb0f1b (diff) |
*misc
Diffstat (limited to 'Editor/GUI')
-rw-r--r-- | Editor/GUI/EditorWindows.h | 3 | ||||
-rw-r--r-- | Editor/GUI/GUIWindow.cpp | 11 |
2 files changed, 11 insertions, 3 deletions
diff --git a/Editor/GUI/EditorWindows.h b/Editor/GUI/EditorWindows.h index a25b612..3b84b13 100644 --- a/Editor/GUI/EditorWindows.h +++ b/Editor/GUI/EditorWindows.h @@ -145,6 +145,7 @@ public: void OnFocus(); void OnLostFocus(); + void OnPaint(); GET_SET(std::string, Name, m_Name); GET(HDC, DC, m_DC); @@ -161,7 +162,7 @@ private: HDC m_DC; HGLRC m_RC; - LuaBind::MemberRef m_Instance; // EditorWindow脚本 + LuaBind::MemberRef m_Script; // EditorWindow脚本 LUA_BIND_DECL_CLASS(GUIWindow); diff --git a/Editor/GUI/GUIWindow.cpp b/Editor/GUI/GUIWindow.cpp index 2127232..fb23a59 100644 --- a/Editor/GUI/GUIWindow.cpp +++ b/Editor/GUI/GUIWindow.cpp @@ -45,7 +45,7 @@ LRESULT CALLBACK GUIWindow::GUIViewWndProc(HWND hWnd, UINT message, WPARAM wPara { log_info("WndProc", "WM_PAINT"); self->SetAsRenderContext(); - + self->OnPaint(); BeginPaint(self->m_Handle, &ps); EndPaint(self->m_Handle, &ps); UpdateWindow(self->m_Handle); @@ -150,6 +150,7 @@ LRESULT CALLBACK GUIWindow::GUIViewWndProc(HWND hWnd, UINT message, WPARAM wPara } case WM_SETFOCUS: //获得焦点 + self->OnFocus(); return 0; case WM_KILLFOCUS: //失去焦点 return 0; @@ -176,7 +177,7 @@ void GUIWindow::RepaintAll() GUIWindow::GUIWindow(LuaBind::VM* vm) : LuaBind::NativeClass<GUIWindow>(vm) - , m_Instance() + , m_Script() { } @@ -313,12 +314,18 @@ void GUIWindow::DoPaint() void GUIWindow::OnFocus() { + InvokeLuaCallback(m_Script, "OnFocus"); } void GUIWindow::OnLostFocus() { } +void GUIWindow::OnPaint() +{ + InvokeLuaCallback(m_Script, "OnPaint"); +} + void GUIWindow::SetPosition(Rectf position) { log_info("GUIWindow::SetPosition()"); |