From 1535b3122b523f2935fc7a38aded4c2bc0ccb4b5 Mon Sep 17 00:00:00 2001 From: momo5502 Date: Sun, 4 Aug 2024 07:59:30 +0200 Subject: [PATCH] Support wide window titles --- src/window.cpp | 10 +++++++++- src/window.hpp | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/window.cpp b/src/window.cpp index 3b6bae7..c83ad67 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -41,6 +41,14 @@ namespace momo } window::window(const std::string& title, const int width, const int height, + std::function(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(window*, UINT, WPARAM, LPARAM)> callback, const long flags) : callback_(std::move(callback)) @@ -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; diff --git a/src/window.hpp b/src/window.hpp index a56732d..9a2c32b 100644 --- a/src/window.hpp +++ b/src/window.hpp @@ -15,6 +15,10 @@ namespace momo std::function(window*, UINT, WPARAM, LPARAM)> callback, long flags = (WS_OVERLAPPEDWINDOW & ~(WS_THICKFRAME | WS_MAXIMIZEBOX))); + window(const std::wstring& title, int width, int height, + std::function(window*, UINT, WPARAM, LPARAM)> callback, + long flags = (WS_OVERLAPPEDWINDOW & ~(WS_THICKFRAME | WS_MAXIMIZEBOX))); + virtual ~window(); void close();