diff --git a/src/company_gui.cpp b/src/company_gui.cpp --- a/src/company_gui.cpp +++ b/src/company_gui.cpp @@ -597,7 +597,7 @@ public: return ScaleGUITrad(28) + WidgetDimensions::scaled.hsep_normal + GetStringBoundingBox(this->String()).width + WidgetDimensions::scaled.dropdowntext.Horizontal(); } - uint Height(uint) const override + uint Height() const override { return std::max(FONT_HEIGHT_NORMAL, ScaleGUITrad(12) + WidgetDimensions::scaled.vsep_normal); } diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -475,7 +475,7 @@ struct GameOptionsWindow : Window { Dimension string_dim; int width = ddli->Width(); string_dim.width = width + padding.width; - string_dim.height = ddli->Height(width) + padding.height; + string_dim.height = ddli->Height() + padding.height; *size = maxdim(*size, string_dim); } } diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -147,7 +147,7 @@ public: return GetStringBoundingBox(STR_COMPANY_NAME_COMPANY_NUM).width + this->icon_size.width + this->lock_size.width + WidgetDimensions::scaled.dropdowntext.Horizontal() + WidgetDimensions::scaled.hsep_wide; } - uint Height(uint) const override + uint Height() const override { return std::max(std::max(this->icon_size.height, this->lock_size.height) + WidgetDimensions::scaled.imgbtn.Vertical(), (uint)FONT_HEIGHT_NORMAL); } 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()); } diff --git a/src/widgets/dropdown_type.h b/src/widgets/dropdown_type.h --- a/src/widgets/dropdown_type.h +++ b/src/widgets/dropdown_type.h @@ -27,7 +27,7 @@ public: virtual ~DropDownListItem() = default; virtual bool Selectable() const { return false; } - virtual uint Height([[maybe_unused]] uint) const { return FONT_HEIGHT_NORMAL; } + virtual uint Height() const { return FONT_HEIGHT_NORMAL; } virtual uint Width() const { return 0; } virtual void Draw(const Rect &r, bool sel, Colours bg_colour) const; }; @@ -61,7 +61,7 @@ class DropDownListIconItem : public Drop public: DropDownListIconItem(SpriteID sprite, PaletteID pal, StringID string, int result, bool masked); - uint Height(uint width) const override; + uint Height() const override; uint Width() const override; void Draw(const Rect &r, bool sel, Colours bg_colour) const override; void SetDimension(Dimension d);