applied patch to fix tooltips charset
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@20171 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -227,6 +227,7 @@ wxMSW:
|
|||||||
- Alt-letter didn't switch focus to a spin ctrl following static control with
|
- Alt-letter didn't switch focus to a spin ctrl following static control with
|
||||||
hotkey
|
hotkey
|
||||||
- fix for multiple consecutive groups of radiobuttons
|
- fix for multiple consecutive groups of radiobuttons
|
||||||
|
- fix for incorrect display of tooltips in non English locales (Niki Spahiev)
|
||||||
|
|
||||||
wxMotif:
|
wxMotif:
|
||||||
|
|
||||||
|
@@ -3155,36 +3155,9 @@ bool wxWindowMSW::HandleTooltipNotify(WXUINT code,
|
|||||||
// in Unicode mode this is just what we need
|
// in Unicode mode this is just what we need
|
||||||
ttText->lpszText = (wxChar *)ttip.c_str();
|
ttText->lpszText = (wxChar *)ttip.c_str();
|
||||||
#else // !Unicode
|
#else // !Unicode
|
||||||
// in ANSI mode we have to convert the string and put it into the
|
MultiByteToWideChar(CP_ACP, 0, ttip, ttip.length()+1,
|
||||||
// provided buffer: be careful not to overrun it
|
(wchar_t *)ttText->szText,
|
||||||
const size_t lenAnsi = ttip.length();
|
sizeof(ttText->szText) / sizeof(wchar_t));
|
||||||
|
|
||||||
// some compilers (MetroWerks and Cygwin) don't like calling mbstowcs
|
|
||||||
// with NULL argument
|
|
||||||
#if defined( __MWERKS__ ) || defined( __CYGWIN__ )
|
|
||||||
size_t lenUnicode = 2*lenAnsi;
|
|
||||||
#else
|
|
||||||
size_t lenUnicode = mbstowcs(NULL, ttip, lenAnsi);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// using the pointer of right type avoids us doing all sorts of
|
|
||||||
// pointer arithmetics ourselves
|
|
||||||
wchar_t *dst = (wchar_t *)ttText->szText,
|
|
||||||
*pwz = new wchar_t[lenUnicode + 1];
|
|
||||||
mbstowcs(pwz, ttip, lenAnsi + 1);
|
|
||||||
|
|
||||||
// stay inside the buffer (-1 because it must be NUL-terminated)
|
|
||||||
if ( lenUnicode > WXSIZEOF(ttText->szText) - 1 )
|
|
||||||
{
|
|
||||||
lenUnicode = WXSIZEOF(ttText->szText) - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
memcpy(dst, pwz, lenUnicode*sizeof(wchar_t));
|
|
||||||
|
|
||||||
// put the terminating wide NUL
|
|
||||||
dst[lenUnicode] = L'\0';
|
|
||||||
|
|
||||||
delete [] pwz;
|
|
||||||
#endif // Unicode/!Unicode
|
#endif // Unicode/!Unicode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user