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

Function GetDropDownListDimension

src/dropdown.cpp:381–390  ·  view source on GitHub ↗

* Determine width and height required to fully display a DropDownList * @param list The list. * @return Dimension required to display the list. */

Source from the content-addressed store, hash-verified

379 * @return Dimension required to display the list.
380 */
381Dimension GetDropDownListDimension(const DropDownList &list)
382{
383 Dimension dim{};
384 for (const auto &item : list) {
385 dim.height += item->Height();
386 dim.width = std::max(dim.width, item->Width());
387 }
388 dim.width += WidgetDimensions::scaled.dropdowntext.Horizontal();
389 return dim;
390}
391
392/**
393 * Show a drop down list.

Callers 5

UpdateWidgetSizeMethod · 0.85
UpdateWidgetSizeMethod · 0.85
UpdateWidgetSizeMethod · 0.85
UpdateWidgetSizeMethod · 0.85
UpdateSizeAndPositionMethod · 0.85

Calls 3

HorizontalMethod · 0.80
HeightMethod · 0.45
WidthMethod · 0.45

Tested by

no test coverage detected