2016-03-20 21:53:44 +08:00
|
|
|
#include "editor-support/cocosbuilder/CCControlLoader.h"
|
2012-06-02 06:14:18 +08:00
|
|
|
|
2013-10-15 18:00:03 +08:00
|
|
|
using namespace cocos2d;
|
|
|
|
using namespace cocos2d::extension;
|
2012-09-24 11:47:33 +08:00
|
|
|
|
2013-10-15 18:00:03 +08:00
|
|
|
namespace cocosbuilder {
|
2012-06-02 06:14:18 +08:00
|
|
|
|
|
|
|
#define PROPERTY_ENABLED "enabled"
|
|
|
|
#define PROPERTY_SELECTED "selected"
|
|
|
|
#define PROPERTY_CCCONTROL "ccControl"
|
|
|
|
|
2013-07-27 21:44:49 +08:00
|
|
|
void ControlLoader::onHandlePropTypeCheck(Node * pNode, Node * pParent, const char * pPropertyName, bool pCheck, CCBReader * ccbReader) {
|
2012-11-26 21:51:05 +08:00
|
|
|
if(strcmp(pPropertyName, PROPERTY_ENABLED) == 0) {
|
2013-06-20 14:15:53 +08:00
|
|
|
((Control *)pNode)->setEnabled(pCheck);
|
2012-11-26 21:51:05 +08:00
|
|
|
} else if(strcmp(pPropertyName, PROPERTY_SELECTED) == 0) {
|
2013-06-20 14:15:53 +08:00
|
|
|
((Control *)pNode)->setSelected(pCheck);
|
2012-06-02 06:14:18 +08:00
|
|
|
} else {
|
2013-07-27 21:44:49 +08:00
|
|
|
NodeLoader::onHandlePropTypeCheck(pNode, pParent, pPropertyName, pCheck, ccbReader);
|
2012-06-02 06:14:18 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-07-27 21:44:49 +08:00
|
|
|
void ControlLoader::onHandlePropTypeBlockControl(Node * pNode, Node * pParent, const char * pPropertyName, BlockControlData * pBlockControlData, CCBReader * ccbReader) {
|
2012-11-26 21:51:05 +08:00
|
|
|
if(strcmp(pPropertyName, PROPERTY_CCCONTROL) == 0) {
|
2013-07-27 21:44:49 +08:00
|
|
|
((Control *)pNode)->addTargetWithActionForControlEvents(pBlockControlData->_target, pBlockControlData->mSELControlHandler, pBlockControlData->mControlEvents);
|
2012-06-02 06:14:18 +08:00
|
|
|
} else {
|
2013-07-27 21:44:49 +08:00
|
|
|
NodeLoader::onHandlePropTypeBlockControl(pNode, pParent, pPropertyName, pBlockControlData, ccbReader);
|
2012-06-02 06:14:18 +08:00
|
|
|
}
|
2012-07-19 17:22:36 +08:00
|
|
|
}
|
|
|
|
|
2014-06-19 19:45:24 +08:00
|
|
|
}
|