Block all events in wxSpinButton::SetValue etc.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@47293 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robert Roebling
2007-07-10 12:00:48 +00:00
parent ef1e53d1b3
commit 6027b33b15

View File

@@ -150,22 +150,34 @@ int wxSpinButton::GetValue() const
return m_pos;
}
static void wxSpinButton_GtkDisableEvents( const wxSpinButton *spinctrl )
{
g_signal_handlers_block_by_func( spinctrl->m_widget,
(gpointer)gtk_value_changed, (void*) spinctrl );
}
static void wxSpinButton_GtkEnableEvents( const wxSpinButton *spinctrl )
{
g_signal_handlers_unblock_by_func( spinctrl->m_widget,
(gpointer)gtk_value_changed, (void*) spinctrl );
}
void wxSpinButton::SetValue( int value )
{
wxCHECK_RET( (m_widget != NULL), wxT("invalid spin button") );
BlockScrollEvent();
wxSpinButton_GtkDisableEvents( this );
gtk_spin_button_set_value((GtkSpinButton*)m_widget, value);
UnblockScrollEvent();
wxSpinButton_GtkEnableEvents( this );
}
void wxSpinButton::SetRange(int minVal, int maxVal)
{
wxCHECK_RET( (m_widget != NULL), wxT("invalid spin button") );
BlockScrollEvent();
wxSpinButton_GtkDisableEvents( this );
gtk_spin_button_set_range((GtkSpinButton*)m_widget, minVal, maxVal);
UnblockScrollEvent();
wxSpinButton_GtkEnableEvents( this );
}
void wxSpinButton::OnSize( wxSizeEvent &WXUNUSED(event) )