diff --git a/mx/mx-scroll-view.c b/mx/mx-scroll-view.c index 0362c8d5..d678b864 100644 --- a/mx/mx-scroll-view.c +++ b/mx/mx-scroll-view.c @@ -76,6 +76,11 @@ struct _MxScrollViewPrivate guint scrollbar_width; guint scrollbar_height; + gboolean top_shading; + gboolean bottom_shading; + gboolean left_shading; + gboolean right_shading; + MxScrollPolicy scroll_policy; MxScrollPolicy scroll_visibility; }; @@ -242,7 +247,8 @@ mx_scroll_view_paint (ClutterActor *actor) if (vadjustment) { gdouble len; - if ((len = mx_adjustment_get_value (vadjustment)) > 0) + if ((len = mx_adjustment_get_value (vadjustment)) > 0 && + priv->top_shading) { CoglTextureVertex top[4] = { { 0,}, }; @@ -263,7 +269,8 @@ mx_scroll_view_paint (ClutterActor *actor) if ((len = (mx_adjustment_get_upper (vadjustment) - mx_adjustment_get_page_size (vadjustment)) - - mx_adjustment_get_value (vadjustment)) > 0) + - mx_adjustment_get_value (vadjustment)) > 0 && + priv->bottom_shading) { CoglTextureVertex bottom[4] = { {0, }, }; @@ -290,7 +297,8 @@ mx_scroll_view_paint (ClutterActor *actor) { gdouble len; - if ((len = mx_adjustment_get_value (hadjustment)) > 0) + if ((len = mx_adjustment_get_value (hadjustment)) > 0 && + priv->left_shading) { CoglTextureVertex left[4] = { { 0, }, }; @@ -313,7 +321,8 @@ mx_scroll_view_paint (ClutterActor *actor) if ((len = (mx_adjustment_get_upper (hadjustment) - mx_adjustment_get_page_size (hadjustment)) - - mx_adjustment_get_value (hadjustment)) > 0) + - mx_adjustment_get_value (hadjustment)) > 0 && + priv->right_shading) { CoglTextureVertex right[4] = { { 0, }, }; @@ -543,17 +552,31 @@ mx_scroll_view_style_changed (MxWidget *widget, MxStyleChangedFlags flags) { MxScrollViewPrivate *priv = MX_SCROLL_VIEW (widget)->priv; gint scrollbar_width, scrollbar_height; + gboolean top_shading, bottom_shading, left_shading, right_shading; mx_stylable_get (MX_STYLABLE (widget), "x-mx-scrollbar-width", &scrollbar_width, "x-mx-scrollbar-height", &scrollbar_height, + "x-mx-top-shading", &top_shading, + "x-mx-bottom-shading", &bottom_shading, + "x-mx-left-shading", &left_shading, + "x-mx-right-shading", &right_shading, NULL); + if (scrollbar_width != priv->scrollbar_width || - scrollbar_height != priv->scrollbar_height) + scrollbar_height != priv->scrollbar_height || + top_shading != priv->top_shading || + bottom_shading != priv->bottom_shading || + left_shading != priv->left_shading || + right_shading != priv->right_shading) { priv->scrollbar_width = scrollbar_width; priv->scrollbar_height = scrollbar_height; + priv->top_shading = top_shading; + priv->bottom_shading = bottom_shading; + priv->left_shading = left_shading; + priv->right_shading = right_shading; clutter_actor_queue_relayout (CLUTTER_ACTOR (widget)); } } @@ -781,6 +804,38 @@ mx_stylable_iface_init (MxStylableIface *iface) 0, G_MAXUINT, 24, G_PARAM_READWRITE); mx_stylable_iface_install_property (iface, MX_TYPE_SCROLL_VIEW, pspec); + + pspec = g_param_spec_boolean ("x-mx-top-shading", + "Display top shading", + "If we should display a shading on top " + "of the view", + TRUE, + G_PARAM_READWRITE); + mx_stylable_iface_install_property (iface, MX_TYPE_SCROLL_VIEW, pspec); + + pspec = g_param_spec_boolean ("x-mx-bottom-shading", + "Display bottom shading", + "If we should display a shading on bottom " + "of the view", + TRUE, + G_PARAM_READWRITE); + mx_stylable_iface_install_property (iface, MX_TYPE_SCROLL_VIEW, pspec); + + pspec = g_param_spec_boolean ("x-mx-left-shading", + "Display left shading", + "If we should display a shading on left " + "of the view", + TRUE, + G_PARAM_READWRITE); + mx_stylable_iface_install_property (iface, MX_TYPE_SCROLL_VIEW, pspec); + + pspec = g_param_spec_boolean ("x-mx-right-shading", + "Display right shading", + "If we should display a shading on right " + "of the view", + TRUE, + G_PARAM_READWRITE); + mx_stylable_iface_install_property (iface, MX_TYPE_SCROLL_VIEW, pspec); } } diff --git a/mx/mx-style.c b/mx/mx-style.c index 76e52f01..740592d6 100644 --- a/mx/mx-style.c +++ b/mx/mx-style.c @@ -567,6 +567,26 @@ mx_style_transform_css_value (MxStyleSheetValue *css_value, g_type_class_unref (class); } + else if (g_type_is_a (pspec->value_type, G_TYPE_BOOLEAN)) + { + g_value_init (value, pspec->value_type); + + if (css_value->string) + { + gboolean b = TRUE; + + if (g_ascii_strcasecmp (css_value->string, "false") == 0 || + strcmp (css_value->string, "0") == 0) + b = FALSE; + + g_value_set_boolean (value, b); + } + else + { + g_value_set_boolean (value, + ((GParamSpecUInt *) pspec)->default_value); + } + } else { GValue strval = { 0, };