### Class

# Clutter GestureAction

#### Description [src]

    class Clutter.GestureAction : Clutter.Action
    {
      /* No available fields */
    }

Action for gesture gestures

`ClutterGestureAction` is a sub-class of `ClutterAction` that implements the logic for recognizing gesture gestures. It listens for low level `ClutterEvent` events on the stage to raise the `ClutterGestureAction::gesture-begin`, `ClutterGestureAction::gesture-progress`, and `ClutterGestureAction::gesture-end` signals.

To use `ClutterGestureAction` you just need to apply it to a `ClutterActor` using `clutter_actor_add_action()` and connect to the signals:

      ClutterAction *action = clutter_gesture_action_new ();

      clutter_actor_add_action (actor, action);

      g_signal_connect (action, "gesture-begin", G_CALLBACK (on_gesture_begin), NULL);
      g_signal_connect (action, "gesture-progress", G_CALLBACK (on_gesture_progress), NULL);
      g_signal_connect (action, "gesture-end", G_CALLBACK (on_gesture_end), NULL);

## Creating Gesture actions

A `ClutterGestureAction` provides four separate states that can be used to recognize or ignore gestures when writing a new action class:

- Prepare -> Cancel
- Prepare -> Begin -> Cancel
- Prepare -> Begin -> End
- Prepare -> Begin -> Progress -> Cancel
- Prepare -> Begin -> Progress -> End

Each `ClutterGestureAction` starts in the “prepare” state, and calls the `Clutter.GestureActionClass.gesture_prepare` virtual function; this state can be used to reset the internal state of a `ClutterGestureAction` subclass, but it can also immediately cancel a gesture without going through the rest of the states.

The “begin” state follows the “prepare” state, and calls the `Clutter.GestureActionClass.gesture_begin` virtual function. This state signals the start of a gesture recognizing process. From the “begin” state the gesture recognition process can successfully end, by going to the “end” state; it can continue in the “progress” state, in case of a continuous gesture; or it can be terminated, by moving to the “cancel” state.

In case of continuous gestures, the `ClutterGestureAction` will use the “progress” state, calling the `Clutter.GestureActionClass.gesture_progress` virtual function; the “progress” state will continue until the end of the gesture, in which case the “end” state will be reached, or until the gesture is cancelled, in which case the “cancel” gesture will be used instead.

#### Ancestors

- ClutterAction
- ClutterActorMeta
- GInitiallyUnowned
- GObject

#### Descendants

- ClutterPanAction
- ClutterRotateAction
- ClutterSwipeAction
- ClutterTapAction
- ClutterZoomAction

#### Constructors

###### clutter_gesture_action_new

Creates a new `ClutterGestureAction` instance.

#### Instance methods

###### clutter_gesture_action_cancel

Cancel a `ClutterGestureAction` before it begins.

###### clutter_gesture_action_get_device

Retrieves the `ClutterInputDevice` of a touch point.

###### clutter_gesture_action_get_last_event

Retrieves a reference to the last `ClutterEvent` for a touch point. Call `clutter_event_copy()` if you need to store the reference somewhere.

###### clutter_gesture_action_get_motion_coords

Retrieves the coordinates, in stage space, of the latest motion event during the dragging.

###### clutter_gesture_action_get_motion_delta

Retrieves the incremental delta since the last motion event during the dragging.

###### clutter_gesture_action_get_n_current_points

Retrieves the number of points currently active.

###### clutter_gesture_action_get_n_touch_points

Retrieves the number of requested points to trigger the gesture.

###### clutter_gesture_action_get_press_coords

Retrieves the coordinates, in stage space, of the press event that started the dragging for a specific touch point.

###### clutter_gesture_action_get_release_coords

Retrieves the coordinates, in stage space, where the touch point was last released.

###### clutter_gesture_action_get_sequence

Retrieves the `ClutterEventSequence` of a touch point.

###### clutter_gesture_action_get_threshold_trigger_distance

Retrieves the threshold trigger distance of the gesture `action`, as set using `clutter_gesture_action_set_threshold_trigger_distance()`.

###### clutter_gesture_action_get_threshold_trigger_edge

Retrieves the edge trigger of the gesture `action`, as set using `clutter_gesture_action_set_threshold_trigger_edge()`.

###### clutter_gesture_action_get_velocity

Retrieves the velocity, in stage pixels per millisecond, of the latest motion event during the dragging.

###### clutter_gesture_action_set_n_touch_points

Sets the number of points needed to trigger the gesture.

###### clutter_gesture_action_set_threshold_trigger_distance

Sets the threshold trigger distance for the gesture drag threshold, if any.

###### clutter_gesture_action_set_threshold_trigger_edge

Sets the edge trigger for the gesture drag threshold, if any.

##### Methods inherited from ClutterAction (1)

###### clutter_action_get_phase

No description available.

##### Methods inherited from ClutterActorMeta (5)

###### clutter_actor_meta_get_actor

Retrieves a pointer to the `ClutterActor` that owns `meta`.

###### clutter_actor_meta_get_enabled

Retrieves whether `meta` is enabled.

###### clutter_actor_meta_get_name

Retrieves the name set using `clutter_actor_meta_set_name()`.

###### clutter_actor_meta_set_enabled

Sets whether `meta` should be enabled or not.

###### clutter_actor_meta_set_name

Sets the name of `meta`.

##### Methods inherited from GObject (43)

Please see GObject for a full list of methods.

#### Properties

###### Clutter.GestureAction:n-touch-points

Number of touch points to trigger a gesture action.

###### Clutter.GestureAction: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.

###### Clutter.GestureAction: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.

###### Clutter.GestureAction: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.

##### Properties inherited from ClutterActorMeta (3)

###### Clutter.ActorMeta:actor

The `ClutterActor` attached to the `ClutterActorMeta` instance.

###### Clutter.ActorMeta:enabled

Whether or not the `ClutterActorMeta` is enabled.

###### Clutter.ActorMeta:name

The unique name to access the `ClutterActorMeta`.

#### Signals

###### Clutter.GestureAction::gesture-begin

The signal is emitted when the `ClutterActor` to which a `ClutterGestureAction` has been applied starts receiving a gesture.

###### Clutter.GestureAction::gesture-cancel

The signal is emitted when the ongoing gesture gets cancelled from the `ClutterGestureAction::gesture-progress` signal handler.

###### Clutter.GestureAction::gesture-end

The signal is emitted at the end of the gesture gesture, when the pointer’s button is released.

###### Clutter.GestureAction::gesture-progress

The signal is emitted for each motion event after the `ClutterGestureAction::gesture-begin` signal has been emitted.

##### Signals inherited from GObject (1)

###### GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

#### Class structure

    struct ClutterGestureActionClass {
      gboolean (* gesture_begin) (
        ClutterGestureAction* action,
        ClutterActor* actor
      );
      gboolean (* gesture_progress) (
        ClutterGestureAction* action,
        ClutterActor* actor
      );
      void (* gesture_end) (
        ClutterGestureAction* action,
        ClutterActor* actor
      );
      void (* gesture_cancel) (
        ClutterGestureAction* action,
        ClutterActor* actor
      );
      gboolean (* gesture_prepare) (
        ClutterGestureAction* action,
        ClutterActor* actor
      );

    }

The `ClutterGestureClass` structure contains only private data.

###### Class members

`gesture_begin: gboolean (* gesture_begin) ( ClutterGestureAction* action, ClutterActor* actor )`

  Class handler for the `ClutterGestureAction::gesture-begin` signal.

`gesture_progress: gboolean (* gesture_progress) ( ClutterGestureAction* action, ClutterActor* actor )`

  Class handler for the `ClutterGestureAction::gesture-progress` signal.

`gesture_end: void (* gesture_end) ( ClutterGestureAction* action, ClutterActor* actor )`

  Class handler for the `ClutterGestureAction::gesture-end` signal.

`gesture_cancel: void (* gesture_cancel) ( ClutterGestureAction* action, ClutterActor* actor )`

  Class handler for the `ClutterGestureAction::gesture-cancel` signal.

`gesture_prepare: gboolean (* gesture_prepare) ( ClutterGestureAction* action, ClutterActor* actor )`

  Virtual function called before emitting the `ClutterGestureAction::gesture-cancel` signal.

#### Virtual methods

###### Clutter.GestureActionClass.gesture_begin

Class handler for the `ClutterGestureAction::gesture-begin` signal.

###### Clutter.GestureActionClass.gesture_cancel

Class handler for the `ClutterGestureAction::gesture-cancel` signal.

###### Clutter.GestureActionClass.gesture_end

Class handler for the `ClutterGestureAction::gesture-end` signal.

###### Clutter.GestureActionClass.gesture_prepare

Virtual function called before emitting the `ClutterGestureAction::gesture-cancel` signal.

###### Clutter.GestureActionClass.gesture_progress

Class handler for the `ClutterGestureAction::gesture-progress` signal.