From 75bcecb363ee9c01f717f7dfc6d89db77cb8ae0d Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 4 Oct 2014 21:35:36 -0400 Subject: [PATCH] Add a label style class --- docs/reference/gtk/gtk3-sections.txt | 1 + gtk/gtklabel.c | 4 ++++ gtk/gtkstylecontext.h | 11 +++++++++++ 3 files changed, 16 insertions(+) diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt index c7d53755bf..70818e0a49 100644 --- a/docs/reference/gtk/gtk3-sections.txt +++ b/docs/reference/gtk/gtk3-sections.txt @@ -5998,6 +5998,7 @@ GTK_STYLE_CLASS_IMAGE GTK_STYLE_CLASS_INFO GTK_STYLE_CLASS_INLINE_TOOLBAR GTK_STYLE_CLASS_INSERTION_CURSOR +GTK_STYLE_CLASS_LABEL GTK_STYLE_CLASS_LEFT GTK_STYLE_CLASS_LEVEL_BAR GTK_STYLE_CLASS_LINKED diff --git a/gtk/gtklabel.c b/gtk/gtklabel.c index 08b046321d..4c6417d887 100644 --- a/gtk/gtklabel.c +++ b/gtk/gtklabel.c @@ -1298,6 +1298,7 @@ static void gtk_label_init (GtkLabel *label) { GtkLabelPrivate *priv; + GtkStyleContext *context; label->priv = gtk_label_get_instance_private (label); priv = label->priv; @@ -1334,6 +1335,9 @@ gtk_label_init (GtkLabel *label) gtk_label_set_text (label, ""); + context = gtk_widget_get_style_context (GTK_WIDGET (label)); + gtk_style_context_add_class (context, GTK_STYLE_CLASS_LABEL); + priv->drag_gesture = gtk_gesture_drag_new (GTK_WIDGET (label)); g_signal_connect (priv->drag_gesture, "drag-begin", G_CALLBACK (gtk_label_drag_gesture_begin), label); diff --git a/gtk/gtkstylecontext.h b/gtk/gtkstylecontext.h index b2a4c3e787..b1e65dd22d 100644 --- a/gtk/gtkstylecontext.h +++ b/gtk/gtkstylecontext.h @@ -176,6 +176,17 @@ struct _GtkStyleContextClass */ #define GTK_STYLE_CLASS_ENTRY "entry" +/** + * GTK_STYLE_CLASS_LABEL: + * + * A CSS class to match labels. + * + * This is used by #GtkLabel. + * + * Since: 3.16 + */ +#define GTK_STYLE_CLASS_LABEL "label" + /** * GTK_STYLE_CLASS_COMBOBOX_ENTRY: *