From: Harco de Hilster Date: Tue, 14 Sep 1999 19:32:20 +0000 (+0000) Subject: Changed AppendCommon (called by all Append methods) so it doesn't X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/91f491639e8b7a034704a2e1cfc15129783e9b56 Changed AppendCommon (called by all Append methods) so it doesn't call ApplyWidgetStyle (which applies the current style to all list_items, which should already have the right style), but instead only applies the style to the new list_item. This results in a *great* speedup for large listboxes. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3659 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/gtk/listbox.cpp b/src/gtk/listbox.cpp index fe31b2e16d..f5f8c7a65e 100644 --- a/src/gtk/listbox.cpp +++ b/src/gtk/listbox.cpp @@ -518,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 @@ -994,4 +1001,4 @@ void wxListBox::ApplyWidgetStyle() } } -#endif \ No newline at end of file +#endif diff --git a/src/gtk1/listbox.cpp b/src/gtk1/listbox.cpp index fe31b2e16d..f5f8c7a65e 100644 --- a/src/gtk1/listbox.cpp +++ b/src/gtk1/listbox.cpp @@ -518,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 @@ -994,4 +1001,4 @@ void wxListBox::ApplyWidgetStyle() } } -#endif \ No newline at end of file +#endif