diff options
| author | crupest <crupest@outlook.com> | 2022-01-29 18:10:21 +0800 |
|---|---|---|
| committer | crupest <crupest@outlook.com> | 2022-01-29 18:10:21 +0800 |
| commit | 406d1d2be02e83f897b65789897d81a060142ace (patch) | |
| tree | 0869587df0680bb482b55359efdf3cba57d3eab0 /src/osx/gui/Window.mm | |
| parent | e7da93f75ba57fa4ab1ae1fd8053266ed09f92d8 (diff) | |
| download | cru-406d1d2be02e83f897b65789897d81a060142ace.tar.gz cru-406d1d2be02e83f897b65789897d81a060142ace.tar.bz2 cru-406d1d2be02e83f897b65789897d81a060142ace.zip | |
...
Diffstat (limited to 'src/osx/gui/Window.mm')
| -rw-r--r-- | src/osx/gui/Window.mm | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/osx/gui/Window.mm b/src/osx/gui/Window.mm index a0542147..3bea5543 100644 --- a/src/osx/gui/Window.mm +++ b/src/osx/gui/Window.mm @@ -186,6 +186,10 @@ void OsxWindowPrivate::CreateWindow() { [window_ setContentView:content_view]; + auto title_str = Convert(title_); + [window_ setTitle:(NSString*)title_str]; + CFRelease(title_str); + draw_layer_ = CreateLayer(content_rect.size); create_event_.Raise(nullptr); @@ -246,6 +250,18 @@ void OsxWindow::SetStyleFlag(WindowStyleFlag flag) { } } +String OsxWindow::GetTitle() { return p_->title_; } + +void OsxWindow::SetTitle(String title) { + p_->title_ = title; + + if (p_->window_) { + auto str = Convert(title); + [p_->window_ setTitle:(NSString*)str]; + CFRelease(str); + } +} + WindowVisibilityType OsxWindow::GetVisibility() { if (!p_->window_) return WindowVisibilityType::Hide; if ([p_->window_ isMiniaturized]) return WindowVisibilityType::Minimize; |
