]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/textctrl.cpp
restored missing parts of wxClipboardTextEvent docs lost in the conversion
[wxWidgets.git] / src / msw / textctrl.cpp
index f20fd9c970af6bdbf63b18d5f54fc0c1c49b9228..5007bc1d845e270dd3fa9bd54b89bacc0a519c86 100644 (file)
@@ -1305,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;
@@ -2057,15 +2064,12 @@ void wxTextCtrl::OnRedo(wxCommandEvent& WXUNUSED(event))
 
 void wxTextCtrl::OnDelete(wxCommandEvent& WXUNUSED(event))
 {
-    long from, to;
-    GetSelection(& from, & to);
-    if (from != -1 && to != -1)
-        Remove(from, to);
+    RemoveSelection();
 }
 
 void wxTextCtrl::OnSelectAll(wxCommandEvent& WXUNUSED(event))
 {
-    SetSelection(-1, -1);
+    SelectAll();
 }
 
 void wxTextCtrl::OnUpdateCut(wxUpdateUIEvent& event)
@@ -2095,14 +2099,12 @@ void wxTextCtrl::OnUpdateRedo(wxUpdateUIEvent& event)
 
 void wxTextCtrl::OnUpdateDelete(wxUpdateUIEvent& event)
 {
-    long from, to;
-    GetSelection(& from, & to);
-    event.Enable(from != -1 && to != -1 && from != to && IsEditable()) ;
+    event.Enable( HasSelection() && IsEditable() );
 }
 
 void wxTextCtrl::OnUpdateSelectAll(wxUpdateUIEvent& event)
 {
-    event.Enable(GetLastPosition() > 0);
+    event.Enable( !IsEmpty() );
 }
 
 void wxTextCtrl::OnContextMenu(wxContextMenuEvent& event)