X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8cd6a9ad50c00a94e62558a3b55e814028d81100..e1f833da2a8bbe01cc96c0d7a3542ac2c1d6d6f0:/src/gtk/spinctrl.cpp diff --git a/src/gtk/spinctrl.cpp b/src/gtk/spinctrl.cpp index 77a9cb485b..698e6f1365 100644 --- a/src/gtk/spinctrl.cpp +++ b/src/gtk/spinctrl.cpp @@ -52,7 +52,7 @@ gtk_value_changed(GtkSpinButton* spinbutton, wxSpinCtrlGTKBase* win) { wxSpinEvent event(wxEVT_COMMAND_SPINCTRL_UPDATED, win->GetId()); event.SetEventObject( win ); - event.SetPosition((int)(win->m_value + 0.5)); // FIXME should be SetValue + event.SetPosition( wxRound(win->m_value) ); // FIXME should be SetValue event.SetString(GTK_ENTRY(spinbutton)->text); win->HandleWindowEvent( event ); } @@ -113,6 +113,7 @@ bool wxSpinCtrlGTKBase::Create(wxWindow *parent, wxWindowID id, } m_widget = gtk_spin_button_new_with_range(min, max, inc); + g_object_ref(m_widget); gtk_spin_button_set_value( GTK_SPIN_BUTTON(m_widget), initial); m_value = gtk_spin_button_get_value( GTK_SPIN_BUTTON(m_widget)); @@ -141,7 +142,7 @@ double wxSpinCtrlGTKBase::DoGetValue() const GtkDisableEvents(); gtk_spin_button_update( GTK_SPIN_BUTTON(m_widget) ); - wx_const_cast(wxSpinCtrlGTKBase*, this)->m_value = + const_cast(this)->m_value = gtk_spin_button_get_value(GTK_SPIN_BUTTON(m_widget)); GtkEnableEvents(); @@ -205,7 +206,7 @@ void wxSpinCtrlGTKBase::DoSetValue( double value ) wxCHECK_RET( (m_widget != NULL), wxT("invalid spin button") ); if (wxIsKindOf(this, wxSpinCtrl)) - value = int(value + 0.5); + value = wxRound( value ); GtkDisableEvents(); gtk_spin_button_set_value( GTK_SPIN_BUTTON(m_widget), value);