X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/af01f1ba0d697c07173f436ab661b4c833258a91..df16a53ef9ae506c51023178e4fe45ce45e69447:/src/msw/textctrl.cpp diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index 4282e711fe..c64bfb06e8 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -91,6 +91,10 @@ } ENLINK; #endif // ENLINK +#ifndef SF_UNICODE + #define SF_UNICODE 0x0010 +#endif + // ---------------------------------------------------------------------------- // private functions // ---------------------------------------------------------------------------- @@ -464,6 +468,7 @@ extern long wxEncodingToCodepage(wxFontEncoding encoding); // from strconv.cpp bool wxTextCtrl::StreamIn(const wxString& value, wxFontEncoding encoding) { +#if !wxUSE_UNICODE // we have to use EM_STREAMIN to force richedit control 2.0+ to show any // text in the non default charset - otherwise it thinks it knows better // than we do and always shows it in the default one @@ -487,11 +492,15 @@ bool wxTextCtrl::StreamIn(const wxString& value, wxFontEncoding encoding) // finally, stream it in the control const wchar_t *wpc = wchBuf; +#else + const wchar_t *wpc = value.c_str(); +#endif EDITSTREAM eds; wxZeroMemory(eds); eds.dwCookie = (DWORD)&wpc; - eds.pfnCallback = wxRichEditStreamIn; + // the cast below is needed for broken (very) old mingw32 headers + eds.pfnCallback = (EDITSTREAMCALLBACK)wxRichEditStreamIn; if ( !::SendMessage(GetHwnd(), EM_STREAMIN, SF_TEXT | SF_UNICODE | SFF_SELECTION,