Codechange: add and use SetString over directly accessing widget_data

This commit is contained in:
Rubidium
2025-01-02 12:46:21 +01:00
committed by rubidium42
parent fb06ddafba
commit b60101853c
16 changed files with 74 additions and 42 deletions

View File

@@ -1134,6 +1134,26 @@ void NWidgetCore::SetDataTip(uint32_t widget_data, StringID tool_tip)
this->tool_tip = tool_tip;
}
/**
* Set string of the nested widget.
* @param string The new string.
*/
void NWidgetCore::SetString(StringID string)
{
this->widget_data = string;
}
/**
* Set string and tool tip of the nested widget.
* @param stringThe new string.
* @param tool_tip The new tool_tip.
*/
void NWidgetCore::SetStringTip(StringID string, StringID tool_tip)
{
this->SetString(string);
this->SetToolTip(tool_tip);
}
/**
* Set sprite of the nested widget.
* @param sprite The new sprite.
@@ -1143,6 +1163,17 @@ void NWidgetCore::SetSprite(SpriteID sprite)
this->widget_data = sprite;
}
/**
* Set sprite and tool tip of the nested widget.
* @param sprite The new sprite.
* @param tool_tip The new tool_tip.
*/
void NWidgetCore::SetSpriteTip(SpriteID sprite, StringID tool_tip)
{
this->SetSprite(sprite);
this->SetToolTip(tool_tip);
}
/**
* Set the text style of the nested widget.
* @param colour TextColour to use.