[gtk+] GtkThemingEngine: Add gtk_theming_engine_lookup_color()



commit afeac82fbdcd169ed06990b3959ca8508551f121
Author: Carlos Garnacho <carlosg gnome org>
Date:   Wed Dec 1 19:19:26 2010 +0100

    GtkThemingEngine: Add gtk_theming_engine_lookup_color()
    
    It could also be handy for theme engines...

 docs/reference/gtk/gtk3-sections.txt |    1 +
 gtk/gtkthemingengine.c               |   25 +++++++++++++++++++++++++
 gtk/gtkthemingengine.h               |    3 +++
 3 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/docs/reference/gtk/gtk3-sections.txt b/docs/reference/gtk/gtk3-sections.txt
index 00fa6d3..8ab7fd7 100644
--- a/docs/reference/gtk/gtk3-sections.txt
+++ b/docs/reference/gtk/gtk3-sections.txt
@@ -5507,6 +5507,7 @@ gtk_theming_engine_get_style_valist
 gtk_theming_engine_get_valist
 gtk_theming_engine_has_class
 gtk_theming_engine_has_region
+gtk_theming_engine_lookup_color
 gtk_theming_engine_state_is_running
 gtk_theming_engine_load
 gtk_theming_engine_register_property
diff --git a/gtk/gtkthemingengine.c b/gtk/gtkthemingengine.c
index 124ee51..e5d9e57 100644
--- a/gtk/gtkthemingengine.c
+++ b/gtk/gtkthemingengine.c
@@ -543,6 +543,31 @@ gtk_theming_engine_get_style (GtkThemingEngine *engine,
 }
 
 /**
+ * gtk_theming_engine_lookup_color:
+ * @engine: a #GtkThemingEngine
+ * @color_name: color name to lookup
+ * @color: (out) (transfer full): Return location for the looked up color
+ *
+ * Looks up and resolves a color name in the current style's color map.
+ * The returned color must be freed with gdk_rgba_free().
+ *
+ * Returns: %TRUE if @color_name was found and resolved, %FALSE otherwise
+ **/
+gboolean
+gtk_theming_engine_lookup_color (GtkThemingEngine  *engine,
+                                 const gchar       *color_name,
+                                 GdkRGBA          **color)
+{
+  GtkThemingEnginePrivate *priv;
+
+  g_return_val_if_fail (GTK_IS_THEMING_ENGINE (engine), FALSE);
+  g_return_val_if_fail (color_name != NULL, FALSE);
+
+  priv = engine->priv;
+  return gtk_style_context_lookup_color (priv->context, color_name, color);
+}
+
+/**
  * gtk_theming_engine_get_state:
  * @engine: a #GtkThemingEngine
  *
diff --git a/gtk/gtkthemingengine.h b/gtk/gtkthemingengine.h
index ee443d6..8dc862e 100644
--- a/gtk/gtkthemingengine.h
+++ b/gtk/gtkthemingengine.h
@@ -194,6 +194,9 @@ void gtk_theming_engine_get_style_valist   (GtkThemingEngine *engine,
 void gtk_theming_engine_get_style          (GtkThemingEngine *engine,
                                             ...);
 
+gboolean gtk_theming_engine_lookup_color (GtkThemingEngine  *engine,
+                                          const gchar       *color_name,
+                                          GdkRGBA          **color);
 
 G_CONST_RETURN GtkWidgetPath * gtk_theming_engine_get_path (GtkThemingEngine *engine);
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]