-
- 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.SetInt(n);
- listbox->GetEventHandler()->ProcessEvent( new_event );
- }
- }
-
- if (ret)
- {
- gtk_signal_emit_stop_by_name( GTK_OBJECT(widget), "key_press_event" );
- return TRUE;
- }
-
- return FALSE;