00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #import "CCTouchDelegateProtocol.h"
00028 #import "Support/EAGLView.h"
00029
00030
00031 typedef enum
00032 {
00033 ccTouchSelectorBeganBit = 1 << 0,
00034 ccTouchSelectorMovedBit = 1 << 1,
00035 ccTouchSelectorEndedBit = 1 << 2,
00036 ccTouchSelectorCancelledBit = 1 << 3,
00037 ccTouchSelectorAllBits = ( ccTouchSelectorBeganBit | ccTouchSelectorMovedBit | ccTouchSelectorEndedBit | ccTouchSelectorCancelledBit),
00038 } ccTouchSelectorFlag;
00039
00040
00041 enum {
00042 ccTouchBegan,
00043 ccTouchMoved,
00044 ccTouchEnded,
00045 ccTouchCancelled,
00046
00047 ccTouchMax,
00048 };
00049
00050 struct ccTouchHandlerHelperData {
00051 SEL touchesSel;
00052 SEL touchSel;
00053 ccTouchSelectorFlag type;
00054 };
00055
00072 @interface CCTouchDispatcher : NSObject <EAGLTouchDelegate>
00073 {
00074 NSMutableArray *targetedHandlers;
00075 NSMutableArray *standardHandlers;
00076
00077 BOOL locked;
00078 BOOL toAdd;
00079 BOOL toRemove;
00080 NSMutableArray *handlersToAdd;
00081 NSMutableArray *handlersToRemove;
00082 BOOL toQuit;
00083
00084 BOOL dispatchEvents;
00085
00086
00087 struct ccTouchHandlerHelperData handlerHelperData[ccTouchMax];
00088 }
00089
00091 + (CCTouchDispatcher*)sharedDispatcher;
00092
00094 @property (nonatomic,readwrite, assign) BOOL dispatchEvents;
00095
00100 -(void) addStandardDelegate:(id<CCStandardTouchDelegate>) delegate priority:(int)priority;
00105 -(void) addTargetedDelegate:(id<CCTargetedTouchDelegate>) delegate priority:(int)priority swallowsTouches:(BOOL)swallowsTouches;
00109 -(void) removeDelegate:(id) delegate;
00111 -(void) removeAllDelegates;
00114 -(void) setPriority:(int) priority forDelegate:(id) delegate;
00115
00116 @end