Commit f56ba837 authored by Benjamin Otte's avatar Benjamin Otte

css: Add -gtk-icon-transform property

This property allows transforming icons and is mainly intended to be
used for spinner animations.
parent 965cd4a9
......@@ -57,6 +57,7 @@
#include "gtkcssrgbavalueprivate.h"
#include "gtkcssshadowsvalueprivate.h"
#include "gtkcssstringvalueprivate.h"
#include "gtkcsstransformvalueprivate.h"
#include "gtkthemingengine.h"
#include "gtktypebuiltins.h"
#include "gtkwin32themeprivate.h"
......@@ -576,6 +577,13 @@ shadow_value_parse (GtkCssStyleProperty *property,
return _gtk_css_shadows_value_parse (parser);
}
static GtkCssValue *
transform_value_parse (GtkCssStyleProperty *property,
GtkCssParser *parser)
{
return _gtk_css_transform_value_parse (parser);
}
static GtkCssValue *
border_corner_radius_value_parse (GtkCssStyleProperty *property,
GtkCssParser *parser)
......@@ -962,8 +970,8 @@ _gtk_css_style_property_init_properties (void)
G_TYPE_NONE,
GTK_STYLE_PROPERTY_ANIMATED | GTK_STYLE_PROPERTY_NO_RESIZE,
css_image_value_parse,
css_image_value_query,
css_image_value_assign,
NULL,
NULL,
_gtk_css_image_value_new (NULL));
gtk_css_style_property_register ("icon-shadow",
GTK_CSS_PROPERTY_ICON_SHADOW,
......@@ -973,6 +981,14 @@ _gtk_css_style_property_init_properties (void)
NULL,
NULL,
_gtk_css_shadows_value_new_none ());
gtk_css_style_property_register ("-gtk-icon-transform",
GTK_CSS_PROPERTY_ICON_TRANSFORM,
G_TYPE_NONE,
GTK_STYLE_PROPERTY_ANIMATED | GTK_STYLE_PROPERTY_NO_RESIZE,
transform_value_parse,
NULL,
NULL,
_gtk_css_transform_value_new_none ());
gtk_css_style_property_register ("box-shadow",
GTK_CSS_PROPERTY_BOX_SHADOW,
......
......@@ -82,6 +82,7 @@ enum { /*< skip >*/
GTK_CSS_PROPERTY_TEXT_SHADOW,
GTK_CSS_PROPERTY_ICON_SOURCE,
GTK_CSS_PROPERTY_ICON_SHADOW,
GTK_CSS_PROPERTY_ICON_TRANSFORM,
GTK_CSS_PROPERTY_BOX_SHADOW,
GTK_CSS_PROPERTY_MARGIN_TOP,
GTK_CSS_PROPERTY_MARGIN_LEFT,
......
......@@ -35,6 +35,7 @@
#include "gtkcssnumbervalueprivate.h"
#include "gtkcssrgbavalueprivate.h"
#include "gtkcssshadowsvalueprivate.h"
#include "gtkcsstransformvalueprivate.h"
#include "gtkcsstypesprivate.h"
#include "gtkhslaprivate.h"
#include "gtkthemingengineprivate.h"
......@@ -1037,7 +1038,14 @@ render_icon_image (GtkThemingEngine *engine,
return FALSE;
cairo_translate (cr, x, y);
_gtk_css_image_draw (image, cr, width, height);
cairo_translate (cr, width / 2, height / 2);
if (_gtk_css_transform_value_apply (_gtk_theming_engine_peek_property (engine, GTK_CSS_PROPERTY_ICON_TRANSFORM), cr))
{
cairo_translate (cr, -width / 2, -height / 2);
_gtk_css_image_draw (image, cr, width, height);
}
return TRUE;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment