+//-----------------------------------------------------------------------------
+// "button_press_event"
+//-----------------------------------------------------------------------------
+
+extern "C" {
+static gint
+gtk_listbox_button_press_callback( GtkWidget *widget,
+ GdkEventButton *gdk_event,
+ wxListBox *listbox )
+{
+ if (g_isIdle) wxapp_install_idle_handler();
+
+ if (g_blockEventsOnDrag) return FALSE;
+ if (g_blockEventsOnScroll) return FALSE;
+
+ if (!listbox->m_hasVMT) return FALSE;
+
+ //Just to be on the safe side - it should be unset in the activate callback
+ //but we don't want any obscure bugs if it doesn't get called somehow...
+ listbox->m_spacePressed = false;
+
+#if wxUSE_CHECKLISTBOX && !wxUSE_NATIVEGTKCHECKLIST
+ if ((listbox->m_hasCheckBoxes) && (gdk_event->x < 15) && (gdk_event->type != GDK_2BUTTON_PRESS))
+ {
+ GtkTreePath* path;
+ gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(widget),
+ (gint)gdk_event->x, (gint)gdk_event->y,
+ &path, NULL, NULL, NULL);
+ int sel = gtk_tree_path_get_indices(path)[0];
+ gtk_tree_path_free(path);
+
+ wxCheckListBox *clb = (wxCheckListBox *)listbox;
+
+ clb->Check( sel, !clb->IsChecked(sel) );
+
+ wxCommandEvent event( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, listbox->GetId() );
+ event.SetEventObject( listbox );
+ event.SetInt( sel );