src/widgets/dropdown_type.h
changeset 9859 28606a486c52
parent 9111 48ce04029fe4
child 9868 c529be2a15c5
equal deleted inserted replaced
9858:c8e0746a5945 9859:28606a486c52
    17 	int result;  ///< Result code to return to window on selection
    17 	int result;  ///< Result code to return to window on selection
    18 	bool masked; ///< Masked and unselectable item
    18 	bool masked; ///< Masked and unselectable item
    19 
    19 
    20 	DropDownListItem(int result, bool masked) : result(result), masked(masked) {}
    20 	DropDownListItem(int result, bool masked) : result(result), masked(masked) {}
    21 	virtual ~DropDownListItem() {}
    21 	virtual ~DropDownListItem() {}
    22 	virtual StringID String() const;
    22 
    23 	virtual uint Height(uint width) const;
    23 	virtual bool Selectable() const { return false; }
    24 	virtual void Draw(int x, int y, uint width, uint height, bool sel) const;
    24 	virtual uint Height(uint width) const { return 10; }
       
    25 	virtual void Draw(int x, int y, uint width, uint height, bool sel, int bg_colour) const;
    25 };
    26 };
    26 
    27 
    27 /**
    28 /**
    28  * Common string list item.
    29  * Common string list item.
    29  */
    30  */
    32 	StringID string; ///< String ID of item
    33 	StringID string; ///< String ID of item
    33 
    34 
    34 	DropDownListStringItem(StringID string, int result, bool masked) : DropDownListItem(result, masked), string(string) {}
    35 	DropDownListStringItem(StringID string, int result, bool masked) : DropDownListItem(result, masked), string(string) {}
    35 	virtual ~DropDownListStringItem() {}
    36 	virtual ~DropDownListStringItem() {}
    36 
    37 
    37 	StringID String() const;
    38 	virtual bool Selectable() const { return true; }
       
    39 	virtual void Draw(int x, int y, uint width, uint height, bool sel, int bg_colour) const;
       
    40 	virtual StringID String() const { return this->string; }
    38 };
    41 };
    39 
    42 
    40 /**
    43 /**
    41  * String list item with parameters.
    44  * String list item with parameters.
    42  */
    45  */
    45 	uint64 decode_params[10]; ///< Parameters of the string
    48 	uint64 decode_params[10]; ///< Parameters of the string
    46 
    49 
    47 	DropDownListParamStringItem(StringID string, int result, bool masked) : DropDownListStringItem(string, result, masked) {}
    50 	DropDownListParamStringItem(StringID string, int result, bool masked) : DropDownListStringItem(string, result, masked) {}
    48 	virtual ~DropDownListParamStringItem() {}
    51 	virtual ~DropDownListParamStringItem() {}
    49 
    52 
    50 	StringID String() const;
    53 	virtual StringID String() const;
    51 	void SetParam(uint index, uint64 value) { decode_params[index] = value; }
    54 	virtual void SetParam(uint index, uint64 value) { decode_params[index] = value; }
    52 };
    55 };
    53 
    56 
    54 /**
    57 /**
    55  * A drop down list is a collection of drop down list items.
    58  * A drop down list is a collection of drop down list items.
    56  */
    59  */