From f30f5607e33e47ca9a9fca1250a13c02d7bdb931 Mon Sep 17 00:00:00 2001 From: peter1138 Date: Sat, 28 Mar 2009 12:47:29 +0000 Subject: (svn r15877) -Codechange: Let drop down lists know about font height. --- src/widgets/dropdown.cpp | 5 +++-- src/widgets/dropdown_type.h | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) (limited to 'src/widgets') 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; }; -- cgit v1.2.3-54-g00ecf