]> git.saurik.com Git - wxWidgets.git/commitdiff
refactored code reused in several different places in wxTextEntry::RemoveSelection...
authorVadim Zeitlin <vadim@wxwidgets.org>
Sat, 15 Mar 2008 02:58:54 +0000 (02:58 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sat, 15 Mar 2008 02:58:54 +0000 (02:58 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52534 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/textentry.h
src/common/textentrycmn.cpp
src/gtk/combobox.cpp
src/msw/combobox.cpp
src/msw/textctrl.cpp

index 8567296cba1dd9eb0851460bf3b98fcae9920ad7..32c6895bd5198a9a44ad0777a2a3e48337c7354d 100644 (file)
@@ -54,6 +54,7 @@ public:
     virtual void Replace(long from, long to, const wxString& value);
     virtual void Remove(long from, long to) = 0;
     virtual void Clear() { SetValue(wxString()); }
+    void RemoveSelection();
 
 
     // clipboard operations
index 61d80ffbaaae6619940ec73a54a7f42ed1e34fe2..c6b769601e4256fe2863a0afcb8c347c5b32a15c 100644 (file)
@@ -80,6 +80,14 @@ bool wxTextEntryBase::HasSelection() const
     return from < to;
 }
 
+void wxTextEntryBase::RemoveSelection()
+{
+    long from, to;
+    GetSelection(& from, & to);
+    if (from != -1 && to != -1)
+        Remove(from, to);
+}
+
 wxString wxTextEntryBase::GetStringSelection() const
 {
     long from, to;
index 3e3429f1faeb52696edbbc4324d15b9f2343cf6c..0ad836e685034143b84072119c68215ce7795fc3 100644 (file)
@@ -493,10 +493,7 @@ void wxComboBox::OnRedo(wxCommandEvent& WXUNUSED(event))
 
 void wxComboBox::OnDelete(wxCommandEvent& WXUNUSED(event))
 {
-    long from, to;
-    GetSelection(& from, & to);
-    if (from != -1 && to != -1)
-        Remove(from, to);
+    RemoveSelection();
 }
 
 void wxComboBox::OnSelectAll(wxCommandEvent& WXUNUSED(event))
index 2de9a4e10b09ced8f3fdc0233c811e68169778a1..9d8e4a542d7a1740440b2989faf24b0ade5705a7 100644 (file)
@@ -581,10 +581,7 @@ void wxComboBox::OnRedo(wxCommandEvent& WXUNUSED(event))
 
 void wxComboBox::OnDelete(wxCommandEvent& WXUNUSED(event))
 {
-    long from, to;
-    GetSelection(& from, & to);
-    if (from != -1 && to != -1)
-        Remove(from, to);
+    RemoveSelection();
 }
 
 void wxComboBox::OnSelectAll(wxCommandEvent& WXUNUSED(event))
index b6144e1fbfd5f8edd5184d102a2ca95c76f64bfd..5007bc1d845e270dd3fa9bd54b89bacc0a519c86 100644 (file)
@@ -2064,10 +2064,7 @@ 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))