Codechange: refactor string list dimension finding into a separate function

This commit is contained in:
Rubidium
2024-04-28 15:59:53 +02:00
committed by rubidium42
parent 546a996d95
commit 37a03b513f
10 changed files with 26 additions and 35 deletions

View File

@@ -1739,10 +1739,7 @@ public:
}
case WID_ID_DROPDOWN_CRITERIA: {
Dimension d = {0, 0};
for (uint i = 0; IndustryDirectoryWindow::sorter_names[i] != INVALID_STRING_ID; i++) {
d = maxdim(d, GetStringBoundingBox(IndustryDirectoryWindow::sorter_names[i]));
}
Dimension d = GetStringListBoundingBox(IndustryDirectoryWindow::sorter_names);
d.width += padding.width;
d.height += padding.height;
size = maxdim(size, d);