X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/ce4169a4d129fc6cd165b2e9ccc5cf5d48356020..e7b3d6babbc006f2936be6827d0b826adbbc82e4:/src/gtk/combobox.cpp diff --git a/src/gtk/combobox.cpp b/src/gtk/combobox.cpp index efbe51763d..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" @@ -166,13 +165,15 @@ bool wxComboBox::Create( wxWindow *parent, wxWindowID id, const wxString& value, wxComboBox::~wxComboBox() { - wxNode *node = m_clientDataList.First(); + wxNode *node = m_clientObjectList.First(); while (node) { wxClientData *cd = (wxClientData*)node->Data(); if (cd) delete cd; node = node->Next(); } + m_clientObjectList.Clear(); + m_clientDataList.Clear(); } @@ -421,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 ) @@ -585,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();