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
|
|
|
|
|
2013-06-20 14:15:53 +08:00
|
|
|
void ScrollViewLoader::onHandlePropTypeSize(Node * pNode, Node * pParent, const char * pPropertyName, Size pSize, CCBReader * pCCBReader) {
|
2012-11-26 21:51:05 +08:00
|
|
|
if(strcmp(pPropertyName, PROPERTY_CONTENTSIZE) == 0) {
|
2013-06-20 14:15:53 +08:00
|
|
|
((ScrollView *)pNode)->setViewSize(pSize);
|
2012-09-09 22:34:32 +08:00
|
|
|
} else {
|
2013-06-20 14:15:53 +08:00
|
|
|
NodeLoader::onHandlePropTypeSize(pNode, pParent, pPropertyName, pSize, pCCBReader);
|
2012-09-09 22:34:32 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-20 14:15:53 +08:00
|
|
|
void ScrollViewLoader::onHandlePropTypeCheck(Node * pNode, Node * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
|
2012-11-26 21:51:05 +08:00
|
|
|
if(strcmp(pPropertyName, PROPERTY_CLIPSTOBOUNDS) == 0) {
|
2013-06-20 14:15:53 +08:00
|
|
|
((ScrollView *)pNode)->setClippingToBounds(pCheck);
|
2012-11-26 21:51:05 +08:00
|
|
|
} else if(strcmp(pPropertyName, PROPERTY_BOUNCES) == 0) {
|
2013-06-20 14:15:53 +08:00
|
|
|
((ScrollView *)pNode)->setBounceable(pCheck);
|
2012-06-19 04:59:45 +08:00
|
|
|
} else {
|
2013-06-20 14:15:53 +08:00
|
|
|
NodeLoader::onHandlePropTypeCheck(pNode, pParent, pPropertyName, pCheck, pCCBReader);
|
2012-06-19 04:59:45 +08:00
|
|
|
}
|
2012-06-18 19:00:26 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:15:53 +08:00
|
|
|
void ScrollViewLoader::onHandlePropTypeCCBFile(Node * pNode, Node * pParent, const char * pPropertyName, Node * pCCBFileNode, CCBReader * pCCBReader) {
|
2012-11-26 21:51:05 +08:00
|
|
|
if(strcmp(pPropertyName, PROPERTY_CONTAINER) == 0) {
|
2013-06-20 14:15:53 +08:00
|
|
|
((ScrollView *)pNode)->setContainer(pCCBFileNode);
|
|
|
|
((ScrollView *)pNode)->updateInset();
|
2012-06-19 04:59:45 +08:00
|
|
|
} else {
|
2013-06-20 14:15:53 +08:00
|
|
|
NodeLoader::onHandlePropTypeCCBFile(pNode, pParent, pPropertyName, pCCBFileNode, pCCBReader);
|
2012-06-19 04:59:45 +08:00
|
|
|
}
|
2012-06-18 19:00:26 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:15:53 +08:00
|
|
|
void ScrollViewLoader::onHandlePropTypeFloat(Node * pNode, Node * pParent, const char * pPropertyName, float pFloat, CCBReader * pCCBReader) {
|
2012-11-26 21:51:05 +08:00
|
|
|
if(strcmp(pPropertyName, PROPERTY_SCALE) == 0) {
|
2013-06-20 14:15:53 +08:00
|
|
|
((ScrollView *)pNode)->setScale(pFloat);
|
2012-06-19 04:59:45 +08:00
|
|
|
} else {
|
2013-06-20 14:15:53 +08:00
|
|
|
NodeLoader::onHandlePropTypeFloat(pNode, pParent, pPropertyName, pFloat, pCCBReader);
|
2012-06-19 04:59:45 +08:00
|
|
|
}
|
2012-06-18 19:00:26 +08:00
|
|
|
}
|
|
|
|
|
2013-06-20 14:15:53 +08:00
|
|
|
void ScrollViewLoader::onHandlePropTypeIntegerLabeled(Node * pNode, Node * pParent, const char * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader) {
|
2012-11-26 21:51:05 +08:00
|
|
|
if(strcmp(pPropertyName, PROPERTY_DIRECTION) == 0) {
|
2013-07-26 22:55:41 +08:00
|
|
|
((ScrollView *)pNode)->setDirection(ScrollView::Direction(pIntegerLabeled));
|
2012-06-19 04:59:45 +08:00
|
|
|
} else {
|
2013-06-20 14:15:53 +08:00
|
|
|
NodeLoader::onHandlePropTypeFloatScale(pNode, pParent, pPropertyName, pIntegerLabeled, pCCBReader);
|
2012-06-19 04:59:45 +08:00
|
|
|
}
|
2012-07-19 17:22:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
NS_CC_EXT_END
|