示例#1
0
文件: mx-toggle.c 项目: ManMower/mx
static MxFocusable*
mx_toggle_accept_focus (MxFocusable *focusable, MxFocusHint hint)
{
  MxTogglePrivate *priv = MX_TOGGLE (focusable)->priv;

  mx_stylable_style_pseudo_class_add (MX_STYLABLE (focusable), "focus");
  mx_stylable_style_pseudo_class_add (MX_STYLABLE (priv->handle), "focus");

  clutter_actor_grab_key_focus (CLUTTER_ACTOR (focusable));

  return focusable;
}
示例#2
0
文件: mx-button.c 项目: danni/mx
static MxFocusable*
mx_button_accept_focus (MxFocusable *focusable, MxFocusHint hint)
{
  mx_stylable_style_pseudo_class_add (MX_STYLABLE (focusable), "focus");

  clutter_actor_grab_key_focus (CLUTTER_ACTOR (focusable));

  return focusable;
}
示例#3
0
static void
mex_menu_item_set_toggled (ClutterActor *item,
                           gboolean      toggled)
{
  MxStylable *icon = g_object_get_data (G_OBJECT (item), "toggle-icon");
  if (toggled)
    mx_stylable_style_pseudo_class_add (icon, "checked");
  else
    mx_stylable_style_pseudo_class_remove (icon, "checked");
}
示例#4
0
文件: mx-button.c 项目: danni/mx
static void
mx_button_push (MxButton           *button,
                ClutterButtonEvent *event)
{
  MxWidget *widget = MX_WIDGET (button);

  mx_widget_hide_tooltip (widget);

  button->priv->is_pressed = TRUE;

  //clutter_grab_pointer (CLUTTER_ACTOR (button));

  mx_stylable_style_pseudo_class_add (MX_STYLABLE (button), "active");

  if (event)
    mx_widget_long_press_query (widget, event);
}
示例#5
0
文件: mx-button.c 项目: danni/mx
static gboolean
mx_button_enter (ClutterActor         *actor,
                 ClutterCrossingEvent *event)
{
  MxWidget *widget = MX_WIDGET (actor);

  if (event->source != actor)
    return FALSE;

  /* check if the widget is disabled */
  if (mx_widget_get_disabled (MX_WIDGET (actor)))
    return FALSE;


  mx_stylable_style_pseudo_class_add (MX_STYLABLE (widget), "hover");

  return FALSE;
}
示例#6
0
文件: mx-button.c 项目: danni/mx
/**
 * mx_button_set_toggled:
 * @button: a #MxButton
 * @toggled: #TRUE or #FALSE
 *
 * Sets the toggled state of the button. This is only really useful if the
 * button has #toggle-mode mode set to #TRUE.
 */
void
mx_button_set_toggled (MxButton *button,
                       gboolean  toggled)
{
  g_return_if_fail (MX_IS_BUTTON (button));

  if (button->priv->is_toggled != toggled)
    {
      button->priv->is_toggled = toggled;

      if (toggled)
        mx_stylable_style_pseudo_class_add (MX_STYLABLE (button), "checked");
      else
        mx_stylable_style_pseudo_class_remove (MX_STYLABLE (button), "checked");

      g_object_notify (G_OBJECT (button), "toggled");
    }
}
示例#7
0
static void
mex_tile_notify_focused_cb (MxFocusManager *manager,
                            GParamSpec     *pspec,
                            MexTile        *self)
{
  ClutterActor *focus;

  MexTilePrivate *priv = self->priv;

  focus = (ClutterActor *)mx_focus_manager_get_focused (manager);

  if (focus)
    {
      ClutterActor *parent = clutter_actor_get_parent (focus);
      while (parent)
        {
          if (focus == (ClutterActor *)self)
            {
              if (!priv->has_focus)
                {
                  priv->has_focus = TRUE;
                  mx_stylable_style_pseudo_class_add (MX_STYLABLE (self),
                                                      "focus");
                }

              return;
            }

          focus = parent;
          parent = clutter_actor_get_parent (focus);
        }
    }

  priv->has_focus = FALSE;
  mx_stylable_style_pseudo_class_remove (MX_STYLABLE (self), "focus");
}