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

Method NWidgetBackground

src/widget.cpp:2174–2180  ·  view source on GitHub ↗

* Constructor parent nested widgets. * @param tp Type of parent widget. * @param colour Colour of the parent widget. * @param index Index of the widget. * @param child Child container widget (if supplied). If not supplied, a * vertical container will be inserted while adding the first * child widget. */

Source from the content-addressed store, hash-verified

2172 * child widget.
2173 */
2174NWidgetBackground::NWidgetBackground(WidgetType tp, Colours colour, WidgetID index, std::unique_ptr<NWidgetPIPContainer> &&child) : NWidgetCore(tp, colour, index, 1, 1, {}, STR_NULL)
2175{
2176 assert(tp == WWT_PANEL || tp == WWT_INSET || tp == WWT_FRAME);
2177 this->child = std::move(child);
2178 if (this->child != nullptr) this->child->parent = this;
2179 this->SetAlignment(SA_TOP | SA_LEFT);
2180}
2181
2182/**
2183 * Add a child to the parent.

Callers

nothing calls this directly

Calls 1

SetAlignmentMethod · 0.80

Tested by

no test coverage detected