[App] Build title using StringBuffer.
This commit is contained in:
@@ -48,7 +48,7 @@ class Window {
|
||||
virtual void DisableMainMenu() = 0;
|
||||
|
||||
const std::string& title() const { return title_; }
|
||||
virtual bool set_title(const std::string& title) {
|
||||
virtual bool set_title(const std::string_view title) {
|
||||
if (title == title_) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -99,11 +99,12 @@ void GTKWindow::OnClose() {
|
||||
super::OnClose();
|
||||
}
|
||||
|
||||
bool GTKWindow::set_title(const std::string& title) {
|
||||
bool GTKWindow::set_title(const std::string_view title) {
|
||||
if (!super::set_title(title)) {
|
||||
return false;
|
||||
}
|
||||
gtk_window_set_title(GTK_WINDOW(window_), (gchar*)title.c_str());
|
||||
std::string titlez(title);
|
||||
gtk_window_set_title(GTK_WINDOW(window_), (gchar*)titlez.c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ class GTKWindow : public Window {
|
||||
void EnableMainMenu() override {}
|
||||
void DisableMainMenu() override {}
|
||||
|
||||
bool set_title(const std::string& title) override;
|
||||
bool set_title(const std::string_view title) override;
|
||||
|
||||
bool SetIcon(const void* buffer, size_t size) override;
|
||||
|
||||
|
||||
@@ -199,11 +199,12 @@ void Win32Window::DisableMainMenu() {
|
||||
}
|
||||
}
|
||||
|
||||
bool Win32Window::set_title(const std::string& title) {
|
||||
bool Win32Window::set_title(const std::string_view title) {
|
||||
if (!super::set_title(title)) {
|
||||
return false;
|
||||
}
|
||||
SetWindowTextW(hwnd_, reinterpret_cast<LPCWSTR>(xe::to_utf16(title).c_str()));
|
||||
auto wide_title = xe::to_utf16(title);
|
||||
SetWindowTextW(hwnd_, reinterpret_cast<LPCWSTR>(wide_title.c_str()));
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ class Win32Window : public Window {
|
||||
void EnableMainMenu() override;
|
||||
void DisableMainMenu() override;
|
||||
|
||||
bool set_title(const std::string& title) override;
|
||||
bool set_title(const std::string_view title) override;
|
||||
|
||||
bool SetIcon(const void* buffer, size_t size) override;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user