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

Method SetupSmallestSize

src/smallmap_gui.cpp:1919–1937  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1917 NWidgetSmallmapDisplay() : NWidgetContainer(NWID_VERTICAL) {}
1918
1919 void SetupSmallestSize(Window *w) override
1920 {
1921 assert(this->children.size() == 2);
1922 NWidgetBase *display = this->children.front().get();
1923 NWidgetBase *bar = this->children.back().get();
1924
1925 display->SetupSmallestSize(w);
1926 bar->SetupSmallestSize(w);
1927
1928 this->smallmap_window = dynamic_cast<SmallMapWindow *>(w);
1929 assert(this->smallmap_window != nullptr);
1930 this->smallest_x = std::max(display->smallest_x, bar->smallest_x + smallmap_window->GetMinLegendWidth());
1931 this->smallest_y = display->smallest_y + std::max(bar->smallest_y, smallmap_window->GetLegendHeight(smallmap_window->min_number_of_columns));
1932 this->fill_x = std::max(display->fill_x, bar->fill_x);
1933 this->fill_y = (display->fill_y == 0 && bar->fill_y == 0) ? 0 : std::min(display->fill_y, bar->fill_y);
1934 this->resize_x = std::max(display->resize_x, bar->resize_x);
1935 this->resize_y = std::min(display->resize_y, bar->resize_y);
1936 this->ApplyAspectRatio();
1937 }
1938
1939 void AssignSizePosition(SizingType sizing, int x, int y, uint given_width, uint given_height, bool rtl) override
1940 {

Callers

nothing calls this directly

Calls 5

GetMinLegendWidthMethod · 0.80
GetLegendHeightMethod · 0.80
ApplyAspectRatioMethod · 0.80
sizeMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected