Changeset - r28032:f968ebef2274
[Not reviewed]
master
0 5 0
Bernhard Reutner-Fischer - 15 months ago 2023-09-18 22:47:47
rep.dot.nop@gmail.com
Codechange: Remove unused parameter for Height()

DropDownListItem::Height does not need to take an argument so remove it

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
5 files changed with 10 insertions and 11 deletions:
0 comments (0 inline, 0 general)
src/company_gui.cpp
Show inline comments
 
@@ -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);
 
	}
src/settings_gui.cpp
Show inline comments
 
@@ -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);
 
					}
 
				}
src/toolbar_gui.cpp
Show inline comments
 
@@ -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);
 
	}
src/widgets/dropdown.cpp
Show inline comments
 
@@ -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<NWidgetBase>(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());
 
	}
 

	
src/widgets/dropdown_type.h
Show inline comments
 
@@ -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);
0 comments (0 inline, 0 general)