gtk_widget_realize( GTK_COMBO(m_widget)->button );
SetBackgroundColour( parent->GetBackgroundColour() );
+ SetForegroundColour( parent->GetForegroundColour() );
Show( TRUE );
GtkWidget *list_item = gtk_list_item_new_with_label( item );
- if (m_hasOwnStyle)
- {
- GtkBin *bin = GTK_BIN( list_item );
- gtk_widget_set_style( bin->child,
- gtk_style_ref(
- gtk_widget_get_style( m_widget ) ) );
- gtk_widget_set_style( GTK_WIDGET(bin),
- gtk_style_ref(
- gtk_widget_get_style( m_widget ) ) );
- }
+ if (m_widgetStyle) ApplyWidgetStyle();
gtk_signal_connect( GTK_OBJECT(list_item), "select",
GTK_SIGNAL_FUNC(gtk_combo_clicked_callback), (gpointer)this );
gtk_widget_set_usize( GTK_COMBO(m_widget)->button, w, m_height );
}
-void wxComboBox::SetFont( const wxFont &font )
+void wxComboBox::ApplyWidgetStyle()
{
- wxCHECK_RET( m_widget != NULL, "invalid combobox" );
+ SetWidgetStyle();
- wxWindow::SetFont( font );
-
- GtkWidget *entry = GTK_COMBO(m_widget)->entry;
-
- gtk_widget_set_style( entry,
- gtk_style_ref(
- gtk_widget_get_style( m_widget ) ) );
-
- GtkWidget *list = GTK_COMBO(m_widget)->list;
+ 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 );
- GList *child = GTK_LIST(list)->children;
+ GtkList *list = GTK_LIST( GTK_COMBO(m_widget)->list );
+ GList *child = list->children;
while (child)
{
- GtkBin *bin = (GtkBin*) child->data;
- gtk_widget_set_style( bin->child,
- gtk_style_ref(
- gtk_widget_get_style( m_widget ) ) );
+ gtk_widget_set_style( GTK_WIDGET(child->data), m_widgetStyle );
+
+ GtkBin *bin = GTK_BIN(child->data);
+ gtk_widget_set_style( bin->child, m_widgetStyle );
child = child->next;
}
return ( (window == GTK_ENTRY( GTK_COMBO(m_widget)->entry )->text_area) ||
(window == GTK_COMBO(m_widget)->button->window ) );
}
-
-void wxComboBox::SetBackgroundColour( const wxColour &colour )
-{
- return;
-
- wxCHECK_RET( m_widget != NULL, "invalid combobox" );
-
- m_backgroundColour = colour;
- if (!m_backgroundColour.Ok()) return;
-
- GtkStyle *style = gtk_widget_get_style( m_widget );
- if (!m_hasOwnStyle)
- {
- m_hasOwnStyle = TRUE;
- style = gtk_style_copy( gtk_widget_get_style( m_widget ) );
- }
-
- style->base[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
- style->bg[GTK_STATE_NORMAL] = *m_backgroundColour.GetColor();
-
- gtk_widget_set_style( m_widget, style );
-
- gtk_widget_set_style( GTK_COMBO(m_widget)->button, gtk_style_ref( style ) );
- gtk_widget_set_style( GTK_COMBO(m_widget)->entry, gtk_style_ref( style ) );
- gtk_widget_set_style( GTK_COMBO(m_widget)->list, gtk_style_ref( style ) );
-
- GList *child = GTK_LIST( GTK_COMBO(m_widget)->list )->children;
- while (child)
- {
- GtkWidget *item = GTK_WIDGET(child->data);
- gtk_widget_set_style( item, gtk_style_ref( style ) );
- child = child->next;
- }
-}
-