mirror of https://github.com/OpenTTD/OpenTTD
(svn r15877) -Codechange: Let drop down lists know about font height.
parent
1d9c362dda
commit
f30f5607e3
|
@ -480,7 +480,7 @@ public:
|
|||
|
||||
uint Height(uint width) const
|
||||
{
|
||||
return 14;
|
||||
return max(FONT_HEIGHT_NORMAL, (byte)14);
|
||||
}
|
||||
|
||||
bool Selectable() const
|
||||
|
@ -491,7 +491,7 @@ public:
|
|||
void Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const
|
||||
{
|
||||
DrawSprite(SPR_VEH_BUS_SIDE_VIEW, PALETTE_RECOLOUR_START + this->result, left + 16, top + 7);
|
||||
DrawString(left + 32, right - 2, top + 3, this->String(), sel ? TC_WHITE : TC_BLACK);
|
||||
DrawString(left + 32, right - 2, top + max(0, 13 - FONT_HEIGHT_NORMAL), this->String(), sel ? TC_WHITE : TC_BLACK);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -17,8 +17,9 @@ void DropDownListItem::Draw(int left, int right, int top, int bottom, bool sel,
|
|||
int c1 = _colour_gradient[bg_colour][3];
|
||||
int c2 = _colour_gradient[bg_colour][7];
|
||||
|
||||
GfxFillRect(left + 1, top + 3, right - 1, top + 3, c1);
|
||||
GfxFillRect(left + 1, top + 4, right - 1, top + 4, c2);
|
||||
int mid = top + this->Height(0) / 2;
|
||||
GfxFillRect(left + 1, mid - 2, right - 1, mid - 2, c1);
|
||||
GfxFillRect(left + 1, mid - 1, right - 1, mid - 1, c2);
|
||||
}
|
||||
|
||||
uint DropDownListStringItem::Width() const
|
||||
|
|
|
@ -21,7 +21,7 @@ public:
|
|||
virtual ~DropDownListItem() {}
|
||||
|
||||
virtual bool Selectable() const { return false; }
|
||||
virtual uint Height(uint width) const { return 10; }
|
||||
virtual uint Height(uint width) const { return FONT_HEIGHT_NORMAL; }
|
||||
virtual uint Width() const { return 0; }
|
||||
virtual void Draw(int left, int right, int top, int bottom, bool sel, int bg_colour) const;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue