| 115 | } |
| 116 | |
| 117 | Widget* ResourceLayout::createWidget( |
| 118 | const WidgetInfo& _widgetInfo, |
| 119 | std::string_view _prefix, |
| 120 | Widget* _parent, |
| 121 | bool _template) |
| 122 | { |
| 123 | std::string widgetName; |
| 124 | WidgetStyle style = _widgetInfo.style; |
| 125 | std::string_view widgetLayer = _widgetInfo.layer; |
| 126 | |
| 127 | if (!_widgetInfo.name.empty()) |
| 128 | { |
| 129 | widgetName = _prefix; |
| 130 | widgetName += _widgetInfo.name; |
| 131 | } |
| 132 | |
| 133 | if (_parent != nullptr && style != WidgetStyle::Popup) |
| 134 | widgetLayer = {}; |
| 135 | if (_parent == nullptr && widgetLayer.empty()) |
| 136 | { |
| 137 | MYGUI_LOG( |
| 138 | Warning, |
| 139 | "Root widget's layer is not specified, widget won't be visible. Specify layer or parent or attach it " |
| 140 | "to another widget after load." |
| 141 | << " [" << LayoutManager::getInstance().getCurrentLayout() << "]"); |
| 142 | } |
| 143 | |
| 144 | IntCoord coord; |
| 145 | if (_widgetInfo.positionType == WidgetInfo::Pixels) |
| 146 | coord = _widgetInfo.intCoord; |
| 147 | else if (_widgetInfo.positionType == WidgetInfo::Relative) |
| 148 | { |
| 149 | if (_parent == nullptr || style == WidgetStyle::Popup) |
| 150 | coord = CoordConverter::convertFromRelative( |
| 151 | _widgetInfo.floatCoord, |
| 152 | RenderManager::getInstance().getViewSize()); |
| 153 | else |
| 154 | coord = CoordConverter::convertFromRelative(_widgetInfo.floatCoord, _parent->getClientCoord().size()); |
| 155 | } |
| 156 | |
| 157 | Widget* wid; |
| 158 | if (nullptr == _parent) |
| 159 | wid = Gui::getInstance().createWidgetT( |
| 160 | _widgetInfo.type, |
| 161 | _widgetInfo.skin, |
| 162 | coord, |
| 163 | _widgetInfo.align, |
| 164 | widgetLayer, |
| 165 | widgetName); |
| 166 | else if (_template) |
| 167 | wid = _parent->_createSkinWidget( |
| 168 | style, |
| 169 | _widgetInfo.type, |
| 170 | _widgetInfo.skin, |
| 171 | coord, |
| 172 | _widgetInfo.align, |
| 173 | widgetLayer, |
| 174 | widgetName); |
nothing calls this directly
no test coverage detected