Move wxEVT_TEXT generation to wxSpinCtrlGTKBase::GTKTextChanged()

This is more consistent with GTKValueChanged() and allows making the
change in the upcoming commit.

No real changes yet, this is just a refactoring.
This commit is contained in:
Vadim Zeitlin
2021-04-21 09:00:14 +02:00
parent e7c9bd32fd
commit 32258bd10a
2 changed files with 11 additions and 5 deletions

View File

@@ -72,6 +72,7 @@ public:
virtual bool GTKOutput(wxString* text) const = 0;
virtual void GTKValueChanged() = 0;
void GTKTextChanged();
protected:
wxSpinCtrlGTKBase();

View File

@@ -54,11 +54,7 @@ extern "C" {
static void
gtk_changed(GtkSpinButton*, wxSpinCtrl* win)
{
wxCommandEvent event( wxEVT_TEXT, win->GetId() );
event.SetEventObject( win );
event.SetString(win->GetTextValue());
event.SetInt(win->GetValue());
win->HandleWindowEvent( event );
win->GTKTextChanged();
}
}
@@ -526,6 +522,15 @@ bool wxSpinCtrlGTKBase::GTKOutput(wxString* text) const
return false;
}
void wxSpinCtrlGTKBase::GTKTextChanged()
{
wxCommandEvent event( wxEVT_TEXT, GetId() );
event.SetEventObject( this );
event.SetString(GetTextValue());
event.SetInt(static_cast<int>(DoGetValue()));
HandleWindowEvent( event );
}
//-----------------------------------------------------------------------------
// wxSpinCtrl
//-----------------------------------------------------------------------------