X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/47908e25f992135fbc8c9573870784c62654e9e9..df9067d85cb82051e01ecf3a30d9d14474cf5259:/src/gtk/listbox.cpp diff --git a/src/gtk/listbox.cpp b/src/gtk/listbox.cpp index 359adda8d0..e4f05dc807 100644 --- a/src/gtk/listbox.cpp +++ b/src/gtk/listbox.cpp @@ -16,12 +16,21 @@ #include "wx/dynarray.h" #include "wx/listbox.h" +//----------------------------------------------------------------------------- +// data +//----------------------------------------------------------------------------- + +extern bool g_blockEventsOnDrag; + //----------------------------------------------------------------------------- // wxListBox //----------------------------------------------------------------------------- -void gtk_listitem_select_callback( GtkWidget *widget, wxListBox *listbox ) +static void gtk_listitem_select_callback( GtkWidget *widget, wxListBox *listbox ) { + if (!listbox->HasVMT()) return; + if (g_blockEventsOnDrag) return; + wxCommandEvent event(wxEVT_COMMAND_LISTBOX_SELECTED, listbox->GetId() ); event.SetInt( listbox->GetIndex( widget ) ); @@ -84,11 +93,11 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id, GtkWidget *list_item; list_item = gtk_list_item_new_with_label( choices[i] ); + gtk_container_add( GTK_CONTAINER(m_list), list_item ); + gtk_signal_connect( GTK_OBJECT(list_item), "select", GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this ); - gtk_container_add( GTK_CONTAINER(m_list), list_item ); - m_clientData.Append( (wxObject*)NULL ); gtk_widget_show( list_item );