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:
Ron Lee 2004-09-05 10:08:19 +00:00
parent 1f6967c2dd
commit 631a05be91
4 changed files with 42 additions and 24 deletions

View File

@ -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 );

View File

@ -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,

View File

@ -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 );

View File

@ -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,