2012-06-18 19:00:26 +08:00
|
|
|
#include "CCScrollViewLoader.h"
|
|
|
|
|
2012-06-19 04:33:19 +08:00
|
|
|
USING_NS_CC;
|
2012-06-18 19:00:26 +08:00
|
|
|
|
2012-06-19 04:59:45 +08:00
|
|
|
#define PROPERTY_CONTAINER "container"
|
|
|
|
#define PROPERTY_DIRECTION "direction"
|
|
|
|
#define PROPERTY_CLIPSTOBOUNDS "clipsToBounds"
|
|
|
|
#define PROPERTY_BOUNCES "bounces"
|
|
|
|
#define PROPERTY_SCALE "scale"
|
|
|
|
|
2012-07-19 17:22:36 +08:00
|
|
|
NS_CC_EXT_BEGIN
|
|
|
|
|
2012-06-19 04:59:45 +08:00
|
|
|
void CCScrollViewLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
|
|
|
|
if(pPropertyName->compare(PROPERTY_CLIPSTOBOUNDS) == 0) {
|
|
|
|
((CCScrollView *)pNode)->setClippingToBounds(pCheck);
|
|
|
|
} else if(pPropertyName->compare(PROPERTY_BOUNCES) == 0) {
|
|
|
|
((CCScrollView *)pNode)->setBounceable(pCheck);
|
|
|
|
} else {
|
|
|
|
CCNodeLoader::onHandlePropTypeCheck(pNode, pParent, pPropertyName, pCheck, pCCBReader);
|
|
|
|
}
|
2012-06-18 19:00:26 +08:00
|
|
|
}
|
|
|
|
|
2012-06-19 04:59:45 +08:00
|
|
|
void CCScrollViewLoader::onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, CCNode * pCCBFileNode, CCBReader * pCCBReader) {
|
|
|
|
if(pPropertyName->compare(PROPERTY_CONTAINER) == 0) {
|
2012-06-19 09:43:53 +08:00
|
|
|
((CCScrollView *)pNode)->setContainer(pCCBFileNode);
|
2012-06-19 04:59:45 +08:00
|
|
|
} else {
|
|
|
|
CCNodeLoader::onHandlePropTypeCCBFile(pNode, pParent, pPropertyName, pCCBFileNode, pCCBReader);
|
|
|
|
}
|
2012-06-18 19:00:26 +08:00
|
|
|
}
|
|
|
|
|
2012-06-19 04:59:45 +08:00
|
|
|
void CCScrollViewLoader::onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, float pFloat, CCBReader * pCCBReader) {
|
|
|
|
if(pPropertyName->compare(PROPERTY_SCALE) == 0) {
|
|
|
|
((CCScrollView *)pNode)->setScale(pFloat);
|
|
|
|
} else {
|
|
|
|
CCNodeLoader::onHandlePropTypeFloat(pNode, pParent, pPropertyName, pFloat, pCCBReader);
|
|
|
|
}
|
2012-06-18 19:00:26 +08:00
|
|
|
}
|
|
|
|
|
2012-06-19 04:59:45 +08:00
|
|
|
void CCScrollViewLoader::onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, CCString * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader) {
|
|
|
|
if(pPropertyName->compare(PROPERTY_DIRECTION) == 0) {
|
|
|
|
((CCScrollView *)pNode)->setDirection(CCScrollViewDirection(pIntegerLabeled));
|
|
|
|
} else {
|
|
|
|
CCNodeLoader::onHandlePropTypeFloatScale(pNode, pParent, pPropertyName, pIntegerLabeled, pCCBReader);
|
|
|
|
}
|
2012-07-19 17:22:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_CC_EXT_END
|