OpenTTD Source  20241120-master-g6d3adc6169
dropdown_func.h File Reference

Functions related to the drop down widget. More...

#include "window_gui.h"

Go to the source code of this file.

Functions

void ShowDropDownMenu (Window *w, std::span< const StringID > strings, int selected, WidgetID button, uint32_t disabled_mask, uint32_t hidden_mask, uint width=0)
 Show a dropdown menu window near a widget of the parent window. More...
 
std::unique_ptr< DropDownListItemMakeDropDownListDividerItem ()
 
std::unique_ptr< DropDownListItemMakeDropDownListStringItem (StringID str, int value, bool masked=false, bool shaded=false)
 
std::unique_ptr< DropDownListItemMakeDropDownListStringItem (const std::string &str, int value, bool masked=false, bool shaded=false)
 
std::unique_ptr< DropDownListItemMakeDropDownListIconItem (SpriteID sprite, PaletteID palette, StringID str, int value, bool masked=false, bool shaded=false)
 
std::unique_ptr< DropDownListItemMakeDropDownListIconItem (const Dimension &dim, SpriteID sprite, PaletteID palette, StringID str, int value, bool masked=false, bool shaded=false)
 
std::unique_ptr< DropDownListItemMakeDropDownListCheckedItem (bool checked, StringID str, int value, bool masked=false, bool shaded=false)
 

Detailed Description

Functions related to the drop down widget.

Definition in file dropdown_func.h.

Function Documentation

◆ ShowDropDownMenu()

void ShowDropDownMenu ( Window w,
std::span< const StringID strings,
int  selected,
WidgetID  button,
uint32_t  disabled_mask,
uint32_t  hidden_mask,
uint  width 
)

Show a dropdown menu window near a widget of the parent window.

The result code of the items is their index in the strings list.

Parameters
wParent window that wants the dropdown menu.
stringsMenu list.
selectedIndex of initial selected item.
buttonButton widget number of the parent window w that wants the dropdown menu.
disabled_maskBitmask for disabled items (items with their bit set are displayed, but not selectable in the dropdown list).
hidden_maskBitmask for hidden items (items with their bit set are not copied to the dropdown list).
widthMinimum width of the dropdown menu.

Definition at line 441 of file dropdown.cpp.

References HasBit().