Changeset - r8907:1be09ff114ab
[Not reviewed]
master
0 2 0
peter1138 - 17 years ago 2008-04-12 22:12:27
peter1138@openttd.org
(svn r12675) -Codechange: Add support for custom drawing of drop down list items.
2 files changed with 7 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/widgets/dropdown.cpp
Show inline comments
 
@@ -36,6 +36,11 @@ StringID DropDownListParamStringItem::St
 
	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 @@ static void DropDownMenuWndProc(Window *
 
					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,
src/widgets/dropdown_type.h
Show inline comments
 
@@ -19,6 +19,7 @@ public:
 
	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;
 
};
 

	
 
/**
0 comments (0 inline, 0 general)