From d4a8c64d2249ffc6c30c069eddeac589621a4732 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20M=C3=BCllner?= Date: Sun, 30 May 2010 23:06:37 +0200 Subject: [PATCH] [StThemeNode] Add transition-duration CSS property Add a CSS property to control style transitions. https://bugzilla.gnome.org/show_bug.cgi?id=619025 --- src/st/st-theme-node-private.h | 2 ++ src/st/st-theme-node.c | 28 ++++++++++++++++++++++++++++ src/st/st-theme-node.h | 2 ++ 3 files changed, 32 insertions(+) diff --git a/src/st/st-theme-node-private.h b/src/st/st-theme-node-private.h index bd84ef7ae..1f9d1c304 100644 --- a/src/st/st-theme-node-private.h +++ b/src/st/st-theme-node-private.h @@ -36,6 +36,8 @@ struct _StThemeNode { int max_width; int max_height; + int transition_duration; + char *background_image; StBorderImage *border_image; StShadow *shadow; diff --git a/src/st/st-theme-node.c b/src/st/st-theme-node.c index 5c4768ae1..d097da535 100644 --- a/src/st/st-theme-node.c +++ b/src/st/st-theme-node.c @@ -20,6 +20,7 @@ G_DEFINE_TYPE (StThemeNode, st_theme_node, G_TYPE_OBJECT) static void st_theme_node_init (StThemeNode *node) { + node->transition_duration = -1; _st_theme_node_init_drawing_state (node); } @@ -1548,6 +1549,33 @@ st_theme_node_get_padding (StThemeNode *node, return node->padding[side]; } +/** + * st_theme_node_get_transition_duration: + * @node: an #StThemeNode + * + * Get the value of the transition-duration property, which + * specifies the transition time between the previous #StThemeNode + * and @node. + * + * Returns: the node's transition duration in milliseconds + */ +int +st_theme_node_get_transition_duration (StThemeNode *node) +{ + gdouble value = 0.0; + + g_return_val_if_fail (ST_IS_THEME_NODE (node), 0); + + if (node->transition_duration > -1) + return node->transition_duration; + + st_theme_node_get_double (node, "transition-duration", FALSE, &value); + + node->transition_duration = (int)value; + + return node->transition_duration; +} + StTextDecoration st_theme_node_get_text_decoration (StThemeNode *node) { diff --git a/src/st/st-theme-node.h b/src/st/st-theme-node.h index e560f8706..2dfa2b2ea 100644 --- a/src/st/st-theme-node.h +++ b/src/st/st-theme-node.h @@ -141,6 +141,8 @@ int st_theme_node_get_min_height (StThemeNode *node); int st_theme_node_get_max_width (StThemeNode *node); int st_theme_node_get_max_height (StThemeNode *node); +int st_theme_node_get_transition_duration (StThemeNode *node); + StTextDecoration st_theme_node_get_text_decoration (StThemeNode *node); /* Font rule processing is pretty complicated, so we just hardcode it