diff options
author | Benjamin Otte <otte@redhat.com> | 2012-03-27 23:54:06 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2012-04-17 08:59:13 +0200 |
commit | f7c0c7677bba207722e147246df98a081d8f7bcf (patch) | |
tree | 330655af3287fc35f87ec54bff994b355aa68c05 /gtk/gtkcssstyleproperty.c | |
parent | 6ef76f4a924a241a7900542e6ef8bc6fa7a79b82 (diff) | |
download | gtk+-f7c0c7677bba207722e147246df98a081d8f7bcf.tar.gz |
cssstyleproperty: Make query func a vfunc
This will be needed soon.
Diffstat (limited to 'gtk/gtkcssstyleproperty.c')
-rw-r--r-- | gtk/gtkcssstyleproperty.c | 53 |
1 files changed, 5 insertions, 48 deletions
diff --git a/gtk/gtkcssstyleproperty.c b/gtk/gtkcssstyleproperty.c index 6921b08343..338f2562b7 100644 --- a/gtk/gtkcssstyleproperty.c +++ b/gtk/gtkcssstyleproperty.c @@ -29,11 +29,6 @@ #include "gtkprivatetypebuiltins.h" #include "gtkstylepropertiesprivate.h" -#include <math.h> -#include <cairo-gobject.h> -#include "gtkcssimagegradientprivate.h" -#include "gtkcssimageprivate.h" - /* this is in case round() is not provided by the compiler, * such as in the case of C89 compilers, like MSVC */ @@ -128,52 +123,14 @@ _gtk_css_style_property_query (GtkStyleProperty *property, GtkStyleQueryFunc query_func, gpointer query_data) { + GtkCssStyleProperty *style_property = GTK_CSS_STYLE_PROPERTY (property); GtkCssValue *css_value; css_value = (* query_func) (GTK_CSS_STYLE_PROPERTY (property)->id, query_data); - if (css_value) - { - /* Somebody make this a vfunc */ - if (_gtk_css_value_holds (css_value, GTK_TYPE_CSS_IMAGE)) - { - GtkCssImage *image = _gtk_css_value_get_image (css_value); - cairo_pattern_t *pattern; - cairo_surface_t *surface; - cairo_matrix_t matrix; - - g_value_init (value, CAIRO_GOBJECT_TYPE_PATTERN); - - if (GTK_IS_CSS_IMAGE_GRADIENT (image)) - g_value_set_boxed (value, GTK_CSS_IMAGE_GRADIENT (image)->pattern); - else if (image != NULL) - { - double width, height; - - /* the 100, 100 is rather random */ - _gtk_css_image_get_concrete_size (image, 0, 0, 100, 100, &width, &height); - surface = _gtk_css_image_get_surface (image, NULL, width, height); - pattern = cairo_pattern_create_for_surface (surface); - cairo_matrix_init_scale (&matrix, width, height); - cairo_pattern_set_matrix (pattern, &matrix); - cairo_surface_destroy (surface); - g_value_take_boxed (value, pattern); - } - } - else if (_gtk_css_value_holds (css_value, GTK_TYPE_CSS_NUMBER)) - { - g_value_init (value, G_TYPE_INT); - g_value_set_int (value, round (_gtk_css_number_get (_gtk_css_value_get_number (css_value), 100))); - } - else - { - _gtk_css_value_init_gvalue (css_value, value); - } - } - else - { - _gtk_css_value_init_gvalue (_gtk_css_style_property_get_initial_value (GTK_CSS_STYLE_PROPERTY (property)), - value); - } + if (css_value == NULL) + css_value =_gtk_css_style_property_get_initial_value (style_property); + + style_property->query_value (style_property, css_value, value); } static GtkCssValue * |