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

Function MakeMainToolbar

src/toolbar_gui.cpp:2214–2234  ·  view source on GitHub ↗

* Make widgets for the main toolbar. * @return widgets for the main toolbar. */

Source from the content-addressed store, hash-verified

2212 * @return widgets for the main toolbar.
2213 */
2214static std::unique_ptr<NWidgetBase> MakeMainToolbar()
2215{
2216 auto hor = std::make_unique<NWidgetMainToolbarContainer>();
2217 for (const auto &[widget, tp, sprite] : _toolbar_button_sprites) {
2218 switch (widget) {
2219 case WID_TN_SMALL_MAP:
2220 case WID_TN_FINANCES:
2221 case WID_TN_VEHICLE_START:
2222 case WID_TN_ZOOM_IN:
2223 case WID_TN_BUILDING_TOOLS_START:
2224 case WID_TN_MUSIC_SOUND:
2225 hor->Add(std::make_unique<NWidgetSpacer>(0, 0));
2226 break;
2227 }
2228 auto leaf = std::make_unique<NWidgetLeaf>(tp, COLOUR_GREY, widget, WidgetData{.sprite = sprite}, STR_TOOLBAR_TOOLTIP_PAUSE_GAME + widget);
2229 leaf->SetToolbarMinimalSize(1);
2230 hor->Add(std::move(leaf));
2231 }
2232
2233 return hor;
2234}
2235
2236static constexpr std::initializer_list<NWidgetPart> _nested_toolbar_normal_widgets = {
2237 NWidgetFunction(MakeMainToolbar),

Callers

nothing calls this directly

Calls 2

SetToolbarMinimalSizeMethod · 0.80
AddMethod · 0.45

Tested by

no test coverage detected