[gtk+/wip/css: 97/154] styleproperty: Add a compute vfunc



commit 933f917e8f4b86006f7f815b3621bff955ec8527
Author: Benjamin Otte <otte redhat com>
Date:   Mon Jan 2 17:50:32 2012 +0100

    styleproperty: Add a compute vfunc

 gtk/gtkcssstyleproperty.c        |   15 ++++++++++++---
 gtk/gtkcssstylepropertyprivate.h |    6 ++++++
 2 files changed, 18 insertions(+), 3 deletions(-)
---
diff --git a/gtk/gtkcssstyleproperty.c b/gtk/gtkcssstyleproperty.c
index 2f54244..e358077 100644
--- a/gtk/gtkcssstyleproperty.c
+++ b/gtk/gtkcssstyleproperty.c
@@ -218,10 +218,20 @@ _gtk_css_style_property_class_init (GtkCssStylePropertyClass *klass)
   klass->style_properties = g_ptr_array_new ();
 }
 
+static void
+gtk_css_style_property_real_compute_value (GtkCssStyleProperty *property,
+                                           GValue              *computed,
+                                           GtkStyleContext     *context,
+                                           const GValue        *specified)
+{
+  g_value_init (computed, _gtk_style_property_get_value_type (GTK_STYLE_PROPERTY (property)));
+  _gtk_css_style_compute_value (computed, context, specified);
+}
 
 static void
-_gtk_css_style_property_init (GtkCssStyleProperty *style_property)
+_gtk_css_style_property_init (GtkCssStyleProperty *property)
 {
+  property->compute_value = gtk_css_style_property_real_compute_value;
 }
 
 /**
@@ -338,8 +348,7 @@ _gtk_css_style_property_compute_value (GtkCssStyleProperty *property,
   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
   g_return_if_fail (G_IS_VALUE (specified));
 
-  g_value_init (computed, _gtk_style_property_get_value_type (GTK_STYLE_PROPERTY (property)));
-  _gtk_css_style_compute_value (computed, context, specified);
+  property->compute_value (property, computed, context, specified);
 }
 
 /**
diff --git a/gtk/gtkcssstylepropertyprivate.h b/gtk/gtkcssstylepropertyprivate.h
index c02a766..a8f6dce 100644
--- a/gtk/gtkcssstylepropertyprivate.h
+++ b/gtk/gtkcssstylepropertyprivate.h
@@ -35,6 +35,10 @@ G_BEGIN_DECLS
 typedef struct _GtkCssStyleProperty           GtkCssStyleProperty;
 typedef struct _GtkCssStylePropertyClass      GtkCssStylePropertyClass;
 
+typedef void             (* GtkCssStylePropertyComputeFunc)(GtkCssStyleProperty    *property,
+                                                            GValue                 *computed,
+                                                            GtkStyleContext        *context,
+                                                            const GValue           *specified);
 struct _GtkCssStyleProperty
 {
   GtkStyleProperty parent;
@@ -42,6 +46,8 @@ struct _GtkCssStyleProperty
   GValue initial_value;
   guint id;
   guint inherit :1;
+
+  GtkCssStylePropertyComputeFunc compute_value;
 };
 
 struct _GtkCssStylePropertyClass



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