X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/f96aa4d9eb296b3dfc468a351ce013bf92fab983..a5e13868ca700aa39bae26b8fb13c640f466d9f0:/src/gtk1/combobox.cpp?ds=sidebyside diff --git a/src/gtk1/combobox.cpp b/src/gtk1/combobox.cpp index 906f31c2e5..38e40a9642 100644 --- a/src/gtk1/combobox.cpp +++ b/src/gtk1/combobox.cpp @@ -2,7 +2,7 @@ // Name: combobox.cpp // Purpose: // Author: Robert Roebling -// Id: $id$ +// Id: $Id$ // Copyright: (c) 1998 Robert Roebling // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// @@ -104,6 +104,7 @@ bool wxComboBox::Create(wxWindow *parent, wxWindowID id, const wxString& value, gtk_widget_realize( GTK_COMBO(m_widget)->button ); SetBackgroundColour( parent->GetBackgroundColour() ); + SetForegroundColour( parent->GetForegroundColour() ); Show( TRUE ); @@ -135,16 +136,7 @@ void wxComboBox::Append( const wxString &item, char *clientData ) 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 ); @@ -443,27 +435,22 @@ void wxComboBox::OnSize( wxSizeEvent &event ) 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; } @@ -479,38 +466,3 @@ bool wxComboBox::IsOwnGtkWindow( GdkWindow *window ) 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; - } -} -