/libs/cocos2d/CCMenu.h
C Header | 86 lines | 27 code | 15 blank | 44 comment | 0 complexity | 4f64c0b96917457736ce07ee9c74bd70 MD5 | raw file
Possible License(s): Apache-2.0
1/* 2 * cocos2d for iPhone: http://www.cocos2d-iphone.org 3 * 4 * Copyright (c) 2008-2010 Ricardo Quesada 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 27#import <UIKit/UIKit.h> 28 29#import "CCMenuItem.h" 30#import "CCLayer.h" 31 32typedef enum { 33 kMenuStateWaiting, 34 kMenuStateTrackingTouch 35} MenuState; 36 37/** A CCMenu 38 * 39 * Features and Limitation: 40 * - You can add MenuItem objects in runtime using addChild: 41 * - But the only accecpted children are MenuItem objects 42 */ 43@interface CCMenu : CCLayer <CCRGBAProtocol> 44{ 45 MenuState state; 46 CCMenuItem *selectedItem; 47 GLubyte opacity_; 48 ccColor3B color_; 49} 50 51/** creates a CCMenu with it's items */ 52+ (id) menuWithItems: (CCMenuItem*) item, ... NS_REQUIRES_NIL_TERMINATION; 53 54/** initializes a CCMenu with it's items */ 55- (id) initWithItems: (CCMenuItem*) item vaList: (va_list) args; 56 57/** align items vertically */ 58-(void) alignItemsVertically; 59/** align items vertically with padding 60 @since v0.7.2 61 */ 62-(void) alignItemsVerticallyWithPadding:(float) padding; 63 64/** align items horizontally */ 65-(void) alignItemsHorizontally; 66/** align items horizontally with padding 67 @since v0.7.2 68 */ 69-(void) alignItemsHorizontallyWithPadding: (float) padding; 70 71 72/** align items in rows of columns */ 73-(void) alignItemsInColumns: (NSNumber *) columns, ... NS_REQUIRES_NIL_TERMINATION; 74-(void) alignItemsInColumns: (NSNumber *) columns vaList: (va_list) args; 75 76/** align items in columns of rows */ 77-(void) alignItemsInRows: (NSNumber *) rows, ... NS_REQUIRES_NIL_TERMINATION; 78-(void) alignItemsInRows: (NSNumber *) rows vaList: (va_list) args; 79 80 81/** conforms to CCRGBAProtocol protocol */ 82@property (nonatomic,readonly) GLubyte opacity; 83/** conforms to CCRGBAProtocol protocol */ 84@property (nonatomic,readonly) ccColor3B color; 85 86@end