Codechange: Replace mishmash of types for widget index with WidgetID.

Indices were stored as int, but often passed around as uint/uint8_t and casts.

Now they should all use WidgetID.
This commit is contained in:
Peter Nelson
2023-12-29 19:11:59 +00:00
committed by Peter Nelson
parent fd84f73323
commit a0dfb76e34
77 changed files with 666 additions and 657 deletions

View File

@@ -801,7 +801,7 @@ public:
this->OnInvalidateData(VIWD_MODIFY_ORDERS);
}
void UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
void UpdateWidgetSize(WidgetID widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize) override
{
switch (widget) {
case WID_O_ORDER_LIST:
@@ -1081,7 +1081,7 @@ public:
this->DrawWidgets();
}
void DrawWidget(const Rect &r, int widget) const override
void DrawWidget(const Rect &r, WidgetID widget) const override
{
if (widget != WID_O_ORDER_LIST) return;
@@ -1140,7 +1140,7 @@ public:
}
}
void SetStringParameters(int widget) const override
void SetStringParameters(WidgetID widget) const override
{
switch (widget) {
case WID_O_COND_VALUE: {
@@ -1161,7 +1161,7 @@ public:
}
}
void OnClick([[maybe_unused]] Point pt, int widget, [[maybe_unused]] int click_count) override
void OnClick([[maybe_unused]] Point pt, WidgetID widget, [[maybe_unused]] int click_count) override
{
switch (widget) {
case WID_O_ORDER_LIST: {
@@ -1351,7 +1351,7 @@ public:
}
}
void OnDropdownSelect(int widget, int index) override
void OnDropdownSelect(WidgetID widget, int index) override
{
switch (widget) {
case WID_O_NON_STOP:
@@ -1394,7 +1394,7 @@ public:
}
}
void OnDragDrop(Point pt, int widget) override
void OnDragDrop(Point pt, WidgetID widget) override
{
switch (widget) {
case WID_O_ORDER_LIST: {
@@ -1525,7 +1525,7 @@ public:
}
}
void OnMouseDrag(Point pt, int widget) override
void OnMouseDrag(Point pt, WidgetID widget) override
{
if (this->selected_order != -1 && widget == WID_O_ORDER_LIST) {
/* An order is dragged.. */