2012-06-13 02:59:49 +08:00
|
|
|
#include "CCMenuItemImageLoader.h"
|
2012-06-01 08:07:02 +08:00
|
|
|
|
2012-06-14 05:19:13 +08:00
|
|
|
USING_NS_CC;
|
|
|
|
USING_NS_CC_EXT;
|
2012-06-01 08:07:02 +08:00
|
|
|
|
|
|
|
#define PROPERTY_NORMALDISPLAYFRAME "normalSpriteFrame"
|
|
|
|
#define PROPERTY_SELECTEDDISPLAYFRAME "selectedSpriteFrame"
|
|
|
|
#define PROPERTY_DISABLEDDISPLAYFRAME "disabledSpriteFrame"
|
|
|
|
|
|
|
|
CCMenuItemImage * CCMenuItemImageLoader::createCCNode(CCNode * pParent, CCBReader * pCCBReader) {
|
|
|
|
return CCMenuItemImage::node();
|
|
|
|
}
|
|
|
|
|
2012-06-14 15:01:01 +08:00
|
|
|
void CCMenuItemImageLoader::onHandlePropTypeSpriteFrame(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCSpriteFrame * pCCSpriteFrame, CCBReader * pCCBReader) {
|
|
|
|
if(pPropertyName->compare(PROPERTY_NORMALDISPLAYFRAME) == 0) {
|
2012-06-14 05:19:13 +08:00
|
|
|
if(pCCSpriteFrame != NULL) {
|
|
|
|
((CCMenuItemImage *)pNode)->setNormalSpriteFrame(pCCSpriteFrame);
|
|
|
|
}
|
2012-06-14 15:01:01 +08:00
|
|
|
} else if(pPropertyName->compare(PROPERTY_SELECTEDDISPLAYFRAME) == 0) {
|
2012-06-14 05:19:13 +08:00
|
|
|
if(pCCSpriteFrame != NULL) {
|
|
|
|
((CCMenuItemImage *)pNode)->setSelectedSpriteFrame(pCCSpriteFrame);
|
|
|
|
}
|
2012-06-14 15:01:01 +08:00
|
|
|
} else if(pPropertyName->compare(PROPERTY_DISABLEDDISPLAYFRAME) == 0) {
|
2012-06-14 05:19:13 +08:00
|
|
|
if(pCCSpriteFrame != NULL) {
|
|
|
|
((CCMenuItemImage *)pNode)->setDisabledSpriteFrame(pCCSpriteFrame);
|
|
|
|
}
|
2012-06-01 08:07:02 +08:00
|
|
|
} else {
|
|
|
|
CCMenuItemLoader::onHandlePropTypeSpriteFrame(pNode, pParent, pPropertyName, pCCSpriteFrame, pCCBReader);
|
|
|
|
}
|
|
|
|
}
|