OpenTTD Source: DropDownString< TBase, TFs, TEnd > Class Template Reference

OpenTTD Source 15.0-RC2

Public Member Functions | Static Public Member Functions | Private Attributes
DropDownString< TBase, TFs, TEnd > Class Template Reference

Drop down string component. More...

`#include <dropdown_common_type.h>`

Inheritance diagram for DropDownString< TBase, TFs, TEnd >:

## Public Member Functions
template<typename... Args>
| DropDownString (std::string &&string, Args &&... args)
void | SetString (std::string &&string)
uint | Height () const override
uint | Width () const override
int | OnClick (const Rect &r, const Point &pt) const override
void | Draw (const Rect &full, const Rect &r, bool sel, int click_result, Colours bg_colour) const override

## 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().

## Private Attributes
std::string | string
| String to be drawn.
Dimension | dim
| Dimensions of string.

## Detailed Description

template<class TBase, FontSize TFs = FS_NORMAL, bool TEnd = false>
class DropDownString< TBase, TFs, TEnd >

Drop down string component.

Template Parameters

  TBase | Base component.
  TFs | Font size.
  TEnd | Position string at end if true, or start if false.

Definition at line 56 of file dropdown_common_type.h.

## Constructor & Destructor Documentation

## ◆ DropDownString()

template<class TBase , FontSize TFs = FS_NORMAL, bool TEnd = false>
template<typename... Args>

DropDownString< TBase, TFs, TEnd >::DropDownString | ( | std::string && | string,
|  | Args &&... | args
| ) |  |
| inlineexplicit

Definition at line 61 of file dropdown_common_type.h.

## Member Function Documentation

## ◆ Draw()

template<class TBase , FontSize TFs = FS_NORMAL, bool TEnd = false>

void DropDownString< TBase, TFs, TEnd >::Draw | ( | const Rect & | full,
|  | const Rect & | r,
|  | bool | sel,
|  | int | click_result,
|  | Colours | bg_colour
| ) |  | const
| inlineoverride

Definition at line 85 of file dropdown_common_type.h.

## ◆ Height()

template<class TBase , FontSize TFs = FS_NORMAL, bool TEnd = false>

uint DropDownString< TBase, TFs, TEnd >::Height | ( |  | ) | const
| inlineoverride

Definition at line 72 of file dropdown_common_type.h.

## ◆ NatSortFunc()

template<class TBase , FontSize TFs = FS_NORMAL, bool TEnd = false>

static bool DropDownString< TBase, TFs, TEnd >::NatSortFunc | ( | std::unique_ptr< const DropDownListItem > const & | first,
|  | std::unique_ptr< const DropDownListItem > const & | second
| ) |  |
| inlinestatic

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 99 of file dropdown_common_type.h.

References StrNaturalCompare().

## ◆ OnClick()

template<class TBase , FontSize TFs = FS_NORMAL, bool TEnd = false>

int DropDownString< TBase, TFs, TEnd >::OnClick | ( | const Rect & | r,
|  | const Point & | pt
| ) |  | const
| inlineoverride

Definition at line 79 of file dropdown_common_type.h.

## ◆ SetString()

template<class TBase , FontSize TFs = FS_NORMAL, bool TEnd = false>

void DropDownString< TBase, TFs, TEnd >::SetString | ( | std::string && | string | ) |
| inline

Definition at line 66 of file dropdown_common_type.h.

## ◆ Width()

template<class TBase , FontSize TFs = FS_NORMAL, bool TEnd = false>

uint DropDownString< TBase, TFs, TEnd >::Width | ( |  | ) | const
| inlineoverride

Definition at line 77 of file dropdown_common_type.h.

## Field Documentation

## ◆ dim

template<class TBase , FontSize TFs = FS_NORMAL, bool TEnd = false>

Dimension DropDownString< TBase, TFs, TEnd >::dim
| private

Dimensions of string.

Definition at line 58 of file dropdown_common_type.h.

## ◆ string

template<class TBase , FontSize TFs = FS_NORMAL, bool TEnd = false>

std::string DropDownString< TBase, TFs, TEnd >::string
| private

String to be drawn.

Definition at line 57 of file dropdown_common_type.h.

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

- src/dropdown_common_type.h