MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / constructImpl

Method constructImpl

source/windowing/StarWidgetParsing.cpp:57–74  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

55}
56
57void WidgetParser::constructImpl(Json const& config, Widget* widget) {
58 List<WidgetConstructResult> widgets = constructor(config);
59
60 sort(widgets,
61 [&](WidgetConstructResult const& a, WidgetConstructResult const& b) -> bool {
62 if (a.zlevel == b.zlevel)
63 return a.obj->position() < b.obj->position();
64 return a.zlevel < b.zlevel;
65 });
66
67 for (auto const& res : widgets) {
68 widget->addChild(res.name, res.obj);
69 if (res.obj->hasFocus()) {
70 if (m_pane)
71 m_pane->setFocus(res.obj.get());
72 }
73 }
74}
75
76WidgetPtr WidgetParser::makeSingle(String const& name, Json const& config) {
77 if (!m_constructors.contains(config.getString("type"))) {

Callers

nothing calls this directly

Calls 7

constructorFunction · 0.85
setFocusMethod · 0.80
sortFunction · 0.50
positionMethod · 0.45
addChildMethod · 0.45
hasFocusMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected