mirror of https://github.com/OpenTTD/OpenTTD
(svn r26691) -Codechange: Simplify ShowDropDownListAt (Juanjo)
parent
e6641f86d8
commit
925fb7bd37
|
@ -344,22 +344,16 @@ void ShowDropDownListAt(Window *w, const DropDownList *list, int selected, int b
|
|||
/* The preferred width equals the calling widget */
|
||||
uint width = wi_rect.right - wi_rect.left + 1;
|
||||
|
||||
/* Longest item in the list, if auto_width is enabled */
|
||||
uint max_item_width = 0;
|
||||
|
||||
if (auto_width) {
|
||||
/* Find the longest item in the list */
|
||||
for (const DropDownListItem * const *it = list->Begin(); it != list->End(); ++it) {
|
||||
const DropDownListItem *item = *it;
|
||||
max_item_width = max(max_item_width, item->Width() + 5);
|
||||
}
|
||||
}
|
||||
|
||||
/* Total length of list */
|
||||
int height = 0;
|
||||
|
||||
for (const DropDownListItem * const *it = list->Begin(); it != list->End(); ++it) {
|
||||
const DropDownListItem *item = *it;
|
||||
height += item->Height(width);
|
||||
if (auto_width) max_item_width = max(max_item_width, item->Width() + 5);
|
||||
}
|
||||
|
||||
/* Check if the status bar is visible, as we don't want to draw over it */
|
||||
|
|
Loading…
Reference in New Issue