Ejemplo n.º 1
0
static void
mex_action_button_paint_background (MxWidget *widget,
                                    ClutterActor *background,
                                    const ClutterColor *color)
{
    MexActionButtonPrivate *priv = MEX_ACTION_BUTTON (widget)->priv;
    gfloat width, height;
    gfloat factor_x, factor_y;

    cogl_push_matrix ();

    if (priv->has_focus)
    {
        clutter_actor_get_size (background, &width, &height);

        factor_x = (width + 4) / width;
        factor_y = (height + 4) / height;

        cogl_translate (width/2, height/2, 0);
        cogl_scale (factor_x, factor_y, 1);
        cogl_translate (-width/2, -height/2, 0);
    }

    MX_WIDGET_CLASS(mex_action_button_parent_class)->paint_background (widget,
            background,
            color);
    cogl_pop_matrix ();
}
Ejemplo n.º 2
0
static MxFocusable *
_accept_focus (MxFocusable *focusable,
               MxFocusHint  hint)
{
  MexActionButtonPrivate *priv = MEX_ACTION_BUTTON (focusable)->priv;
  MxFocusableIface *iface;

  priv->has_focus = TRUE;

  clutter_actor_meta_set_enabled (CLUTTER_ACTOR_META (priv->shadow), TRUE);

  iface = g_type_interface_peek_parent (MX_FOCUSABLE_GET_INTERFACE (focusable));
  return iface->accept_focus (focusable, hint);
}
Ejemplo n.º 3
0
static MxFocusable *
_move_focus (MxFocusable      *focusable,
             MxFocusDirection  direction,
             MxFocusable      *old_focus)
{
  MexActionButtonPrivate *priv = MEX_ACTION_BUTTON (focusable)->priv;
  MxFocusableIface *iface;

  clutter_actor_meta_set_enabled (CLUTTER_ACTOR_META (priv->shadow), FALSE);

  priv->has_focus = FALSE;


  iface = g_type_interface_peek_parent (MX_FOCUSABLE_GET_INTERFACE (focusable));
  return iface->move_focus (focusable, direction, old_focus);
}
Ejemplo n.º 4
0
static MxFocusable *
_move_focus (MxFocusable      *focusable,
             MxFocusDirection  direction,
             MxFocusable      *old_focus)
{
    MexActionButtonPrivate *priv = MEX_ACTION_BUTTON (focusable)->priv;
    MxFocusableIface *iface;

    g_object_unref (priv->shadow);
    priv->shadow = NULL;

    priv->has_focus = FALSE;


    iface = g_type_interface_peek_parent (MX_FOCUSABLE_GET_INTERFACE (focusable));
    return iface->move_focus (focusable, direction, old_focus);
}
Ejemplo n.º 5
0
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);
}