static void
st_scroll_view_fade_set_actor (ClutterActorMeta *meta,
                               ClutterActor *actor)
{
  StScrollViewFade *self = ST_SCROLL_VIEW_FADE (meta);
  ClutterActorMetaClass *parent;

  g_return_if_fail (actor == NULL || ST_IS_SCROLL_VIEW (actor));

  if (self->shader == COGL_INVALID_HANDLE)
    {
      clutter_actor_meta_set_enabled (meta, FALSE);
      return;
    }

  if (self->vadjustment)
    {
      g_signal_handlers_disconnect_by_func (self->vadjustment,
                                            (gpointer)on_vadjustment_changed,
                                            self);
      self->vadjustment = NULL;
    }

  if (actor)
    {
        StScrollView *scroll_view = ST_SCROLL_VIEW (actor);
        StScrollBar *vscroll = ST_SCROLL_BAR (st_scroll_view_get_vscroll_bar (scroll_view));
        self->vadjustment = ST_ADJUSTMENT (st_scroll_bar_get_adjustment (vscroll));

        g_signal_connect (self->vadjustment, "changed",
                          G_CALLBACK (on_vadjustment_changed),
                          self);

        on_vadjustment_changed (self->vadjustment, CLUTTER_EFFECT (self));
    }

  parent = CLUTTER_ACTOR_META_CLASS (st_scroll_view_fade_parent_class);
  parent->set_actor (meta, actor);

  /* we keep a back pointer here, to avoid going through the ActorMeta */
  self->actor = clutter_actor_meta_get_actor (meta);
}
示例#2
0
static void
clutter_click_action_set_actor (ClutterActorMeta *meta,
                                ClutterActor     *actor)
{
  ClutterClickAction *action = CLUTTER_CLICK_ACTION (meta);
  ClutterClickActionPrivate *priv = action->priv;

  if (priv->event_id != 0)
    {
      ClutterActor *old_actor = clutter_actor_meta_get_actor (meta);

      if (old_actor != NULL)
        g_signal_handler_disconnect (old_actor, priv->event_id);

      priv->event_id = 0;
    }

  if (priv->capture_id != 0)
    {
      if (priv->stage != NULL)
        g_signal_handler_disconnect (priv->stage, priv->capture_id);

      priv->capture_id = 0;
      priv->stage = NULL;
    }

  if (priv->long_press_id != 0)
    {
      g_source_remove (priv->long_press_id);
      priv->long_press_id = 0;
    }

  click_action_set_pressed (action, FALSE);
  click_action_set_held (action, FALSE);

  if (actor != NULL)
    priv->event_id = g_signal_connect (actor, "event",
                                       G_CALLBACK (on_event),
                                       action);

  CLUTTER_ACTOR_META_CLASS (clutter_click_action_parent_class)->set_actor (meta, actor);
}
示例#3
0
static void
clutter_shader_effect_class_init (ClutterShaderEffectClass *klass)
{
  ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass);
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
  ClutterOffscreenEffectClass *offscreen_class;

  offscreen_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (klass);

  g_type_class_add_private (klass, sizeof (ClutterShaderEffectPrivate));

  /**
   * ClutterShaderEffect:shader-type:
   *
   * The type of shader that is used by the effect. This property
   * should be set by the constructor of #ClutterShaderEffect
   * sub-classes.
   *
   * Since: 1.4
   */
  obj_props[PROP_SHADER_TYPE] =
    g_param_spec_enum ("shader-type",
                       P_("Shader Type"),
                       P_("The type of shader used"),
                       CLUTTER_TYPE_SHADER_TYPE,
                       CLUTTER_FRAGMENT_SHADER,
                       CLUTTER_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);

  gobject_class->set_property = clutter_shader_effect_set_property;
  gobject_class->finalize = clutter_shader_effect_finalize;
  _clutter_object_class_install_properties (gobject_class,
                                            PROP_LAST,
                                            obj_props);

  meta_class->set_actor = clutter_shader_effect_set_actor;

  offscreen_class->paint_target = clutter_shader_effect_paint_target;
}
示例#4
0
static void
clutter_gesture_action_set_actor (ClutterActorMeta *meta,
                                  ClutterActor     *actor)
{
  ClutterGestureActionPrivate *priv = CLUTTER_GESTURE_ACTION (meta)->priv;
  ClutterActorMetaClass *meta_class =
    CLUTTER_ACTOR_META_CLASS (clutter_gesture_action_parent_class);

  if (priv->actor_capture_id != 0)
    {
      ClutterActor *old_actor = clutter_actor_meta_get_actor (meta);

      if (old_actor != NULL)
        g_signal_handler_disconnect (old_actor, priv->actor_capture_id);

      priv->actor_capture_id = 0;
    }

  if (priv->stage_capture_id != 0)
    {
      if (priv->stage != NULL)
        g_signal_handler_disconnect (priv->stage, priv->stage_capture_id);

      priv->stage_capture_id = 0;
      priv->stage = NULL;
    }

  if (actor != NULL)
    {
      priv->actor_capture_id =
        g_signal_connect (actor, "captured-event",
                          G_CALLBACK (actor_captured_event_cb),
                          meta);
    }

  meta_class->set_actor (meta, actor);
}
示例#5
0
/* Class initialization
 * Override functions in parent classes and define properties
 * and signals
 */
static void xfdashboard_tooltip_action_class_init(XfdashboardTooltipActionClass *klass)
{
	GObjectClass			*gobjectClass=G_OBJECT_CLASS(klass);
	ClutterActorMetaClass	*actorMetaClass=CLUTTER_ACTOR_META_CLASS(klass);

	/* Override functions */
	actorMetaClass->set_actor=_xfdashboard_tooltip_action_set_actor;

	gobjectClass->dispose=_xfdashboard_tooltip_action_dispose;
	gobjectClass->set_property=_xfdashboard_tooltip_action_set_property;
	gobjectClass->get_property=_xfdashboard_tooltip_action_get_property;

	/* Set up private structure */
	g_type_class_add_private(klass, sizeof (XfdashboardTooltipActionPrivate));

	/* Define properties */
	XfdashboardTooltipActionProperties[PROP_TOOLTIP_TEXT]=
		g_param_spec_string("tooltip-text",
								_("Tooltip text"),
								_("The text to display in a tooltip"),
								NULL,
								G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);

	g_object_class_install_properties(gobjectClass, PROP_LAST, XfdashboardTooltipActionProperties);

	/* Define signals */
	XfdashboardTooltipActionSignals[SIGNAL_ACTIVATING]=
		g_signal_new("activating",
						G_TYPE_FROM_CLASS(klass),
						G_SIGNAL_RUN_LAST | G_SIGNAL_NO_HOOKS,
						G_STRUCT_OFFSET(XfdashboardTooltipActionClass, activating),
						NULL,
						NULL,
						g_cclosure_marshal_VOID__VOID,
						G_TYPE_NONE,
						0);
}
static void
st_scroll_view_fade_class_init (StScrollViewFadeClass *klass)
{
  ClutterEffectClass *effect_class = CLUTTER_EFFECT_CLASS (klass);
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
  ClutterOffscreenEffectClass *offscreen_class;
  ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass);

  gobject_class->dispose = st_scroll_view_fade_dispose;
  gobject_class->get_property = st_scroll_view_fade_get_property;
  gobject_class->set_property = st_scroll_view_fade_set_property;

  meta_class->set_actor = st_scroll_view_fade_set_actor;

  effect_class->pre_paint = st_scroll_view_fade_pre_paint;

  offscreen_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (klass);
  offscreen_class->create_texture = st_scroll_view_fade_create_texture;
  offscreen_class->paint_target = st_scroll_view_fade_paint_target;

  g_object_class_install_property (gobject_class,
                                   PROP_VFADE_OFFSET,
                                   g_param_spec_float ("vfade-offset",
                                                       "Vertical Fade Offset",
                                                       "The height of the area which is faded at the edge",
                                                       0.f, G_MAXFLOAT, DEFAULT_FADE_OFFSET,
                                                       G_PARAM_READWRITE));
  g_object_class_install_property (gobject_class,
                                   PROP_HFADE_OFFSET,
                                   g_param_spec_float ("hfade-offset",
                                                       "Horizontal Fade Offset",
                                                       "The width of the area which is faded at the edge",
                                                       0.f, G_MAXFLOAT, DEFAULT_FADE_OFFSET,
                                                       G_PARAM_READWRITE));

}
示例#7
0
static void
clutter_click_action_class_init (ClutterClickActionClass *klass)
{
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
  ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass);

  meta_class->set_actor = clutter_click_action_set_actor;

  gobject_class->dispose = clutter_click_action_dispose;
  gobject_class->set_property = clutter_click_action_set_property;
  gobject_class->get_property = clutter_click_action_get_property;

  /**
   * ClutterClickAction:pressed:
   *
   * Whether the clickable actor should be in "pressed" state
   *
   * Since: 1.4
   */
  obj_props[PROP_PRESSED] =
    g_param_spec_boolean ("pressed",
                          P_("Pressed"),
                          P_("Whether the clickable should be in pressed state"),
                          FALSE,
                          CLUTTER_PARAM_READABLE);

  /**
   * ClutterClickAction:held:
   *
   * Whether the clickable actor has the pointer grabbed
   *
   * Since: 1.4
   */
  obj_props[PROP_HELD] =
    g_param_spec_boolean ("held",
                          P_("Held"),
                          P_("Whether the clickable has a grab"),
                          FALSE,
                          CLUTTER_PARAM_READABLE);

  /**
   * ClutterClickAction:long-press-duration:
   *
   * The minimum duration of a press for it to be recognized as a long
   * press gesture, in milliseconds.
   *
   * A value of -1 will make the #ClutterClickAction use the value of
   * the #ClutterSettings:long-press-duration property.
   *
   * Since: 1.8
   */
  obj_props[PROP_LONG_PRESS_DURATION] =
    g_param_spec_int ("long-press-duration",
                      P_("Long Press Duration"),
                      P_("The minimum duration of a long press to recognize the gesture"),
                      -1, G_MAXINT,
                      -1,
                      CLUTTER_PARAM_READWRITE);

  /**
   * ClutterClickAction:long-press-threshold:
   *
   * The maximum allowed distance that can be covered (on both axes) before
   * a long press gesture is cancelled, in pixels.
   *
   * A value of -1 will make the #ClutterClickAction use the value of
   * the #ClutterSettings:dnd-drag-threshold property.
   *
   * Since: 1.8
   */
  obj_props[PROP_LONG_PRESS_THRESHOLD] =
    g_param_spec_int ("long-press-threshold",
                      P_("Long Press Threshold"),
                      P_("The maximum threshold before a long press is cancelled"),
                      -1, G_MAXINT,
                      -1,
                      CLUTTER_PARAM_READWRITE);

  g_object_class_install_properties (gobject_class,
                                     PROP_LAST,
                                     obj_props);

  /**
   * ClutterClickAction::clicked:
   * @action: the #ClutterClickAction that emitted the signal
   * @actor: the #ClutterActor attached to the @action
   *
   * The ::clicked signal is emitted when the #ClutterActor to which
   * a #ClutterClickAction has been applied should respond to a
   * pointer button press and release events
   *
   * Since: 1.4
   */
  click_signals[CLICKED] =
    g_signal_new (I_("clicked"),
                  G_TYPE_FROM_CLASS (klass),
                  G_SIGNAL_RUN_LAST,
                  G_STRUCT_OFFSET (ClutterClickActionClass, clicked),
                  NULL, NULL,
                  _clutter_marshal_VOID__OBJECT,
                  G_TYPE_NONE, 1,
                  CLUTTER_TYPE_ACTOR);

  /**
   * ClutterClickAction::long-press:
   * @action: the #ClutterClickAction that emitted the signal
   * @actor: the #ClutterActor attached to the @action
   * @state: the long press state
   *
   * The ::long-press signal is emitted during the long press gesture
   * handling.
   *
   * This signal can be emitted multiple times with different states.
   *
   * The %CLUTTER_LONG_PRESS_QUERY state will be emitted on button presses,
   * and its return value will determine whether the long press handling
   * should be initiated. If the signal handlers will return %TRUE, the
   * %CLUTTER_LONG_PRESS_QUERY state will be followed either by a signal
   * emission with the %CLUTTER_LONG_PRESS_ACTIVATE state if the long press
   * constraints were respected, or by a signal emission with the
   * %CLUTTER_LONG_PRESS_CANCEL state if the long press was cancelled.
   *
   * It is possible to forcibly cancel a long press detection using
   * clutter_click_action_release().
   *
   * Return value: Only the %CLUTTER_LONG_PRESS_QUERY state uses the
   *   returned value of the handler; other states will ignore it
   *
   * Since: 1.8
   */
  click_signals[LONG_PRESS] =
    g_signal_new (I_("long-press"),
                  G_TYPE_FROM_CLASS (klass),
                  G_SIGNAL_RUN_LAST,
                  G_STRUCT_OFFSET (ClutterClickActionClass, long_press),
                  NULL, NULL,
                  _clutter_marshal_BOOLEAN__OBJECT_ENUM,
                  G_TYPE_BOOLEAN, 2,
                  CLUTTER_TYPE_ACTOR,
                  CLUTTER_TYPE_LONG_PRESS_STATE);
}
示例#8
0
static void
clutter_deform_effect_class_init (ClutterDeformEffectClass *klass)
{
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
  ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass);
  ClutterOffscreenEffectClass *offscreen_class = CLUTTER_OFFSCREEN_EFFECT_CLASS (klass);

  klass->deform_vertex = clutter_deform_effect_real_deform_vertex;

  /**
   * ClutterDeformEffect:x-tiles:
   *
   * The number of horizontal tiles. The bigger the number, the
   * smaller the tiles
   *
   * Since: 1.4
   */
  obj_props[PROP_X_TILES] =
    g_param_spec_uint ("x-tiles",
                       P_("Horizontal Tiles"),
                       P_("The number of horizontal tiles"),
                       1, G_MAXUINT,
                       DEFAULT_N_TILES,
                       CLUTTER_PARAM_READWRITE);

  /**
   * ClutterDeformEffect:y-tiles:
   *
   * The number of vertical tiles. The bigger the number, the
   * smaller the tiles
   *
   * Since: 1.4
   */
  obj_props[PROP_Y_TILES] =
    g_param_spec_uint ("y-tiles",
                       P_("Vertical Tiles"),
                       P_("The number of vertical tiles"),
                       1, G_MAXUINT,
                       DEFAULT_N_TILES,
                       CLUTTER_PARAM_READWRITE);

  /**
   * ClutterDeformEffect:back-material:
   *
   * A material to be used when painting the back of the actor
   * to which this effect has been applied
   *
   * By default, no material will be used
   *
   * Since: 1.4
   */
  obj_props[PROP_BACK_MATERIAL] =
    g_param_spec_boxed ("back-material",
                        P_("Back Material"),
                        P_("The material to be used when painting the back of the actor"),
                        COGL_TYPE_HANDLE,
                        CLUTTER_PARAM_READWRITE);

  gobject_class->finalize = clutter_deform_effect_finalize;
  gobject_class->set_property = clutter_deform_effect_set_property;
  gobject_class->get_property = clutter_deform_effect_get_property;
  g_object_class_install_properties (gobject_class,
                                     PROP_LAST,
                                     obj_props);

  meta_class->set_actor = clutter_deform_effect_set_actor;

  offscreen_class->paint_target = clutter_deform_effect_paint_target;
}
示例#9
0
static void
clutter_drag_action_class_init (ClutterDragActionClass *klass)
{
  ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass);
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);

  g_type_class_add_private (klass, sizeof (ClutterDragActionPrivate));

  meta_class->set_actor = clutter_drag_action_set_actor;

  klass->drag_motion = clutter_drag_action_real_drag_motion;

  /**
   * ClutterDragAction:x-drag-threshold:
   *
   * The horizontal threshold, in pixels, that begins a drag action
   *
   * When set to a non-zero value, #ClutterDragAction will only emit
   * #ClutterDragAction::drag-begin if the pointer has moved
   * horizontally at least of the given amount of pixels since
   * the button press event
   *
   * Since: 1.4
   */
  drag_props[PROP_X_DRAG_THRESHOLD] =
    g_param_spec_uint ("x-drag-threshold",
                       P_("Horizontal Drag Threshold"),
                       P_("The horizontal amount of pixels required to start dragging"),
                       0, G_MAXUINT,
                       0,
                       CLUTTER_PARAM_READWRITE);

  /**
   * ClutterDragAction:y-drag-threshold:
   *
   * The vertical threshold, in pixels, that begins a drag action
   *
   * When set to a non-zero value, #ClutterDragAction will only emit
   * #ClutterDragAction::drag-begin if the pointer has moved
   * vertically at least of the given amount of pixels since
   * the button press event
   *
   * Since: 1.4
   */
  drag_props[PROP_Y_DRAG_THRESHOLD] =
    g_param_spec_uint ("y-drag-threshold",
                       P_("Vertical Drag Threshold"),
                       P_("The vertical amount of pixels required to start dragging"),
                       0, G_MAXUINT,
                       0,
                       CLUTTER_PARAM_READWRITE);

  /**
   * ClutterDragAction:drag-handle:
   *
   * The #ClutterActor that is effectively being dragged
   *
   * A #ClutterDragAction will, be default, use the #ClutterActor that
   * has been attached to the action; it is possible to create a
   * separate #ClutterActor and use it instead.
   *
   * Setting this property has no effect on the #ClutterActor argument
   * passed to the #ClutterDragAction signals
   *
   * Since: 1.4
   */
  drag_props[PROP_DRAG_HANDLE] =
    g_param_spec_object ("drag-handle",
                         P_("Drag Handle"),
                         P_("The actor that is being dragged"),
                         CLUTTER_TYPE_ACTOR,
                         CLUTTER_PARAM_READWRITE);

  /**
   * ClutterDragAction:drag-axis:
   *
   * Constraints the dragging action to the specified axis
   *
   * Since: 1.4
   */
  drag_props[PROP_DRAG_AXIS] =
    g_param_spec_enum ("drag-axis",
                       P_("Drag Axis"),
                       P_("Constraints the dragging to an axis"),
                       CLUTTER_TYPE_DRAG_AXIS,
                       CLUTTER_DRAG_AXIS_NONE,
                       CLUTTER_PARAM_READWRITE);

  gobject_class->set_property = clutter_drag_action_set_property;
  gobject_class->get_property = clutter_drag_action_get_property;
  gobject_class->dispose = clutter_drag_action_dispose;
  _clutter_object_class_install_properties (gobject_class,
                                            PROP_LAST,
                                            drag_props);

  /**
   * ClutterDragAction::drag-begin:
   * @action: the #ClutterDragAction that emitted the signal
   * @actor: the #ClutterActor attached to the action
   * @event_x: the X coordinate (in stage space) of the press event
   * @event_y: the Y coordinate (in stage space) of the press event
   * @modifiers: the modifiers of the press event
   *
   * The ::drag-begin signal is emitted when the #ClutterDragAction
   * starts the dragging
   *
   * The emission of this signal can be delayed by using the
   * #ClutterDragAction:x-drag-threshold and
   * #ClutterDragAction:y-drag-threshold properties
   *
   * Since: 1.4
   */
  drag_signals[DRAG_BEGIN] =
    g_signal_new (I_("drag-begin"),
                  CLUTTER_TYPE_DRAG_ACTION,
                  G_SIGNAL_RUN_LAST,
                  G_STRUCT_OFFSET (ClutterDragActionClass, drag_begin),
                  NULL, NULL,
                  _clutter_marshal_VOID__OBJECT_FLOAT_FLOAT_FLAGS,
                  G_TYPE_NONE, 4,
                  CLUTTER_TYPE_ACTOR,
                  G_TYPE_FLOAT,
                  G_TYPE_FLOAT,
                  CLUTTER_TYPE_MODIFIER_TYPE);

  /**
   * ClutterDragAction::drag-motion
   * @action: the #ClutterDragAction that emitted the signal
   * @actor: the #ClutterActor attached to the action
   * @delta_x: the X component of the distance between the press event
   *   that began the dragging and the current position of the pointer,
   *   as of the latest motion event
   * @delta_y: the Y component of the distance between the press event
   *   that began the dragging and the current position of the pointer,
   *   as of the latest motion event
   *
   * The ::drag-motion signal is emitted for each motion event after
   * the #ClutterDragAction::drag-begin signal has been emitted.
   *
   * The components of the distance between the press event and the
   * latest motion event are computed in the actor's coordinate space,
   * to take into account eventual transformations. If you want the
   * stage coordinates of the latest motion event you can use
   * clutter_drag_action_get_motion_coords().
   *
   * The default handler of the signal will call clutter_actor_move_by()
   * either on @actor or, if set, of #ClutterDragAction:drag-handle using
   * the @delta_x and @delta_y components of the dragging motion. If you
   * want to override the default behaviour, you can connect to this
   * signal and call g_signal_stop_emission_by_name() from within your
   * callback.
   *
   * Since: 1.4
   */
  drag_signals[DRAG_MOTION] =
    g_signal_new (I_("drag-motion"),
                  CLUTTER_TYPE_DRAG_ACTION,
                  G_SIGNAL_RUN_LAST,
                  G_STRUCT_OFFSET (ClutterDragActionClass, drag_motion),
                  NULL, NULL,
                  _clutter_marshal_VOID__OBJECT_FLOAT_FLOAT,
                  G_TYPE_NONE, 3,
                  CLUTTER_TYPE_ACTOR,
                  G_TYPE_FLOAT,
                  G_TYPE_FLOAT);

  /**
   * ClutterDragAction::drag-end:
   * @action: the #ClutterDragAction that emitted the signal
   * @actor: the #ClutterActor attached to the action
   * @event_x: the X coordinate (in stage space) of the release event
   * @event_y: the Y coordinate (in stage space) of the release event
   * @modifiers: the modifiers of the release event
   *
   * The ::drag-end signal is emitted at the end of the dragging,
   * when the pointer button's is released
   *
   * This signal is emitted if and only if the #ClutterDragAction::drag-begin
   * signal has been emitted first
   *
   * Since: 1.4
   */
  drag_signals[DRAG_END] =
    g_signal_new (I_("drag-end"),
                  CLUTTER_TYPE_DRAG_ACTION,
                  G_SIGNAL_RUN_LAST,
                  G_STRUCT_OFFSET (ClutterDragActionClass, drag_end),
                  NULL, NULL,
                  _clutter_marshal_VOID__OBJECT_FLOAT_FLOAT_FLAGS,
                  G_TYPE_NONE, 4,
                  CLUTTER_TYPE_ACTOR,
                  G_TYPE_FLOAT,
                  G_TYPE_FLOAT,
                  CLUTTER_TYPE_MODIFIER_TYPE);
}
示例#10
0
/* Class initialization
 * Override functions in parent classes and define properties
 * and signals
 */
static void xfdashboard_click_action_class_init(XfdashboardClickActionClass *klass)
{
    GObjectClass			*gobjectClass=G_OBJECT_CLASS(klass);
    ClutterActorMetaClass	*actorMetaClass=CLUTTER_ACTOR_META_CLASS(klass);

    /* Override functions */
    actorMetaClass->set_actor=_xfdashboard_click_action_set_actor;

    gobjectClass->set_property=_xfdashboard_click_action_set_property;
    gobjectClass->get_property=_xfdashboard_click_action_get_property;

    /* Set up private structure */
    g_type_class_add_private(klass, sizeof (XfdashboardClickActionPrivate));

    /* Define properties */
    /**
     * XfdashboardClickAction:pressed:
     *
     * Whether the clickable actor should be in "pressed" state
     */
    XfdashboardClickActionProperties[PROP_PRESSED]=
        g_param_spec_boolean("pressed",
                             _("Pressed"),
                             _("Whether the clickable should be in pressed state"),
                             FALSE,
                             G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);

    /**
     * XfdashboardClickAction:held:
     *
     * Whether the clickable actor has the pointer grabbed
     */
    XfdashboardClickActionProperties[PROP_HELD]=
        g_param_spec_boolean("held",
                             _("Held"),
                             _("Whether the clickable has a grab"),
                             FALSE,
                             G_PARAM_READABLE | G_PARAM_STATIC_STRINGS);

    /**
     * XfdashboardClickAction:long-press-duration:
     *
     * The minimum duration of a press for it to be recognized as a long press
     * gesture, in milliseconds.
     *
     * A value of -1 will make the #XfdashboardClickAction use the value of the
     * #ClutterSettings:long-press-duration property.
     */
    XfdashboardClickActionProperties[PROP_LONG_PRESS_DURATION]=
        g_param_spec_int("long-press-duration",
                         _("Long Press Duration"),
                         _("The minimum duration of a long press to recognize the gesture"),
                         -1,
                         G_MAXINT,
                         -1,
                         G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);

    /**
     * XfdashboardClickAction:long-press-threshold:
     *
     * The maximum allowed distance that can be covered (on both axes) before
     * a long press gesture is cancelled, in pixels.
     *
     * A value of -1 will make the #XfdashboardClickAction use the value of the
     * #ClutterSettings:dnd-drag-threshold property.
     */
    XfdashboardClickActionProperties[PROP_LONG_PRESS_THRESHOLD]=
        g_param_spec_int("long-press-threshold",
                         _("Long Press Threshold"),
                         _("The maximum threshold before a long press is cancelled"),
                         -1,
                         G_MAXINT,
                         -1,
                         G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS);

    g_object_class_install_properties(gobjectClass, PROP_LAST, XfdashboardClickActionProperties);

    /* Define signals */
    /**
     * XfdashboardClickAction::clicked:
     * @self: The #XfdashboardClickAction that emitted the signal
     * @inActor: The #ClutterActor attached to @self
     *
     * The ::clicked signal is emitted when the #ClutterActor to which
     * a #XfdashboardClickAction has been applied should respond to a
     * pointer button press and release events
     */
    XfdashboardClickActionSignals[SIGNAL_CLICKED]=
        g_signal_new("clicked",
                     G_TYPE_FROM_CLASS(klass),
                     G_SIGNAL_RUN_LAST,
                     G_STRUCT_OFFSET(XfdashboardClickActionClass, clicked),
                     NULL, NULL,
                     g_cclosure_marshal_VOID__OBJECT,
                     G_TYPE_NONE,
                     1,
                     CLUTTER_TYPE_ACTOR);

    /**
     * XfdashboardClickAction::long-press:
     * @self: The #XfdashboardClickAction that emitted the signal
     * @inActor: The #ClutterActor attached to @self
     * @inState: The long press state
     *
     * The ::long-press signal is emitted during the long press gesture
     * handling.
     *
     * This signal can be emitted multiple times with different states.
     *
     * The %CLUTTER_LONG_PRESS_QUERY state will be emitted on button presses,
     * and its return value will determine whether the long press handling
     * should be initiated. If the signal handlers will return %TRUE, the
     * %CLUTTER_LONG_PRESS_QUERY state will be followed either by a signal
     * emission with the %CLUTTER_LONG_PRESS_ACTIVATE state if the long press
     * constraints were respected, or by a signal emission with the
     * %CLUTTER_LONG_PRESS_CANCEL state if the long press was cancelled.
     *
     * It is possible to forcibly cancel a long press detection using
     * xfdashboard_click_action_release().
     *
     * Return value: Only the %CLUTTER_LONG_PRESS_QUERY state uses the
     *   returned value of the handler; other states will ignore it
     */
    XfdashboardClickActionSignals[SIGNAL_LONG_PRESS]=
        g_signal_new("long-press",
                     G_TYPE_FROM_CLASS(klass),
                     G_SIGNAL_RUN_LAST,
                     G_STRUCT_OFFSET(XfdashboardClickActionClass, long_press),
                     NULL, NULL,
                     _xfdashboard_marshal_BOOLEAN__OBJECT_ENUM,
                     G_TYPE_BOOLEAN,
                     2,
                     CLUTTER_TYPE_ACTOR,
                     CLUTTER_TYPE_LONG_PRESS_STATE);
}
示例#11
0
static void
clutter_gesture_action_class_init (ClutterGestureActionClass *klass)
{
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
  ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass);

  gobject_class->finalize = clutter_gesture_action_finalize;
  gobject_class->set_property = clutter_gesture_action_set_property;
  gobject_class->get_property = clutter_gesture_action_get_property;

  meta_class->set_actor = clutter_gesture_action_set_actor;

  klass->gesture_begin = default_event_handler;
  klass->gesture_progress = default_event_handler;
  klass->gesture_prepare = default_event_handler;

  /**
   * ClutterGestureAction:n-touch-points:
   *
   * Number of touch points to trigger a gesture action.
   *
   * Since: 1.16
   */
  gesture_props[PROP_N_TOUCH_POINTS] =
    g_param_spec_int ("n-touch-points",
                      P_("Number touch points"),
                      P_("Number of touch points"),
                      1, G_MAXINT, 1,
                      CLUTTER_PARAM_READWRITE);

  /**
   * ClutterGestureAction:threshold-trigger-edge:
   *
   * The trigger edge to be used by the action to either emit the
   * #ClutterGestureAction::gesture-begin signal or to emit the
   * #ClutterGestureAction::gesture-cancel signal.
   *
   * Since: 1.18
   */
  gesture_props[PROP_THRESHOLD_TRIGGER_EDGE] =
    g_param_spec_enum ("threshold-trigger-edge",
                       P_("Threshold Trigger Edge"),
                       P_("The trigger edge used by the action"),
                       CLUTTER_TYPE_GESTURE_TRIGGER_EDGE,
                       CLUTTER_GESTURE_TRIGGER_EDGE_NONE,
                       CLUTTER_PARAM_READWRITE |
                       G_PARAM_CONSTRUCT_ONLY);

  /**
   * ClutterGestureAction:threshold-trigger-distance-x:
   *
   * The horizontal trigger distance to be used by the action to either
   * emit the #ClutterGestureAction::gesture-begin signal or to emit
   * the #ClutterGestureAction::gesture-cancel signal.
   *
   * A negative value will be interpreted as the default drag threshold.
   *
   * Since: 1.18
   */
  gesture_props[PROP_THRESHOLD_TRIGGER_DISTANCE_X] =
    g_param_spec_float ("threshold-trigger-distance-x",
                        P_("Threshold Trigger Horizontal Distance"),
                        P_("The horizontal trigger distance used by the action"),
                        -1.0, G_MAXFLOAT, -1.0,
                        CLUTTER_PARAM_READWRITE |
                        G_PARAM_CONSTRUCT_ONLY);

  /**
   * ClutterGestureAction:threshold-trigger-distance-y:
   *
   * The vertical trigger distance to be used by the action to either
   * emit the #ClutterGestureAction::gesture-begin signal or to emit
   * the #ClutterGestureAction::gesture-cancel signal.
   *
   * A negative value will be interpreted as the default drag threshold.
   *
   * Since: 1.18
   */
  gesture_props[PROP_THRESHOLD_TRIGGER_DISTANCE_Y] =
    g_param_spec_float ("threshold-trigger-distance-y",
                        P_("Threshold Trigger Vertical Distance"),
                        P_("The vertical trigger distance used by the action"),
                        -1.0, G_MAXFLOAT, -1.0,
                        CLUTTER_PARAM_READWRITE |
                        G_PARAM_CONSTRUCT_ONLY);

  g_object_class_install_properties (gobject_class,
                                     PROP_LAST,
                                     gesture_props);

  /**
   * ClutterGestureAction::gesture-begin:
   * @action: the #ClutterGestureAction that emitted the signal
   * @actor: the #ClutterActor attached to the @action
   *
   * The ::gesture_begin signal is emitted when the #ClutterActor to which
   * a #ClutterGestureAction has been applied starts receiving a gesture.
   *
   * Return value: %TRUE if the gesture should start, and %FALSE if
   *   the gesture should be ignored.
   *
   * Since: 1.8
   */
  gesture_signals[GESTURE_BEGIN] =
    g_signal_new (I_("gesture-begin"),
                  G_TYPE_FROM_CLASS (klass),
                  G_SIGNAL_RUN_LAST,
                  G_STRUCT_OFFSET (ClutterGestureActionClass, gesture_begin),
                  _clutter_boolean_continue_accumulator, NULL,
                  _clutter_marshal_BOOLEAN__OBJECT,
                  G_TYPE_BOOLEAN, 1,
                  CLUTTER_TYPE_ACTOR);

  /**
   * ClutterGestureAction::gesture-progress:
   * @action: the #ClutterGestureAction that emitted the signal
   * @actor: the #ClutterActor attached to the @action
   *
   * The ::gesture-progress signal is emitted for each motion event after
   * the #ClutterGestureAction::gesture-begin signal has been emitted.
   *
   * Return value: %TRUE if the gesture should continue, and %FALSE if
   *   the gesture should be cancelled.
   *
   * Since: 1.8
   */
  gesture_signals[GESTURE_PROGRESS] =
    g_signal_new (I_("gesture-progress"),
                  G_TYPE_FROM_CLASS (klass),
                  G_SIGNAL_RUN_LAST,
                  G_STRUCT_OFFSET (ClutterGestureActionClass, gesture_progress),
                  _clutter_boolean_continue_accumulator, NULL,
                  _clutter_marshal_BOOLEAN__OBJECT,
                  G_TYPE_BOOLEAN, 1,
                  CLUTTER_TYPE_ACTOR);

  /**
   * ClutterGestureAction::gesture-end:
   * @action: the #ClutterGestureAction that emitted the signal
   * @actor: the #ClutterActor attached to the @action
   *
   * The ::gesture-end signal is emitted at the end of the gesture gesture,
   * when the pointer's button is released
   *
   * This signal is emitted if and only if the #ClutterGestureAction::gesture-begin
   * signal has been emitted first.
   *
   * Since: 1.8
   */
  gesture_signals[GESTURE_END] =
    g_signal_new (I_("gesture-end"),
                  G_TYPE_FROM_CLASS (klass),
                  G_SIGNAL_RUN_LAST,
                  G_STRUCT_OFFSET (ClutterGestureActionClass, gesture_end),
                  NULL, NULL,
                  _clutter_marshal_VOID__OBJECT,
                  G_TYPE_NONE, 1,
                  CLUTTER_TYPE_ACTOR);

  /**
   * ClutterGestureAction::gesture-cancel:
   * @action: the #ClutterGestureAction that emitted the signal
   * @actor: the #ClutterActor attached to the @action
   *
   * The ::gesture-cancel signal is emitted when the ongoing gesture gets
   * cancelled from the #ClutterGestureAction::gesture-progress signal handler.
   *
   * This signal is emitted if and only if the #ClutterGestureAction::gesture-begin
   * signal has been emitted first.
   *
   * Since: 1.8
   */
  gesture_signals[GESTURE_CANCEL] =
    g_signal_new (I_("gesture-cancel"),
                  G_TYPE_FROM_CLASS (klass),
                  G_SIGNAL_RUN_LAST,
                  G_STRUCT_OFFSET (ClutterGestureActionClass, gesture_cancel),
                  NULL, NULL,
                  _clutter_marshal_VOID__OBJECT,
                  G_TYPE_NONE, 1,
                  CLUTTER_TYPE_ACTOR);
}
示例#12
0
/* Called when attaching and detaching a ClutterActorMeta instance to a ClutterActor */
static void _xfdashboard_tooltip_action_set_actor(ClutterActorMeta *inActorMeta, ClutterActor *inActor)
{
	XfdashboardTooltipAction			*self;
	XfdashboardTooltipActionPrivate		*priv;
	ClutterActor						*oldActor;

	g_return_if_fail(XFDASHBOARD_IS_TOOLTIP_ACTION(inActorMeta));

	self=XFDASHBOARD_TOOLTIP_ACTION(inActorMeta);
	priv=self->priv;

	/* Get current actor this action belongs to */
	oldActor=clutter_actor_meta_get_actor(CLUTTER_ACTOR_META(self));

	/* Do nothing if new actor to set is the current one */
	if(oldActor==inActor) return;

	/* Release signals */
	if(priv->enterSignalID!=0)
	{
		if(oldActor!=NULL) g_signal_handler_disconnect(oldActor, priv->enterSignalID);
		priv->enterSignalID=0;
	}

	if(priv->motionSignalID!=0)
	{
		if(oldActor!=NULL) g_signal_handler_disconnect(oldActor, priv->motionSignalID);
		priv->motionSignalID=0;
	}

	if(priv->leaveSignalID!=0)
	{
		if(oldActor!=NULL) g_signal_handler_disconnect(oldActor, priv->leaveSignalID);
		priv->leaveSignalID=0;
	}

	if(priv->captureSignalID)
	{
		if(priv->captureSignalActor) g_signal_handler_disconnect(priv->captureSignalActor, priv->captureSignalID);
		priv->captureSignalActor=NULL;
		priv->captureSignalID=0;
	}

	/* Release sources */
	if(priv->timeoutSourceID!=0)
	{
		g_source_remove(priv->timeoutSourceID);
		priv->timeoutSourceID=0;
	}

	/* Connect signals */
	if(inActor!=NULL)
	{
		priv->enterSignalID=g_signal_connect_swapped(inActor,
													"enter-event",
													G_CALLBACK(_xfdashboard_tooltip_action_on_enter_event),
													self);
	}

	/* Call parent's class method */
	if(CLUTTER_ACTOR_META_CLASS(xfdashboard_tooltip_action_parent_class)->set_actor)
	{
		CLUTTER_ACTOR_META_CLASS(xfdashboard_tooltip_action_parent_class)->set_actor(inActorMeta, inActor);
	}
}
示例#13
0
static void
clutter_snap_constraint_class_init (ClutterSnapConstraintClass *klass)
{
  ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass);
  ClutterConstraintClass *constraint_class = CLUTTER_CONSTRAINT_CLASS (klass);
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);

  meta_class->set_actor = clutter_snap_constraint_set_actor;

  constraint_class->update_allocation = clutter_snap_constraint_update_allocation;
  /**
   * ClutterSnapConstraint:source:
   *
   * The #ClutterActor used as the source for the constraint
   *
   *
   */
  obj_props[PROP_SOURCE] =
    g_param_spec_object ("source",
                         P_("Source"),
                         P_("The source of the constraint"),
                         CLUTTER_TYPE_ACTOR,
                         CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);

  /**
   * ClutterSnapConstraint:from-edge:
   *
   * The edge of the #ClutterActor that should be snapped
   *
   *
   */
  obj_props[PROP_FROM_EDGE] =
    g_param_spec_enum ("from-edge",
                       P_("From Edge"),
                       P_("The edge of the actor that should be snapped"),
                       CLUTTER_TYPE_SNAP_EDGE,
                       CLUTTER_SNAP_EDGE_RIGHT,
                       CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);

  /**
   * ClutterSnapConstraint:to-edge:
   *
   * The edge of the #ClutterSnapConstraint:source that should be snapped
   *
   *
   */
  obj_props[PROP_TO_EDGE] =
    g_param_spec_enum ("to-edge",
                       P_("To Edge"),
                       P_("The edge of the source that should be snapped"),
                       CLUTTER_TYPE_SNAP_EDGE,
                       CLUTTER_SNAP_EDGE_RIGHT,
                       CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);

  /**
   * ClutterSnapConstraint:offset:
   *
   * The offset, in pixels, between #ClutterSnapConstraint:from-edge
   * and #ClutterSnapConstraint:to-edge
   *
   *
   */
  obj_props[PROP_OFFSET] =
    g_param_spec_float ("offset",
                        P_("Offset"),
                        P_("The offset in pixels to apply to the constraint"),
                        -G_MAXFLOAT, G_MAXFLOAT,
                        0.0f,
                        CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);

  gobject_class->dispose = clutter_snap_constraint_dispose;
  gobject_class->set_property = clutter_snap_constraint_set_property;
  gobject_class->get_property = clutter_snap_constraint_get_property;
  g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
}
示例#14
0
/* Class initialization
 * Override functions in parent classes and define properties
 * and signals
 */
void xfdashboard_drop_action_class_init(XfdashboardDropActionClass *klass)
{
	ClutterActorMetaClass		*actorMetaClass=CLUTTER_ACTOR_META_CLASS(klass);

	/* Override functions */
	actorMetaClass->set_actor=_xfdashboard_drop_action_set_actor;

	klass->begin=_xfdashboard_drop_action_class_real_begin;
	klass->end=_xfdashboard_drop_action_class_real_end;
	klass->can_drop=_xfdashboard_drop_action_class_real_can_drop;
	klass->drop=_xfdashboard_drop_action_class_real_drop;
	klass->drag_enter=_xfdashboard_drop_action_class_real_drag_enter;
	klass->drag_leave=_xfdashboard_drop_action_class_real_drag_leave;

	/* Set up private structure */
	g_type_class_add_private(klass, sizeof(XfdashboardDropActionPrivate));

	/* Define signals */
	XfdashboardDropActionSignals[SIGNAL_BEGIN]=
		g_signal_new("begin",
						G_TYPE_FROM_CLASS(klass),
						G_SIGNAL_RUN_LAST,
						G_STRUCT_OFFSET(XfdashboardDropActionClass, begin),
						_xfdashboard_drop_action_stop_signal_on_first_false,
						NULL,
						_xfdashboard_marshal_BOOLEAN__OBJECT,
						G_TYPE_BOOLEAN,
						1,
						XFDASHBOARD_TYPE_DRAG_ACTION);

	XfdashboardDropActionSignals[SIGNAL_CAN_DROP]=
		g_signal_new("can-drop",
						G_TYPE_FROM_CLASS(klass),
						G_SIGNAL_RUN_LAST,
						G_STRUCT_OFFSET(XfdashboardDropActionClass, can_drop),
						_xfdashboard_drop_action_stop_signal_on_first_false,
						NULL,
						_xfdashboard_marshal_BOOLEAN__OBJECT_FLOAT_FLOAT,
						G_TYPE_BOOLEAN,
						3,
						XFDASHBOARD_TYPE_DRAG_ACTION,
						G_TYPE_FLOAT,
						G_TYPE_FLOAT);

	XfdashboardDropActionSignals[SIGNAL_DROP]=
		g_signal_new("drop",
						G_TYPE_FROM_CLASS(klass),
						G_SIGNAL_RUN_LAST,
						G_STRUCT_OFFSET(XfdashboardDropActionClass, drop),
						NULL,
						NULL,
						_xfdashboard_marshal_VOID__OBJECT_FLOAT_FLOAT,
						G_TYPE_NONE,
						3,
						XFDASHBOARD_TYPE_DRAG_ACTION,
						G_TYPE_FLOAT,
						G_TYPE_FLOAT);

	XfdashboardDropActionSignals[SIGNAL_END]=
		g_signal_new("end",
						G_TYPE_FROM_CLASS(klass),
						G_SIGNAL_RUN_LAST,
						G_STRUCT_OFFSET(XfdashboardDropActionClass, end),
						NULL,
						NULL,
						g_cclosure_marshal_VOID__OBJECT,
						G_TYPE_NONE,
						1,
						XFDASHBOARD_TYPE_DRAG_ACTION);

	XfdashboardDropActionSignals[SIGNAL_DRAG_ENTER]=
		g_signal_new("drag-enter",
						G_TYPE_FROM_CLASS(klass),
						G_SIGNAL_RUN_LAST,
						G_STRUCT_OFFSET(XfdashboardDropActionClass, drag_enter),
						NULL,
						NULL,
						g_cclosure_marshal_VOID__OBJECT,
						G_TYPE_NONE,
						1,
						XFDASHBOARD_TYPE_DRAG_ACTION);

	XfdashboardDropActionSignals[SIGNAL_DRAG_MOTION]=
		g_signal_new("drag-motion",
						G_TYPE_FROM_CLASS(klass),
						G_SIGNAL_RUN_LAST,
						G_STRUCT_OFFSET(XfdashboardDropActionClass, drag_motion),
						NULL,
						NULL,
						_xfdashboard_marshal_VOID__OBJECT_FLOAT_FLOAT,
						G_TYPE_NONE,
						3,
						XFDASHBOARD_TYPE_DRAG_ACTION,
						G_TYPE_FLOAT,
						G_TYPE_FLOAT);

	XfdashboardDropActionSignals[SIGNAL_DRAG_LEAVE]=
		g_signal_new("drag-leave",
						G_TYPE_FROM_CLASS(klass),
						G_SIGNAL_RUN_LAST,
						G_STRUCT_OFFSET(XfdashboardDropActionClass, drag_leave),
						NULL,
						NULL,
						g_cclosure_marshal_VOID__OBJECT,
						G_TYPE_NONE,
						1,
						XFDASHBOARD_TYPE_DRAG_ACTION);
}
示例#15
0
static void
clutter_path_constraint_class_init (ClutterPathConstraintClass *klass)
{
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
  ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass);
  ClutterConstraintClass *constraint_class = CLUTTER_CONSTRAINT_CLASS (klass);

  /**
   * ClutterPathConstraint:path:
   *
   * The #ClutterPath used to constrain the position of an actor.
   *
   * Since: 1.6
   */
  path_properties[PROP_PATH] =
    g_param_spec_object ("path",
                         P_("Path"),
                         P_("The path used to constrain an actor"),
                         CLUTTER_TYPE_PATH,
                         CLUTTER_PARAM_READWRITE);

  /**
   * ClutterPathConstraint:offset:
   *
   * The offset along the #ClutterPathConstraint:path, between -1.0 and 2.0.
   *
   * Since: 1.6
   */
  path_properties[PROP_OFFSET] =
    g_param_spec_float ("offset",
                        P_("Offset"),
                        P_("The offset along the path, between -1.0 and 2.0"),
                        -1.0, 2.0,
                        0.0,
                        CLUTTER_PARAM_READWRITE);

  gobject_class->set_property = clutter_path_constraint_set_property;
  gobject_class->get_property = clutter_path_constraint_get_property;
  gobject_class->dispose = clutter_path_constraint_dispose;
  _clutter_object_class_install_properties (gobject_class,
                                            LAST_PROPERTY,
                                            path_properties);

  meta_class->set_actor = clutter_path_constraint_set_actor;

  constraint_class->update_allocation = clutter_path_constraint_update_allocation;

  /**
   * ClutterPathConstraint::node-reached:
   * @constraint: the #ClutterPathConstraint that emitted the signal
   * @actor: the #ClutterActor using the @constraint
   * @index: the index of the node that has been reached
   *
   * The ::node-reached signal is emitted each time a
   * #ClutterPathConstraint:offset value results in the actor
   * passing a #ClutterPathNode
   *
   * Since: 1.6
   */
  path_signals[NODE_REACHED] =
    g_signal_new (I_("node-reached"),
                  G_TYPE_FROM_CLASS (klass),
                  G_SIGNAL_RUN_LAST,
                  0,
                  NULL, NULL,
                  _clutter_marshal_VOID__OBJECT_UINT,
                  G_TYPE_NONE, 2,
                  CLUTTER_TYPE_ACTOR,
                  G_TYPE_UINT);
}
示例#16
0
static void
clutter_align_constraint_class_init (ClutterAlignConstraintClass *klass)
{
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
  ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass);
  ClutterConstraintClass *constraint_class = CLUTTER_CONSTRAINT_CLASS (klass);

  meta_class->set_actor = clutter_align_constraint_set_actor;

  constraint_class->update_allocation = clutter_align_constraint_update_allocation;

  /**
   * ClutterAlignConstraint:source:
   *
   * The #ClutterActor used as the source for the alignment
   *
   * Since: 1.4
   */
  obj_props[PROP_SOURCE] =
    g_param_spec_object ("source",
                           P_("Source"),
                           P_("The source of the alignment"),
                           CLUTTER_TYPE_ACTOR,
                           CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);

  /**
   * ClutterAlignConstraint:align-axis:
   *
   * The axis to be used to compute the alignment
   *
   * Since: 1.4
   */
  obj_props[PROP_ALIGN_AXIS] =
    g_param_spec_enum ("align-axis",
                       P_("Align Axis"),
                       P_("The axis to align the position to"),
                       CLUTTER_TYPE_ALIGN_AXIS,
                       CLUTTER_ALIGN_X_AXIS,
                       CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);

  /**
   * ClutterAlignConstraint:factor:
   *
   * The alignment factor, as a normalized value between 0.0 and 1.0
   *
   * The factor depends on the #ClutterAlignConstraint:align-axis property:
   * with an align-axis value of %CLUTTER_ALIGN_X_AXIS, 0.0 means left and
   * 1.0 means right; with a value of %CLUTTER_ALIGN_Y_AXIS, 0.0 means top
   * and 1.0 means bottom.
   *
   * Since: 1.4
   */
  obj_props[PROP_FACTOR] =
    g_param_spec_float ("factor",
                        P_("Factor"),
                        P_("The alignment factor, between 0.0 and 1.0"),
                        0.0, 1.0,
                        0.0,
                        CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);

  gobject_class->dispose = clutter_align_constraint_dispose;
  gobject_class->set_property = clutter_align_constraint_set_property;
  gobject_class->get_property = clutter_align_constraint_get_property;
  g_object_class_install_properties (gobject_class, PROP_LAST, obj_props);
}
static void
clutter_bind_constraint_class_init (ClutterBindConstraintClass *klass)
{
  ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass);
  ClutterConstraintClass *constraint_class = CLUTTER_CONSTRAINT_CLASS (klass);
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);

  gobject_class->set_property = clutter_bind_constraint_set_property;
  gobject_class->get_property = clutter_bind_constraint_get_property;
  gobject_class->dispose = clutter_bind_constraint_dispose;

  meta_class->set_actor = clutter_bind_constraint_set_actor;

  constraint_class->update_allocation = clutter_bind_constraint_update_allocation;
  /**
   * ClutterBindConstraint:source:
   *
   * The #ClutterActor used as the source for the binding.
   *
   * The #ClutterActor must not be contained inside the actor associated
   * to the constraint.
   *
   * Since: 1.4
   */
  obj_props[PROP_SOURCE] =
    g_param_spec_object ("source",
                         P_("Source"),
                         P_("The source of the binding"),
                         CLUTTER_TYPE_ACTOR,
                         CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);

  /**
   * ClutterBindConstraint:coordinate:
   *
   * The coordinate to be bound
   *
   * Since: 1.4
   */
  obj_props[PROP_COORDINATE] =
    g_param_spec_enum ("coordinate",
                       P_("Coordinate"),
                       P_("The coordinate to bind"),
                       CLUTTER_TYPE_BIND_COORDINATE,
                       CLUTTER_BIND_X,
                       CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);

  /**
   * ClutterBindConstraint:offset:
   *
   * The offset, in pixels, to be applied to the binding
   *
   * Since: 1.4
   */
  obj_props[PROP_OFFSET] =
    g_param_spec_float ("offset",
                        P_("Offset"),
                        P_("The offset in pixels to apply to the binding"),
                        -G_MAXFLOAT, G_MAXFLOAT,
                        0.0f,
                        CLUTTER_PARAM_READWRITE | G_PARAM_CONSTRUCT);

  g_object_class_install_properties (gobject_class,
                                     PROP_LAST,
                                     obj_props);
}
示例#18
0
static void
clutter_pan_action_class_init (ClutterPanActionClass *klass)
{
  GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
  ClutterActorMetaClass *meta_class = CLUTTER_ACTOR_META_CLASS (klass);
  ClutterGestureActionClass *gesture_class =
      CLUTTER_GESTURE_ACTION_CLASS (klass);

  g_type_class_add_private (klass, sizeof (ClutterPanActionPrivate));

  klass->pan = clutter_pan_action_real_pan;

  gesture_class->gesture_prepare = gesture_prepare;
  gesture_class->gesture_begin = gesture_begin;
  gesture_class->gesture_progress = gesture_progress;
  gesture_class->gesture_cancel = gesture_cancel;
  gesture_class->gesture_end = gesture_end;

  meta_class->set_actor = clutter_pan_action_set_actor;

  /**
   * ClutterPanAction:pan-axis:
   *
   * Constraints the panning action to the specified axis
   */
  pan_props[PROP_PAN_AXIS] =
    g_param_spec_enum ("pan-axis",
                       P_("Pan Axis"),
                       P_("Constraints the panning to an axis"),
                       CLUTTER_TYPE_PAN_AXIS,
                       CLUTTER_PAN_AXIS_NONE,
                       CLUTTER_PARAM_READWRITE);

  /**
   * ClutterPanAction:interpolate:
   *
   * Whether interpolated events emission is enabled.
   */
  pan_props[PROP_INTERPOLATE] =
    g_param_spec_boolean ("interpolate",
                          P_("Interpolate"),
                          P_("Whether interpolated events emission is enabled."),
                          FALSE,
                          CLUTTER_PARAM_READWRITE);

  /**
   * ClutterPanAction:deceleration:
   *
   * The rate at which the interpolated panning will decelerate in
   *
   * #ClutterPanAction will emit interpolated ::pan events with decreasing
   * scroll deltas, using the rate specified by this property.
   */
  pan_props[PROP_DECELERATION] =
    g_param_spec_double ("deceleration",
                         P_("Deceleration"),
                         P_("Rate at which the interpolated panning will decelerate in"),
                         FLOAT_EPSILON, 1.0, default_deceleration_rate,
                         CLUTTER_PARAM_READWRITE);

  /**
   * ClutterPanAction:acceleration-factor:
   *
   * The initial acceleration factor
   *
   * The kinetic momentum measured at the time of releasing the pointer will
   * be multiplied by the factor specified by this property before being used
   * to generate interpolated ::pan events.
   */
  pan_props[PROP_ACCELERATION_FACTOR] =
    g_param_spec_double ("acceleration-factor",
                         P_("Initial acceleration factor"),
                         P_("Factor applied to the momentum when starting the interpolated phase"),
                         1.0, G_MAXDOUBLE, default_acceleration_factor,
                         CLUTTER_PARAM_READWRITE);

  gobject_class->set_property = clutter_pan_action_set_property;
  gobject_class->get_property = clutter_pan_action_get_property;
  gobject_class->dispose = clutter_pan_action_dispose;
  g_object_class_install_properties  (gobject_class,
                                      PROP_LAST,
                                      pan_props);

  /**
   * ClutterPanAction::pan:
   * @action: the #ClutterPanAction that emitted the signal
   * @actor: the #ClutterActor attached to the @action
   * @is_interpolated: if the event is the result of interpolating
   *                   the motion velocity at the end of the drag
   *
   * The ::pan signal is emitted to keep track of the motion during
   * a pan gesture. @is_interpolated is set to %TRUE during the
   * interpolation phase of the pan, after the drag has ended and
   * the :interpolate property was set to %TRUE.
   *
   * Return value: %TRUE if the pan should continue, and %FALSE if
   *   the pan should be cancelled.
   */
  pan_signals[PAN] =
    g_signal_new (I_("pan"),
                  G_TYPE_FROM_CLASS (klass),
                  G_SIGNAL_RUN_LAST,
                  G_STRUCT_OFFSET (ClutterPanActionClass, pan),
                  _clutter_boolean_continue_accumulator, NULL,
                  _clutter_marshal_BOOLEAN__OBJECT_BOOLEAN,
                  G_TYPE_BOOLEAN, 2,
                  CLUTTER_TYPE_ACTOR,
                  G_TYPE_BOOLEAN);

  /**
   * ClutterPanAction::pan-stopped:
   * @action: the #ClutterPanAction that emitted the signal
   * @actor: the #ClutterActor attached to the @action
   *
   * The ::pan-stopped signal is emitted at the end of the interpolation
   * phase of the pan action, only when :interpolate is set to %TRUE.
   */
  pan_signals[PAN_STOPPED] =
    g_signal_new (I_("pan-stopped"),
                  G_TYPE_FROM_CLASS (klass),
                  G_SIGNAL_RUN_LAST,
                  G_STRUCT_OFFSET (ClutterPanActionClass, pan_stopped),
                  NULL, NULL,
                  _clutter_marshal_VOID__OBJECT,
                  G_TYPE_NONE, 1,
                  CLUTTER_TYPE_ACTOR);
}