Gesture Recognizer Classes and Functions (Compact 2013)
3/26/2014
This topic describes the GestureRecognizer class and other classes of the built-in gesture recognizer, as well as some of the methods implemented by these classes.
The GestureRecognizer class provides the following public methods:
- Instance
- RecognizeGesture
- SetSettings
- GetSettings
When a touch event occurs, the gesture core calls the RecognizeGesture function, as discussed in Touch Event from Gesture Core to the Recognizers. RecognizeGesture calls the GestureRecognizer::RecognizeGesture method. The GestureRecognizer class uses either the DMRecognizer class or the TouchGesture class to perform the recognition task. It uses DMRecognizer if the window that generated the event is a direct manipulation window (that is, the direct manipulation gesture is enabled for the window); otherwise, it uses the TouchGesture class. These two classes, DMRecognizer and TouchGesture, both provide the following public methods:
- OnBeginGestureSession
- OnEndGestureSession
- HandleTouchEvent
DMRecognizer provides the following additional methods:
- OnHoldComplete
- IsDMWindow
The GestureRecognizer class uses IsDMWindow to determine, at the start of a gesture session, whether the window has direct manipulation gestures enabled.
The TouchGesture class makes uses of other classes for specific gestures. The gesture-specific classes are as follows:
- FlickRecognizer
- HoldRecognizer
- SelectRecognizer (handles both single-and double-tap gestures)
These classes implement methods according to their recognition needs. The following table shows some of the methods implemented in some of the classes.
Public method |
Classes |
---|---|
AddPoint |
FlickRecognizer |
OnContactDown |
HoldRecognizer, SelectRecognizer |
OnContactMove |
HoldRecognizer, SelectRecognizer |
RecognizeFlick |
FlickRecognizer |
OnContactUp |
HoldRecognizer |