2012-06-18 19:00:26 +08:00
|
|
|
#include "CCScrollViewLoader.h"
|
|
|
|
|
2012-09-24 11:47:33 +08:00
|
|
|
|
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-11-26 21:51:05 +08:00
|
|
|
void CCScrollViewLoader::onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSize pSize, CCBReader * pCCBReader) {
|
|
|
|
if(strcmp(pPropertyName, PROPERTY_CONTENTSIZE) == 0) {
|
2012-09-09 22:34:32 +08:00
|
|
|
((CCScrollView *)pNode)->setViewSize(pSize);
|
|
|
|
} else {
|
|
|
|
CCNodeLoader::onHandlePropTypeSize(pNode, pParent, pPropertyName, pSize, pCCBReader);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-11-26 21:51:05 +08:00
|
|
|
void CCScrollViewLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
|
|
|
|
if(strcmp(pPropertyName, PROPERTY_CLIPSTOBOUNDS) == 0) {
|
2012-06-19 04:59:45 +08:00
|
|
|
((CCScrollView *)pNode)->setClippingToBounds(pCheck);
|
2012-11-26 21:51:05 +08:00
|
|
|
} else if(strcmp(pPropertyName, PROPERTY_BOUNCES) == 0) {
|
2012-06-19 04:59:45 +08:00
|
|
|
((CCScrollView *)pNode)->setBounceable(pCheck);
|
|
|
|
} else {
|
|
|
|
CCNodeLoader::onHandlePropTypeCheck(pNode, pParent, pPropertyName, pCheck, pCCBReader);
|
|
|
|
}
|
2012-06-18 19:00:26 +08:00
|
|
|
}
|
|
|
|
|
2012-11-26 21:51:05 +08:00
|
|
|
void CCScrollViewLoader::onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCNode * pCCBFileNode, CCBReader * pCCBReader) {
|
|
|
|
if(strcmp(pPropertyName, PROPERTY_CONTAINER) == 0) {
|
2012-06-19 09:43:53 +08:00
|
|
|
((CCScrollView *)pNode)->setContainer(pCCBFileNode);
|
2012-09-09 22:46:31 +08:00
|
|
|
((CCScrollView *)pNode)->updateInset();
|
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-11-26 21:51:05 +08:00
|
|
|
void CCScrollViewLoader::onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float pFloat, CCBReader * pCCBReader) {
|
|
|
|
if(strcmp(pPropertyName, PROPERTY_SCALE) == 0) {
|
2012-06-19 04:59:45 +08:00
|
|
|
((CCScrollView *)pNode)->setScale(pFloat);
|
|
|
|
} else {
|
|
|
|
CCNodeLoader::onHandlePropTypeFloat(pNode, pParent, pPropertyName, pFloat, pCCBReader);
|
|
|
|
}
|
2012-06-18 19:00:26 +08:00
|
|
|
}
|
|
|
|
|
2012-11-26 21:51:05 +08:00
|
|
|
void CCScrollViewLoader::onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, const char * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader) {
|
|
|
|
if(strcmp(pPropertyName, PROPERTY_DIRECTION) == 0) {
|
2012-06-19 04:59:45 +08:00
|
|
|
((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
|