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

Method UpdateWidgetSize

src/network/network_content_gui.cpp:120–136  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

118}
119
120void BaseNetworkContentDownloadStatusWindow::UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize)
121{
122 switch (widget) {
123 case WID_NCDS_PROGRESS_BAR: {
124 auto max_value = GetParamMaxDigits(8);
125 size = GetStringBoundingBox(GetString(STR_CONTENT_DOWNLOAD_PROGRESS_SIZE, max_value, max_value, max_value));
126 /* We need some spacing for the 'border' */
127 size.height += WidgetDimensions::scaled.frametext.Horizontal();
128 size.width += WidgetDimensions::scaled.frametext.Vertical();
129 break;
130 }
131
132 case WID_NCDS_PROGRESS_TEXT:
133 size.height = GetCharacterHeight(FS_NORMAL) * 2 + WidgetDimensions::scaled.vsep_normal;
134 break;
135 }
136}
137
138void BaseNetworkContentDownloadStatusWindow::DrawWidget(const Rect &r, WidgetID widget) const
139{

Callers

nothing calls this directly

Calls 6

GetParamMaxDigitsFunction · 0.85
GetStringBoundingBoxFunction · 0.85
GetCharacterHeightFunction · 0.85
HorizontalMethod · 0.80
VerticalMethod · 0.80
GetStringFunction · 0.50

Tested by

no test coverage detected