X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7d6d2cd4622a2fdfdbce768dfaf868a838747707..54c13c66d2c465ae00fc4e59c29312bb16eccdc4:/src/gtk/combobox.cpp diff --git a/src/gtk/combobox.cpp b/src/gtk/combobox.cpp index b51c7c04ab..20718dfae3 100644 --- a/src/gtk/combobox.cpp +++ b/src/gtk/combobox.cpp @@ -16,8 +16,7 @@ #if wxUSE_COMBOBOX #include "wx/settings.h" - -#include +#include "wx/intl.h" #include "gdk/gdk.h" #include "gtk/gtk.h" @@ -423,8 +422,12 @@ void wxComboBox::SetSelection( int n ) { wxCHECK_RET( m_widget != NULL, _T("invalid combobox") ); + DisableEvents(); + GtkWidget *list = GTK_COMBO(m_widget)->list; gtk_list_select_item( GTK_LIST(list), n ); + + EnableEvents(); } void wxComboBox::SetStringSelection( const wxString &string ) @@ -587,6 +590,32 @@ void wxComboBox::OnChar( wxKeyEvent &event ) event.Skip(); } +void wxComboBox::DisableEvents() +{ + GtkList *list = GTK_LIST( GTK_COMBO(m_widget)->list ); + GList *child = list->children; + while (child) + { + gtk_signal_disconnect_by_func( GTK_OBJECT(child->data), + GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this ); + + child = child->next; + } +} + +void wxComboBox::EnableEvents() +{ + GtkList *list = GTK_LIST( GTK_COMBO(m_widget)->list ); + GList *child = list->children; + while (child) + { + gtk_signal_connect( GTK_OBJECT(child->data), "select", + GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this ); + + child = child->next; + } +} + void wxComboBox::OnSize( wxSizeEvent &event ) { event.Skip();