Add colour flags field to DropDownListStringItem
This commit is contained in:
@@ -39,7 +39,7 @@ uint DropDownListStringItem::Width() const
|
|||||||
|
|
||||||
void DropDownListStringItem::Draw(int left, int right, int top, int bottom, bool sel, Colours bg_colour) const
|
void DropDownListStringItem::Draw(int left, int right, int top, int bottom, bool sel, Colours bg_colour) const
|
||||||
{
|
{
|
||||||
DrawString(left + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, this->String(), sel ? TC_WHITE : TC_BLACK);
|
DrawString(left + WD_FRAMERECT_LEFT, right - WD_FRAMERECT_RIGHT, top, this->String(), (sel ? TC_WHITE : TC_BLACK) | this->colour_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -89,7 +89,7 @@ void DropDownListIconItem::Draw(int left, int right, int top, int bottom, bool s
|
|||||||
{
|
{
|
||||||
bool rtl = _current_text_dir == TD_RTL;
|
bool rtl = _current_text_dir == TD_RTL;
|
||||||
DrawSprite(this->sprite, this->pal, rtl ? right - this->dim.width - WD_FRAMERECT_RIGHT : left + WD_FRAMERECT_LEFT, CenterBounds(top, bottom, this->sprite_y));
|
DrawSprite(this->sprite, this->pal, rtl ? right - this->dim.width - WD_FRAMERECT_RIGHT : left + WD_FRAMERECT_LEFT, CenterBounds(top, bottom, this->sprite_y));
|
||||||
DrawString(left + WD_FRAMERECT_LEFT + (rtl ? 0 : (this->dim.width + WD_FRAMERECT_LEFT)), right - WD_FRAMERECT_RIGHT - (rtl ? (this->dim.width + WD_FRAMERECT_RIGHT) : 0), CenterBounds(top, bottom, FONT_HEIGHT_NORMAL), this->String(), sel ? TC_WHITE : TC_BLACK);
|
DrawString(left + WD_FRAMERECT_LEFT + (rtl ? 0 : (this->dim.width + WD_FRAMERECT_LEFT)), right - WD_FRAMERECT_RIGHT - (rtl ? (this->dim.width + WD_FRAMERECT_RIGHT) : 0), CenterBounds(top, bottom, FONT_HEIGHT_NORMAL), this->String(), (sel ? TC_WHITE : TC_BLACK) | this->colour_flags);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DropDownListIconItem::SetDimension(Dimension d)
|
void DropDownListIconItem::SetDimension(Dimension d)
|
||||||
|
@@ -46,6 +46,7 @@ public:
|
|||||||
class DropDownListStringItem : public DropDownListItem {
|
class DropDownListStringItem : public DropDownListItem {
|
||||||
public:
|
public:
|
||||||
StringID string; ///< String ID of item
|
StringID string; ///< String ID of item
|
||||||
|
TextColour colour_flags = TC_BEGIN;
|
||||||
|
|
||||||
DropDownListStringItem(StringID string, int result, bool masked) : DropDownListItem(result, masked), string(string) {}
|
DropDownListStringItem(StringID string, int result, bool masked) : DropDownListItem(result, masked), string(string) {}
|
||||||
|
|
||||||
@@ -53,6 +54,7 @@ public:
|
|||||||
uint Width() const override;
|
uint Width() const override;
|
||||||
void Draw(int left, int right, int top, int bottom, bool sel, Colours bg_colour) const override;
|
void Draw(int left, int right, int top, int bottom, bool sel, Colours bg_colour) const override;
|
||||||
virtual StringID String() const { return this->string; }
|
virtual StringID String() const { return this->string; }
|
||||||
|
void SetColourFlags(TextColour colour_flags) { this->colour_flags = colour_flags; }
|
||||||
|
|
||||||
static bool NatSortFunc(std::unique_ptr<const DropDownListItem> const &first, std::unique_ptr<const DropDownListItem> const &second);
|
static bool NatSortFunc(std::unique_ptr<const DropDownListItem> const &first, std::unique_ptr<const DropDownListItem> const &second);
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user