[ Version ( since = "1.8" ) ]
public class GestureAction : Action
GestureAction is a sub-class of Action that implements the logic for recognizing gesture gestures.
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);
A GestureAction 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 GestureAction starts in the "prepare" state, and calls the gesture_prepare virtual function; this state can be used to reset the internal state of a GestureAction 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 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 GestureAction will use the "progress" state, calling the 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.