MSLU fixes for RichEdit

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@13389 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík 2002-01-05 19:30:05 +00:00
parent 0d54461f4e
commit 0b8e5844ce

View File

@ -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) 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 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) bool wxTextCtrl::StreamIn(const wxString& value, wxFontEncoding encoding)
{ {
// we have to use EM_STREAMIN to force richedit control 2.0+ to show any // 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 // finally, stream it in the control
const wchar_t *wpc = wchBuf; const wchar_t *wpc = wchBuf;
#endif // wxUSE_UNICODE_MSLU
EDITSTREAM eds; EDITSTREAM eds;
wxZeroMemory(eds); wxZeroMemory(eds);
@ -530,9 +536,18 @@ void wxTextCtrl::WriteText(const wxString& value)
{ {
long start, end; long start, end;
GetSelection(&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 #if !wxUSE_UNICODE
// next check if the text we're inserting must be shown in a non // next check if the text we're inserting must be shown in a non
// default charset -- this only works for RichEdit > 1.0 // default charset -- this only works for RichEdit > 1.0