[gtk+/wip/css: 5/16] cssvalue: Add animation enum properties
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/css: 5/16] cssvalue: Add animation enum properties
- Date: Wed, 23 May 2012 16:20:16 +0000 (UTC)
commit 6a21fb5b7a495cb35b61643503ef574cce3fec2e
Author: Benjamin Otte <otte redhat com>
Date: Thu Apr 19 14:50:05 2012 +0200
cssvalue: Add animation enum properties
gtk/gtkcssenumvalue.c | 160 ++++++++++++++++++++++++++++++++++++++++++
gtk/gtkcssenumvalueprivate.h | 12 +++
gtk/gtkcsstypesprivate.h | 27 +++++++
3 files changed, 199 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkcssenumvalue.c b/gtk/gtkcssenumvalue.c
index 84e986b..4706a77 100644
--- a/gtk/gtkcssenumvalue.c
+++ b/gtk/gtkcssenumvalue.c
@@ -321,3 +321,163 @@ _gtk_css_area_value_get (const GtkCssValue *value)
return value->value;
}
+/* GtkCssDirection */
+
+static const GtkCssValueClass GTK_CSS_VALUE_DIRECTION = {
+ gtk_css_value_enum_free,
+ gtk_css_value_enum_equal,
+ gtk_css_value_enum_transition,
+ gtk_css_value_enum_print
+};
+
+static GtkCssValue direction_values[] = {
+ { >K_CSS_VALUE_DIRECTION, 1, GTK_CSS_DIRECTION_NORMAL, "normal" },
+ { >K_CSS_VALUE_DIRECTION, 1, GTK_CSS_DIRECTION_REVERSE, "reverse" },
+ { >K_CSS_VALUE_DIRECTION, 1, GTK_CSS_DIRECTION_ALTERNATE, "alternate" },
+ { >K_CSS_VALUE_DIRECTION, 1, GTK_CSS_DIRECTION_ALTERNATE_REVERSE, "alternate-reverse" }
+};
+
+GtkCssValue *
+_gtk_css_direction_value_new (GtkCssDirection direction)
+{
+ guint i;
+
+ for (i = 0; i < G_N_ELEMENTS (direction_values); i++)
+ {
+ if (direction_values[i].value == direction)
+ return _gtk_css_value_ref (&direction_values[i]);
+ }
+
+ g_return_val_if_reached (NULL);
+}
+
+GtkCssValue *
+_gtk_css_direction_value_try_parse (GtkCssParser *parser)
+{
+ guint i;
+
+ g_return_val_if_fail (parser != NULL, NULL);
+
+ for (i = 0; i < G_N_ELEMENTS (direction_values); i++)
+ {
+ if (_gtk_css_parser_try (parser, direction_values[i].name, TRUE))
+ return _gtk_css_value_ref (&direction_values[i]);
+ }
+
+ return NULL;
+}
+
+GtkCssDirection
+_gtk_css_direction_value_get (const GtkCssValue *value)
+{
+ g_return_val_if_fail (value->class == >K_CSS_VALUE_DIRECTION, GTK_CSS_DIRECTION_NORMAL);
+
+ return value->value;
+}
+
+/* GtkCssPlayState */
+
+static const GtkCssValueClass GTK_CSS_VALUE_PLAY_STATE = {
+ gtk_css_value_enum_free,
+ gtk_css_value_enum_equal,
+ gtk_css_value_enum_transition,
+ gtk_css_value_enum_print
+};
+
+static GtkCssValue play_state_values[] = {
+ { >K_CSS_VALUE_PLAY_STATE, 1, GTK_CSS_PLAY_STATE_RUNNING, "running" },
+ { >K_CSS_VALUE_PLAY_STATE, 1, GTK_CSS_PLAY_STATE_PAUSED, "paused" }
+};
+
+GtkCssValue *
+_gtk_css_play_state_value_new (GtkCssPlayState play_state)
+{
+ guint i;
+
+ for (i = 0; i < G_N_ELEMENTS (play_state_values); i++)
+ {
+ if (play_state_values[i].value == play_state)
+ return _gtk_css_value_ref (&play_state_values[i]);
+ }
+
+ g_return_val_if_reached (NULL);
+}
+
+GtkCssValue *
+_gtk_css_play_state_value_try_parse (GtkCssParser *parser)
+{
+ guint i;
+
+ g_return_val_if_fail (parser != NULL, NULL);
+
+ for (i = 0; i < G_N_ELEMENTS (play_state_values); i++)
+ {
+ if (_gtk_css_parser_try (parser, play_state_values[i].name, TRUE))
+ return _gtk_css_value_ref (&play_state_values[i]);
+ }
+
+ return NULL;
+}
+
+GtkCssPlayState
+_gtk_css_play_state_value_get (const GtkCssValue *value)
+{
+ g_return_val_if_fail (value->class == >K_CSS_VALUE_PLAY_STATE, GTK_CSS_PLAY_STATE_RUNNING);
+
+ return value->value;
+}
+
+/* GtkCssFillMode */
+
+static const GtkCssValueClass GTK_CSS_VALUE_FILL_MODE = {
+ gtk_css_value_enum_free,
+ gtk_css_value_enum_equal,
+ gtk_css_value_enum_transition,
+ gtk_css_value_enum_print
+};
+
+static GtkCssValue fill_mode_values[] = {
+ { >K_CSS_VALUE_FILL_MODE, 1, GTK_CSS_FILL_NONE, "none" },
+ { >K_CSS_VALUE_FILL_MODE, 1, GTK_CSS_FILL_FORWARDS, "forwards" },
+ { >K_CSS_VALUE_FILL_MODE, 1, GTK_CSS_FILL_BACKWARDS, "backwards" },
+ { >K_CSS_VALUE_FILL_MODE, 1, GTK_CSS_FILL_BOTH, "both" }
+};
+
+GtkCssValue *
+_gtk_css_fill_mode_value_new (GtkCssFillMode fill_mode)
+{
+ guint i;
+
+ for (i = 0; i < G_N_ELEMENTS (fill_mode_values); i++)
+ {
+ if (fill_mode_values[i].value == fill_mode)
+ return _gtk_css_value_ref (&fill_mode_values[i]);
+ }
+
+ g_return_val_if_reached (NULL);
+}
+
+GtkCssValue *
+_gtk_css_fill_mode_value_try_parse (GtkCssParser *parser)
+{
+ guint i;
+
+ g_return_val_if_fail (parser != NULL, NULL);
+
+ for (i = 0; i < G_N_ELEMENTS (fill_mode_values); i++)
+ {
+ if (_gtk_css_parser_try (parser, fill_mode_values[i].name, TRUE))
+ return _gtk_css_value_ref (&fill_mode_values[i]);
+ }
+
+ return NULL;
+}
+
+GtkCssFillMode
+_gtk_css_fill_mode_value_get (const GtkCssValue *value)
+{
+ g_return_val_if_fail (value->class == >K_CSS_VALUE_FILL_MODE, GTK_CSS_FILL_NONE);
+
+ return value->value;
+}
+
diff --git a/gtk/gtkcssenumvalueprivate.h b/gtk/gtkcssenumvalueprivate.h
index 6092137..09a9d67 100644
--- a/gtk/gtkcssenumvalueprivate.h
+++ b/gtk/gtkcssenumvalueprivate.h
@@ -47,6 +47,18 @@ GtkCssValue * _gtk_css_area_value_new (GtkCssArea area);
GtkCssValue * _gtk_css_area_value_try_parse (GtkCssParser *parser);
GtkCssArea _gtk_css_area_value_get (const GtkCssValue *value);
+GtkCssValue * _gtk_css_direction_value_new (GtkCssDirection direction);
+GtkCssValue * _gtk_css_direction_value_try_parse (GtkCssParser *parser);
+GtkCssDirection _gtk_css_direction_value_get (const GtkCssValue *value);
+
+GtkCssValue * _gtk_css_play_state_value_new (GtkCssPlayState play_state);
+GtkCssValue * _gtk_css_play_state_value_try_parse (GtkCssParser *parser);
+GtkCssPlayState _gtk_css_play_state_value_get (const GtkCssValue *value);
+
+GtkCssValue * _gtk_css_fill_mode_value_new (GtkCssFillMode fill_mode);
+GtkCssValue * _gtk_css_fill_mode_value_try_parse (GtkCssParser *parser);
+GtkCssFillMode _gtk_css_fill_mode_value_get (const GtkCssValue *value);
+
G_END_DECLS
#endif /* __GTK_CSS_ENUM_VALUE_PRIVATE_H__ */
diff --git a/gtk/gtkcsstypesprivate.h b/gtk/gtkcsstypesprivate.h
index b0db18d..6d85032 100644
--- a/gtk/gtkcsstypesprivate.h
+++ b/gtk/gtkcsstypesprivate.h
@@ -109,6 +109,14 @@ enum { /*< skip >*/
GTK_CSS_PROPERTY_TRANSITION_DURATION,
GTK_CSS_PROPERTY_TRANSITION_TIMING_FUNCTION,
GTK_CSS_PROPERTY_TRANSITION_DELAY,
+ GTK_CSS_PROPERTY_ANIMATION_NAME,
+ GTK_CSS_PROPERTY_ANIMATION_DURATION,
+ GTK_CSS_PROPERTY_ANIMATION_TIMING_FUNCTION,
+ GTK_CSS_PROPERTY_ANIMATION_ITERATION_COUNT,
+ GTK_CSS_PROPERTY_ANIMATION_DIRECTION,
+ GTK_CSS_PROPERTY_ANIMATION_PLAY_STATE,
+ GTK_CSS_PROPERTY_ANIMATION_DELAY,
+ GTK_CSS_PROPERTY_ANIMATION_FILL_MODE,
GTK_CSS_PROPERTY_ENGINE,
GTK_CSS_PROPERTY_GTK_KEY_BINDINGS,
/* add more */
@@ -121,6 +129,25 @@ typedef enum /*< skip >*/ {
GTK_CSS_AREA_CONTENT_BOX
} GtkCssArea;
+typedef enum /*< skip >*/ {
+ GTK_CSS_DIRECTION_NORMAL,
+ GTK_CSS_DIRECTION_REVERSE,
+ GTK_CSS_DIRECTION_ALTERNATE,
+ GTK_CSS_DIRECTION_ALTERNATE_REVERSE
+} GtkCssDirection;
+
+typedef enum /*< skip >*/ {
+ GTK_CSS_PLAY_STATE_RUNNING,
+ GTK_CSS_PLAY_STATE_PAUSED
+} GtkCssPlayState;
+
+typedef enum /*< skip >*/ {
+ GTK_CSS_FILL_NONE,
+ GTK_CSS_FILL_FORWARDS,
+ GTK_CSS_FILL_BACKWARDS,
+ GTK_CSS_FILL_BOTH
+} GtkCssFillMode;
+
/* for the order in arrays */
typedef enum /*< skip >*/ {
GTK_CSS_TOP,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]