[gtk+] Add convenience function for the font description.
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Add convenience function for the font description.
- Date: Mon, 13 Dec 2010 21:33:49 +0000 (UTC)
commit f285a84bd60297cfd0aef58bcd588434bb329bde
Author: Paolo Borelli <pborelli gnome org>
Date: Sun Dec 5 19:40:13 2010 +0100
Add convenience function for the font description.
docs/reference/gtk/gtk3-sections.txt | 1 +
gtk/gtkstylecontext.c | 32 ++++++++++++++++++++++++++++++++
gtk/gtkstylecontext.h | 3 +++
3 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt
index 261cf31..35fbd5e 100644
--- a/docs/reference/gtk/gtk3-sections.txt
+++ b/docs/reference/gtk/gtk3-sections.txt
@@ -5415,6 +5415,7 @@ gtk_style_context_get_border_color
gtk_style_context_get_border
gtk_style_context_get_padding
gtk_style_context_get_margin
+gtk_style_context_get_font
gtk_style_context_invalidate
gtk_style_context_state_is_running
gtk_style_context_lookup_color
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index 2aee8b2..be7f782 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -3346,6 +3346,38 @@ gtk_style_context_get_margin (GtkStyleContext *context,
*margin = *b;
}
+/**
+ * gtk_style_context_get_font:
+ * @context: a #GtkStyleContext
+ * @state: state to retrieve the font for
+ *
+ * Returns the font description for a given state. The returned
+ * object is const and will remain valid until the
+ * #GtkStyleContext::changed signal happens.
+ *
+ * Returns: the #PangoFontDescription for the given state. This
+ * object is owned by GTK+ and should not be freed.
+ *
+ * Since: 3.0
+ **/
+const PangoFontDescription *
+gtk_style_context_get_font (GtkStyleContext *context,
+ GtkStateFlags state)
+{
+ GtkStyleContextPrivate *priv;
+ StyleData *data;
+ const GValue *value;
+
+ g_return_val_if_fail (GTK_IS_STYLE_CONTEXT (context), NULL);
+
+ priv = context->priv;
+ g_return_val_if_fail (priv->widget_path != NULL, NULL);
+
+ data = style_data_lookup (context);
+ value = _gtk_style_properties_peek_property (data->store, "font", state);
+ return g_value_get_boxed (value);
+}
+
/* Paint methods */
/**
diff --git a/gtk/gtkstylecontext.h b/gtk/gtkstylecontext.h
index a67e523..f7d658a 100644
--- a/gtk/gtkstylecontext.h
+++ b/gtk/gtkstylecontext.h
@@ -439,6 +439,9 @@ void gtk_style_context_get_border_color (GtkStyleContext *context,
GtkStateFlags state,
GdkRGBA *color);
+const PangoFontDescription * gtk_style_context_get_font (GtkStyleContext *context,
+ GtkStateFlags state);
+
void gtk_style_context_get_border (GtkStyleContext *context,
GtkStateFlags state,
GtkBorder *border);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]