diff options
author | alberth <alberth@openttd.org> | 2009-05-04 18:42:49 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2009-05-04 18:42:49 +0000 |
commit | 34066a60272e65bf6c8a966e50474ec69ccef374 (patch) | |
tree | b940549066a0bdb6454708dfe1a3b3ffe0d08bc4 /src/widgets | |
parent | efde51e4523b4e74f16b43579d7894ac3387dab0 (diff) | |
download | openttd-34066a60272e65bf6c8a966e50474ec69ccef374.tar.xz |
(svn r16227) -Codechange: Added nested widgets for error windows, tooltip window, and dropdown window.
Diffstat (limited to 'src/widgets')
-rw-r--r-- | src/widgets/dropdown.cpp | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/widgets/dropdown.cpp b/src/widgets/dropdown.cpp index 3c3f4fb6a..6a0e015b8 100644 --- a/src/widgets/dropdown.cpp +++ b/src/widgets/dropdown.cpp @@ -69,6 +69,13 @@ static const Widget _dropdown_menu_widgets[] = { { WIDGETS_END}, }; +static const NWidgetPart _nested_dropdown_menu_widgets[] = { + NWidget(NWID_LAYERED), + NWidget(WWT_PANEL, COLOUR_END, 0), SetMinimalSize(1, 1), EndContainer(), + NWidget(WWT_SCROLLBAR, COLOUR_END, 1), SetMinimalSize(1, 1), + EndContainer(), +}; + struct DropdownWindow : Window { WindowClass parent_wnd_class; WindowNumber parent_wnd_num; @@ -238,6 +245,8 @@ struct DropdownWindow : Window { void ShowDropDownList(Window *w, DropDownList *list, int selected, int button, uint width, bool auto_width, bool instant_close) { + static Widget *generated_dropdown_menu_widgets = NULL; + DeleteWindowById(WC_DROPDOWN_MENU, 0); w->LowerWidget(button); @@ -302,12 +311,9 @@ void ShowDropDownList(Window *w, DropDownList *list, int selected, int button, u if (auto_width) width = max(width, max_item_width); - DropdownWindow *dw = new DropdownWindow( - w->left + wi->left, - top, - width, - height + 4, - _dropdown_menu_widgets); + const Widget *wid = InitializeWidgetArrayFromNestedWidgets(_nested_dropdown_menu_widgets, lengthof(_nested_dropdown_menu_widgets), + _dropdown_menu_widgets, &generated_dropdown_menu_widgets); + DropdownWindow *dw = new DropdownWindow(w->left + wi->left, top, width, height + 4, wid); dw->widget[0].colour = wi->colour; dw->widget[0].right = width - 1; |