From 0b8e5844cec28dcd6ce8ba88ff0c4a0a423cb425 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=A1clav=20Slav=C3=ADk?= Date: Sat, 5 Jan 2002 19:30:05 +0000 Subject: [PATCH] MSLU fixes for RichEdit git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13389 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/msw/textctrl.cpp | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index 47d62a13a4..c1511e337f 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -447,7 +447,7 @@ void wxTextCtrl::SetValue(const wxString& value) } } -#if wxUSE_RICHEDIT && !wxUSE_UNICODE +#if wxUSE_RICHEDIT && (!wxUSE_UNICODE || wxUSE_UNICODE_MSLU) DWORD CALLBACK wxRichEditStreamIn(DWORD dwCookie, BYTE *buf, LONG cb, LONG *pcb) { @@ -470,6 +470,11 @@ DWORD CALLBACK wxRichEditStreamIn(DWORD dwCookie, BYTE *buf, LONG cb, LONG *pcb) extern long wxEncodingToCodepage(wxFontEncoding encoding); // from strconv.cpp +#if wxUSE_UNICODE_MSLU +bool wxTextCtrl::StreamIn(const wxString& value, wxFontEncoding WXUNUSED(encoding)) +{ + const wchar_t *wpc = value.c_str(); +#else bool wxTextCtrl::StreamIn(const wxString& value, wxFontEncoding encoding) { // we have to use EM_STREAMIN to force richedit control 2.0+ to show any @@ -495,6 +500,7 @@ bool wxTextCtrl::StreamIn(const wxString& value, wxFontEncoding encoding) // finally, stream it in the control const wchar_t *wpc = wchBuf; +#endif // wxUSE_UNICODE_MSLU EDITSTREAM eds; wxZeroMemory(eds); @@ -530,9 +536,18 @@ void wxTextCtrl::WriteText(const wxString& value) { long start, end; GetSelection(&start, &end); - SetStyle(start, end, m_defaultStyle ); + SetStyle(start, end, m_defaultStyle); } +#if wxUSE_UNICODE_MSLU + // RichEdit doesn't have Unicode version of EM_REPLACESEL on Win9x, + // but EM_STREAMIN works + if ( wxGetOsVersion() == wxWIN95 && GetRichVersion() > 1 ) + { + done = StreamIn(valueDos, wxFONTENCODING_SYSTEM); + } +#endif // wxUSE_UNICODE_MSLU + #if !wxUSE_UNICODE // next check if the text we're inserting must be shown in a non // default charset -- this only works for RichEdit > 1.0