Skip to content

Commit

Permalink
Support wide window titles
Browse files Browse the repository at this point in the history
  • Loading branch information
momo5502 committed Aug 4, 2024
1 parent 9270120 commit 1535b31
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,14 @@ namespace momo
}

window::window(const std::string& title, const int width, const int height,
std::function<std::optional<LRESULT>(window*, UINT, WPARAM, LPARAM)> callback,
const long flags)
: window(convert_utf8_to_wide(title), width, height,std::move(callback), flags)
{

}

window::window(const std::wstring& title, const int width, const int height,
std::function<std::optional<LRESULT>(window*, UINT, WPARAM, LPARAM)> callback,
const long flags)
: callback_(std::move(callback))
Expand All @@ -65,7 +73,7 @@ namespace momo

++window_count;

this->handle_ = CreateWindowExW(NULL, this->wc_.lpszClassName, convert_utf8_to_wide(title).data(), flags, x, y,
this->handle_ = CreateWindowExW(NULL, this->wc_.lpszClassName, title.data(), flags, x, y,
width, height, nullptr, nullptr, this->wc_.hInstance, this);

constexpr BOOL value = TRUE;
Expand Down
4 changes: 4 additions & 0 deletions src/window.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ namespace momo
std::function<std::optional<LRESULT>(window*, UINT, WPARAM, LPARAM)> callback,
long flags = (WS_OVERLAPPEDWINDOW & ~(WS_THICKFRAME | WS_MAXIMIZEBOX)));

window(const std::wstring& title, int width, int height,
std::function<std::optional<LRESULT>(window*, UINT, WPARAM, LPARAM)> callback,
long flags = (WS_OVERLAPPEDWINDOW & ~(WS_THICKFRAME | WS_MAXIMIZEBOX)));

virtual ~window();

void close();
Expand Down

0 comments on commit 1535b31

Please sign in to comment.