|
OpenTTD Source 20260311-master-g511d3794ce
|
Functions related to the drop down widget. More...
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, DropDownOptions options={}, std::string *const persistent_filter_text=nullptr) |
| Show a dropdown menu window near a widget of the parent window. | |
| std::unique_ptr< DropDownListItem > | MakeDropDownListDividerItem () |
| Creates new DropDownListDividerItem. | |
| std::unique_ptr< DropDownListItem > | MakeDropDownListStringItem (StringID str, int value, bool masked=false, bool shaded=false) |
| Creates new DropDownListStringItem. | |
| std::unique_ptr< DropDownListItem > | MakeDropDownListStringItem (std::string &&str, int value, bool masked=false, bool shaded=false) |
| Creates new DropDownListStringItem. | |
| std::unique_ptr< DropDownListItem > | MakeDropDownListIconItem (SpriteID sprite, PaletteID palette, StringID str, int value, bool masked=false, bool shaded=false) |
| Creates new DropDownListIconItem. | |
| std::unique_ptr< DropDownListItem > | MakeDropDownListIconItem (const Dimension &dim, SpriteID sprite, PaletteID palette, StringID str, int value, bool masked=false, bool shaded=false) |
| Creates new DropDownListIconItem. | |
| std::unique_ptr< DropDownListItem > | MakeDropDownListCheckedItem (bool checked, StringID str, int value, bool masked=false, bool shaded=false, uint indent=0) |
| Creates new DropDownListCheckedItem. | |
| template<typename EnumType> | |
| std::unique_ptr< DropDownListItem > | MakeDropDownListStringItem (StringID str, EnumType value, bool masked=false, bool shaded=false) |
| Creates new DropDownListStringItem. | |
| template<typename EnumType> | |
| std::unique_ptr< DropDownListItem > | MakeDropDownListStringItem (std::string &&str, EnumType value, bool masked=false, bool shaded=false) |
| Creates new DropDownListStringItem. | |
| template<typename EnumType> | |
| std::unique_ptr< DropDownListItem > | MakeDropDownListIconItem (SpriteID sprite, PaletteID palette, StringID str, EnumType value, bool masked=false, bool shaded=false) |
| Creates new DropDownListIconItem. | |
| template<typename EnumType> | |
| std::unique_ptr< DropDownListItem > | MakeDropDownListIconItem (const Dimension &dim, SpriteID sprite, PaletteID palette, StringID str, EnumType value, bool masked=false, bool shaded=false) |
| Creates new DropDownListIconItem. | |
| template<typename EnumType> | |
| std::unique_ptr< DropDownListItem > | MakeDropDownListCheckedItem (bool checked, StringID str, EnumType value, bool masked=false, bool shaded=false, uint indent=0) |
| Creates new DropDownListCheckedItem. | |
Functions related to the drop down widget.
Definition in file dropdown_func.h.
|
inline |
Creates new DropDownListCheckedItem.
| checked | Whether the tick before the string should be visible or not. |
| str | The string to show on this item in the drop down menu. |
| value | The value to use when the item becomes selected. |
| masked | Whether the item should be masked out. |
| shaded | Whether the item should be shaded. |
| indent | By what factor the tick and string should be indent. |
Definition at line 58 of file dropdown_func.h.
References MakeDropDownListCheckedItem(), and to_underlying().
| std::unique_ptr< DropDownListItem > MakeDropDownListCheckedItem | ( | bool | checked, |
| StringID | str, | ||
| int | value, | ||
| bool | masked, | ||
| bool | shaded, | ||
| uint | indent ) |
Creates new DropDownListCheckedItem.
| checked | Whether the tick before the string should be visible or not. |
| str | The string to show on this item in the drop down menu. |
| value | The value to use when the item becomes selected. |
| masked | Whether the item should be masked out. |
| shaded | Whether the item should be shaded. |
| indent | By what factor the tick and string should be indent. |
Definition at line 94 of file dropdown.cpp.
References GetString().
Referenced by MakeDropDownListCheckedItem(), and ToolbarOptionsClick().
| std::unique_ptr< DropDownListItem > MakeDropDownListDividerItem | ( | ) |
Creates new DropDownListDividerItem.
Definition at line 36 of file dropdown.cpp.
Referenced by BaseVehicleListWindow::BuildActionDropdownList(), GameOptionsWindow::BuildDropDownList(), NWidgetBadgeFilter::GetDropDownList(), PopupMainToolbarMenu(), and ToolbarOptionsClick().
|
inline |
Creates new DropDownListIconItem.
| sprite | The sprite id to use as an icon on the side of the string. |
| palette | The palette to use when drawing icon. |
| str | The string to show on this item in the drop down menu. |
| value | The value to use when the item becomes selected. |
| masked | Whether the item should be masked out. |
| shaded | Whether the item should be shaded. |
| dim | The rect specifying what part from the sprite should be used as an icon. |
Definition at line 51 of file dropdown_func.h.
References MakeDropDownListIconItem(), and to_underlying().
| std::unique_ptr< DropDownListItem > MakeDropDownListIconItem | ( | const Dimension & | dim, |
| SpriteID | sprite, | ||
| PaletteID | palette, | ||
| StringID | str, | ||
| int | value, | ||
| bool | masked, | ||
| bool | shaded ) |
Creates new DropDownListIconItem.
| sprite | The sprite id to use as an icon on the side of the string. |
| palette | The palette to use when drawing icon. |
| str | The string to show on this item in the drop down menu. |
| value | The value to use when the item becomes selected. |
| masked | Whether the item should be masked out. |
| shaded | Whether the item should be shaded. |
| dim | The rect specifying what part from the sprite should be used as an icon. |
Definition at line 79 of file dropdown.cpp.
References GetString().
|
inline |
Creates new DropDownListIconItem.
| sprite | The sprite id to use as an icon on the side of the string. |
| palette | The palette to use when drawing icon. |
| str | The string to show on this item in the drop down menu. |
| value | The value to use when the item becomes selected. |
| masked | Whether the item should be masked out. |
| shaded | Whether the item should be shaded. |
Definition at line 44 of file dropdown_func.h.
References MakeDropDownListIconItem(), and to_underlying().
| std::unique_ptr< DropDownListItem > MakeDropDownListIconItem | ( | SpriteID | sprite, |
| PaletteID | palette, | ||
| StringID | str, | ||
| int | value, | ||
| bool | masked, | ||
| bool | shaded ) |
Creates new DropDownListIconItem.
| sprite | The sprite id to use as an icon on the side of the string. |
| palette | The palette to use when drawing icon. |
| str | The string to show on this item in the drop down menu. |
| value | The value to use when the item becomes selected. |
| masked | Whether the item should be masked out. |
| shaded | Whether the item should be shaded. |
Definition at line 70 of file dropdown.cpp.
References GetString().
Referenced by BaseVehicleListWindow::BuildCargoDropDownList(), NWidgetBadgeFilter::GetDropDownList(), MakeDropDownListIconItem(), MakeDropDownListIconItem(), and IndustryCargoesWindow::OnClick().
|
inline |
Creates new DropDownListStringItem.
| str | The string to show on this item in the drop down menu. |
| value | The value to use when the item becomes selected. |
| masked | Whether the item should be masked out. |
| shaded | Whether the item should be shaded. |
Definition at line 37 of file dropdown_func.h.
References MakeDropDownListStringItem(), and to_underlying().
| std::unique_ptr< DropDownListItem > MakeDropDownListStringItem | ( | std::string && | str, |
| int | value, | ||
| bool | masked, | ||
| bool | shaded ) |
Creates new DropDownListStringItem.
| str | The string to show on this item in the drop down menu. |
| value | The value to use when the item becomes selected. |
| masked | Whether the item should be masked out. |
| shaded | Whether the item should be shaded. |
Definition at line 55 of file dropdown.cpp.
|
inline |
Creates new DropDownListStringItem.
| str | The string to show on this item in the drop down menu. |
| value | The value to use when the item becomes selected. |
| masked | Whether the item should be masked out. |
| shaded | Whether the item should be shaded. |
Definition at line 30 of file dropdown_func.h.
References MakeDropDownListStringItem(), and to_underlying().
| std::unique_ptr< DropDownListItem > MakeDropDownListStringItem | ( | StringID | str, |
| int | value, | ||
| bool | masked, | ||
| bool | shaded ) |
Creates new DropDownListStringItem.
| str | The string to show on this item in the drop down menu. |
| value | The value to use when the item becomes selected. |
| masked | Whether the item should be masked out. |
| shaded | Whether the item should be shaded. |
Definition at line 49 of file dropdown.cpp.
References GetString(), and MakeDropDownListStringItem().
Referenced by BaseVehicleListWindow::BuildActionDropdownList(), BuildAirportWindow::BuildAirportClassDropDown(), BaseVehicleListWindow::BuildCargoDropDownList(), GameOptionsWindow::BuildDropDownList(), StoryBookWindow::BuildDropDownList(), EnginePreviewWindow::BuildDropdownList(), NWidgetBadgeFilter::GetDropDownList(), GetRailTypeDropDownList(), MakeDropDownListStringItem(), MakeDropDownListStringItem(), MakeDropDownListStringItem(), GSConfigWindow::OnClick(), IndustryCargoesWindow::OnClick(), NewGRFParametersWindow::OnClick(), NewGRFWindow::OnClick(), OrdersWindow::OnClick(), ReplaceVehicleWindow::OnClick(), ScriptSettingsWindow::OnClick(), TextfileWindow::OnClick(), NetworkClientListWindow::OnClickClientAdmin(), NetworkClientListWindow::OnClickCompanyAdmin(), PopupMainToolbarMenu(), SetDateWindow::ShowDateDropDown(), ShowDropDownMenu(), and ToolbarOptionsClick().
| void ShowDropDownMenu | ( | Window * | w, |
| std::span< const StringID > | strings, | ||
| int | selected, | ||
| WidgetID | button, | ||
| uint32_t | disabled_mask, | ||
| uint32_t | hidden_mask, | ||
| uint | width, | ||
| DropDownOptions | options, | ||
| std::string *const | persistent_filter_text ) |
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.
| 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. |
| options | Drop Down options for this menu |
| persistent_filter_text | Optional pointer to string for retaining filter text. |
Definition at line 627 of file dropdown.cpp.
References HasBit(), MakeDropDownListStringItem(), and ShowDropDownList().
Referenced by DisplayVehicleSortDropDown(), BuildBridgeWindow::OnClick(), CompanyStationsWindow::OnClick(), GenerateLandscapeWindow::OnClick(), IndustryDirectoryWindow::OnClick(), OrdersWindow::OnClick(), ReplaceVehicleWindow::OnClick(), StationViewWindow::OnClick(), TownDirectoryWindow::OnClick(), VehicleDetailsWindow::OnClick(), VehicleGroupWindow::OnClick(), and VehicleListWindow::OnClick().