32 Base::deserialization(_node, _version);
37 while (widget.
next(
"Widget"))
73 if (node->
getName() ==
"Widget")
77 else if (node->
getName() ==
"Property")
81 else if (node->
getName() ==
"UserString")
85 else if (node->
getName() ==
"Controller")
91 while (prop.
next(
"Property"))
108 widgets.push_back(widget);
116 std::string widgetName = _widgetInfo.
name;
118 std::string widgetLayer = _widgetInfo.
layer;
120 if (!widgetName.empty()) widgetName = _prefix + widgetName;
123 if (_parent ==
nullptr && widgetLayer.empty())
125 MYGUI_LOG(Warning,
"Root widget's layer is not specified, widget won't be visible. Specify layer or parent or attach it to another widget after load." <<
" [" <<
LayoutManager::getInstance().getCurrentLayout() <<
"]");
139 if (
nullptr == _parent)
146 for (VectorStringPairs::const_iterator iter = _widgetInfo.
properties.begin(); iter != _widgetInfo.
properties.end(); ++iter)
151 for (MapString::const_iterator iter = _widgetInfo.
userStrings.begin(); iter != _widgetInfo.
userStrings.end(); ++iter)
163 for (std::vector<ControllerInfo>::const_iterator iter = _widgetInfo.
controllers.begin(); iter != _widgetInfo.
controllers.end(); ++iter)
168 for (MapString::const_iterator iterProp = iter->properties.begin(); iterProp != iter->properties.end(); ++iterProp)
170 item->
setProperty(iterProp->first, iterProp->second);
176 MYGUI_LOG(Warning,
"Controller '" << iter->type <<
"' not found");
#define MYGUI_LOG(level, text)
virtual void setProperty(const std::string &_key, const std::string &_value)
ControllerItem * createItem(const std::string &_type)
static ControllerManager & getInstance()
void addItem(Widget *_widget, ControllerItem *_item)
static IntCoord convertFromRelative(const FloatCoord &_coord, const IntSize &_view)
Widget * createWidgetT(const std::string &_type, const std::string &_skin, const IntCoord &_coord, Align _align, const std::string &_layer, const std::string &_name="")
static Gui & getInstance()
std::string mResourceName
static LayoutManager & getInstance()
EventHandle_AddUserStringDelegate eventAddUserString
EventHandle_CreateWidgetDelegate eventCreateWidget
virtual const IntSize & getViewSize() const =0
static RenderManager & getInstance()
VectorWidgetInfo mLayoutData
void deserialization(xml::ElementPtr _node, Version _version) override
WidgetInfo parseWidget(xml::ElementEnumerator &_widget)
const VectorWidgetInfo & getLayoutData() const
Widget * createWidget(const WidgetInfo &_widgetInfo, const std::string &_prefix="", Widget *_parent=nullptr, bool _template=false)
VectorWidgetPtr createLayout(const std::string &_prefix="", Widget *_parent=nullptr)
void setUserString(const std::string &_key, const std::string &_value)
ElementEnumerator getElementEnumerator()
const std::string & getName() const
bool findAttribute(const std::string &_name, std::string &_value)
std::pair< std::string, std::string > PairString
std::vector< WidgetInfo > VectorWidgetInfo
std::vector< Widget * > VectorWidgetPtr
static Align parse(const std::string &_value)
static TCoord< int > parse(const std::string &_value)