diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp --- a/src/widgets/dropdown.cpp +++ b/src/widgets/dropdown.cpp @@ -67,7 +67,7 @@ DropDownListIconItem::DropDownListIconIt this->sprite_y = dim.height; } -uint DropDownListIconItem::Height(uint) const +uint DropDownListIconItem::Height() const { return std::max(this->dim.height, (uint)FONT_HEIGHT_NORMAL); } @@ -158,7 +158,7 @@ struct DropdownWindow : Window { /* Total length of list */ int list_height = 0; for (const auto &item : this->list) { - list_height += item->Height(items_width); + list_height += item->Height(); } /* Capacity is the average number of items visible */ @@ -213,14 +213,13 @@ struct DropdownWindow : Window { const Rect &r = this->GetWidget(WID_DM_ITEMS)->GetCurrentRect().Shrink(WidgetDimensions::scaled.fullbevel); int y = _cursor.pos.y - this->top - r.top - WidgetDimensions::scaled.fullbevel.top; - int width = r.Width(); int pos = this->vscroll->GetPosition(); for (const auto &item : this->list) { /* Skip items that are scrolled up */ if (--pos >= 0) continue; - int item_height = item->Height(width); + int item_height = item->Height(); if (y < item_height) { if (item->masked || !item->Selectable()) return false; @@ -244,7 +243,7 @@ struct DropdownWindow : Window { int y = ir.top; int pos = this->vscroll->GetPosition(); for (const auto &item : this->list) { - int item_height = item->Height(ir.Width()); + int item_height = item->Height(); /* Skip items that are scrolled up */ if (--pos >= 0) continue; @@ -353,7 +352,7 @@ void ShowDropDownListAt(Window *w, DropD uint height = 0; for (const auto &item : list) { - height += item->Height(width); + height += item->Height(); max_item_width = std::max(max_item_width, item->Width()); }