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

Method UpdateWidgetSize

src/rail_gui.cpp:1524–1533  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1522 }
1523
1524 void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
1525 {
1526 if (widget == WID_BS_DRAG_SIGNALS_DENSITY_LABEL) {
1527 /* Two digits for signals density. */
1528 size.width = std::max(size.width, 2 * GetDigitWidth() + padding.width + WidgetDimensions::scaled.framerect.Horizontal());
1529 } else if (IsInsideMM(widget, WID_BS_SEMAPHORE_NORM, WID_BS_ELECTRIC_PBS_OWAY + 1)) {
1530 size.width = std::max(size.width, this->sig_sprite_size.width + padding.width);
1531 size.height = std::max(size.height, this->sig_sprite_size.height + padding.height);
1532 }
1533 }
1534
1535 std::string GetWidgetString(WidgetID widget, StringID stringid) const override
1536 {

Callers

nothing calls this directly

Calls 3

GetDigitWidthFunction · 0.85
IsInsideMMFunction · 0.85
HorizontalMethod · 0.80

Tested by

no test coverage detected