]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/textctrl.cpp
simplified and cleaned up wxGTK's focus handling
[wxWidgets.git] / src / msw / textctrl.cpp
index 9293dcebb717c9b6a936dbb25073dbe6f6a88c41..c8173d7fc7bcc0a00425f135c7e6fc4665406d9d 100644 (file)
@@ -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;