From 6bae045b4af118f19946ecb4d160a9d69c6638f8 Mon Sep 17 00:00:00 2001 From: peter1138 Date: Thu, 7 Aug 2008 18:11:09 +0000 Subject: (svn r14014) -Codechange: Add support for automatically sizing drop down lists to the widest list item. --- src/widgets/dropdown_type.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/widgets/dropdown_type.h') diff --git a/src/widgets/dropdown_type.h b/src/widgets/dropdown_type.h index aa4baafe1..c9686a178 100644 --- a/src/widgets/dropdown_type.h +++ b/src/widgets/dropdown_type.h @@ -22,6 +22,7 @@ public: virtual bool Selectable() const { return false; } virtual uint Height(uint width) const { return 10; } + virtual uint Width() const { return 0; } virtual void Draw(int x, int y, uint width, uint height, bool sel, int bg_colour) const; }; @@ -36,6 +37,7 @@ public: virtual ~DropDownListStringItem() {} virtual bool Selectable() const { return true; } + virtual uint Width() const; virtual void Draw(int x, int y, uint width, uint height, bool sel, int bg_colour) const; virtual StringID String() const { return this->string; } }; @@ -68,6 +70,8 @@ typedef std::list DropDownList; * @param button The widget within the parent window that is used to determine * the list's location. * @param width Override the width determined by the selected widget. + * If UINT_MAX then the width is determined by the widest item + * in the list. */ void ShowDropDownList(Window *w, DropDownList *list, int selected, int button, uint width = 0); -- cgit v1.2.3-70-g09d2