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

Method UpdateWidgetSize

src/statusbar_gui.cpp:82–104  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

80 }
81
82 void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
83 {
84 Dimension d;
85 switch (widget) {
86 case WID_S_LEFT:
87 d = GetStringBoundingBox(GetString(STR_JUST_DATE_LONG, GetParamMaxValue(TimerGameCalendar::DateAtStartOfYear(CalendarTime::MAX_YEAR).base())));
88 break;
89
90 case WID_S_RIGHT: {
91 int64_t max_money = UINT32_MAX;
92 for (const Company *c : Company::Iterate()) max_money = std::max<int64_t>(c->money, max_money);
93 d = GetStringBoundingBox(GetString(STR_JUST_CURRENCY_LONG, 100LL * max_money));
94 break;
95 }
96
97 default:
98 return;
99 }
100
101 d.width += padding.width;
102 d.height += padding.height;
103 size = maxdim(d, size);
104 }
105
106 void DrawWidget(const Rect &r, WidgetID widget) const override
107 {

Callers

nothing calls this directly

Calls 5

GetStringBoundingBoxFunction · 0.85
GetParamMaxValueFunction · 0.85
maxdimFunction · 0.85
GetStringFunction · 0.70
baseMethod · 0.45

Tested by

no test coverage detected