# HG changeset patch # User peter1138 # Date 1208038347 0 # Node ID 52d27a99a3319c96a13391251335656ea9a3f40d # Parent 043d546c1eaca928b3b2b8197151b2bf9e244014 (svn r12675) -Codechange: Add support for custom drawing of drop down list items. diff -r 043d546c1eac -r 52d27a99a331 src/widgets/dropdown.cpp --- a/src/widgets/dropdown.cpp Sat Apr 12 22:11:21 2008 +0000 +++ b/src/widgets/dropdown.cpp Sat Apr 12 22:12:27 2008 +0000 @@ -36,6 +36,11 @@ return this->string; } +void DropDownListItem::Draw(int x, int y, uint width, uint height, bool sel) const +{ + DrawStringTruncated(x + 2, y, this->String(), sel ? TC_WHITE : TC_BLACK, x + width); +} + /** * Delete all items of a drop down list and the list itself * @param list List to delete. @@ -122,7 +127,7 @@ if (item->String() != STR_NULL) { if (sel == item->result) GfxFillRect(x + 1, y, x + width, y + item_height - 1, 0); - DrawStringTruncated(x + 2, y, item->String(), sel == item->result ? TC_WHITE : TC_BLACK, x + width); + item->Draw(x, y, width, 10, sel == item->result); if (item->masked) { GfxFillRect(x, y, x + width, y + item_height - 1, diff -r 043d546c1eac -r 52d27a99a331 src/widgets/dropdown_type.h --- a/src/widgets/dropdown_type.h Sat Apr 12 22:11:21 2008 +0000 +++ b/src/widgets/dropdown_type.h Sat Apr 12 22:12:27 2008 +0000 @@ -19,6 +19,7 @@ virtual ~DropDownListItem() {} virtual StringID String() const; virtual uint Height(uint width) const; + virtual void Draw(int x, int y, uint width, uint height, bool sel) const; }; /**