forked from mirror/OpenTTD
Change: Add alternate_colour widget data for boolean button.
Allows boolean button to have different background and button colours.
This commit is contained in:
@@ -353,6 +353,7 @@ struct WidgetData {
|
||||
SpriteID sprite{};
|
||||
ArrowWidgetValues arrow_widget_type{};
|
||||
ResizeWidgetValues resize_widget_type{};
|
||||
Colours alternate_colour = INVALID_COLOUR;
|
||||
Dimension matrix{};
|
||||
};
|
||||
|
||||
@@ -1242,6 +1243,17 @@ constexpr NWidgetPart SetResizeWidgetTypeTip(ResizeWidgetValues widget_type, Str
|
||||
return NWidgetPart{WPT_DATATIP, NWidgetPartDataTip{{.resize_widget_type = widget_type}, tip}};
|
||||
}
|
||||
|
||||
/**
|
||||
* Widget part function for setting the alternate colour and tooltip.
|
||||
* @param colour Alternate colour of the widget.
|
||||
* @param tip Tooltip of the widget.
|
||||
* @ingroup NestedWidgetParts
|
||||
*/
|
||||
constexpr NWidgetPart SetAlternateColourTip(Colours colour, StringID tip)
|
||||
{
|
||||
return NWidgetPart{WPT_DATATIP, NWidgetPartDataTip{{.alternate_colour = colour}, tip}};
|
||||
}
|
||||
|
||||
/**
|
||||
* Widget part function for setting the data and tooltip of WWT_MATRIX widgets
|
||||
* @param cols Number of columns. \c 0 means to use draw columns with width according to the resize step size.
|
||||
|
Reference in New Issue
Block a user