2011-06-14 14:31:25 +08:00
|
|
|
|
|
|
|
#include "CCMenuItem.h"
|
|
|
|
#include "CCLayer.h"
|
|
|
|
|
|
|
|
namespace cocos2d{
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
kCCMenuStateWaiting,
|
|
|
|
kCCMenuStateTrackingTouch
|
|
|
|
} tCCMenuState;
|
|
|
|
|
|
|
|
enum {
|
|
|
|
//* priority used by the menu
|
|
|
|
kCCMenuTouchPriority = -128,
|
|
|
|
};
|
|
|
|
|
|
|
|
class CCMenu : public CCLayer, public CCRGBAProtocol
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
CCMenu();
|
|
|
|
virtual ~CCMenu(){}
|
|
|
|
static CCMenu*menuWithItem(CCMenuItem* item);
|
|
|
|
bool initWithItems(CCMenuItem* item, va_list args);
|
|
|
|
void alignItemsVertically();
|
|
|
|
|
|
|
|
void alignItemsVerticallyWithPadding(float padding);
|
|
|
|
void alignItemsHorizontally();
|
|
|
|
void alignItemsHorizontallyWithPadding(float padding);
|
|
|
|
|
|
|
|
|
2011-06-20 17:31:38 +08:00
|
|
|
// void alignItemsInRows(unsigned int rows, ...);
|
2011-06-14 14:31:25 +08:00
|
|
|
void alignItemsInColumns(unsigned int columns, va_list args);
|
|
|
|
|
|
|
|
/** align items in columns of rows */
|
2011-06-20 17:31:38 +08:00
|
|
|
// void alignItemsInColumns(unsigned int columns, ...);
|
2011-06-14 14:31:25 +08:00
|
|
|
void alignItemsInRows(unsigned int rows, va_list args);
|
|
|
|
|
|
|
|
//super methods
|
|
|
|
void addChild(CCNode * child, int zOrder);
|
|
|
|
void addChild(CCNode * child, int zOrder, int tag);
|
|
|
|
void registerWithTouchDispatcher();
|
|
|
|
bool ccTouchBegan(CCTouch* touch, CCEvent* event);
|
|
|
|
void ccTouchEnded(CCTouch* touch, CCEvent* event);
|
|
|
|
void ccTouchCancelled(CCTouch *touch, CCEvent* event);
|
|
|
|
void ccTouchMoved(CCTouch* touch, CCEvent* event);
|
|
|
|
|
|
|
|
|
|
|
|
void onExit();
|
|
|
|
|
|
|
|
void setOpacity(GLubyte opacity);
|
|
|
|
GLubyte getOpacity(void);
|
|
|
|
ccColor3B getColor(void);
|
|
|
|
void setColor(ccColor3B color);
|
|
|
|
|
|
|
|
|
2011-06-20 17:31:38 +08:00
|
|
|
bool init();
|
|
|
|
static CCLayer *node(void);
|
|
|
|
void onEnter();
|
|
|
|
void onExit();
|
|
|
|
void onEnterTransitionDidFinish();
|
|
|
|
bool ccTouchBegan(CCTouch *pTouch, CCEvent *pEvent);
|
|
|
|
|
|
|
|
void didAccelerate(CCAcceleration* pAccelerationValue) {}
|
|
|
|
|
|
|
|
void registerWithTouchDispatcher(void);
|
|
|
|
|
|
|
|
void setIsTouchEnabled(bool bValue);
|
|
|
|
bool getIsTouchEnabled();
|
|
|
|
|
|
|
|
void setIsAccelerometerEnabled(bool bValue);
|
|
|
|
bool getIsAccelerometerEnabled();
|
|
|
|
|
|
|
|
void setIsKeypadEnabled(bool bValue);
|
2011-06-14 14:31:25 +08:00
|
|
|
bool getIsKeypadEnabled();
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|