mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-13 04:10:13 +00:00
css: Add -gtk-icon-transform property
This property allows transforming icons and is mainly intended to be used for spinner animations.
This commit is contained in:
parent
965cd4a9c0
commit
f56ba8378b
@ -57,6 +57,7 @@
|
|||||||
#include "gtkcssrgbavalueprivate.h"
|
#include "gtkcssrgbavalueprivate.h"
|
||||||
#include "gtkcssshadowsvalueprivate.h"
|
#include "gtkcssshadowsvalueprivate.h"
|
||||||
#include "gtkcssstringvalueprivate.h"
|
#include "gtkcssstringvalueprivate.h"
|
||||||
|
#include "gtkcsstransformvalueprivate.h"
|
||||||
#include "gtkthemingengine.h"
|
#include "gtkthemingengine.h"
|
||||||
#include "gtktypebuiltins.h"
|
#include "gtktypebuiltins.h"
|
||||||
#include "gtkwin32themeprivate.h"
|
#include "gtkwin32themeprivate.h"
|
||||||
@ -576,6 +577,13 @@ shadow_value_parse (GtkCssStyleProperty *property,
|
|||||||
return _gtk_css_shadows_value_parse (parser);
|
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 *
|
static GtkCssValue *
|
||||||
border_corner_radius_value_parse (GtkCssStyleProperty *property,
|
border_corner_radius_value_parse (GtkCssStyleProperty *property,
|
||||||
GtkCssParser *parser)
|
GtkCssParser *parser)
|
||||||
@ -962,8 +970,8 @@ _gtk_css_style_property_init_properties (void)
|
|||||||
G_TYPE_NONE,
|
G_TYPE_NONE,
|
||||||
GTK_STYLE_PROPERTY_ANIMATED | GTK_STYLE_PROPERTY_NO_RESIZE,
|
GTK_STYLE_PROPERTY_ANIMATED | GTK_STYLE_PROPERTY_NO_RESIZE,
|
||||||
css_image_value_parse,
|
css_image_value_parse,
|
||||||
css_image_value_query,
|
NULL,
|
||||||
css_image_value_assign,
|
NULL,
|
||||||
_gtk_css_image_value_new (NULL));
|
_gtk_css_image_value_new (NULL));
|
||||||
gtk_css_style_property_register ("icon-shadow",
|
gtk_css_style_property_register ("icon-shadow",
|
||||||
GTK_CSS_PROPERTY_ICON_SHADOW,
|
GTK_CSS_PROPERTY_ICON_SHADOW,
|
||||||
@ -973,6 +981,14 @@ _gtk_css_style_property_init_properties (void)
|
|||||||
NULL,
|
NULL,
|
||||||
NULL,
|
NULL,
|
||||||
_gtk_css_shadows_value_new_none ());
|
_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_style_property_register ("box-shadow",
|
||||||
GTK_CSS_PROPERTY_BOX_SHADOW,
|
GTK_CSS_PROPERTY_BOX_SHADOW,
|
||||||
|
@ -82,6 +82,7 @@ enum { /*< skip >*/
|
|||||||
GTK_CSS_PROPERTY_TEXT_SHADOW,
|
GTK_CSS_PROPERTY_TEXT_SHADOW,
|
||||||
GTK_CSS_PROPERTY_ICON_SOURCE,
|
GTK_CSS_PROPERTY_ICON_SOURCE,
|
||||||
GTK_CSS_PROPERTY_ICON_SHADOW,
|
GTK_CSS_PROPERTY_ICON_SHADOW,
|
||||||
|
GTK_CSS_PROPERTY_ICON_TRANSFORM,
|
||||||
GTK_CSS_PROPERTY_BOX_SHADOW,
|
GTK_CSS_PROPERTY_BOX_SHADOW,
|
||||||
GTK_CSS_PROPERTY_MARGIN_TOP,
|
GTK_CSS_PROPERTY_MARGIN_TOP,
|
||||||
GTK_CSS_PROPERTY_MARGIN_LEFT,
|
GTK_CSS_PROPERTY_MARGIN_LEFT,
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
#include "gtkcssnumbervalueprivate.h"
|
#include "gtkcssnumbervalueprivate.h"
|
||||||
#include "gtkcssrgbavalueprivate.h"
|
#include "gtkcssrgbavalueprivate.h"
|
||||||
#include "gtkcssshadowsvalueprivate.h"
|
#include "gtkcssshadowsvalueprivate.h"
|
||||||
|
#include "gtkcsstransformvalueprivate.h"
|
||||||
#include "gtkcsstypesprivate.h"
|
#include "gtkcsstypesprivate.h"
|
||||||
#include "gtkhslaprivate.h"
|
#include "gtkhslaprivate.h"
|
||||||
#include "gtkthemingengineprivate.h"
|
#include "gtkthemingengineprivate.h"
|
||||||
@ -1037,7 +1038,14 @@ render_icon_image (GtkThemingEngine *engine,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
cairo_translate (cr, x, y);
|
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;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user