mirror of https://github.com/axmolengine/axmol.git
49 lines
1.2 KiB
C++
49 lines
1.2 KiB
C++
|
|
|
|
#include "ListViewReader.h"
|
|
#include "gui/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(gui::Widget *widget, const rapidjson::Value &options)
|
|
{
|
|
ScrollViewReader::setPropsFromJsonDictionary(widget, options);
|
|
|
|
|
|
ListView* listView = static_cast<ListView*>(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);
|
|
}
|
|
}
|
|
|