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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user