+extern bool g_blockEventsOnScroll;
+
+//-----------------------------------------------------------------------------
+// "button_press_event"
+//-----------------------------------------------------------------------------
+
+static gint
+gtk_listbox_button_press_callback( GtkWidget *widget, GdkEventButton *gdk_event, wxListBox *listbox )
+{
+ if (g_blockEventsOnDrag) return FALSE;
+ if (g_blockEventsOnScroll) return FALSE;
+
+ if (!listbox->HasVMT()) return FALSE;
+
+ int sel = listbox->GetIndex( widget );
+
+ if ((listbox->m_hasCheckBoxes) && (gdk_event->x < 15) && (gdk_event->type != GDK_2BUTTON_PRESS))
+ {
+ wxCheckListBox *clb = (wxCheckListBox *)listbox;
+
+ clb->Check( sel, !clb->IsChecked(sel) );
+
+ wxCommandEvent event( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, listbox->GetId() );
+ event.SetEventObject( listbox );
+ event.SetInt( sel );
+ listbox->GetEventHandler()->ProcessEvent( event );
+ }
+
+ if (gdk_event->type == GDK_2BUTTON_PRESS)
+ {
+ wxCommandEvent event( wxEVT_COMMAND_LISTBOX_DOUBLECLICKED, listbox->GetId() );
+ event.SetEventObject( listbox );
+ event.SetInt( sel );
+ listbox->GetEventHandler()->ProcessEvent( event );
+ }
+
+ return FALSE;
+}
+
+//-----------------------------------------------------------------------------
+// "key_press_event"
+//-----------------------------------------------------------------------------
+
+static gint
+gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxListBox *listbox )
+{
+ if (g_blockEventsOnDrag) return FALSE;
+
+ if (!listbox->HasVMT()) return FALSE;
+
+ if (gdk_event->keyval != ' ') return FALSE;
+
+ int sel = listbox->GetIndex( widget );
+
+ wxCheckListBox *clb = (wxCheckListBox *)listbox;
+
+ clb->Check( sel, !clb->IsChecked(sel) );
+
+ wxCommandEvent event( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, listbox->GetId() );
+ event.SetEventObject( listbox );
+ event.SetInt( sel );
+ listbox->GetEventHandler()->ProcessEvent( event );
+
+ return FALSE;
+}