+// "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 );
+
+ wxArrayInt aSelections;
+ int count = listbox->GetSelections(aSelections);
+ if ( count > 0 )
+ {
+ event.m_commandInt = aSelections[0] ;
+ event.m_clientData = listbox->GetClientData( event.m_commandInt );
+ wxString str(listbox->GetString(event.m_commandInt));
+ if (str != "") event.m_commandString = copystring((char *)(const char *)str);
+ }
+ else
+ {
+ event.m_commandInt = -1 ;
+ event.m_commandString = copystring("") ;
+ }
+
+ listbox->GetEventHandler()->ProcessEvent( event );
+
+ if (event.m_commandString) delete[] event.m_commandString ;
+ }
+
+ 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;
+}
+
+//-----------------------------------------------------------------------------
+// "select" and "deselect"