OpenTTD Source
1.11.0-beta2
|
Go to the documentation of this file.
10 #ifndef WIDGETS_DROPDOWN_TYPE_H
11 #define WIDGETS_DROPDOWN_TYPE_H
13 #include "../window_type.h"
14 #include "../gfx_func.h"
15 #include "../core/smallvec_type.hpp"
16 #include "table/strings.h"
30 virtual bool Selectable()
const {
return false; }
32 virtual uint Width()
const {
return 0; }
33 virtual void Draw(
int left,
int right,
int top,
int bottom,
bool sel, Colours bg_colour)
const;
45 bool Selectable()
const override {
return true; }
46 uint Width()
const override;
47 void Draw(
int left,
int right,
int top,
int bottom,
bool sel, Colours bg_colour)
const override;
50 static bool NatSortFunc(std::unique_ptr<const DropDownListItem>
const &first, std::unique_ptr<const DropDownListItem>
const &second);
63 void SetParam(uint index, uint64 value) {
decode_params[index] = value; }
71 std::string raw_string;
90 uint Height(uint width)
const override;
91 uint Width()
const override;
92 void Draw(
int left,
int right,
int top,
int bottom,
bool sel, Colours bg_colour)
const override;
99 typedef std::vector<std::unique_ptr<const DropDownListItem>>
DropDownList;
StringID string
String ID of item.
int result
Result code to return to window on selection.
String list item with parameters.
Dimensions (a width and height) of a rectangle in 2D.
std::vector< std::unique_ptr< const DropDownListItem > > DropDownList
A drop down list is a collection of drop down list items.
List item containing a C char string.
Base list item class from which others are derived.
void ShowDropDownList(Window *w, DropDownList &&list, int selected, int button, uint width=0, bool auto_width=false, bool instant_close=false)
Show a drop down list.
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
uint64 decode_params[10]
Parameters of the string.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
#define FONT_HEIGHT_NORMAL
Height of characters in the normal (FS_NORMAL) font.
uint32 PaletteID
The number of the palette.
void ShowDropDownListAt(Window *w, DropDownList &&list, int selected, int button, Rect wi_rect, Colours wi_colour, bool auto_width=false, bool instant_close=false)
Show a drop down list.
Data structure for an opened window.
Specification of a rectangle with absolute coordinates of all edges.
bool masked
Masked and unselectable item.
List item with icon and string.
static bool NatSortFunc(std::unique_ptr< const DropDownListItem > const &first, std::unique_ptr< const DropDownListItem > const &second)
Natural sorting comparator function for DropDownList::sort().