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:
@@ -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
|
||||
|
@@ -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;
|
||||
|
@@ -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))
|
||||
|
@@ -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))
|
||||
|
@@ -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))
|
||||
|
Reference in New Issue
Block a user