X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0bf36922c8a60f19dccc3889c15b281fc94d69c5..3cfe87da6e54dc7ce367c6028cf659667e695413:/src/gtk/spinctrl.cpp diff --git a/src/gtk/spinctrl.cpp b/src/gtk/spinctrl.cpp index d14e452c6c..5f8406cbe0 100644 --- a/src/gtk/spinctrl.cpp +++ b/src/gtk/spinctrl.cpp @@ -38,7 +38,7 @@ static void gtk_value_changed(GtkSpinButton* spinbutton, wxSpinCtrl* win) { win->m_pos = int(gtk_spin_button_get_value(spinbutton)); - if (!win->m_hasVMT || g_blockEventsOnDrag || win->m_blockScrollEvent) + if (!win->m_hasVMT || g_blockEventsOnDrag) return; wxCommandEvent event( wxEVT_COMMAND_SPINCTRL_UPDATED, win->GetId()); @@ -63,7 +63,7 @@ extern "C" { static void gtk_changed(GtkSpinButton* spinbutton, wxSpinCtrl* win) { - if (!win->m_hasVMT || win->m_blockScrollEvent) + if (!win->m_hasVMT) return; wxCommandEvent event( wxEVT_COMMAND_TEXT_UPDATED, win->GetId() ); @@ -106,8 +106,8 @@ bool wxSpinCtrl::Create(wxWindow *parent, wxWindowID id, } m_widget = gtk_spin_button_new_with_range(min, max, 1); - gtk_spin_button_set_value((GtkSpinButton*)m_widget, initial); - m_pos = int(gtk_spin_button_get_value((GtkSpinButton*)m_widget)); + gtk_spin_button_set_value( GTK_SPIN_BUTTON(m_widget), initial); + m_pos = (int) gtk_spin_button_get_value( GTK_SPIN_BUTTON(m_widget)); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON(m_widget), (int)(m_windowStyle & wxSP_WRAP) ); @@ -132,7 +132,7 @@ int wxSpinCtrl::GetMin() const wxCHECK_MSG( (m_widget != NULL), 0, wxT("invalid spin button") ); double min; - gtk_spin_button_get_range((GtkSpinButton*)m_widget, &min, NULL); + gtk_spin_button_get_range( GTK_SPIN_BUTTON(m_widget), &min, NULL); return int(min); } @@ -141,7 +141,7 @@ int wxSpinCtrl::GetMax() const wxCHECK_MSG( (m_widget != NULL), 0, wxT("invalid spin button") ); double max; - gtk_spin_button_get_range((GtkSpinButton*)m_widget, NULL, &max); + gtk_spin_button_get_range( GTK_SPIN_BUTTON(m_widget), NULL, &max); return int(max); } @@ -151,6 +151,8 @@ int wxSpinCtrl::GetValue() const GtkDisableEvents(); gtk_spin_button_update( GTK_SPIN_BUTTON(m_widget) ); + wx_const_cast(wxSpinCtrl*, this)->m_pos = + int(gtk_spin_button_get_value(GTK_SPIN_BUTTON(m_widget))); GtkEnableEvents(); return m_pos; @@ -180,7 +182,8 @@ void wxSpinCtrl::SetValue( int value ) wxCHECK_RET( (m_widget != NULL), wxT("invalid spin button") ); GtkDisableEvents(); - gtk_spin_button_set_value((GtkSpinButton*)m_widget, value); + gtk_spin_button_set_value( GTK_SPIN_BUTTON(m_widget), value); + m_pos = (int) gtk_spin_button_get_value( GTK_SPIN_BUTTON(m_widget)); GtkEnableEvents(); } @@ -202,7 +205,8 @@ void wxSpinCtrl::SetRange(int minVal, int maxVal) wxCHECK_RET( (m_widget != NULL), wxT("invalid spin button") ); GtkDisableEvents(); - gtk_spin_button_set_range((GtkSpinButton*)m_widget, minVal, maxVal); + gtk_spin_button_set_range( GTK_SPIN_BUTTON(m_widget), minVal, maxVal); + m_pos = int(gtk_spin_button_get_value(GTK_SPIN_BUTTON(m_widget))); GtkEnableEvents(); } @@ -211,7 +215,7 @@ void wxSpinCtrl::GtkDisableEvents() const { g_signal_handlers_block_by_func( m_widget, (gpointer)gtk_value_changed, (void*) this); - + g_signal_handlers_block_by_func(m_widget, (gpointer)gtk_changed, (void*) this); } @@ -220,7 +224,7 @@ void wxSpinCtrl::GtkEnableEvents() const { g_signal_handlers_unblock_by_func(m_widget, (gpointer)gtk_value_changed, (void*) this); - + g_signal_handlers_unblock_by_func(m_widget, (gpointer)gtk_changed, (void*) this); }