GTK Combobox and Listbox aren't realized until actually
visible, so a list_item created before that would receive a default style instead of the control's style. Instead of calling ApplyWidgetStyle() which would iterate all items, only the newly created item will receive the current style to speed things up. Thanks to Andreas Pflug. Closes 984861 git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29032 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
parent
1f6967c2dd
commit
631a05be91
@ -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 );
|
||||
|
@ -578,21 +578,21 @@ void wxListBox::GtkAddItem( const wxString &item, int pos )
|
||||
gtk_widget_realize( list_item );
|
||||
gtk_widget_realize( GTK_BIN(list_item)->child );
|
||||
|
||||
// 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 );
|
||||
}
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
if (m_tooltip) m_tooltip->Apply( this );
|
||||
#endif
|
||||
}
|
||||
|
||||
// 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 );
|
||||
}
|
||||
}
|
||||
|
||||
void wxListBox::DoSetItems( const wxArrayString& items,
|
||||
|
@ -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 );
|
||||
|
@ -578,21 +578,21 @@ void wxListBox::GtkAddItem( const wxString &item, int pos )
|
||||
gtk_widget_realize( list_item );
|
||||
gtk_widget_realize( GTK_BIN(list_item)->child );
|
||||
|
||||
// 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 );
|
||||
}
|
||||
|
||||
#if wxUSE_TOOLTIPS
|
||||
if (m_tooltip) m_tooltip->Apply( this );
|
||||
#endif
|
||||
}
|
||||
|
||||
// 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 );
|
||||
}
|
||||
}
|
||||
|
||||
void wxListBox::DoSetItems( const wxArrayString& items,
|
||||
|
Loading…
Reference in New Issue
Block a user