MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / MakeNWidgets

Function MakeNWidgets

src/widget.cpp:3410–3418  ·  view source on GitHub ↗

* Construct a nested widget tree from an array of parts. * @param nwid_parts Span of nested widget parts. * @param container Container to add the nested widgets to. In case it is nullptr a vertical container is used. * @return Root of the nested widget tree, a vertical container containing the entire GUI. * @ingroup NestedWidgetParts */

Source from the content-addressed store, hash-verified

3408 * @ingroup NestedWidgetParts
3409 */
3410std::unique_ptr<NWidgetBase> MakeNWidgets(std::span<const NWidgetPart> nwid_parts, std::unique_ptr<NWidgetBase> &&container)
3411{
3412 if (container == nullptr) container = std::make_unique<NWidgetVertical>();
3413 [[maybe_unused]] auto nwid_part = MakeWidgetTree(std::begin(nwid_parts), std::end(nwid_parts), container);
3414#ifdef WITH_ASSERT
3415 if (nwid_part != std::end(nwid_parts)) [[unlikely]] throw std::runtime_error("Did not consume all NWidgetParts");
3416#endif
3417 return std::move(container);
3418}
3419
3420/**
3421 * Make a nested widget tree for a window from a parts array. Besides loading, it inserts a shading selection widget

Callers 7

NewGRFDisplayFunction · 0.85
MakeScenarioToolbarFunction · 0.85
MakePickerClassWidgetsFunction · 0.85
MakePickerTypeWidgetsFunction · 0.85
NWidgetSocialPluginsMethod · 0.85
MakeWindowNWidgetTreeFunction · 0.85
SmallMapDisplayFunction · 0.85

Calls 3

MakeWidgetTreeFunction · 0.85
beginFunction · 0.50
endFunction · 0.50

Tested by

no test coverage detected