From 7662e226653105c58da40bd5a670a35d0482591d Mon Sep 17 00:00:00 2001 From: sonicfind <52436993+sonicfind@users.noreply.github.com> Date: Fri, 18 Sep 2020 19:56:27 -0500 Subject: [PATCH] GSdx-GUI: Add wchar_t variant of ComboBoxAppend --- plugins/GSdx/Window/GSCaptureDlg.cpp | 4 +--- plugins/GSdx/Window/GSDialog.cpp | 14 ++++++++++++-- plugins/GSdx/Window/GSDialog.h | 4 ++++ 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/plugins/GSdx/Window/GSCaptureDlg.cpp b/plugins/GSdx/Window/GSCaptureDlg.cpp index 964b7c1cf9..c5e7981b28 100644 --- a/plugins/GSdx/Window/GSCaptureDlg.cpp +++ b/plugins/GSdx/Window/GSCaptureDlg.cpp @@ -143,9 +143,7 @@ void GSCaptureDlg::OnInit() m_codecs.push_back(c); - std::string s{c.FriendlyName.begin(), c.FriendlyName.end()}; - - ComboBoxAppend(IDC_CODECS, s.c_str(), (LPARAM)&m_codecs.back(), c.DisplayName == selected); + ComboBoxAppend(IDC_CODECS, c.FriendlyName.c_str(), (LPARAM)&m_codecs.back(), c.DisplayName == selected); } EndEnumSysDev UpdateConfigureButton(); diff --git a/plugins/GSdx/Window/GSDialog.cpp b/plugins/GSdx/Window/GSDialog.cpp index c9c7a11647..86ad09db7b 100644 --- a/plugins/GSdx/Window/GSDialog.cpp +++ b/plugins/GSdx/Window/GSDialog.cpp @@ -200,12 +200,22 @@ void GSDialog::ComboBoxInit(UINT id, const std::vector& settings, int int GSDialog::ComboBoxAppend(UINT id, const char* str, LPARAM data, bool select) { HWND hWnd = GetDlgItem(m_hWnd, id); + int item = (int)SendMessageA(hWnd, CB_ADDSTRING, 0, (LPARAM)str); + return BoxAppend(hWnd, item, data, select); +} - int item = (int)SendMessage(hWnd, CB_ADDSTRING, 0, (LPARAM)str); +int GSDialog::ComboBoxAppend(UINT id, const wchar_t* str, LPARAM data, bool select) +{ + HWND hWnd = GetDlgItem(m_hWnd, id); + int item = (int)SendMessageW(hWnd, CB_ADDSTRING, 0, (LPARAM)str); + return BoxAppend(hWnd, item, data, select); +} +int GSDialog::BoxAppend(HWND& hWnd, int item, LPARAM data, bool select) +{ SendMessage(hWnd, CB_SETITEMDATA, item, (LPARAM)data); - if(select) + if (select) { SendMessage(hWnd, CB_SETCURSEL, item, 0); } diff --git a/plugins/GSdx/Window/GSDialog.h b/plugins/GSdx/Window/GSDialog.h index ad663ae598..b02e35a916 100644 --- a/plugins/GSdx/Window/GSDialog.h +++ b/plugins/GSdx/Window/GSDialog.h @@ -53,6 +53,7 @@ public: void ComboBoxInit(UINT id, const std::vector& settings, int32_t selectionValue, int32_t maxValue = INT32_MAX); int ComboBoxAppend(UINT id, const char* str, LPARAM data = 0, bool select = false); + int ComboBoxAppend(UINT id, const wchar_t* str, LPARAM data = 0, bool select = false); bool ComboBoxGetSelData(UINT id, INT_PTR& data); void ComboBoxFixDroppedWidth(UINT id); @@ -61,4 +62,7 @@ public: void AddTooltip(UINT id); static void InitCommonControls(); + +private: + int BoxAppend(HWND& hWnd, int item, LPARAM data = 0, bool select = false); };