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:

committed by
Peter Nelson

parent
fd84f73323
commit
a0dfb76e34
@@ -64,7 +64,7 @@ struct ContentTextfileWindow : public TextfileWindow {
|
||||
}
|
||||
}
|
||||
|
||||
void SetStringParameters(int widget) const override
|
||||
void SetStringParameters(WidgetID widget) const override
|
||||
{
|
||||
if (widget == WID_TF_CAPTION) {
|
||||
SetDParam(0, this->GetTypeString());
|
||||
@@ -114,7 +114,7 @@ void BaseNetworkContentDownloadStatusWindow::Close([[maybe_unused]] int data)
|
||||
this->Window::Close();
|
||||
}
|
||||
|
||||
void BaseNetworkContentDownloadStatusWindow::UpdateWidgetSize(int widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize)
|
||||
void BaseNetworkContentDownloadStatusWindow::UpdateWidgetSize(WidgetID widget, Dimension *size, [[maybe_unused]] const Dimension &padding, [[maybe_unused]] Dimension *fill, [[maybe_unused]] Dimension *resize)
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_NCDS_PROGRESS_BAR:
|
||||
@@ -133,7 +133,7 @@ void BaseNetworkContentDownloadStatusWindow::UpdateWidgetSize(int widget, Dimens
|
||||
}
|
||||
}
|
||||
|
||||
void BaseNetworkContentDownloadStatusWindow::DrawWidget(const Rect &r, int widget) const
|
||||
void BaseNetworkContentDownloadStatusWindow::DrawWidget(const Rect &r, WidgetID widget) const
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_NCDS_PROGRESS_BAR: {
|
||||
@@ -285,7 +285,7 @@ public:
|
||||
this->BaseNetworkContentDownloadStatusWindow::Close();
|
||||
}
|
||||
|
||||
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
|
||||
{
|
||||
if (widget == WID_NCDS_CANCELOK) {
|
||||
if (this->downloaded_bytes != this->total_bytes) {
|
||||
@@ -581,7 +581,7 @@ public:
|
||||
this->checkbox_size = maxdim(maxdim(GetSpriteSize(SPR_BOX_EMPTY), GetSpriteSize(SPR_BOX_CHECKED)), GetSpriteSize(SPR_BLOT));
|
||||
}
|
||||
|
||||
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_NCL_CHECKBOX:
|
||||
@@ -605,7 +605,7 @@ public:
|
||||
}
|
||||
|
||||
|
||||
void DrawWidget(const Rect &r, int widget) const override
|
||||
void DrawWidget(const Rect &r, WidgetID widget) const override
|
||||
{
|
||||
switch (widget) {
|
||||
case WID_NCL_DETAILS:
|
||||
@@ -788,7 +788,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
|
||||
{
|
||||
if (widget >= WID_NCL_TEXTFILE && widget < WID_NCL_TEXTFILE + TFT_CONTENT_END) {
|
||||
if (this->selected == nullptr || this->selected->state != ContentInfo::ALREADY_HERE) return;
|
||||
@@ -921,7 +921,7 @@ public:
|
||||
return ES_HANDLED;
|
||||
}
|
||||
|
||||
void OnEditboxChanged(int wid) override
|
||||
void OnEditboxChanged(WidgetID wid) override
|
||||
{
|
||||
if (wid == WID_NCL_FILTER) {
|
||||
this->filter_data.string_filter.SetFilterTerm(this->filter_editbox.text.buf);
|
||||
|
Reference in New Issue
Block a user