static void expander_box_open_notify (MexExpanderBox *box, GParamSpec *pspec, MexColumn *column) { MexColumnPrivate *priv = MEX_COLUMN (column)->priv; GList *l; MexShadow *shadow; ClutterColor shadow_color = { 0, 0, 0, 128 }; if (mex_expander_box_get_open (box)) { for (l = priv->children; l; l = l->next) { if (l->data != box) clutter_actor_animate (l->data, CLUTTER_EASE_IN_OUT_QUAD, 200, "opacity", 56, NULL); } clutter_actor_animate (priv->header, CLUTTER_EASE_IN_OUT_QUAD, 200, "opacity", 56, NULL); /* Restore the opened box to full opacity */ clutter_actor_animate (CLUTTER_ACTOR (box), CLUTTER_EASE_IN_OUT_QUAD, 200, "opacity", 255, NULL); shadow = mex_shadow_new (CLUTTER_ACTOR (box)); mex_shadow_set_paint_flags (shadow, MEX_TEXTURE_FRAME_TOP | MEX_TEXTURE_FRAME_BOTTOM); mex_shadow_set_radius_y (shadow, 25); mex_shadow_set_color (shadow, &shadow_color); g_object_set_qdata (G_OBJECT (box), _item_shadow_quark (), shadow); priv->open_boxes ++; } else { priv->open_boxes --; } if (priv->open_boxes == 0) { /* restore all children to full opacity */ for (l = priv->children; l; l = l->next) { clutter_actor_animate (l->data, CLUTTER_EASE_IN_OUT_QUAD, 200, "opacity", 255, NULL); } clutter_actor_animate (priv->header, CLUTTER_EASE_IN_OUT_QUAD, 200, "opacity", 255, NULL); shadow = g_object_get_qdata (G_OBJECT (box), _item_shadow_quark ()); if (shadow) { g_object_unref (shadow); g_object_set_qdata (G_OBJECT (box), _item_shadow_quark (), NULL); } } }
MexShadow * mex_telepathy_channel_create_shadow (void) { ClutterColor shadow_color = {0, 0, 0, 64}; MexShadow *shadow = mex_shadow_new (); mex_shadow_set_radius_x (shadow, 15); mex_shadow_set_radius_y (shadow, 15); mex_shadow_set_color (shadow, &shadow_color); return shadow; }
static MxFocusable * _accept_focus (MxFocusable *focusable, MxFocusHint hint) { MexActionButtonPrivate *priv = MEX_ACTION_BUTTON (focusable)->priv; MxFocusableIface *iface; ClutterColor shadow_color = {0, 0, 0, 64}; priv->has_focus = TRUE; priv->shadow = mex_shadow_new (CLUTTER_ACTOR (focusable)); mex_shadow_set_radius_x (priv->shadow, 15); mex_shadow_set_radius_y (priv->shadow, 15); mex_shadow_set_color (priv->shadow, &shadow_color); iface = g_type_interface_peek_parent (MX_FOCUSABLE_GET_INTERFACE (focusable)); return iface->accept_focus (focusable, hint); }
static void mex_action_button_init (MexActionButton *self) { ClutterColor shadow_color = {0, 0, 0, 64}; MexActionButtonPrivate *priv; priv = self->priv = ACTION_BUTTON_PRIVATE (self); mx_button_set_icon_position (MX_BUTTON (self), MX_POSITION_RIGHT); mx_bin_set_fill (MX_BIN (self), TRUE, TRUE); priv->shadow = mex_shadow_new (); mex_shadow_set_radius_x (priv->shadow, 15); mex_shadow_set_radius_y (priv->shadow, 15); mex_shadow_set_color (priv->shadow, &shadow_color); clutter_actor_meta_set_enabled (CLUTTER_ACTOR_META (priv->shadow), FALSE); clutter_actor_add_effect (CLUTTER_ACTOR (self), CLUTTER_EFFECT (priv->shadow)); }
/** * mex_column_add_content: * * Add an item to the column for the specified content at the specified * position. */ static void mex_column_add_content (MexColumn *column, MexContent *content, guint position) { MexColumnPrivate *priv = column->priv; ClutterActor *box; MexShadow *shadow; ClutterColor shadow_color = { 0, 0, 0, 128 }; GList *sibling; box = mex_content_box_new (); mex_content_view_set_content (MEX_CONTENT_VIEW (box), content); mex_content_view_set_context (MEX_CONTENT_VIEW (box), priv->model); sibling = g_list_nth (priv->children, position); priv->children = g_list_insert_before (priv->children, sibling, box); priv->n_items ++; /* add shadow */ shadow = mex_shadow_new (); mex_shadow_set_paint_flags (shadow, MEX_TEXTURE_FRAME_TOP | MEX_TEXTURE_FRAME_BOTTOM); mex_shadow_set_radius_y (shadow, 25); mex_shadow_set_color (shadow, &shadow_color); clutter_actor_add_effect_with_name (CLUTTER_ACTOR (box), "shadow", CLUTTER_EFFECT (shadow)); clutter_actor_meta_set_enabled (CLUTTER_ACTOR_META (shadow), FALSE); g_signal_connect (box, "notify::open", G_CALLBACK (content_box_open_notify), column); /* set important if the column has focus */ mex_content_box_set_important (MEX_CONTENT_BOX (box), priv->has_focus); clutter_actor_set_parent (box, CLUTTER_ACTOR (column)); }