block signal handlers, instead of disconnecting, to temporarily disable them

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46982 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Paul Cornett
2007-06-27 17:38:13 +00:00
parent ab29bb87b2
commit 9826452012
6 changed files with 49 additions and 62 deletions

View File

@@ -132,12 +132,12 @@ gtkcombo_combo_select_child_callback( GtkList *WXUNUSED(list), GtkWidget *WXUNUS
// Quickly set the value of the combo box
// as GTK+ does that only AFTER the event
// is sent.
g_signal_handlers_disconnect_by_func (GTK_COMBO (combo->GetHandle())->entry,
(gpointer) gtkcombo_text_changed_callback,
combo);
GtkWidget* entry = GTK_COMBO(combo->GetHandle())->entry;
g_signal_handlers_block_by_func(
entry, (gpointer)gtkcombo_text_changed_callback, combo);
combo->SetValue( combo->GetStringSelection() );
g_signal_connect_after (GTK_COMBO (combo->GetHandle())->entry, "changed",
G_CALLBACK (gtkcombo_text_changed_callback), combo);
g_signal_handlers_unblock_by_func(
entry, (gpointer)gtkcombo_text_changed_callback, combo);
// throw a SELECTED event only if the combobox popup is hidden (wxID_NONE)
// because when combobox popup is shown, gtkcombo_combo_select_child_callback is
@@ -1214,20 +1214,20 @@ void wxComboBox::DisableEvents()
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
g_signal_handlers_disconnect_by_func (GTK_BIN(m_widget)->child,
(gpointer)gtkcombobox_text_changed_callback, this);
g_signal_handlers_block_by_func(GTK_BIN(m_widget)->child,
(gpointer)gtkcombobox_text_changed_callback, this);
g_signal_handlers_disconnect_by_func (m_widget,
(gpointer)gtkcombobox_changed_callback, this);
g_signal_handlers_block_by_func(m_widget,
(gpointer)gtkcombobox_changed_callback, this);
}
else
#endif
{
g_signal_handlers_disconnect_by_func (GTK_COMBO(m_widget)->list,
(gpointer) gtkcombo_combo_select_child_callback, this);
g_signal_handlers_block_by_func(GTK_COMBO(m_widget)->list,
(gpointer) gtkcombo_combo_select_child_callback, this);
g_signal_handlers_disconnect_by_func (GTK_COMBO(m_widget)->entry,
(gpointer) gtkcombo_text_changed_callback, this);
g_signal_handlers_block_by_func(GTK_COMBO(m_widget)->entry,
(gpointer) gtkcombo_text_changed_callback, this);
}
}
@@ -1236,21 +1236,20 @@ void wxComboBox::EnableEvents()
#ifdef __WXGTK24__
if (!gtk_check_version(2,4,0))
{
g_signal_connect_after (GTK_BIN(m_widget)->child, "changed",
G_CALLBACK (gtkcombobox_text_changed_callback), this);
g_signal_handlers_unblock_by_func(GTK_BIN(m_widget)->child,
(gpointer)gtkcombobox_text_changed_callback, this);
g_signal_connect_after (m_widget, "changed",
G_CALLBACK (gtkcombobox_changed_callback), this);
g_signal_handlers_unblock_by_func(m_widget,
(gpointer)gtkcombobox_changed_callback, this);
}
else
#endif
{
g_signal_connect_after (GTK_COMBO(m_widget)->list, "select-child",
G_CALLBACK (gtkcombo_combo_select_child_callback),
this);
g_signal_connect_after (GTK_COMBO(m_widget)->entry, "changed",
G_CALLBACK (gtkcombo_text_changed_callback),
this );
g_signal_handlers_unblock_by_func(GTK_COMBO(m_widget)->list,
(gpointer) gtkcombo_combo_select_child_callback, this);
g_signal_handlers_unblock_by_func(GTK_COMBO(m_widget)->entry,
(gpointer) gtkcombo_text_changed_callback, this);
}
}