styleproperty: Add a compute vfunc
This commit is contained in:
parent
232d9226f9
commit
22a65bcd82
@ -218,10 +218,20 @@ _gtk_css_style_property_class_init (GtkCssStylePropertyClass *klass)
|
|||||||
klass->style_properties = g_ptr_array_new ();
|
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
|
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 (GTK_IS_STYLE_CONTEXT (context));
|
||||||
g_return_if_fail (G_IS_VALUE (specified));
|
g_return_if_fail (G_IS_VALUE (specified));
|
||||||
|
|
||||||
g_value_init (computed, _gtk_style_property_get_value_type (GTK_STYLE_PROPERTY (property)));
|
property->compute_value (property, computed, context, specified);
|
||||||
_gtk_css_style_compute_value (computed, context, specified);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -35,6 +35,10 @@ G_BEGIN_DECLS
|
|||||||
typedef struct _GtkCssStyleProperty GtkCssStyleProperty;
|
typedef struct _GtkCssStyleProperty GtkCssStyleProperty;
|
||||||
typedef struct _GtkCssStylePropertyClass GtkCssStylePropertyClass;
|
typedef struct _GtkCssStylePropertyClass GtkCssStylePropertyClass;
|
||||||
|
|
||||||
|
typedef void (* GtkCssStylePropertyComputeFunc)(GtkCssStyleProperty *property,
|
||||||
|
GValue *computed,
|
||||||
|
GtkStyleContext *context,
|
||||||
|
const GValue *specified);
|
||||||
struct _GtkCssStyleProperty
|
struct _GtkCssStyleProperty
|
||||||
{
|
{
|
||||||
GtkStyleProperty parent;
|
GtkStyleProperty parent;
|
||||||
@ -42,6 +46,8 @@ struct _GtkCssStyleProperty
|
|||||||
GValue initial_value;
|
GValue initial_value;
|
||||||
guint id;
|
guint id;
|
||||||
guint inherit :1;
|
guint inherit :1;
|
||||||
|
|
||||||
|
GtkCssStylePropertyComputeFunc compute_value;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GtkCssStylePropertyClass
|
struct _GtkCssStylePropertyClass
|
||||||
|
Loading…
Reference in New Issue
Block a user