diff options
Diffstat (limited to 'libs/cocos2d/Platforms/iOS/CCTouchHandler.h')
-rwxr-xr-x | libs/cocos2d/Platforms/iOS/CCTouchHandler.h | 93 |
1 files changed, 93 insertions, 0 deletions
diff --git a/libs/cocos2d/Platforms/iOS/CCTouchHandler.h b/libs/cocos2d/Platforms/iOS/CCTouchHandler.h new file mode 100755 index 0000000..31a3e36 --- /dev/null +++ b/libs/cocos2d/Platforms/iOS/CCTouchHandler.h | |||
@@ -0,0 +1,93 @@ | |||
1 | /* | ||
2 | * cocos2d for iPhone: http://www.cocos2d-iphone.org | ||
3 | * | ||
4 | * Copyright (c) 2009 Valentin Milea | ||
5 | * | ||
6 | * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
7 | * of this software and associated documentation files (the "Software"), to deal | ||
8 | * in the Software without restriction, including without limitation the rights | ||
9 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
10 | * copies of the Software, and to permit persons to whom the Software is | ||
11 | * furnished to do so, subject to the following conditions: | ||
12 | * | ||
13 | * The above copyright notice and this permission notice shall be included in | ||
14 | * all copies or substantial portions of the Software. | ||
15 | * | ||
16 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
17 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
18 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
19 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
20 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
21 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
22 | * THE SOFTWARE. | ||
23 | * | ||
24 | */ | ||
25 | |||
26 | // Only compile this code on iOS. These files should NOT be included on your Mac project. | ||
27 | // But in case they are included, it won't be compiled. | ||
28 | #import <Availability.h> | ||
29 | #ifdef __IPHONE_OS_VERSION_MAX_ALLOWED | ||
30 | |||
31 | /* | ||
32 | * This file contains the delegates of the touches | ||
33 | * There are 2 possible delegates: | ||
34 | * - CCStandardTouchHandler: propagates all the events at once | ||
35 | * - CCTargetedTouchHandler: propagates 1 event at the time | ||
36 | */ | ||
37 | |||
38 | #import "CCTouchDelegateProtocol.h" | ||
39 | #import "CCTouchDispatcher.h" | ||
40 | |||
41 | /** | ||
42 | CCTouchHandler | ||
43 | Object than contains the delegate and priority of the event handler. | ||
44 | */ | ||
45 | @interface CCTouchHandler : NSObject { | ||
46 | id delegate; | ||
47 | int priority; | ||
48 | ccTouchSelectorFlag enabledSelectors_; | ||
49 | } | ||
50 | |||
51 | /** delegate */ | ||
52 | @property(nonatomic, readwrite, retain) id delegate; | ||
53 | /** priority */ | ||
54 | @property(nonatomic, readwrite) int priority; // default 0 | ||
55 | /** enabled selectors */ | ||
56 | @property(nonatomic,readwrite) ccTouchSelectorFlag enabledSelectors; | ||
57 | |||
58 | /** allocates a TouchHandler with a delegate and a priority */ | ||
59 | + (id)handlerWithDelegate:(id)aDelegate priority:(int)priority; | ||
60 | /** initializes a TouchHandler with a delegate and a priority */ | ||
61 | - (id)initWithDelegate:(id)aDelegate priority:(int)priority; | ||
62 | @end | ||
63 | |||
64 | /** CCStandardTouchHandler | ||
65 | It forwardes each event to the delegate. | ||
66 | */ | ||
67 | @interface CCStandardTouchHandler : CCTouchHandler | ||
68 | { | ||
69 | } | ||
70 | @end | ||
71 | |||
72 | /** | ||
73 | CCTargetedTouchHandler | ||
74 | Object than contains the claimed touches and if it swallos touches. | ||
75 | Used internally by TouchDispatcher | ||
76 | */ | ||
77 | @interface CCTargetedTouchHandler : CCTouchHandler { | ||
78 | BOOL swallowsTouches; | ||
79 | NSMutableSet *claimedTouches; | ||
80 | } | ||
81 | /** whether or not the touches are swallowed */ | ||
82 | @property(nonatomic, readwrite) BOOL swallowsTouches; // default NO | ||
83 | /** MutableSet that contains the claimed touches */ | ||
84 | @property(nonatomic, readonly) NSMutableSet *claimedTouches; | ||
85 | |||
86 | /** allocates a TargetedTouchHandler with a delegate, a priority and whether or not it swallows touches or not */ | ||
87 | + (id)handlerWithDelegate:(id) aDelegate priority:(int)priority swallowsTouches:(BOOL)swallowsTouches; | ||
88 | /** initializes a TargetedTouchHandler with a delegate, a priority and whether or not it swallows touches or not */ | ||
89 | - (id)initWithDelegate:(id) aDelegate priority:(int)priority swallowsTouches:(BOOL)swallowsTouches; | ||
90 | |||
91 | @end | ||
92 | |||
93 | #endif // __IPHONE_OS_VERSION_MAX_ALLOWED | ||