[gtk+] combobox: add a "combobox-entry" style class for comboboxes with entries
- From: Cosimo Cecchi <cosimoc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] combobox: add a "combobox-entry" style class for comboboxes with entries
- Date: Tue, 9 Aug 2011 14:14:18 +0000 (UTC)
commit 7e22b46c1f5c7cc15e18283932497760705f03a3
Author: Cosimo Cecchi <cosimoc gnome org>
Date: Tue Aug 9 15:32:21 2011 +0200
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(+), 0 deletions(-)
---
diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt
index 7992f8f..e1a8a84 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 38b064b..6986db2 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 549fbaf..d2a238c 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 dd13395..3e32c68 100644
--- a/gtk/gtkstylecontext.h
+++ b/gtk/gtkstylecontext.h
@@ -171,6 +171,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:
*
* A CSS class to match buttons.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]