1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-21 22:13:07 +01:00

Add name get / set to widget

This commit is contained in:
Ted John
2020-05-06 22:46:03 +01:00
parent 4701dd3b9b
commit e63fcd010f
4 changed files with 50 additions and 1 deletions

View File

@@ -1102,6 +1102,33 @@ namespace OpenRCT2::Ui::Windows
return std::nullopt;
}
std::string GetWidgetName(rct_window* w, rct_widgetindex widgetIndex)
{
if (w->custom_info != nullptr)
{
const auto& customInfo = GetInfo(w);
auto customWidgetInfo = customInfo.GetCustomWidgetDesc(w, widgetIndex);
if (customWidgetInfo != nullptr)
{
return customWidgetInfo->Name;
}
}
return {};
}
void SetWidgetName(rct_window* w, rct_widgetindex widgetIndex, const std::string_view& name)
{
if (w->custom_info != nullptr)
{
auto& customInfo = GetInfo(w);
auto customWidgetInfo = customInfo.GetCustomWidgetDesc(w, widgetIndex);
if (customWidgetInfo != nullptr)
{
customWidgetInfo->Name = std::string(name);
}
}
}
CustomListView* GetCustomListView(rct_window* w, rct_widgetindex widgetIndex)
{
if (w->custom_info != nullptr)