1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-30 02:05:13 +01:00

Rename rct_widgetindex to WidgetIndex

This commit is contained in:
Gymnasiast
2022-08-21 18:49:23 +02:00
parent 7f29e4e39c
commit a088537b65
87 changed files with 768 additions and 770 deletions

View File

@@ -464,7 +464,7 @@ namespace OpenRCT2::Ui::Windows
// Since the plugin may alter widget positions and sizes during an update event,
// we need to force an update for all list view scrollbars
rct_widgetindex widgetIndex = 0;
WidgetIndex widgetIndex = 0;
for (auto widget = widgets; widget->type != WindowWidgetType::Empty; widget++)
{
if (widget->type == WindowWidgetType::Scroll)
@@ -543,7 +543,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void OnDrawWidget(rct_widgetindex widgetIndex, rct_drawpixelinfo& dpi) override
void OnDrawWidget(WidgetIndex widgetIndex, rct_drawpixelinfo& dpi) override
{
const auto& widget = widgets[widgetIndex];
const auto& info = GetInfo(this);
@@ -572,7 +572,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void OnMouseUp(rct_widgetindex widgetIndex) override
void OnMouseUp(WidgetIndex widgetIndex) override
{
switch (widgetIndex)
{
@@ -582,8 +582,7 @@ namespace OpenRCT2::Ui::Windows
default:
{
const auto& info = GetInfo(this);
if (widgetIndex >= WIDX_TAB_0
&& widgetIndex < static_cast<rct_widgetindex>(WIDX_TAB_0 + info.Desc.Tabs.size()))
if (widgetIndex >= WIDX_TAB_0 && widgetIndex < static_cast<WidgetIndex>(WIDX_TAB_0 + info.Desc.Tabs.size()))
{
ChangeTab(widgetIndex - WIDX_TAB_0);
break;
@@ -624,7 +623,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void OnMouseDown(rct_widgetindex widgetIndex) override
void OnMouseDown(WidgetIndex widgetIndex) override
{
auto* widget = &widgets[widgetIndex];
const auto& info = GetInfo(this);
@@ -671,7 +670,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void OnDropdown(rct_widgetindex widgetIndex, int32_t dropdownIndex) override
void OnDropdown(WidgetIndex widgetIndex, int32_t dropdownIndex) override
{
if (dropdownIndex == -1)
return;
@@ -691,7 +690,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void OnTextInput(rct_widgetindex widgetIndex, std::string_view text) override
void OnTextInput(WidgetIndex widgetIndex, std::string_view text) override
{
auto& info = GetInfo(this);
auto widgetDesc = info.GetCustomWidgetDesc(this, widgetIndex);
@@ -758,9 +757,9 @@ namespace OpenRCT2::Ui::Windows
}
private:
std::optional<rct_widgetindex> GetViewportWidgetIndex()
std::optional<WidgetIndex> GetViewportWidgetIndex()
{
rct_widgetindex widgetIndex = 0;
WidgetIndex widgetIndex = 0;
for (auto widget = widgets; widget->type != WindowWidgetType::Last; widget++)
{
if (widget->type == WindowWidgetType::Viewport)
@@ -843,7 +842,7 @@ namespace OpenRCT2::Ui::Windows
{
for (size_t i = 0; i < numTabs; i++)
{
SetWidgetPressed(static_cast<rct_widgetindex>(WIDX_TAB_0 + i), false);
SetWidgetPressed(static_cast<WidgetIndex>(WIDX_TAB_0 + i), false);
}
SetWidgetPressed(WIDX_TAB_0 + page, true);
}
@@ -856,7 +855,7 @@ namespace OpenRCT2::Ui::Windows
size_t tabIndex = 0;
for (const auto& tab : tabs)
{
auto widgetIndex = static_cast<rct_widgetindex>(WIDX_TAB_0 + tabIndex);
auto widgetIndex = static_cast<WidgetIndex>(WIDX_TAB_0 + tabIndex);
auto widget = &widgets[widgetIndex];
if (WidgetIsVisible(*this, widgetIndex))
{
@@ -1187,7 +1186,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void UpdateWidgetText(rct_window* w, rct_widgetindex widgetIndex, std::string_view value)
void UpdateWidgetText(rct_window* w, WidgetIndex widgetIndex, std::string_view value)
{
if (w->custom_info != nullptr)
{
@@ -1202,7 +1201,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void UpdateWidgetItems(rct_window* w, rct_widgetindex widgetIndex, const std::vector<std::string>& items)
void UpdateWidgetItems(rct_window* w, WidgetIndex widgetIndex, const std::vector<std::string>& items)
{
if (w->custom_info != nullptr)
{
@@ -1216,7 +1215,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void UpdateWidgetColour(rct_window* w, rct_widgetindex widgetIndex, colour_t colour)
void UpdateWidgetColour(rct_window* w, WidgetIndex widgetIndex, colour_t colour)
{
if (w->custom_info != nullptr)
{
@@ -1243,7 +1242,7 @@ namespace OpenRCT2::Ui::Windows
}
}
void UpdateWidgetSelectedIndex(rct_window* w, rct_widgetindex widgetIndex, int32_t selectedIndex)
void UpdateWidgetSelectedIndex(rct_window* w, WidgetIndex widgetIndex, int32_t selectedIndex)
{
if (w->custom_info != nullptr)
{
@@ -1290,7 +1289,7 @@ namespace OpenRCT2::Ui::Windows
}
}
std::vector<std::string> GetWidgetItems(rct_window* w, rct_widgetindex widgetIndex)
std::vector<std::string> GetWidgetItems(rct_window* w, WidgetIndex widgetIndex)
{
if (w->custom_info != nullptr)
{
@@ -1304,7 +1303,7 @@ namespace OpenRCT2::Ui::Windows
return {};
}
colour_t GetWidgetColour(rct_window* w, rct_widgetindex widgetIndex)
colour_t GetWidgetColour(rct_window* w, WidgetIndex widgetIndex)
{
if (w->custom_info != nullptr)
{
@@ -1318,7 +1317,7 @@ namespace OpenRCT2::Ui::Windows
return COLOUR_BLACK;
}
int32_t GetWidgetSelectedIndex(rct_window* w, rct_widgetindex widgetIndex)
int32_t GetWidgetSelectedIndex(rct_window* w, WidgetIndex widgetIndex)
{
if (w->custom_info != nullptr)
{
@@ -1348,7 +1347,7 @@ namespace OpenRCT2::Ui::Windows
return nullptr;
}
std::optional<rct_widgetindex> FindWidgetIndexByName(rct_window* w, std::string_view name)
std::optional<WidgetIndex> FindWidgetIndexByName(rct_window* w, std::string_view name)
{
if (w->custom_info != nullptr)
{
@@ -1360,7 +1359,7 @@ namespace OpenRCT2::Ui::Windows
{
if (customWidgetInfo->Name == name)
{
return static_cast<rct_widgetindex>(i);
return static_cast<WidgetIndex>(i);
}
}
}
@@ -1368,7 +1367,7 @@ namespace OpenRCT2::Ui::Windows
return std::nullopt;
}
std::string GetWidgetName(rct_window* w, rct_widgetindex widgetIndex)
std::string GetWidgetName(rct_window* w, WidgetIndex widgetIndex)
{
if (w->custom_info != nullptr)
{
@@ -1382,7 +1381,7 @@ namespace OpenRCT2::Ui::Windows
return {};
}
void SetWidgetName(rct_window* w, rct_widgetindex widgetIndex, std::string_view name)
void SetWidgetName(rct_window* w, WidgetIndex widgetIndex, std::string_view name)
{
if (w->custom_info != nullptr)
{
@@ -1395,7 +1394,7 @@ namespace OpenRCT2::Ui::Windows
}
}
CustomListView* GetCustomListView(rct_window* w, rct_widgetindex widgetIndex)
CustomListView* GetCustomListView(rct_window* w, WidgetIndex widgetIndex)
{
if (w->custom_info != nullptr)
{
@@ -1409,7 +1408,7 @@ namespace OpenRCT2::Ui::Windows
return nullptr;
}
int32_t GetWidgetMaxLength(rct_window* w, rct_widgetindex widgetIndex)
int32_t GetWidgetMaxLength(rct_window* w, WidgetIndex widgetIndex)
{
if (w->custom_info != nullptr)
{
@@ -1423,7 +1422,7 @@ namespace OpenRCT2::Ui::Windows
return 0;
}
void SetWidgetMaxLength(rct_window* w, rct_widgetindex widgetIndex, int32_t value)
void SetWidgetMaxLength(rct_window* w, WidgetIndex widgetIndex, int32_t value)
{
if (w->custom_info != nullptr)
{