Codechange: use parameter pack/folding instead of va_arg macros for widget states

This commit is contained in:
Rubidium
2023-09-16 21:56:09 +02:00
committed by rubidium42
parent 30eba33f1e
commit 8ab0936491
17 changed files with 58 additions and 88 deletions

View File

@@ -523,46 +523,6 @@ void Window::OnFocusLost(bool closing)
if (this->nested_focus != nullptr && this->nested_focus->type == WWT_EDITBOX) VideoDriver::GetInstance()->EditBoxLostFocus();
}
/**
* Sets the enabled/disabled status of a list of widgets.
* By default, widgets are enabled.
* On certain conditions, they have to be disabled.
* @param disab_stat status to use ie: disabled = true, enabled = false
* @param widgets list of widgets ended by WIDGET_LIST_END
*/
void CDECL Window::SetWidgetsDisabledState(bool disab_stat, int widgets, ...)
{
va_list wdg_list;
va_start(wdg_list, widgets);
while (widgets != WIDGET_LIST_END) {
SetWidgetDisabledState(widgets, disab_stat);
widgets = va_arg(wdg_list, int);
}
va_end(wdg_list);
}
/**
* Sets the lowered/raised status of a list of widgets.
* @param lowered_stat status to use ie: lowered = true, raised = false
* @param widgets list of widgets ended by WIDGET_LIST_END
*/
void CDECL Window::SetWidgetsLoweredState(bool lowered_stat, int widgets, ...)
{
va_list wdg_list;
va_start(wdg_list, widgets);
while (widgets != WIDGET_LIST_END) {
SetWidgetLoweredState(widgets, lowered_stat);
widgets = va_arg(wdg_list, int);
}
va_end(wdg_list);
}
/**
* Raise the buttons of the window.
* @param autoraise Raise only the push buttons of the window.