]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/combobox.cpp
1. Yet another unit test for new stirng stuff
[wxWidgets.git] / src / gtk / combobox.cpp
index acf403570b26e2d311fe1b1a4032098750122294..fc3754d399d9a3065795ff03bbb4b291e4352a7e 100644 (file)
@@ -54,18 +54,18 @@ gtk_combo_select_child_callback( GtkList *WXUNUSED(list), GtkWidget *WXUNUSED(wi
 
     int curSelection = combo->GetSelection();
 
-    if (combo->m_prevSelection != curSelection)
-    {
-        GtkWidget *list = GTK_COMBO(combo->m_widget)->list;
-        gtk_list_unselect_item( GTK_LIST(list), combo->m_prevSelection );
-    }
+    if (combo->m_prevSelection == curSelection) return;
+
+    GtkWidget *list = GTK_COMBO(combo->m_widget)->list;
+    gtk_list_unselect_item( GTK_LIST(list), combo->m_prevSelection );
+    
     combo->m_prevSelection = curSelection;
 
     wxCommandEvent event( wxEVT_COMMAND_COMBOBOX_SELECTED, combo->GetId() );
     event.SetInt( curSelection );
     event.SetString( combo->GetStringSelection() );
     event.SetEventObject( combo );
-
+    
     combo->GetEventHandler()->ProcessEvent( event );
 }
 
@@ -238,8 +238,17 @@ int wxComboBox::DoAppend( const wxString &item )
     {
         gtk_widget_realize( list_item );
         gtk_widget_realize( GTK_BIN(list_item)->child );
+    }
 
-        ApplyWidgetStyle();
+    // Apply current widget style to the new list_item
+    GtkRcStyle *style = CreateWidgetStyle();
+    if (style)
+    {
+        gtk_widget_modify_style( GTK_WIDGET( list_item ), style );
+        GtkBin *bin = GTK_BIN( list_item );
+        GtkWidget *label = GTK_WIDGET( bin->child );
+        gtk_widget_modify_style( label, style );
+        gtk_rc_style_unref( style );
     }
 
     gtk_widget_show( list_item );