mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Undo #11447, drop down list divider lines are now explicit.
parent
667be98ce8
commit
5489b9fc0c
|
@ -48,14 +48,10 @@ uint DropDownListStringItem::Width() const
|
||||||
return GetStringBoundingBox(this->String()).width + WidgetDimensions::scaled.dropdowntext.Horizontal();
|
return GetStringBoundingBox(this->String()).width + WidgetDimensions::scaled.dropdowntext.Horizontal();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DropDownListStringItem::Draw(const Rect &r, bool sel, Colours bg_colour) const
|
void DropDownListStringItem::Draw(const Rect &r, bool sel, Colours) const
|
||||||
{
|
{
|
||||||
if (this->String().empty()) {
|
Rect ir = r.Shrink(WidgetDimensions::scaled.dropdowntext);
|
||||||
this->DropDownListItem::Draw(r, sel, bg_colour);
|
DrawString(ir.left, ir.right, r.top, this->String(), sel ? TC_WHITE : TC_BLACK);
|
||||||
} else {
|
|
||||||
Rect ir = r.Shrink(WidgetDimensions::scaled.dropdowntext);
|
|
||||||
DrawString(ir.left, ir.right, r.top, this->String(), sel ? TC_WHITE : TC_BLACK);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -42,7 +42,7 @@ public:
|
||||||
DropDownListStringItem(StringID string, int result, bool masked);
|
DropDownListStringItem(StringID string, int result, bool masked);
|
||||||
DropDownListStringItem(const std::string &string, int result, bool masked);
|
DropDownListStringItem(const std::string &string, int result, bool masked);
|
||||||
|
|
||||||
bool Selectable() const override { return !this->String().empty(); }
|
bool Selectable() const override { return true; }
|
||||||
uint Width() const override;
|
uint Width() const override;
|
||||||
void Draw(const Rect &r, bool sel, Colours bg_colour) const override;
|
void Draw(const Rect &r, bool sel, Colours bg_colour) const override;
|
||||||
virtual const std::string &String() const { return this->string; }
|
virtual const std::string &String() const { return this->string; }
|
||||||
|
|
Loading…
Reference in New Issue