2012-06-13 02:59:49 +08:00
|
|
|
#include "CCControlLoader.h"
|
2012-06-02 06:14:18 +08:00
|
|
|
|
2012-06-14 05:19:13 +08:00
|
|
|
USING_NS_CC;
|
|
|
|
USING_NS_CC_EXT;
|
2012-06-02 06:14:18 +08:00
|
|
|
|
|
|
|
#define PROPERTY_ENABLED "enabled"
|
|
|
|
#define PROPERTY_SELECTED "selected"
|
|
|
|
#define PROPERTY_CCCONTROL "ccControl"
|
|
|
|
|
2012-06-14 15:01:01 +08:00
|
|
|
void CCControlLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
|
|
|
|
if(pPropertyName->compare(PROPERTY_ENABLED) == 0) {
|
2012-06-15 16:47:30 +08:00
|
|
|
((CCControl *)pNode)->setEnabled(pCheck);
|
2012-06-14 15:01:01 +08:00
|
|
|
} else if(pPropertyName->compare(PROPERTY_SELECTED) == 0) {
|
2012-06-15 16:47:30 +08:00
|
|
|
((CCControl *)pNode)->setSelected(pCheck);
|
2012-06-02 06:14:18 +08:00
|
|
|
} else {
|
|
|
|
CCNodeLoader::onHandlePropTypeCheck(pNode, pParent, pPropertyName, pCheck, pCCBReader);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-06-14 15:01:01 +08:00
|
|
|
void CCControlLoader::onHandlePropTypeBlockCCControl(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, BlockCCControlData * pBlockCCControlData, CCBReader * pCCBReader) {
|
|
|
|
if(pPropertyName->compare(PROPERTY_CCCONTROL) == 0) {
|
2012-06-07 05:32:15 +08:00
|
|
|
((CCControl *)pNode)->addTargetWithActionForControlEvents(pBlockCCControlData->mTarget, pBlockCCControlData->mSELCCControlHandler, pBlockCCControlData->mControlEvents);
|
2012-06-02 06:14:18 +08:00
|
|
|
} else {
|
2012-06-05 06:52:49 +08:00
|
|
|
CCNodeLoader::onHandlePropTypeBlockCCControl(pNode, pParent, pPropertyName, pBlockCCControlData, pCCBReader);
|
2012-06-02 06:14:18 +08:00
|
|
|
}
|
|
|
|
}
|