]> Pileus Git - ~andy/gtk/commitdiff
GtkThemingEngine: Add gtk_theming_engine_lookup_color()
authorCarlos Garnacho <carlosg@gnome.org>
Wed, 1 Dec 2010 18:19:26 +0000 (19:19 +0100)
committerCarlos Garnacho <carlosg@gnome.org>
Sat, 4 Dec 2010 14:39:53 +0000 (15:39 +0100)
It could also be handy for theme engines...

docs/reference/gtk/gtk3-sections.txt
gtk/gtkthemingengine.c
gtk/gtkthemingengine.h

index 00fa6d37646fe98d9f07e66409417e8ca073593e..8ab7fd76bf1779d3ab1543aa0ec91ec5ba92b379 100644 (file)
@@ -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
index 124ee51d860797abe95cad38f895089cda532b31..e5d9e577b36ef1eea279702ff6d181ed0e11b7bf 100644 (file)
@@ -542,6 +542,31 @@ gtk_theming_engine_get_style (GtkThemingEngine *engine,
   va_end (args);
 }
 
+/**
+ * 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
index ee443d67d1e659e83c939c0132a9d0fef0df934a..8dc862e29607b4c09450e159e168ddcb87abb90a 100644 (file)
@@ -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);