]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk1/listbox.cpp
fixes
[wxWidgets.git] / src / gtk1 / listbox.cpp
index 5651b1f97716d7420579631a81ef402e9a01726d..bca38181d53126a97ffac0e31d8735c4ae188764 100644 (file)
@@ -126,6 +126,7 @@ bool wxListBox::Create( wxWindow *parent, wxWindowID id,
   gtk_widget_realize( GTK_WIDGET(m_list) );
 
   SetBackgroundColour( parent->GetBackgroundColour() );
+  SetForegroundColour( parent->GetForegroundColour() );
 
   Show( TRUE );
 
@@ -143,12 +144,6 @@ void wxListBox::Append( const wxString &item, char *clientData )
 
   GtkWidget *list_item = gtk_list_item_new_with_label( item );
 
-  if (m_widgetStyle)
-  {
-    gtk_widget_set_style( list_item, m_widgetStyle );
-    gtk_widget_set_style( GTK_BIN( list_item )->child, m_widgetStyle );
-  }
-  
   gtk_signal_connect( GTK_OBJECT(list_item), "select",
     GTK_SIGNAL_FUNC(gtk_listitem_select_callback), (gpointer)this );
 
@@ -162,6 +157,8 @@ void wxListBox::Append( const wxString &item, char *clientData )
 
   gtk_container_add( GTK_CONTAINER(m_list), list_item );
 
+  if (m_widgetStyle) ApplyWidgetStyle();
+  
   gtk_widget_show( list_item );
 
   ConnectWidget( list_item );
@@ -466,27 +463,9 @@ bool wxListBox::IsOwnGtkWindow( GdkWindow *window )
   return FALSE;
 }
 
-void wxListBox::SetFont( const wxFont &font )
+void wxListBox::ApplyWidgetStyle()
 {
-  wxCHECK_RET( m_list != NULL, "invalid listbox" );
-  
-  wxControl::SetFont( font );
-
-  GList *child = m_list->children;
-  while (child)
-  {
-    gtk_widget_set_style( GTK_BIN(child->data)->child, m_widgetStyle );
-    child = child->next;
-  }
-}
-
-void wxListBox::SetBackgroundColour( const wxColour &colour )
-{
-  wxCHECK_RET( m_list != NULL, "invalid listbox" );
-  
-  wxControl::SetBackgroundColour( colour );
-  
-  if (!m_backgroundColour.Ok()) return;
+  SetWidgetStyle();
   
   GdkWindow *window = GTK_WIDGET(m_list)->window;
   m_backgroundColour.CalcPixel( gdk_window_get_colormap( window ) );
@@ -496,8 +475,8 @@ void wxListBox::SetBackgroundColour( const wxColour &colour )
   GList *child = m_list->children;
   while (child)
   {
+    gtk_widget_set_style( GTK_BIN(child->data)->child, m_widgetStyle );
     gtk_widget_set_style( GTK_WIDGET(child->data), m_widgetStyle );
     child = child->next;
   }
 }
-