diff options
author | Benjamin Otte <otte@redhat.com> | 2012-04-19 14:50:38 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2012-09-17 20:39:11 +0200 |
commit | 5510bef70a91b8879d09989d6f44f73cb08e561d (patch) | |
tree | f8a246f2efe6659271bf19f15f83baf9771fa9f4 /gtk/gtkcssstylepropertyimpl.c | |
parent | 0185e323db8ff37972cfff7cea3849cb8f951b69 (diff) | |
download | gtk+-5510bef70a91b8879d09989d6f44f73cb08e561d.tar.gz |
cssstyleproperty: Add animation properties
Diffstat (limited to 'gtk/gtkcssstylepropertyimpl.c')
-rw-r--r-- | gtk/gtkcssstylepropertyimpl.c | 138 |
1 files changed, 137 insertions, 1 deletions
diff --git a/gtk/gtkcssstylepropertyimpl.c b/gtk/gtkcssstylepropertyimpl.c index a7c0af3728..82f59a237a 100644 --- a/gtk/gtkcssstylepropertyimpl.c +++ b/gtk/gtkcssstylepropertyimpl.c @@ -398,6 +398,60 @@ parse_css_area (GtkCssStyleProperty *property, } static GtkCssValue * +parse_one_css_direction (GtkCssParser *parser) +{ + GtkCssValue *value = _gtk_css_direction_value_try_parse (parser); + + if (value == NULL) + _gtk_css_parser_error (parser, "unknown value for property"); + + return value; +} + +static GtkCssValue * +parse_css_direction (GtkCssStyleProperty *property, + GtkCssParser *parser) +{ + return _gtk_css_array_value_parse (parser, parse_one_css_direction); +} + +static GtkCssValue * +parse_one_css_play_state (GtkCssParser *parser) +{ + GtkCssValue *value = _gtk_css_play_state_value_try_parse (parser); + + if (value == NULL) + _gtk_css_parser_error (parser, "unknown value for property"); + + return value; +} + +static GtkCssValue * +parse_css_play_state (GtkCssStyleProperty *property, + GtkCssParser *parser) +{ + return _gtk_css_array_value_parse (parser, parse_one_css_play_state); +} + +static GtkCssValue * +parse_one_css_fill_mode (GtkCssParser *parser) +{ + GtkCssValue *value = _gtk_css_fill_mode_value_try_parse (parser); + + if (value == NULL) + _gtk_css_parser_error (parser, "unknown value for property"); + + return value; +} + +static GtkCssValue * +parse_css_fill_mode (GtkCssStyleProperty *property, + GtkCssParser *parser) +{ + return _gtk_css_array_value_parse (parser, parse_one_css_fill_mode); +} + +static GtkCssValue * bindings_value_parse_one (GtkCssParser *parser) { char *name; @@ -695,6 +749,22 @@ transition_timing_function_parse (GtkCssStyleProperty *property, } static GtkCssValue * +iteration_count_parse_one (GtkCssParser *parser) +{ + if (_gtk_css_parser_try (parser, "infinite", TRUE)) + return _gtk_css_number_value_new (HUGE_VAL, GTK_CSS_NUMBER); + + return _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_NUMBER | GTK_CSS_POSITIVE_ONLY); +} + +static GtkCssValue * +iteration_count_parse (GtkCssStyleProperty *property, + GtkCssParser *parser) +{ + return _gtk_css_array_value_parse (parser, iteration_count_parse_one); +} + +static GtkCssValue * engine_parse (GtkCssStyleProperty *property, GtkCssParser *parser) { @@ -1105,7 +1175,7 @@ _gtk_css_style_property_init_properties (void) gtk_css_style_property_register ("background-size", GTK_CSS_PROPERTY_BACKGROUND_SIZE, G_TYPE_NONE, - 0, + GTK_STYLE_PROPERTY_ANIMATED, background_size_parse, NULL, NULL, @@ -1264,6 +1334,72 @@ _gtk_css_style_property_init_properties (void) NULL, _gtk_css_array_value_new (_gtk_css_number_value_new (0, GTK_CSS_S))); + gtk_css_style_property_register ("animation-name", + GTK_CSS_PROPERTY_ANIMATION_NAME, + G_TYPE_NONE, + 0, + transition_property_parse, + NULL, + NULL, + _gtk_css_array_value_new (_gtk_css_ident_value_new ("none"))); + gtk_css_style_property_register ("animation-duration", + GTK_CSS_PROPERTY_ANIMATION_DURATION, + G_TYPE_NONE, + 0, + transition_time_parse, + NULL, + NULL, + _gtk_css_array_value_new (_gtk_css_number_value_new (0, GTK_CSS_S))); + gtk_css_style_property_register ("animation-timing-function", + GTK_CSS_PROPERTY_ANIMATION_TIMING_FUNCTION, + G_TYPE_NONE, + 0, + transition_timing_function_parse, + NULL, + NULL, + _gtk_css_array_value_new ( + _gtk_css_ease_value_new_cubic_bezier (0.25, 0.1, 0.25, 1.0))); + gtk_css_style_property_register ("animation-iteration-count", + GTK_CSS_PROPERTY_ANIMATION_ITERATION_COUNT, + G_TYPE_NONE, + 0, + iteration_count_parse, + NULL, + NULL, + _gtk_css_array_value_new (_gtk_css_number_value_new (1, GTK_CSS_NUMBER))); + gtk_css_style_property_register ("animation-direction", + GTK_CSS_PROPERTY_ANIMATION_DIRECTION, + G_TYPE_NONE, + 0, + parse_css_direction, + NULL, + NULL, + _gtk_css_array_value_new (_gtk_css_direction_value_new (GTK_CSS_DIRECTION_NORMAL))); + gtk_css_style_property_register ("animation-play-state", + GTK_CSS_PROPERTY_ANIMATION_PLAY_STATE, + G_TYPE_NONE, + 0, + parse_css_play_state, + NULL, + NULL, + _gtk_css_array_value_new (_gtk_css_play_state_value_new (GTK_CSS_PLAY_STATE_RUNNING))); + gtk_css_style_property_register ("animation-delay", + GTK_CSS_PROPERTY_ANIMATION_DELAY, + G_TYPE_NONE, + 0, + transition_time_parse, + NULL, + NULL, + _gtk_css_array_value_new (_gtk_css_number_value_new (0, GTK_CSS_S))); + gtk_css_style_property_register ("animation-fill-mode", + GTK_CSS_PROPERTY_ANIMATION_FILL_MODE, + G_TYPE_NONE, + 0, + parse_css_fill_mode, + NULL, + NULL, + _gtk_css_array_value_new (_gtk_css_fill_mode_value_new (GTK_CSS_FILL_NONE))); + gtk_css_style_property_register ("engine", GTK_CSS_PROPERTY_ENGINE, GTK_TYPE_THEMING_ENGINE, |