mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-07 01:00:28 +00:00
cssvalue: Add animation enum properties
This commit is contained in:
parent
e6c951a303
commit
0185e323db
@ -339,3 +339,166 @@ _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_compute,
|
||||
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_compute,
|
||||
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_compute,
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -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__ */
|
||||
|
@ -116,6 +116,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 */
|
||||
@ -128,6 +136,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,
|
||||
|
Loading…
Reference in New Issue
Block a user