/libs/cocos2d/CCMenu.h

http://github.com/kstenerud/ObjectAL-for-iPhone · C Header · 86 lines · 27 code · 15 blank · 44 comment · 0 complexity · 4f64c0b96917457736ce07ee9c74bd70 MD5 · raw file

  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. #import <UIKit/UIKit.h>
  26. #import "CCMenuItem.h"
  27. #import "CCLayer.h"
  28. typedef enum {
  29. kMenuStateWaiting,
  30. kMenuStateTrackingTouch
  31. } MenuState;
  32. /** A CCMenu
  33. *
  34. * Features and Limitation:
  35. * - You can add MenuItem objects in runtime using addChild:
  36. * - But the only accecpted children are MenuItem objects
  37. */
  38. @interface CCMenu : CCLayer <CCRGBAProtocol>
  39. {
  40. MenuState state;
  41. CCMenuItem *selectedItem;
  42. GLubyte opacity_;
  43. ccColor3B color_;
  44. }
  45. /** creates a CCMenu with it's items */
  46. + (id) menuWithItems: (CCMenuItem*) item, ... NS_REQUIRES_NIL_TERMINATION;
  47. /** initializes a CCMenu with it's items */
  48. - (id) initWithItems: (CCMenuItem*) item vaList: (va_list) args;
  49. /** align items vertically */
  50. -(void) alignItemsVertically;
  51. /** align items vertically with padding
  52. @since v0.7.2
  53. */
  54. -(void) alignItemsVerticallyWithPadding:(float) padding;
  55. /** align items horizontally */
  56. -(void) alignItemsHorizontally;
  57. /** align items horizontally with padding
  58. @since v0.7.2
  59. */
  60. -(void) alignItemsHorizontallyWithPadding: (float) padding;
  61. /** align items in rows of columns */
  62. -(void) alignItemsInColumns: (NSNumber *) columns, ... NS_REQUIRES_NIL_TERMINATION;
  63. -(void) alignItemsInColumns: (NSNumber *) columns vaList: (va_list) args;
  64. /** align items in columns of rows */
  65. -(void) alignItemsInRows: (NSNumber *) rows, ... NS_REQUIRES_NIL_TERMINATION;
  66. -(void) alignItemsInRows: (NSNumber *) rows vaList: (va_list) args;
  67. /** conforms to CCRGBAProtocol protocol */
  68. @property (nonatomic,readonly) GLubyte opacity;
  69. /** conforms to CCRGBAProtocol protocol */
  70. @property (nonatomic,readonly) ccColor3B color;
  71. @end