diff options
author | peter1138 <peter1138@openttd.org> | 2009-03-28 12:47:29 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2009-03-28 12:47:29 +0000 |
commit | f30f5607e33e47ca9a9fca1250a13c02d7bdb931 (patch) | |
tree | 49ca20a424ccfa5b1af7564accac39aa451c605b /src | |
parent | 1d9c362dda233bb22919e43bdf23a2bdf265eb73 (diff) | |
download | openttd-f30f5607e33e47ca9a9fca1250a13c02d7bdb931.tar.xz |
(svn r15877) -Codechange: Let drop down lists know about font height.
Diffstat (limited to 'src')
-rw-r--r-- | src/company_gui.cpp | 4 | ||||
-rw-r--r-- | src/widgets/dropdown.cpp | 5 | ||||
-rw-r--r-- | src/widgets/dropdown_type.h | 2 |
3 files changed, 6 insertions, 5 deletions
diff --git a/src/company_gui.cpp b/src/company_gui.cpp index 1e24420e4..e3036349f 100644 --- a/src/company_gui.cpp +++ b/src/company_gui.cpp @@ -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); } }; diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp index c3eaa7d35..bfe66ab43 100644 --- a/src/widgets/dropdown.cpp +++ b/src/widgets/dropdown.cpp @@ -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 diff --git a/src/widgets/dropdown_type.h b/src/widgets/dropdown_type.h index 594cabe7e..279217b7b 100644 --- a/src/widgets/dropdown_type.h +++ b/src/widgets/dropdown_type.h @@ -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; }; |