OpenTTD Source: src/dropdown_func.h File Reference

OpenTTD Source 15.0-RC2

Functions
dropdown_func.h File Reference

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

`#include "dropdown_type.h"`
`#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.
std::unique_ptr< DropDownListItem > | MakeDropDownListDividerItem ()
std::unique_ptr< DropDownListItem > | MakeDropDownListStringItem (StringID str, int value, bool masked=false, bool shaded=false)
std::unique_ptr< DropDownListItem > | MakeDropDownListStringItem (std::string &&str, int value, bool masked=false, bool shaded=false)
std::unique_ptr< DropDownListItem > | MakeDropDownListIconItem (SpriteID sprite, PaletteID palette, StringID str, int value, bool masked=false, bool shaded=false)
std::unique_ptr< DropDownListItem > | MakeDropDownListIconItem (const Dimension &dim, SpriteID sprite, PaletteID palette, StringID str, int value, bool masked=false, bool shaded=false)
std::unique_ptr< DropDownListItem > | MakeDropDownListCheckedItem (bool checked, StringID str, int value, bool masked=false, bool shaded=false, uint indent=0)

## Detailed Description

Functions related to the drop down widget.

Definition in file dropdown_func.h.

## Function Documentation

## ◆ MakeDropDownListCheckedItem()

std::unique_ptr< DropDownListItem > MakeDropDownListCheckedItem | ( | bool | checked,
|  | StringID | str,
|  | int | value,
|  | bool | masked = `false`,
|  | bool | shaded = `false`,
|  | uint | indent = `0`
| ) |  |

Definition at line 55 of file dropdown.cpp.

## ◆ MakeDropDownListDividerItem()

std::unique_ptr< DropDownListItem > MakeDropDownListDividerItem | ( |  | ) |

Definition at line 30 of file dropdown.cpp.

## ◆ MakeDropDownListIconItem() [1/2]

std::unique_ptr< DropDownListItem > MakeDropDownListIconItem | ( | const Dimension & | dim,
|  | SpriteID | sprite,
|  | PaletteID | palette,
|  | StringID | str,
|  | int | value,
|  | bool | masked = `false`,
|  | bool | shaded = `false`
| ) |  |

Definition at line 50 of file dropdown.cpp.

## ◆ MakeDropDownListIconItem() [2/2]

std::unique_ptr< DropDownListItem > MakeDropDownListIconItem | ( | SpriteID | sprite,
|  | PaletteID | palette,
|  | StringID | str,
|  | int | value,
|  | bool | masked = `false`,
|  | bool | shaded = `false`
| ) |  |

Definition at line 45 of file dropdown.cpp.

## ◆ MakeDropDownListStringItem() [1/2]

std::unique_ptr< DropDownListItem > MakeDropDownListStringItem | ( | std::string && | str,
|  | int | value,
|  | bool | masked = `false`,
|  | bool | shaded = `false`
| ) |  |

Definition at line 40 of file dropdown.cpp.

## ◆ MakeDropDownListStringItem() [2/2]

std::unique_ptr< DropDownListItem > MakeDropDownListStringItem | ( | StringID | str,
|  | int | value,
|  | bool | masked = `false`,
|  | bool | shaded = `false`
| ) |  |

Definition at line 35 of file dropdown.cpp.

## ◆ 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

  w | Parent window that wants the dropdown menu.
  strings | Menu list.
  selected | Index of initial selected item.
  button | Button widget number of the parent window w that wants the dropdown menu.
  disabled_mask | Bitmask for disabled items (items with their bit set are displayed, but not selectable in the dropdown list).
  hidden_mask | Bitmask for hidden items (items with their bit set are not copied to the dropdown list).
  width | Minimum width of the dropdown menu.

Definition at line 458 of file dropdown.cpp.

References HasBit(), and ShowDropDownList().

Referenced by DisplayVehicleSortDropDown(), ReplaceVehicleWindow::OnClick(), BuildBridgeWindow::OnClick(), GenerateLandscapeWindow::OnClick(), VehicleGroupWindow::OnClick(), IndustryDirectoryWindow::OnClick(), OrdersWindow::OnClick(), CompanyStationsWindow::OnClick(), StationViewWindow::OnClick(), TownDirectoryWindow::OnClick(), VehicleListWindow::OnClick(), and VehicleDetailsWindow::OnClick().