]> git.saurik.com Git - wxWidgets.git/commitdiff
Added LDOWN handler for wxListBox so that it wil
authorRobert Roebling <robert@roebling.de>
Sun, 20 Feb 2005 20:39:51 +0000 (20:39 +0000)
committerRobert Roebling <robert@roebling.de>
Sun, 20 Feb 2005 20:39:51 +0000 (20:39 +0000)
   deselect a selected item if clicke upon. This is
   actually not the native GTK+ behaviour, but the
   native behaviour seems just broken.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@32268 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/listbox.cpp
src/gtk1/listbox.cpp

index a2cf2b46aa71a73a0cca0c3727ab09df57c5e78a..3865a4f20c61d5ed0cf7370f3838908e0f322c24 100644 (file)
@@ -233,6 +233,17 @@ 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)) )
+    {
+        if (listbox->IsSelected(sel))
+        {
+            gtk_list_unselect_item( GTK_LIST(listbox->m_list), sel );
+            return true;
+        }
+    }
+
     /* emit wxEVT_COMMAND_LISTBOX_DOUBLECLICKED later */
     g_hasDoubleClicked = (gdk_event->type == GDK_2BUTTON_PRESS);
 
@@ -492,7 +503,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 );
index a2cf2b46aa71a73a0cca0c3727ab09df57c5e78a..3865a4f20c61d5ed0cf7370f3838908e0f322c24 100644 (file)
@@ -233,6 +233,17 @@ 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)) )
+    {
+        if (listbox->IsSelected(sel))
+        {
+            gtk_list_unselect_item( GTK_LIST(listbox->m_list), sel );
+            return true;
+        }
+    }
+
     /* emit wxEVT_COMMAND_LISTBOX_DOUBLECLICKED later */
     g_hasDoubleClicked = (gdk_event->type == GDK_2BUTTON_PRESS);
 
@@ -492,7 +503,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 );