X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f2e935373d8eaba9a784b2aa64486c7f037562f7..7b0d5c59ebe9299ee312f4f1adb48189137575e1:/src/gtk1/listbox.cpp diff --git a/src/gtk1/listbox.cpp b/src/gtk1/listbox.cpp index 5ad87b3027..b522fd7a88 100644 --- a/src/gtk1/listbox.cpp +++ b/src/gtk1/listbox.cpp @@ -233,6 +233,22 @@ gtk_listbox_button_press_callback( GtkWidget *widget, } #endif // wxUSE_CHECKLISTBOX + if ((gdk_event->state == 0) && + (((listbox->GetWindowStyleFlag() & wxLB_MULTIPLE) != 0) || + ((listbox->GetWindowStyleFlag() & wxLB_EXTENDED) != 0)) ) + { + listbox->m_blockEvent = TRUE; + + int i; + for (i = 0; i < (int)listbox->GetCount(); i++) + if (i != sel) + gtk_list_unselect_item( GTK_LIST(listbox->m_list), i ); + + listbox->m_blockEvent = FALSE; + + return false; + } + /* emit wxEVT_COMMAND_LISTBOX_DOUBLECLICKED later */ g_hasDoubleClicked = (gdk_event->type == GDK_2BUTTON_PRESS); @@ -492,7 +508,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id, { // if style was 0 set single mode m_windowStyle |= wxLB_SINGLE; - mode = GTK_SELECTION_MULTIPLE; + mode = GTK_SELECTION_SINGLE; } gtk_list_set_selection_mode( GTK_LIST(m_list), mode ); @@ -1006,7 +1022,7 @@ bool wxListBox::IsSelected( int n ) const return (GTK_WIDGET(target->data)->state == GTK_STATE_SELECTED) ; } -void wxListBox::SetSelection( int n, bool select ) +void wxListBox::DoSetSelection( int n, bool select ) { wxCHECK_RET( m_list != NULL, wxT("invalid listbox") );