MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / ShowDropDownMenu

Function ShowDropDownMenu

src/dropdown.cpp:458–471  ·  view source on GitHub ↗

* Show a dropdown menu window near a widget of the parent window. * The result code of the items is their index in the \a strings list. * @param w Parent window that wants the dropdown menu. * @param strings Menu list. * @param selected Index of initial selected item. * @param button Button widget number of the parent window \a w that wants the dropdown menu. *

Source from the content-addressed store, hash-verified

456 * @param width Minimum width of the dropdown menu.
457 */
458void ShowDropDownMenu(Window *w, std::span<const StringID> strings, int selected, WidgetID button, uint32_t disabled_mask, uint32_t hidden_mask, uint width)
459{
460 DropDownList list;
461
462 uint i = 0;
463 for (auto string : strings) {
464 if (!HasBit(hidden_mask, i)) {
465 list.push_back(MakeDropDownListStringItem(string, i, HasBit(disabled_mask, i)));
466 }
467 ++i;
468 }
469
470 if (!list.empty()) ShowDropDownList(w, std::move(list), selected, button, width, {});
471}

Callers 12

OnClickMethod · 0.85
OnClickMethod · 0.85
OnClickMethod · 0.85
OnClickMethod · 0.85
OnClickMethod · 0.85
OnClickMethod · 0.85
OnClickMethod · 0.85
OnClickMethod · 0.85
OnClickMethod · 0.85
OnClickMethod · 0.85
OnClickMethod · 0.85

Calls 5

HasBitFunction · 0.85
ShowDropDownListFunction · 0.85
push_backMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected