Change: Add alternate_colour widget data for boolean button.

Allows boolean button to have different background and button colours.
This commit is contained in:
2025-04-21 17:08:10 +01:00
committed by Peter Nelson
parent 7953a97cbb
commit 17e7dafa2a
2 changed files with 15 additions and 1 deletions

View File

@@ -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.