2014-03-04 16:51:35 +08:00
|
|
|
|
|
|
|
|
|
|
|
#include "ScrollViewReader.h"
|
2014-03-11 17:13:54 +08:00
|
|
|
#include "ui/UIScrollView.h"
|
2014-03-04 16:51:35 +08:00
|
|
|
|
2014-03-06 16:15:03 +08:00
|
|
|
USING_NS_CC;
|
|
|
|
using namespace ui;
|
|
|
|
|
2014-03-04 16:51:35 +08:00
|
|
|
namespace cocostudio
|
|
|
|
{
|
|
|
|
static ScrollViewReader* instanceScrollViewReader = NULL;
|
|
|
|
|
|
|
|
IMPLEMENT_CLASS_WIDGET_READER_INFO(ScrollViewReader)
|
|
|
|
|
|
|
|
ScrollViewReader::ScrollViewReader()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ScrollViewReader::~ScrollViewReader()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
ScrollViewReader* ScrollViewReader::getInstance()
|
|
|
|
{
|
|
|
|
if (!instanceScrollViewReader)
|
|
|
|
{
|
|
|
|
instanceScrollViewReader = new ScrollViewReader();
|
|
|
|
}
|
|
|
|
return instanceScrollViewReader;
|
|
|
|
}
|
|
|
|
|
|
|
|
void ScrollViewReader::setPropsFromJsonDictionary(Widget *widget, const rapidjson::Value &options)
|
|
|
|
{
|
|
|
|
LayoutReader::setPropsFromJsonDictionary(widget, options);
|
|
|
|
|
|
|
|
|
|
|
|
ScrollView* scrollView = static_cast<ScrollView*>(widget);
|
|
|
|
float innerWidth = DICTOOL->getFloatValue_json(options, "innerWidth");
|
|
|
|
float innerHeight = DICTOOL->getFloatValue_json(options, "innerHeight");
|
|
|
|
scrollView->setInnerContainerSize(Size(innerWidth, innerHeight));
|
|
|
|
int direction = DICTOOL->getFloatValue_json(options, "direction");
|
|
|
|
scrollView->setDirection((SCROLLVIEW_DIR)direction);
|
|
|
|
scrollView->setBounceEnabled(DICTOOL->getBooleanValue_json(options, "bounceEnable"));
|
|
|
|
|
|
|
|
|
|
|
|
LayoutReader::setColorPropsFromJsonDictionary(widget, options);
|
|
|
|
}
|
|
|
|
}
|