* Create a dropdown menu. * @param parent Parent window. * @param list Dropdown item list. * @param selected Initial selected result of the list. * @param button Widget of the parent window doing the dropdown. * @param wi_rect Rect of the button that opened the dropdown. * @param wi_colour Colour of the parent widget. * @param options Drop Down o
| 100 | * @param options Drop Down options for this menu. |
| 101 | */ |
| 102 | DropdownWindow(Window *parent, DropDownList &&list, int selected, WidgetID button, const Rect wi_rect, Colours wi_colour, DropDownOptions options) |
| 103 | : Window(_dropdown_desc) |
| 104 | , parent_button(button) |
| 105 | , wi_rect(wi_rect) |
| 106 | , list(std::move(list)) |
| 107 | , selected_result(selected) |
| 108 | , options(options) |
| 109 | { |
| 110 | assert(!this->list.empty()); |
| 111 | |
| 112 | this->parent = parent; |
| 113 | |
| 114 | this->CreateNestedTree(); |
| 115 | |
| 116 | this->GetWidget<NWidgetCore>(WID_DM_ITEMS)->colour = wi_colour; |
| 117 | this->GetWidget<NWidgetCore>(WID_DM_SCROLL)->colour = wi_colour; |
| 118 | this->vscroll = this->GetScrollbar(WID_DM_SCROLL); |
| 119 | this->UpdateSizeAndPosition(); |
| 120 | |
| 121 | this->FinishInitNested(0); |
| 122 | this->flags.Reset(WindowFlag::WhiteBorder); |
| 123 | } |
| 124 | |
| 125 | void Close([[maybe_unused]] int data = 0) override |
| 126 | { |
nothing calls this directly
no test coverage detected