static void notify_vertical_changed_cb (MxAdjustment *adjustment, MexMediaControls *controls) { MexMediaControlsPrivate *priv = controls->priv; gint bottom; gdouble value, max, page_size; max = mx_adjustment_get_upper (adjustment); value = mx_adjustment_get_value (adjustment); page_size = mx_adjustment_get_page_size (adjustment); bottom = MIN (50, (max - value - page_size)); mx_fade_effect_set_border (MX_FADE_EFFECT (priv->vertical_effect), 0, 0, bottom, 0); }
static void notify_horizontal_changed_cb (MxAdjustment *adjustment, MexMediaControls *controls) { MexMediaControlsPrivate *priv = controls->priv; gint left, right; gdouble value, min, max, page_size; min = mx_adjustment_get_lower (adjustment); max = mx_adjustment_get_upper (adjustment); value = mx_adjustment_get_value (adjustment); page_size = mx_adjustment_get_page_size (adjustment); left = MIN (136, (value - min)); right = MIN (136, (max - value - page_size)); mx_fade_effect_set_border (MX_FADE_EFFECT (priv->horizontal_effect), 0, right, 0, left); }
static void mx_scroll_view_paint (ClutterActor *actor) { ClutterActorBox box; gfloat w, h; MxAdjustment *vadjustment = NULL, *hadjustment = NULL; MxScrollViewPrivate *priv = MX_SCROLL_VIEW (actor)->priv; ClutterColor *color; guint8 r, g, b; const gint shadow = 15; mx_stylable_get (MX_STYLABLE (actor), "background-color", &color, NULL); r = color->red; g = color->green; b = color->blue; clutter_color_free (color); /* MxBin will paint the child */ CLUTTER_ACTOR_CLASS (mx_scroll_view_parent_class)->paint (actor); clutter_actor_get_allocation_box (actor, &box); w = box.x2 - box.x1; h = box.y2 - box.y1; /* paint our custom children */ if (CLUTTER_ACTOR_IS_VISIBLE (priv->hscroll)) { clutter_actor_paint (priv->hscroll); clutter_actor_get_allocation_box (priv->hscroll, &box); h -= (box.y2 - box.y1); hadjustment = mx_scroll_bar_get_adjustment (MX_SCROLL_BAR(priv->hscroll)); } if (CLUTTER_ACTOR_IS_VISIBLE (priv->vscroll)) { clutter_actor_paint (priv->vscroll); clutter_actor_get_allocation_box (priv->vscroll, &box); w -= (box.x2 - box.x1); vadjustment = mx_scroll_bar_get_adjustment (MX_SCROLL_BAR(priv->vscroll)); } /* set up the matrial using dummy set source call */ cogl_set_source_color4ub (0, 0, 0, 0); if (vadjustment) { gdouble len; if ((len = mx_adjustment_get_value (vadjustment)) > 0) { CoglTextureVertex top[4] = { { 0,}, }; if (len > shadow) len = shadow; top[1].x = w; top[2].x = w; top[2].y = len; top[3].y = len; cogl_color_set_from_4ub (&top[0].color, r, g, b, 0xff); cogl_color_set_from_4ub (&top[1].color, r, g, b, 0xff); cogl_color_set_from_4ub (&top[2].color, 0, 0, 0, 0); cogl_color_set_from_4ub (&top[3].color, 0, 0, 0, 0); cogl_polygon (top, 4, TRUE); } if ((len = (mx_adjustment_get_upper (vadjustment) - mx_adjustment_get_page_size (vadjustment)) - mx_adjustment_get_value (vadjustment)) > 0) { CoglTextureVertex bottom[4] = { {0, }, }; if (len > shadow) len = shadow; bottom[0].x = w; bottom[0].y = h; bottom[1].y = h; bottom[2].y = h - len; bottom[3].x = w; bottom[3].y = h - len; cogl_color_set_from_4ub (&bottom[0].color, r, g, b, 0xff); cogl_color_set_from_4ub (&bottom[1].color, r, g, b, 0xff); cogl_color_set_from_4ub (&bottom[2].color, 0, 0, 0, 0); cogl_color_set_from_4ub (&bottom[3].color, 0, 0, 0, 0); cogl_polygon (bottom, 4, TRUE); } } if (hadjustment) { gdouble len; if ((len = mx_adjustment_get_value (hadjustment)) > 0) { CoglTextureVertex left[4] = { { 0, }, }; if (len > shadow) len = shadow; left[0].y = h; left[2].x = len; left[3].x = len; left[3].y = h; cogl_color_set_from_4ub (&left[0].color, r, g, b, 0xff); cogl_color_set_from_4ub (&left[1].color, r, g, b, 0xff); cogl_color_set_from_4ub (&left[2].color, 0, 0, 0, 0); cogl_color_set_from_4ub (&left[3].color, 0, 0, 0, 0); cogl_polygon (left, 4, TRUE); } if ((len = (mx_adjustment_get_upper (hadjustment) - mx_adjustment_get_page_size (hadjustment)) - mx_adjustment_get_value (hadjustment)) > 0) { CoglTextureVertex right[4] = { { 0, }, }; if (len > shadow) len = shadow; right[0].x = w; right[1].x = w; right[1].y = h; right[2].x = w - len; right[2].y = h; right[3].x = w - len; cogl_color_set_from_4ub (&right[0].color, r, g, b, 0xff); cogl_color_set_from_4ub (&right[1].color, r, g, b, 0xff); cogl_color_set_from_4ub (&right[2].color, 0, 0, 0, 0); cogl_color_set_from_4ub (&right[3].color, 0, 0, 0, 0); cogl_polygon (right, 4, TRUE); } } }