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 #import "CCBlockSupport.h"
00027
00028 #import "CCNode.h"
00029 #import "CCProtocols.h"
00030
00031 @class CCLabel;
00032 @class CCLabelAtlas;
00033 @class CCSprite;
00034
00035 #define kItemSize 32
00036
00041 @interface CCMenuItem : CCNode
00042 {
00043 NSInvocation *invocation;
00044 #if NS_BLOCKS_AVAILABLE
00045
00046 void (^block_)(id sender);
00047 #endif
00048
00049 BOOL isEnabled_;
00050 BOOL isSelected_;
00051 }
00052
00056 @property (nonatomic,readonly) BOOL isSelected;
00057
00059 +(id) itemWithTarget:(id)target selector:(SEL)selector;
00060
00062 -(id) initWithTarget:(id)target selector:(SEL)selector;
00063
00064 #if NS_BLOCKS_AVAILABLE
00065
00066 +(id) itemWithBlock:(void(^)(id sender))block;
00067
00069 -(id) initWithBlock:(void(^)(id sender))block;
00070 #endif
00071
00073 -(CGRect) rect;
00074
00076 -(void) activate;
00077
00079 -(void) selected;
00080
00082 -(void) unselected;
00083
00085 -(void) setIsEnabled:(BOOL)enabled;
00087 -(BOOL) isEnabled;
00088 @end
00089
00097 @interface CCMenuItemLabel : CCMenuItem <CCRGBAProtocol>
00098 {
00099 CCNode<CCLabelProtocol, CCRGBAProtocol> *label_;
00100 ccColor3B colorBackup;
00101 ccColor3B disabledColor_;
00102 float originalScale_;
00103 }
00104
00106 @property (nonatomic,readwrite) ccColor3B disabledColor;
00107
00109 @property (nonatomic,readwrite,retain) CCNode<CCLabelProtocol, CCRGBAProtocol>* label;
00110
00112 +(id) itemWithLabel:(CCNode<CCLabelProtocol,CCRGBAProtocol>*)label target:(id)target selector:(SEL)selector;
00113
00115 -(id) initWithLabel:(CCNode<CCLabelProtocol,CCRGBAProtocol>*)label target:(id)target selector:(SEL)selector;
00116
00117 #if NS_BLOCKS_AVAILABLE
00118
00119 +(id) itemWithLabel:(CCNode<CCLabelProtocol,CCRGBAProtocol>*)label block:(void(^)(id sender))block;
00120
00122 -(id) initWithLabel:(CCNode<CCLabelProtocol,CCRGBAProtocol>*)label block:(void(^)(id sender))block;
00123 #endif
00124
00126 -(void) setString:(NSString*)label;
00127
00131 -(void) setIsEnabled: (BOOL)enabled;
00132 @end
00133
00137 @interface CCMenuItemAtlasFont : CCMenuItemLabel
00138 {
00139 }
00140
00142 +(id) itemFromString: (NSString*) value charMapFile:(NSString*) charMapFile itemWidth:(int)itemWidth itemHeight:(int)itemHeight startCharMap:(char)startCharMap;
00143
00145 +(id) itemFromString: (NSString*) value charMapFile:(NSString*) charMapFile itemWidth:(int)itemWidth itemHeight:(int)itemHeight startCharMap:(char)startCharMap target:(id) rec selector:(SEL) cb;
00146
00148 -(id) initFromString: (NSString*) value charMapFile:(NSString*) charMapFile itemWidth:(int)itemWidth itemHeight:(int)itemHeight startCharMap:(char)startCharMap target:(id) rec selector:(SEL) cb;
00149
00150 #if NS_BLOCKS_AVAILABLE
00151
00152 +(id) itemFromString: (NSString*) value charMapFile:(NSString*) charMapFile itemWidth:(int)itemWidth itemHeight:(int)itemHeight startCharMap:(char)startCharMap block:(void(^)(id sender))block;
00153
00155 -(id) initFromString: (NSString*) value charMapFile:(NSString*) charMapFile itemWidth:(int)itemWidth itemHeight:(int)itemHeight startCharMap:(char)startCharMap block:(void(^)(id sender))block;
00156 #endif
00157
00158 @end
00159
00163 @interface CCMenuItemFont : CCMenuItemLabel
00164 {
00165 }
00167 +(void) setFontSize: (int) s;
00168
00170 +(int) fontSize;
00171
00173 +(void) setFontName: (NSString*) n;
00174
00176 +(NSString*) fontName;
00177
00179 +(id) itemFromString: (NSString*) value;
00180
00182 +(id) itemFromString: (NSString*) value target:(id) r selector:(SEL) s;
00183
00185 -(id) initFromString: (NSString*) value target:(id) r selector:(SEL) s;
00186
00187 #if NS_BLOCKS_AVAILABLE
00188
00189 +(id) itemFromString: (NSString*) value block:(void(^)(id sender))block;
00190
00192 -(id) initFromString: (NSString*) value block:(void(^)(id sender))block;
00193 #endif
00194 @end
00195
00204 @interface CCMenuItemSprite : CCMenuItem <CCRGBAProtocol>
00205 {
00206 CCNode<CCRGBAProtocol> *normalImage_, *selectedImage_, *disabledImage_;
00207 }
00208
00210 @property (nonatomic,readwrite,retain) CCNode<CCRGBAProtocol> *normalImage;
00212 @property (nonatomic,readwrite,retain) CCNode<CCRGBAProtocol> *selectedImage;
00214 @property (nonatomic,readwrite,retain) CCNode<CCRGBAProtocol> *disabledImage;
00215
00217 +(id) itemFromNormalSprite:(CCNode<CCRGBAProtocol>*)normalSprite selectedSprite:(CCNode<CCRGBAProtocol>*)selectedSprite;
00219 +(id) itemFromNormalSprite:(CCNode<CCRGBAProtocol>*)normalSprite selectedSprite:(CCNode<CCRGBAProtocol>*)selectedSprite target:(id)target selector:(SEL)selector;
00221 +(id) itemFromNormalSprite:(CCNode<CCRGBAProtocol>*)normalSprite selectedSprite:(CCNode<CCRGBAProtocol>*)selectedSprite disabledSprite:(CCNode<CCRGBAProtocol>*)disabledSprite target:(id)target selector:(SEL)selector;
00223 -(id) initFromNormalSprite:(CCNode<CCRGBAProtocol>*)normalSprite selectedSprite:(CCNode<CCRGBAProtocol>*)selectedSprite disabledSprite:(CCNode<CCRGBAProtocol>*)disabledSprite target:(id)target selector:(SEL)selector;
00224
00225 #if NS_BLOCKS_AVAILABLE
00226
00227 +(id) itemFromNormalSprite:(CCNode<CCRGBAProtocol>*)normalSprite selectedSprite:(CCNode<CCRGBAProtocol>*)selectedSprite block:(void(^)(id sender))block;
00229 +(id) itemFromNormalSprite:(CCNode<CCRGBAProtocol>*)normalSprite selectedSprite:(CCNode<CCRGBAProtocol>*)selectedSprite disabledSprite:(CCNode<CCRGBAProtocol>*)disabledSprite block:(void(^)(id sender))block;
00231 -(id) initFromNormalSprite:(CCNode<CCRGBAProtocol>*)normalSprite selectedSprite:(CCNode<CCRGBAProtocol>*)selectedSprite disabledSprite:(CCNode<CCRGBAProtocol>*)disabledSprite block:(void(^)(id sender))block;
00232 #endif
00233
00234 @end
00235
00244 @interface CCMenuItemImage : CCMenuItemSprite
00245 {
00246 }
00247
00249 +(id) itemFromNormalImage: (NSString*)value selectedImage:(NSString*) value2;
00251 +(id) itemFromNormalImage: (NSString*)value selectedImage:(NSString*) value2 target:(id) r selector:(SEL) s;
00253 +(id) itemFromNormalImage: (NSString*)value selectedImage:(NSString*) value2 disabledImage:(NSString*) value3 target:(id) r selector:(SEL) s;
00255 -(id) initFromNormalImage: (NSString*) value selectedImage:(NSString*)value2 disabledImage:(NSString*) value3 target:(id) r selector:(SEL) s;
00256 #if NS_BLOCKS_AVAILABLE
00257
00258 +(id) itemFromNormalImage: (NSString*)value selectedImage:(NSString*) value2 block:(void(^)(id sender))block;
00260 +(id) itemFromNormalImage: (NSString*)value selectedImage:(NSString*) value2 disabledImage:(NSString*) value3 block:(void(^)(id sender))block;
00262 -(id) initFromNormalImage: (NSString*) value selectedImage:(NSString*)value2 disabledImage:(NSString*) value3 block:(void(^)(id sender))block;
00263 #endif
00264 @end
00265
00266
00267
00272 @interface CCMenuItemToggle : CCMenuItem <CCRGBAProtocol>
00273 {
00274 NSUInteger selectedIndex_;
00275 NSMutableArray* subItems_;
00276 GLubyte opacity_;
00277 ccColor3B color_;
00278 }
00279
00281 @property (nonatomic,readonly) GLubyte opacity;
00283 @property (nonatomic,readonly) ccColor3B color;
00284
00286 @property (nonatomic,readwrite) NSUInteger selectedIndex;
00290 @property (nonatomic,readwrite,retain) NSMutableArray *subItems;
00291
00293 +(id) itemWithTarget:(id)t selector:(SEL)s items:(CCMenuItem*) item, ... NS_REQUIRES_NIL_TERMINATION;
00294
00296 -(id) initWithTarget:(id)t selector:(SEL)s items:(CCMenuItem*) item vaList:(va_list) args;
00297
00298 #if NS_BLOCKS_AVAILABLE
00299
00300 +(id) itemWithBlock:(void(^)(id sender))block items:(CCMenuItem*)item, ... NS_REQUIRES_NIL_TERMINATION;
00301
00303 -(id) initWithBlock:(void (^)(id))block items:(CCMenuItem*)item vaList:(va_list)args;
00304 #endif
00305
00307 -(CCMenuItem*) selectedItem;
00308 @end
00309