mirror of https://github.com/axmolengine/axmol.git
56 lines
2.3 KiB
C++
56 lines
2.3 KiB
C++
#include "CCScrollViewLoader.h"
|
|
|
|
|
|
|
|
#define PROPERTY_CONTAINER "container"
|
|
#define PROPERTY_DIRECTION "direction"
|
|
#define PROPERTY_CLIPSTOBOUNDS "clipsToBounds"
|
|
#define PROPERTY_BOUNCES "bounces"
|
|
#define PROPERTY_SCALE "scale"
|
|
|
|
NS_CC_EXT_BEGIN
|
|
|
|
void CCScrollViewLoader::onHandlePropTypeSize(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCSize pSize, CCBReader * pCCBReader) {
|
|
if(strcmp(pPropertyName, PROPERTY_CONTENTSIZE) == 0) {
|
|
((CCScrollView *)pNode)->setViewSize(pSize);
|
|
} else {
|
|
CCNodeLoader::onHandlePropTypeSize(pNode, pParent, pPropertyName, pSize, pCCBReader);
|
|
}
|
|
}
|
|
|
|
void CCScrollViewLoader::onHandlePropTypeCheck(CCNode * pNode, CCNode * pParent, const char * pPropertyName, bool pCheck, CCBReader * pCCBReader) {
|
|
if(strcmp(pPropertyName, PROPERTY_CLIPSTOBOUNDS) == 0) {
|
|
((CCScrollView *)pNode)->setClippingToBounds(pCheck);
|
|
} else if(strcmp(pPropertyName, PROPERTY_BOUNCES) == 0) {
|
|
((CCScrollView *)pNode)->setBounceable(pCheck);
|
|
} else {
|
|
CCNodeLoader::onHandlePropTypeCheck(pNode, pParent, pPropertyName, pCheck, pCCBReader);
|
|
}
|
|
}
|
|
|
|
void CCScrollViewLoader::onHandlePropTypeCCBFile(CCNode * pNode, CCNode * pParent, const char * pPropertyName, CCNode * pCCBFileNode, CCBReader * pCCBReader) {
|
|
if(strcmp(pPropertyName, PROPERTY_CONTAINER) == 0) {
|
|
((CCScrollView *)pNode)->setContainer(pCCBFileNode);
|
|
((CCScrollView *)pNode)->updateInset();
|
|
} else {
|
|
CCNodeLoader::onHandlePropTypeCCBFile(pNode, pParent, pPropertyName, pCCBFileNode, pCCBReader);
|
|
}
|
|
}
|
|
|
|
void CCScrollViewLoader::onHandlePropTypeFloat(CCNode * pNode, CCNode * pParent, const char * pPropertyName, float pFloat, CCBReader * pCCBReader) {
|
|
if(strcmp(pPropertyName, PROPERTY_SCALE) == 0) {
|
|
((CCScrollView *)pNode)->setScale(pFloat);
|
|
} else {
|
|
CCNodeLoader::onHandlePropTypeFloat(pNode, pParent, pPropertyName, pFloat, pCCBReader);
|
|
}
|
|
}
|
|
|
|
void CCScrollViewLoader::onHandlePropTypeIntegerLabeled(CCNode * pNode, CCNode * pParent, const char * pPropertyName, int pIntegerLabeled, CCBReader * pCCBReader) {
|
|
if(strcmp(pPropertyName, PROPERTY_DIRECTION) == 0) {
|
|
((CCScrollView *)pNode)->setDirection(CCScrollViewDirection(pIntegerLabeled));
|
|
} else {
|
|
CCNodeLoader::onHandlePropTypeFloatScale(pNode, pParent, pPropertyName, pIntegerLabeled, pCCBReader);
|
|
}
|
|
}
|
|
|
|
NS_CC_EXT_END |