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" 27 DropDownListItem(
int result,
bool masked) : result(result), masked(masked) {}
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;
48 virtual StringID String()
const {
return this->string; }
50 static bool NatSortFunc(std::unique_ptr<const DropDownListItem>
const &first, std::unique_ptr<const DropDownListItem>
const &second);
58 uint64 decode_params[10];
63 void SetParam(uint index, uint64 value) { decode_params[index] = value; }
71 const char *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;
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.
std::vector< std::unique_ptr< const DropDownListItem > > DropDownList
A drop down list is a collection of drop down list items.
List item with icon and string.
#define FONT_HEIGHT_NORMAL
Height of characters in the normal (FS_NORMAL) font.
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.
bool masked
Masked and unselectable item.
uint32 StringID
Numeric value that represents a string, independent of the selected language.
StringID string
String ID of item.
uint32 SpriteID
The number of a sprite, without mapping bits and colourtables.
int result
Result code to return to window on selection.
List item containing a C char string.
Specification of a rectangle with absolute coordinates of all edges.
String list item with parameters.
Base list item class from which others are derived.
Dimensions (a width and height) of a rectangle in 2D.