forked from mirror/OpenTTD
Codechange: Pass by reference to UpdateWidgetSize. (#12457)
These parameters are always provided and not optional.
This commit is contained in:
@@ -423,7 +423,7 @@ public:
|
||||
this->SetupArrays();
|
||||
}
|
||||
|
||||
void UpdateWidgetSize(WidgetID widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
|
||||
void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_DPI_MATRIX_WIDGET: {
|
||||
@@ -431,10 +431,10 @@ public:
|
||||
for (const auto &indtype : this->list) {
|
||||
d = maxdim(d, GetStringBoundingBox(GetIndustrySpec(indtype)->name));
|
||||
}
|
||||
resize->height = std::max<uint>(this->legend.height, GetCharacterHeight(FS_NORMAL)) + padding.height;
|
||||
resize.height = std::max<uint>(this->legend.height, GetCharacterHeight(FS_NORMAL)) + padding.height;
|
||||
d.width += this->legend.width + WidgetDimensions::scaled.hsep_wide + padding.width;
|
||||
d.height = 5 * resize->height;
|
||||
*size = maxdim(*size, d);
|
||||
d.height = 5 * resize.height;
|
||||
size = maxdim(size, d);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -478,8 +478,8 @@ public:
|
||||
|
||||
/* Set it to something more sane :) */
|
||||
height += extra_lines_prd + extra_lines_req + extra_lines_newgrf;
|
||||
size->height = height * GetCharacterHeight(FS_NORMAL) + padding.height;
|
||||
size->width = d.width + padding.width;
|
||||
size.height = height * GetCharacterHeight(FS_NORMAL) + padding.height;
|
||||
size.width = d.width + padding.width;
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -489,7 +489,7 @@ public:
|
||||
d = maxdim(d, GetStringBoundingBox(STR_FUND_INDUSTRY_FUND_NEW_INDUSTRY));
|
||||
d.width += padding.width;
|
||||
d.height += padding.height;
|
||||
*size = maxdim(*size, d);
|
||||
size = maxdim(size, d);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -1004,9 +1004,9 @@ public:
|
||||
if (widget == WID_IV_CAPTION) SetDParam(0, this->window_number);
|
||||
}
|
||||
|
||||
void UpdateWidgetSize(WidgetID widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
|
||||
void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
|
||||
{
|
||||
if (widget == WID_IV_INFO) size->height = this->info_height;
|
||||
if (widget == WID_IV_INFO) size.height = this->info_height;
|
||||
}
|
||||
|
||||
void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
|
||||
@@ -1720,14 +1720,14 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void UpdateWidgetSize(WidgetID widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
|
||||
void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_ID_DROPDOWN_ORDER: {
|
||||
Dimension d = GetStringBoundingBox(this->GetWidget<NWidgetCore>(widget)->widget_data);
|
||||
d.width += padding.width + Window::SortButtonWidth() * 2; // Doubled since the string is centred and it also looks better.
|
||||
d.height += padding.height;
|
||||
*size = maxdim(*size, d);
|
||||
size = maxdim(size, d);
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1738,17 +1738,17 @@ public:
|
||||
}
|
||||
d.width += padding.width;
|
||||
d.height += padding.height;
|
||||
*size = maxdim(*size, d);
|
||||
size = maxdim(size, d);
|
||||
break;
|
||||
}
|
||||
|
||||
case WID_ID_INDUSTRY_LIST: {
|
||||
Dimension d = GetStringBoundingBox(STR_INDUSTRY_DIRECTORY_NONE);
|
||||
resize->height = d.height;
|
||||
resize.height = d.height;
|
||||
d.height *= 5;
|
||||
d.width += padding.width;
|
||||
d.height += padding.height;
|
||||
*size = maxdim(*size, d);
|
||||
size = maxdim(size, d);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -2626,21 +2626,21 @@ struct IndustryCargoesWindow : public Window {
|
||||
CargoesField::cargo_field_width = CargoesField::cargo_border.width * 2 + CargoesField::cargo_line.width * CargoesField::max_cargoes + CargoesField::cargo_space.width * (CargoesField::max_cargoes - 1);
|
||||
}
|
||||
|
||||
void UpdateWidgetSize(WidgetID widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
|
||||
void UpdateWidgetSize(WidgetID widget, Dimension &size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension &fill, [[maybe_unused]] Dimension &resize) override
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_IC_PANEL:
|
||||
resize->height = CargoesField::normal_height;
|
||||
size->width = CargoesField::industry_width * 3 + CargoesField::cargo_field_width * 2 + WidgetDimensions::scaled.frametext.Horizontal();
|
||||
size->height = CargoesField::small_height + 2 * resize->height + WidgetDimensions::scaled.frametext.Vertical();
|
||||
resize.height = CargoesField::normal_height;
|
||||
size.width = CargoesField::industry_width * 3 + CargoesField::cargo_field_width * 2 + WidgetDimensions::scaled.frametext.Horizontal();
|
||||
size.height = CargoesField::small_height + 2 * resize.height + WidgetDimensions::scaled.frametext.Vertical();
|
||||
break;
|
||||
|
||||
case WID_IC_IND_DROPDOWN:
|
||||
size->width = std::max(size->width, this->ind_textsize.width + padding.width);
|
||||
size.width = std::max(size.width, this->ind_textsize.width + padding.width);
|
||||
break;
|
||||
|
||||
case WID_IC_CARGO_DROPDOWN:
|
||||
size->width = std::max(size->width, this->cargo_textsize.width + padding.width);
|
||||
size.width = std::max(size.width, this->cargo_textsize.width + padding.width);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user