[gtk+/wip/css: 6/15] cssstyleproperty: Add animation properties
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/css: 6/15] cssstyleproperty: Add animation properties
- Date: Fri, 18 May 2012 15:52:17 +0000 (UTC)
commit 82b1f7b13105ff85c26927551e7c110fddf8ea69
Author: Benjamin Otte <otte redhat com>
Date: Thu Apr 19 14:50:38 2012 +0200
cssstyleproperty: Add animation properties
gtk/gtkcssstylepropertyimpl.c | 152 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 152 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkcssstylepropertyimpl.c b/gtk/gtkcssstylepropertyimpl.c
index 0a642f0..6602863 100644
--- a/gtk/gtkcssstylepropertyimpl.c
+++ b/gtk/gtkcssstylepropertyimpl.c
@@ -424,6 +424,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, FALSE);
+}
+
+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, FALSE);
+}
+
+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, FALSE);
+}
+
+static GtkCssValue *
bindings_value_parse_one (GtkCssParser *parser)
{
char *name;
@@ -742,6 +796,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, FALSE);
+}
+
+static GtkCssValue *
engine_parse (GtkCssStyleProperty *property,
GtkCssParser *parser)
{
@@ -1460,6 +1530,88 @@ _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,
+ 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,
+ 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,
+ 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,
+ 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,
+ 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,
+ 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,
+ 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,
+ 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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]