From 7e22b46c1f5c7cc15e18283932497760705f03a3 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Tue, 9 Aug 2011 15:32:21 +0200 Subject: [PATCH] combobox: add a "combobox-entry" style class for comboboxes with entries This way themes can use GtkComboBox.combobox-entry to match that specific case, and GtkComboBox.combobox-entry .button to match the button/arrow side of the widget. --- docs/reference/gtk/gtk3-sections.txt | 1 + gtk/gtkcombobox.c | 4 ++++ gtk/gtkstylecontext.c | 1 + gtk/gtkstylecontext.h | 9 +++++++++ 4 files changed, 15 insertions(+) diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt index 7992f8faed..e1a8a84847 100644 --- a/docs/reference/gtk/gtk3-sections.txt +++ b/docs/reference/gtk/gtk3-sections.txt @@ -5530,6 +5530,7 @@ GTK_STYLE_CLASS_BACKGROUND GTK_STYLE_CLASS_BUTTON GTK_STYLE_CLASS_CALENDAR GTK_STYLE_CLASS_CELL +GTK_STYLE_CLASS_COMBOBOX_ENTRY GTK_STYLE_CLASS_CHECK GTK_STYLE_CLASS_DEFAULT GTK_STYLE_CLASS_ENTRY diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index 38b064bc8f..6986db25d8 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -4591,11 +4591,15 @@ gtk_combo_box_constructor (GType type, if (priv->has_entry) { GtkWidget *entry; + GtkStyleContext *context; entry = gtk_entry_new (); gtk_widget_show (entry); gtk_container_add (GTK_CONTAINER (combo_box), entry); + context = gtk_widget_get_style_context (GTK_WIDGET (combo_box)); + gtk_style_context_add_class (context, GTK_STYLE_CLASS_COMBOBOX_ENTRY); + priv->text_renderer = gtk_cell_renderer_text_new (); gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo_box), priv->text_renderer, TRUE); diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c index 549fbaf411..d2a238cba9 100644 --- a/gtk/gtkstylecontext.c +++ b/gtk/gtkstylecontext.c @@ -181,6 +181,7 @@ * #GTK_STYLE_CLASS_CELL, * #GTK_STYLE_CLASS_ENTRY, * #GTK_STYLE_CLASS_BUTTON, + * #GTK_STYLE_CLASS_COMBOBOX_ENTRY, * #GTK_STYLE_CLASS_CALENDAR, * #GTK_STYLE_CLASS_SLIDER, * #GTK_STYLE_CLASS_BACKGROUND, diff --git a/gtk/gtkstylecontext.h b/gtk/gtkstylecontext.h index dd1339508c..3e32c683cb 100644 --- a/gtk/gtkstylecontext.h +++ b/gtk/gtkstylecontext.h @@ -170,6 +170,15 @@ struct _GtkStyleContextClass */ #define GTK_STYLE_CLASS_ENTRY "entry" +/** + * GTK_STYLE_CLASS_COMBOBOX_ENTRY: + * + * A CSS class to match combobox entries. + * + * This is used by #GtkComboBox. + */ +#define GTK_STYLE_CLASS_COMBOBOX_ENTRY "combobox-entry" + /** * GTK_STYLE_CLASS_BUTTON: *