]> git.saurik.com Git - wxWidgets.git/commitdiff
Block all events in wxSpinButton::SetValue etc.
authorRobert Roebling <robert@roebling.de>
Tue, 10 Jul 2007 11:58:03 +0000 (11:58 +0000)
committerRobert Roebling <robert@roebling.de>
Tue, 10 Jul 2007 11:58:03 +0000 (11:58 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47292 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/gtk/spinbutt.h
src/gtk/spinbutt.cpp

index 4daf12bb375eefef7092b352c750a6aeaf602334..cb7e59778e90d6001571a4dbd0662d970a68eccc 100644 (file)
@@ -51,6 +51,9 @@ public:
     int m_pos;
 
 protected:
+    void GtkDisableEvents() const;
+    void GtkEnableEvents() const;
+    
     virtual wxSize DoGetBestSize() const;
     virtual GdkWindow *GTKGetWindow(wxArrayGdkWindows& windows) const;
 
index 46bdce96906e620a3855a9be2d6714d7c7bafa5e..6be5c3a20970760179068a2df5da1e05dd690a05 100644 (file)
@@ -150,18 +150,18 @@ void wxSpinButton::SetValue( int value )
 {
     wxCHECK_RET( (m_widget != NULL), wxT("invalid spin button") );
 
-    BlockScrollEvent();
+    GtkDisableEvents();
     gtk_spin_button_set_value((GtkSpinButton*)m_widget, value);
-    UnblockScrollEvent();
+    GtkEnableEvents();
 }
 
 void wxSpinButton::SetRange(int minVal, int maxVal)
 {
     wxCHECK_RET( (m_widget != NULL), wxT("invalid spin button") );
 
-    BlockScrollEvent();
+    GtkDisableEvents();
     gtk_spin_button_set_range((GtkSpinButton*)m_widget, minVal, maxVal);
-    UnblockScrollEvent();
+    GtkEnableEvents();
 }
 
 void wxSpinButton::OnSize( wxSizeEvent &WXUNUSED(event) )
@@ -172,6 +172,18 @@ void wxSpinButton::OnSize( wxSizeEvent &WXUNUSED(event) )
     gtk_widget_set_size_request( m_widget, m_width, m_height );
 }
 
+void wxSpinButton::GtkDisableEvents() const
+{
+    g_signal_handlers_block_by_func(m_widget,
+        (gpointer)gtk_value_changed, (void*) this);
+}
+
+void wxSpinButton::GtkEnableEvents() const
+{
+    g_signal_handlers_unblock_by_func(m_widget,
+        (gpointer)gtk_value_changed, (void*) this);
+}
+
 GdkWindow *wxSpinButton::GTKGetWindow(wxArrayGdkWindows& WXUNUSED(windows)) const
 {
     return GTK_SPIN_BUTTON(m_widget)->panel;