X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9ff9d30c0aab3b281ef9b380eac17435556c5088..85284ca4b226d9a1ab6bed26c5eaa480543649d5:/src/gtk/spinctrl.cpp diff --git a/src/gtk/spinctrl.cpp b/src/gtk/spinctrl.cpp index 952d003784..5c53cd491a 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 ); } @@ -118,6 +118,16 @@ bool wxSpinCtrlGTKBase::Create(wxWindow *parent, wxWindowID id, gtk_spin_button_set_value( GTK_SPIN_BUTTON(m_widget), initial); m_value = gtk_spin_button_get_value( GTK_SPIN_BUTTON(m_widget)); + gfloat align; + if ( HasFlag(wxALIGN_RIGHT) ) + align = 1.0; + else if ( HasFlag(wxALIGN_CENTRE) ) + align = 0.5; + else + align = 0.0; + + gtk_entry_set_alignment(GTK_ENTRY(m_widget), align); + gtk_spin_button_set_wrap( GTK_SPIN_BUTTON(m_widget), (int)(m_windowStyle & wxSP_WRAP) ); @@ -142,7 +152,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(); @@ -206,7 +216,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);