diff options
author | crupest <crupest@outlook.com> | 2022-01-29 18:25:02 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2022-01-29 18:25:02 +0800 |
commit | 90261a333f251cc241f186f0ee6ed8e12787cc02 (patch) | |
tree | 7b308191503b5961710b9df820e746e421ec9468 | |
parent | 406d1d2be02e83f897b65789897d81a060142ace (diff) | |
download | cru-90261a333f251cc241f186f0ee6ed8e12787cc02.tar.gz cru-90261a333f251cc241f186f0ee6ed8e12787cc02.tar.bz2 cru-90261a333f251cc241f186f0ee6ed8e12787cc02.zip |
...
-rw-r--r-- | include/cru/win/gui/Window.hpp | 1 | ||||
-rw-r--r-- | src/win/gui/Window.cpp | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/include/cru/win/gui/Window.hpp b/include/cru/win/gui/Window.hpp index 8f79c138..d0ea5b41 100644 --- a/include/cru/win/gui/Window.hpp +++ b/include/cru/win/gui/Window.hpp @@ -179,6 +179,7 @@ class CRU_WIN_GUI_API WinNativeWindow : public WinNativeResource, WindowStyleFlag style_flag_{}; WindowVisibilityType visibility_ = WindowVisibilityType::Hide; Rect client_rect_{100, 100, 400, 300}; + String title_; HWND hwnd_ = nullptr; WinNativeWindow* parent_window_ = nullptr; diff --git a/src/win/gui/Window.cpp b/src/win/gui/Window.cpp index b3cf7065..2bd29476 100644 --- a/src/win/gui/Window.cpp +++ b/src/win/gui/Window.cpp @@ -87,6 +87,16 @@ void WinNativeWindow::SetParent(INativeWindow* parent) { } } +String WinNativeWindow::GetTitle() { return title_; } + +void WinNativeWindow::SetTitle(String title) { + title_ = title; + + if (hwnd_) { + ::SetWindowTextW(hwnd_, title_.WinCStr()); + } +} + void WinNativeWindow::SetStyleFlag(WindowStyleFlag flag) { if (flag == style_flag_) return; @@ -466,6 +476,8 @@ void WinNativeWindow::RecreateWindow() { SetCursor(application_->GetCursorManager()->GetSystemCursor( cru::platform::gui::SystemCursorType::Arrow)); + ::SetWindowTextW(hwnd_, title_.WinCStr()); + window_render_target_ = std::make_unique<graphics::win::direct::D2DWindowRenderTarget>( application_->GetDirectFactory(), hwnd_); |