]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/listbox.cpp
corrected the bad patch
[wxWidgets.git] / src / gtk1 / listbox.cpp
index d99c53a4b5cab006589c7f58b69f957267d4acff..f5f8c7a65e5b21cce99ddabc1632c8cf61756e08 100644 (file)
@@ -193,6 +193,13 @@ gtk_listbox_key_press_callback( GtkWidget *widget, GdkEventKey *gdk_event, wxLis
 // "select" and "deselect"
 //-----------------------------------------------------------------------------
 
+static void gtk_listitem_select_callback( GtkWidget *WXUNUSED(widget), wxListBox *listbox );
+
+static void gtk_listitem_deselect_callback( GtkWidget *widget, wxListBox *listbox )
+{
+    gtk_listitem_select_callback( widget, listbox );
+}
+
 static void gtk_listitem_select_callback( GtkWidget *WXUNUSED(widget), wxListBox *listbox )
 {
     if (g_isIdle) wxapp_install_idle_handler();
@@ -310,7 +317,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
 
         if (style & wxLB_MULTIPLE)
             gtk_signal_connect( GTK_OBJECT(list_item), "deselect",
-              GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
+              GTK_SIGNAL_FUNC(gtk_listitem_deselect_callback), (gpointer)this );
 
         gtk_signal_connect( GTK_OBJECT(list_item),
                             "button_press_event",
@@ -480,7 +487,7 @@ void wxListBox::AppendCommon( const wxString &item )
 
     if (HasFlag(wxLB_MULTIPLE))
         gtk_signal_connect( GTK_OBJECT(list_item), "deselect",
-          GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
+          GTK_SIGNAL_FUNC(gtk_listitem_deselect_callback), (gpointer)this );
 
     gtk_signal_connect( GTK_OBJECT(list_item),
                         "button_press_event",
@@ -511,7 +518,14 @@ void wxListBox::AppendCommon( const wxString &item )
         gtk_widget_realize( list_item );
         gtk_widget_realize( GTK_BIN(list_item)->child );
        
-        if (m_widgetStyle) ApplyWidgetStyle();
+        //if (m_widgetStyle) ApplyWidgetStyle();
+        if (m_widgetStyle) {
+            // Apply current widget style to the new list_item
+            gtk_widget_set_style( GTK_WIDGET( list_item ), m_widgetStyle );
+            GtkBin *bin = GTK_BIN( list_item );
+            GtkWidget *label = GTK_WIDGET( bin->child );
+            gtk_widget_set_style( label, m_widgetStyle );
+        }
 
 #if wxUSE_DRAG_AND_DROP
 #ifndef NEW_GTK_DND_CODE
@@ -917,7 +931,7 @@ void wxListBox::DisableEvents()
 
         if (HasFlag(wxLB_MULTIPLE))
             gtk_signal_disconnect_by_func( GTK_OBJECT(child->data),
-              GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
+              GTK_SIGNAL_FUNC(gtk_listitem_deselect_callback), (gpointer)this );
 
         child = child->next;
     }
@@ -933,7 +947,7 @@ void wxListBox::EnableEvents()
 
         if (HasFlag(wxLB_MULTIPLE))
             gtk_signal_connect( GTK_OBJECT(child->data), "deselect",
-              GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
+              GTK_SIGNAL_FUNC(gtk_listitem_deselect_callback), (gpointer)this );
          
         child = child->next;
     }
@@ -987,4 +1001,4 @@ void wxListBox::ApplyWidgetStyle()
     }
 }
 
-#endif
\ No newline at end of file
+#endif