mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-10 08:00:05 +00:00
Codechange: Simplify setting minimum width for game options dropdown lists. (#11474)
Height isn't necessary as drop down controls already have sufficient height, so we can use GetDropDownListDimension() to get the width.
This commit is contained in:
parent
f58a7ef673
commit
c80fa7d752
@ -445,17 +445,8 @@ struct GameOptionsWindow : Window {
|
||||
|
||||
default: {
|
||||
int selected;
|
||||
DropDownList list = this->BuildDropDownList(widget, &selected);
|
||||
if (!list.empty()) {
|
||||
/* Find the biggest item for the default size. */
|
||||
for (const auto &ddli : list) {
|
||||
Dimension string_dim;
|
||||
int width = ddli->Width();
|
||||
string_dim.width = width + padding.width;
|
||||
string_dim.height = ddli->Height() + padding.height;
|
||||
*size = maxdim(*size, string_dim);
|
||||
}
|
||||
}
|
||||
size->width = std::max(size->width, GetDropDownListDimension(this->BuildDropDownList(widget, &selected)).width + padding.width);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user