Block all events in wxSpinButton::SetValue etc.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@47292 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -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;
|
||||
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user