Merge branch 'master' into jgrpp
# Conflicts: # src/build_vehicle_gui.cpp # src/company_gui.cpp # src/gfx_func.h # src/group_gui.cpp # src/industry_gui.cpp # src/misc_gui.cpp # src/news_gui.cpp # src/settings_gui.cpp # src/ship_gui.cpp # src/smallmap_gui.cpp # src/station_gui.cpp # src/subsidy_gui.cpp # src/timetable_gui.cpp # src/toolbar_gui.cpp # src/town_gui.cpp # src/vehicle_gui.cpp # src/viewport.cpp # src/widget.cpp # src/widgets/dropdown.cpp # src/window.cpp
This commit is contained in:
@@ -47,14 +47,10 @@ uint DropDownListStringItem::Width() const
|
||||
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()) {
|
||||
this->DropDownListItem::Draw(r, sel, bg_colour);
|
||||
} else {
|
||||
Rect ir = r.Shrink(WidgetDimensions::scaled.dropdowntext);
|
||||
DrawString(ir.left, ir.right, r.top, this->String(), (sel ? TC_WHITE : TC_BLACK) | this->colour_flags);
|
||||
}
|
||||
Rect ir = r.Shrink(WidgetDimensions::scaled.dropdowntext);
|
||||
DrawString(ir.left, ir.right, r.top, this->String(), (sel ? TC_WHITE : TC_BLACK) | this->colour_flags);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,7 +75,7 @@ DropDownListIconItem::DropDownListIconItem(SpriteID sprite, PaletteID pal, Strin
|
||||
|
||||
uint DropDownListIconItem::Height() const
|
||||
{
|
||||
return std::max(this->dim.height, (uint)FONT_HEIGHT_NORMAL);
|
||||
return std::max(this->dim.height, (uint)GetCharacterHeight(FS_NORMAL));
|
||||
}
|
||||
|
||||
uint DropDownListIconItem::Width() const
|
||||
@@ -93,7 +89,7 @@ void DropDownListIconItem::Draw(const Rect &r, bool sel, Colours) const
|
||||
Rect ir = r.Shrink(WidgetDimensions::scaled.dropdowntext);
|
||||
Rect tr = ir.Indent(this->dim.width + WidgetDimensions::scaled.hsep_normal, rtl);
|
||||
DrawSprite(this->sprite, this->pal, ir.WithWidth(this->dim.width, rtl).left, CenterBounds(r.top, r.bottom, this->sprite_y));
|
||||
DrawString(tr.left, tr.right, CenterBounds(r.top, r.bottom, FONT_HEIGHT_NORMAL), this->String(), (sel ? TC_WHITE : TC_BLACK) | this->colour_flags);
|
||||
DrawString(tr.left, tr.right, CenterBounds(r.top, r.bottom, GetCharacterHeight(FS_NORMAL)), this->String(), (sel ? TC_WHITE : TC_BLACK) | this->colour_flags);
|
||||
}
|
||||
|
||||
void DropDownListIconItem::SetDimension(Dimension d)
|
||||
|
@@ -35,7 +35,7 @@ public:
|
||||
virtual ~DropDownListItem() = default;
|
||||
|
||||
virtual bool Selectable() const { return false; }
|
||||
virtual uint Height() const { return FONT_HEIGHT_NORMAL; }
|
||||
virtual uint Height() const { return GetCharacterHeight(FS_NORMAL); }
|
||||
virtual uint Width() const { return 0; }
|
||||
virtual void Draw(const Rect &r, bool sel, Colours bg_colour) const;
|
||||
};
|
||||
@@ -51,7 +51,7 @@ public:
|
||||
DropDownListStringItem(StringID 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;
|
||||
void Draw(const Rect &r, bool sel, Colours bg_colour) const override;
|
||||
const std::string &String() const { return this->string; }
|
||||
|
@@ -29,7 +29,7 @@ static const int SLIDER_WIDTH = 3;
|
||||
void DrawSliderWidget(Rect r, int min_value, int max_value, int value, const std::map<int, StringID> &labels)
|
||||
{
|
||||
/* Allow space for labels. We assume they are in the small font. */
|
||||
if (!labels.empty()) r.bottom -= FONT_HEIGHT_SMALL + WidgetDimensions::scaled.hsep_normal;
|
||||
if (!labels.empty()) r.bottom -= GetCharacterHeight(FS_SMALL) + WidgetDimensions::scaled.hsep_normal;
|
||||
|
||||
max_value -= min_value;
|
||||
|
||||
|
Reference in New Issue
Block a user