OpenTTD Source: DropDownListStringItem Class Reference

OpenTTD Source 13.2.1

Public Member Functions | Static Public Member Functions | Data Fields
DropDownListStringItem Class Reference

Common string list item. More...

`#include <dropdown_type.h>`

Inheritance diagram for DropDownListStringItem:

## Public Member Functions
| DropDownListStringItem (StringID string, int result, bool masked)
bool | Selectable () const override
uint | Width () const override
void | Draw (const Rect &r, bool sel, Colours bg_colour) const override
virtual StringID | String () const
Public Member Functions inherited from DropDownListItem
| DropDownListItem (int result, bool masked)
virtual uint | Height (uint width) const

## Static Public Member Functions
static bool | NatSortFunc (std::unique_ptr< const DropDownListItem > const &first, std::unique_ptr< const DropDownListItem > const &second)
| Natural sorting comparator function for DropDownList::sort(). More...

## Data Fields
StringID | string
| String ID of item.
Data Fields inherited from DropDownListItem
int | result
| Result code to return to window on selection.
bool | masked
| Masked and unselectable item.

## Detailed Description

Common string list item.

Definition at line 39 of file dropdown_type.h.

## Member Function Documentation

## ◆ NatSortFunc()

bool DropDownListStringItem::NatSortFunc | ( | std::unique_ptr< const DropDownListItem > const & | first,
|  | std::unique_ptr< const DropDownListItem > const & | second
| ) |  |
| static

Natural sorting comparator function for DropDownList::sort().

Parameters

  first | Left side of comparison.
  second | Right side of comparison.

Returns
  true if first precedes second.

Warning
  All items in the list need to be derivates of DropDownListStringItem.

Definition at line 54 of file dropdown.cpp.

The documentation for this class was generated from the following files:

- src/widgets/dropdown_type.h
- src/widgets/dropdown.cpp