1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-04-29 15:19:44 +02:00

CodeConversions: Make compatible with wx3.0

Signed-off-by: Mart Raudsepp <leio@gentoo.org>
This commit is contained in:
Mart Raudsepp 2021-07-18 13:59:17 +03:00
parent 786f21b85c
commit f6b0cd343c

View File

@ -28,7 +28,14 @@ std::string ToUTF8 (const wchar_t* wstr)
std::string ToUTF8 (const wxString& wstr)
{
#if wxCHECK_VERSION(3, 1, 1)
return wstr.ToStdString (wxGet_wxConvUTF8 ());
#elif !wxUSE_UNICODE
return std::string (wstr.c_str (), wstr.length ());
#else
wxScopedCharBuffer buf (wstr.mb_str (wxGet_wxConvUTF8 ()));
return std::string (buf.data (), buf.length ());
#endif
}
std::wstring ToWString (const std::string& str)
@ -48,7 +55,11 @@ std::wstring ToWString (const wxString& str)
wxString ToWXString (const std::string& str)
{
#if wxCHECK_VERSION(3, 1, 1)
return wxString::FromUTF8 (str);
#else
return wxString::FromUTF8 (str.c_str());
#endif
}
wxString ToWXString (const std::wstring& str)