forked from thezerobit/gnustep-gui-sony
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SNSwipeGestureRecognizer.h
executable file
·45 lines (36 loc) · 1.68 KB
/
SNSwipeGestureRecognizer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#import <AppKit/SNGestureRecognizer.h>
typedef enum {
SNSwipeGestureRecognizerDirectionRight = 1 << 0,
SNSwipeGestureRecognizerDirectionLeft = 1 << 1,
SNSwipeGestureRecognizerDirectionUp = 1 << 2,
SNSwipeGestureRecognizerDirectionDown = 1 << 3
} SNSwipeGestureRecognizerDirection;
@interface SNSwipeGestureRecognizer : SNGestureRecognizer {
NSUInteger numberOfTouchesRequired;
SNSwipeGestureRecognizerDirection direction;
SNSwipeGestureRecognizerDirection recognizedDirection;
float minimumSwipeDistance;
NSTimeInterval maximumSwipeDuration;
float allowableAngleDeviation;
NSPoint initialCentroid;
// Fingers can touch down & lift up at different times
// This timer is used so that all required fingers must touch down
// within 0.3 second, and when ending the gesture, all of them
// must lift up within 0.3 second too
NSTimer *_touchCountTimer;
// # of touches of the swipe; must be equal to numberOfTouchesRequired
NSUInteger touchCount;
// # of touches remaining on screen when touchesEnded is called
NSUInteger touchesOnScreen;
}
- (void) setNumberOfTouchesRequired: (NSUInteger)num;
- (void) setDirection: (SNSwipeGestureRecognizerDirection)dir;
- (void) setMinimumSwipeDistance: (float)distance;
- (void) setMaximumSwipeDuration: (NSTimeInterval)duration;
- (void) setAllowableAngleDeviation: (float)angle;
- (SNSwipeGestureRecognizerDirection) direction;
- (void) durationExceeded: (NSTimer*)timer;
- (void) touchesNotSynchronized: (NSTimer*)timer;
- (float) angleFrom: (NSPoint) p1 to: (NSPoint) p2;
- (BOOL) directionPermitted: (float)currentAngle;
@end