- if (g_blockEventsOnDrag)
- return FALSE;
-
- bool ret = FALSE;
-
- if ((gdk_event->keyval == GDK_Tab) || (gdk_event->keyval == GDK_ISO_Left_Tab))
- {
- wxNavigationKeyEvent new_event;
- /* GDK reports GDK_ISO_Left_Tab for SHIFT-TAB */
- new_event.SetDirection( (gdk_event->keyval == GDK_Tab) );
- /* CTRL-TAB changes the (parent) window, i.e. switch notebook page */
- new_event.SetWindowChange( (gdk_event->state & GDK_CONTROL_MASK) );
- new_event.SetCurrentFocus( listbox );
- ret = listbox->GetEventHandler()->ProcessEvent( new_event );
- }
-
- if ((gdk_event->keyval == GDK_Return) && (!ret))
- {
- // eat return in all modes
- ret = TRUE;
- }
-
-#if wxUSE_CHECKLISTBOX
- if ((gdk_event->keyval == ' ') && (listbox->m_hasCheckBoxes) && (!ret))
- {
- int sel = listbox->GtkGetIndex( widget );
-
- wxCheckListBox *clb = (wxCheckListBox *)listbox;
-
- clb->Check( sel, !clb->IsChecked(sel) );
-
- wxCommandEvent new_event( wxEVT_COMMAND_CHECKLISTBOX_TOGGLED, listbox->GetId() );
- new_event.SetEventObject( listbox );
- new_event.SetInt( sel );
- ret = listbox->GetEventHandler()->ProcessEvent( new_event );
- }
-#endif // wxUSE_CHECKLISTBOX
-
- // Check or uncheck item with SPACE
- if ((gdk_event->keyval == ' ') && (!ret) &&
- (((listbox->GetWindowStyleFlag() & wxLB_MULTIPLE) != 0) ||
- ((listbox->GetWindowStyleFlag() & wxLB_EXTENDED) != 0)) )
- {
- int sel = listbox->GtkGetIndex( widget );
-
- if (sel != -1)
- {
- ret = TRUE;
-
- if (listbox->IsSelected( sel ))
- gtk_list_unselect_item( listbox->m_list, sel );
- else
- gtk_list_select_item( listbox->m_list, sel );
-
- wxCommandEvent new_event(wxEVT_COMMAND_LISTBOX_SELECTED, listbox->GetId() );
- new_event.SetEventObject( listbox );
- wxArrayInt aSelections;
- int n, count = listbox->GetSelections(aSelections);
- if ( count > 0 )
- {
- n = aSelections[0];
- if ( listbox->HasClientObjectData() )
- new_event.SetClientObject( listbox->GetClientObject(n) );
- else if ( listbox->HasClientUntypedData() )
- new_event.SetClientData( listbox->GetClientData(n) );
- new_event.SetString( listbox->GetString(n) );
- }
- else
- {
- n = -1;
- }
- new_event.m_commandInt = n;
- listbox->GetEventHandler()->ProcessEvent( new_event );
- }
- }
-
- if (ret)
- {
- gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_press_event" );
- return TRUE;
- }