]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/spinctrl.cpp
check that the version of __sync_sub_and_fetch that returns a value is supported...
[wxWidgets.git] / src / gtk / spinctrl.cpp
index 6b46c461b27343238a2575e0e6ff20412813e467..cc7b511f0ac521a950061db765cc5defa37625ae 100644 (file)
@@ -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());
@@ -51,7 +51,7 @@ gtk_value_changed(GtkSpinButton* spinbutton, wxSpinCtrl* win)
     // values in range 5..50 is then, ummm, quite challenging (hint: you can't
     // enter 1!) (VZ)
     event.SetInt(win->m_pos);
-    win->GetEventHandler()->ProcessEvent( event );
+    win->HandleWindowEvent( event );
 }
 }
 
@@ -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() );
@@ -72,7 +72,7 @@ gtk_changed(GtkSpinButton* spinbutton, wxSpinCtrl* win)
 
     // see above
     event.SetInt(win->m_pos);
-    win->GetEventHandler()->ProcessEvent( event );
+    win->HandleWindowEvent( event );
 }
 }
 
@@ -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;
@@ -204,6 +206,7 @@ void wxSpinCtrl::SetRange(int minVal, int maxVal)
 
     GtkDisableEvents();
     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();
 }
 
@@ -212,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);
 }
@@ -221,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);
 }
@@ -257,7 +260,7 @@ void wxSpinCtrl::OnChar( wxKeyEvent &event )
         GtkSpinButton *gsb = GTK_SPIN_BUTTON(m_widget);
         wxString val = wxGTK_CONV_BACK( gtk_entry_get_text( &gsb->entry ) );
         evt.SetString( val );
-        if (GetEventHandler()->ProcessEvent(evt)) return;
+        if (HandleWindowEvent(evt)) return;
     }
 
     event.Skip();