X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/50c6e05f3de1558af0c0afee70604fd329f913df..bd2e08d06528b2014a4acf878e91fee4696d0666:/src/msw/textctrl.cpp diff --git a/src/msw/textctrl.cpp b/src/msw/textctrl.cpp index 0a8e54ea59..c8173d7fc7 100644 --- a/src/msw/textctrl.cpp +++ b/src/msw/textctrl.cpp @@ -784,10 +784,12 @@ wxString wxTextCtrl::GetRange(long from, long to) const encoding = font.GetEncoding(); } +#if wxUSE_INTL if ( encoding == wxFONTENCODING_SYSTEM ) { encoding = wxLocale::GetSystemEncoding(); } +#endif // wxUSE_INTL if ( encoding == wxFONTENCODING_SYSTEM ) { @@ -974,6 +976,9 @@ wxTextCtrl::StreamIn(const wxString& value, const size_t len = conv.MB2WC(NULL, value.mb_str(), value.length()); + if (len == wxCONV_FAILED) + return false; + #if wxUSE_WCHAR_T wxWCharBuffer wchBuf(len); wchar_t *wpc = wchBuf.data(); @@ -1066,7 +1071,8 @@ wxTextCtrl::StreamOut(wxFontEncoding encoding, bool selectionOnly) const // conversion but what else can we do) wxCSConv conv(encoding); size_t lenNeeded = conv.WC2MB(NULL, wchBuf, 0); - if ( lenNeeded++ ) + + if ( lenNeeded != wxCONV_FAILED && lenNeeded++ ) { conv.WC2MB(wxStringBuffer(out, lenNeeded), wchBuf, lenNeeded); } @@ -1299,6 +1305,13 @@ void wxTextCtrl::DoSetSelection(long from, long to, int flags) #if wxUSE_RICHEDIT if ( IsRich() ) { + // if from and to are both -1, it means (in wxWidgets) that all text + // should be selected, translate this into Windows convention + if ( (from == -1) && (to == -1) ) + { + from = 0; + } + CHARRANGE range; range.cpMin = from; range.cpMax = to; @@ -1877,13 +1890,6 @@ WXLRESULT wxTextCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lPara } } break; - - case WM_CUT: - case WM_COPY: - case WM_PASTE: - if ( HandleClipboardEvent(nMsg) ) - lRc = 0; - break; } return lRc; @@ -1928,17 +1934,6 @@ bool wxTextCtrl::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) { switch ( param ) { - case EN_SETFOCUS: - case EN_KILLFOCUS: - { - wxFocusEvent event(param == EN_KILLFOCUS ? wxEVT_KILL_FOCUS - : wxEVT_SET_FOCUS, - m_windowId); - event.SetEventObject(this); - HandleWindowEvent(event); - } - break; - case EN_CHANGE: SendUpdateEvent(); break; @@ -1954,7 +1949,9 @@ bool wxTextCtrl::MSWCommand(WXUINT param, WXWORD WXUNUSED(id)) } break; - // the other edit notification messages are not processed + // the other edit notification messages are not processed (or, in + // the case of EN_{SET/KILL}FOCUS were already handled at WM_SET/ + // KILLFOCUS level) default: return false; }