#include "ListViewReader.h" #include "ui/UIListView.h" namespace cocostudio { static ListViewReader* instanceListViewReader = NULL; IMPLEMENT_CLASS_WIDGET_READER_INFO(ListViewReader) ListViewReader::ListViewReader() { } ListViewReader::~ListViewReader() { } ListViewReader* ListViewReader::getInstance() { if (!instanceListViewReader) { instanceListViewReader = new ListViewReader(); } return instanceListViewReader; } void ListViewReader::setPropsFromJsonDictionary(ui::Widget *widget, const rapidjson::Value &options) { ScrollViewReader::setPropsFromJsonDictionary(widget, options); ListView* listView = static_cast(widget); int direction = DICTOOL->getFloatValue_json(options, "direction"); listView->setDirection((SCROLLVIEW_DIR)direction); ListViewGravity gravity = (ListViewGravity)DICTOOL->getIntValue_json(options, "gravity"); listView->setGravity(gravity); float itemMargin = DICTOOL->getFloatValue_json(options, "itemMargin"); listView->setItemsMargin(itemMargin); } }