From 1a3d964615d67ac61be35cad25c59bc0ac6b2422 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Sun, 7 Mar 2010 01:22:38 +0100 Subject: [PATCH] GtkStyleContext: Add methods to query composed style. --- gtk/gtkstylecontext.c | 49 +++++++++++++++++++++++++++++++++++++++++++ gtk/gtkstylecontext.h | 11 ++++++++++ 2 files changed, 60 insertions(+) diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c index 0a84cda563..b5c1f075d5 100644 --- a/gtk/gtkstylecontext.c +++ b/gtk/gtkstylecontext.c @@ -221,5 +221,54 @@ gtk_style_context_remove_provider (GtkStyleContext *context, rebuild_properties (context); } +void +gtk_style_context_get_property (GtkStyleContext *context, + const gchar *property, + GtkStateType state, + GValue *value) +{ + GtkStyleContextPrivate *priv; + + g_return_if_fail (GTK_IS_STYLE_CONTEXT (context)); + g_return_if_fail (property != NULL); + g_return_if_fail (state < GTK_STATE_LAST); + g_return_if_fail (value != NULL); + + priv = GTK_STYLE_CONTEXT_GET_PRIVATE (context); + gtk_style_set_get_property (priv->store, property, state, value); +} + +void +gtk_style_context_get_valist (GtkStyleContext *context, + GtkStateType state, + va_list args) +{ + GtkStyleContextPrivate *priv; + + g_return_if_fail (GTK_IS_STYLE_CONTEXT (context)); + g_return_if_fail (state < GTK_STATE_LAST); + + priv = GTK_STYLE_CONTEXT_GET_PRIVATE (context); + gtk_style_set_get_valist (priv->store, state, args); +} + +void +gtk_style_context_get (GtkStyleContext *context, + GtkStateType state, + ...) +{ + GtkStyleContextPrivate *priv; + va_list args; + + g_return_if_fail (GTK_IS_STYLE_CONTEXT (context)); + g_return_if_fail (state < GTK_STATE_LAST); + + priv = GTK_STYLE_CONTEXT_GET_PRIVATE (context); + + va_start (args, state); + gtk_style_context_get_valist (priv->store, state, args); + va_end (args); +} + #define __GTK_STYLE_CONTEXT_C__ #include "gtkaliasdef.c" diff --git a/gtk/gtkstylecontext.h b/gtk/gtkstylecontext.h index 1ded64e6ee..37d4f15e4f 100644 --- a/gtk/gtkstylecontext.h +++ b/gtk/gtkstylecontext.h @@ -54,6 +54,17 @@ void gtk_style_context_add_provider (GtkStyleContext *context, void gtk_style_context_remove_provider (GtkStyleContext *context, GtkStyleProvider *provider); +void gtk_style_context_get_property (GtkStyleContext *context, + const gchar *property, + GtkStateType state, + GValue *value); +void gtk_style_context_get_valist (GtkStyleContext *context, + GtkStateType state, + va_list args); +void gtk_style_context_get (GtkStyleContext *context, + GtkStateType state, + ...) G_GNUC_NULL_TERMINATED; + G_END_DECLS #endif /* __GTK_STYLE_CONTEXT_H__ */