refactored code reused in several different places in wxTextEntry::RemoveSelection() (patch 1910166)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52534 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-03-15 02:58:54 +00:00
parent e976429dfa
commit 5a25f8581a
5 changed files with 12 additions and 12 deletions

View 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

View 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;

View 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))

View 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))

View 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))