X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/abdeb9e7006488bf917d90048fcd0cbe22f44a71..cb719f2e29bd20effa3259d2d7dead9fd857442c:/src/gtk/combobox.cpp?ds=inline diff --git a/src/gtk/combobox.cpp b/src/gtk/combobox.cpp index 2972a0a998..557d3e1b5d 100644 --- a/src/gtk/combobox.cpp +++ b/src/gtk/combobox.cpp @@ -238,8 +238,17 @@ int wxComboBox::DoAppend( const wxString &item ) { gtk_widget_realize( list_item ); gtk_widget_realize( GTK_BIN(list_item)->child ); + } - if (m_widgetStyle) 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 ); @@ -284,8 +293,7 @@ int wxComboBox::DoInsert( const wxString &item, int pos ) gtk_widget_realize( list_item ); gtk_widget_realize( GTK_BIN(list_item)->child ); - if (m_widgetStyle) - ApplyWidgetStyle(); + ApplyWidgetStyle(); } gtk_widget_show( list_item ); @@ -722,22 +730,20 @@ void wxComboBox::OnSize( wxSizeEvent &event ) #endif // 0 } -void wxComboBox::ApplyWidgetStyle() +void wxComboBox::DoApplyWidgetStyle(GtkRcStyle *style) { - SetWidgetStyle(); - -// gtk_widget_set_style( GTK_COMBO(m_widget)->button, m_widgetStyle ); - gtk_widget_set_style( GTK_COMBO(m_widget)->entry, m_widgetStyle ); - gtk_widget_set_style( GTK_COMBO(m_widget)->list, m_widgetStyle ); +// gtk_widget_modify_style( GTK_COMBO(m_widget)->button, syle ); + gtk_widget_modify_style( GTK_COMBO(m_widget)->entry, style ); + gtk_widget_modify_style( GTK_COMBO(m_widget)->list, style ); GtkList *list = GTK_LIST( GTK_COMBO(m_widget)->list ); GList *child = list->children; while (child) { - gtk_widget_set_style( GTK_WIDGET(child->data), m_widgetStyle ); + gtk_widget_modify_style( GTK_WIDGET(child->data), style ); GtkBin *bin = GTK_BIN(child->data); - gtk_widget_set_style( bin->child, m_widgetStyle ); + gtk_widget_modify_style( bin->child, style ); child = child->next; } @@ -776,7 +782,16 @@ wxSize wxComboBox::DoGetBestSize() const // empty combobox should have some reasonable default size too if ( ret.x < 100 ) ret.x = 100; + + CacheBestSize(ret); return ret; } +// static +wxVisualAttributes +wxComboBox::GetClassDefaultAttributes(wxWindowVariant WXUNUSED(variant)) +{ + return GetDefaultAttributesFromGTKWidget(gtk_combo_new, true); +} + #endif