From 8ab0936491ff8dac0e1775ff7d2a98e475e41f57 Mon Sep 17 00:00:00 2001 From: Rubidium Date: Sat, 16 Sep 2023 21:56:09 +0200 Subject: [PATCH] Codechange: use parameter pack/folding instead of va_arg macros for widget states --- src/airport_gui.cpp | 4 +--- src/build_vehicle_gui.cpp | 2 +- src/company_gui.cpp | 26 ++++++++++++------------- src/depot_gui.cpp | 3 +-- src/dock_gui.cpp | 3 +-- src/genworld_gui.cpp | 4 ++-- src/group_gui.cpp | 9 +++------ src/music_gui.cpp | 3 +-- src/newgrf_gui.cpp | 6 ++---- src/road_gui.cpp | 3 +-- src/script/script_gui.cpp | 2 +- src/settings_gui.cpp | 2 +- src/toolbar_gui.cpp | 6 +++--- src/town_gui.cpp | 4 ++-- src/vehicle_gui.cpp | 3 +-- src/window.cpp | 40 --------------------------------------- src/window_gui.h | 26 +++++++++++++++++++++++-- 17 files changed, 58 insertions(+), 88 deletions(-) diff --git a/src/airport_gui.cpp b/src/airport_gui.cpp index ac9b0448e3..d474643b74 100644 --- a/src/airport_gui.cpp +++ b/src/airport_gui.cpp @@ -107,9 +107,7 @@ struct BuildAirToolbarWindow : Window { if (!gui_scope) return; bool can_build = CanBuildVehicleInfrastructure(VEH_AIRCRAFT); - this->SetWidgetsDisabledState(!can_build, - WID_AT_AIRPORT, - WIDGET_LIST_END); + this->SetWidgetDisabledState(WID_AT_AIRPORT, !can_build); if (!can_build) { CloseWindowById(WC_BUILD_STATION, TRANSPORT_AIR); diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index 9a1834a3b0..08f6955120 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -1800,7 +1800,7 @@ struct BuildVehicleWindow : Window { this->GenerateBuildList(); this->vscroll->SetCount(this->eng_list.size()); - this->SetWidgetsDisabledState(this->sel_engine == INVALID_ENGINE, WID_BV_SHOW_HIDE, WID_BV_BUILD, WIDGET_LIST_END); + this->SetWidgetsDisabledState(this->sel_engine == INVALID_ENGINE, WID_BV_SHOW_HIDE, WID_BV_BUILD); /* Disable renaming engines in network games if you are not the server. */ this->SetWidgetDisabledState(WID_BV_RENAME, this->sel_engine == INVALID_ENGINE || (_networking && !_network_server)); diff --git a/src/company_gui.cpp b/src/company_gui.cpp index 71689a087e..b10c43bdbf 100644 --- a/src/company_gui.cpp +++ b/src/company_gui.cpp @@ -1103,7 +1103,7 @@ public: return; } - this->SetWidgetsDisabledState(true, WID_SCL_CLASS_RAIL, WID_SCL_CLASS_ROAD, WID_SCL_CLASS_SHIP, WID_SCL_CLASS_AIRCRAFT, WIDGET_LIST_END); + this->SetWidgetsDisabledState(true, WID_SCL_CLASS_RAIL, WID_SCL_CLASS_ROAD, WID_SCL_CLASS_SHIP, WID_SCL_CLASS_AIRCRAFT); bool current_class_valid = this->livery_class == LC_OTHER || this->livery_class >= LC_GROUP_RAIL; if (_settings_client.gui.liveries == LIT_ALL || (_settings_client.gui.liveries == LIT_COMPANY && this->window_number == _local_company)) { @@ -1519,8 +1519,8 @@ public: void OnPaint() override { /* lower the non-selected gender button */ - this->SetWidgetsLoweredState(!this->is_female, WID_SCMF_MALE, WID_SCMF_MALE2, WIDGET_LIST_END); - this->SetWidgetsLoweredState( this->is_female, WID_SCMF_FEMALE, WID_SCMF_FEMALE2, WIDGET_LIST_END); + this->SetWidgetsLoweredState(!this->is_female, WID_SCMF_MALE, WID_SCMF_MALE2); + this->SetWidgetsLoweredState( this->is_female, WID_SCMF_FEMALE, WID_SCMF_FEMALE2); /* advanced company manager face selection window */ @@ -1535,44 +1535,44 @@ public: /* Eye colour buttons */ this->SetWidgetsDisabledState(_cmf_info[CMFV_EYE_COLOUR].valid_values[this->ge] < 2, - WID_SCMF_EYECOLOUR, WID_SCMF_EYECOLOUR_L, WID_SCMF_EYECOLOUR_R, WIDGET_LIST_END); + WID_SCMF_EYECOLOUR, WID_SCMF_EYECOLOUR_L, WID_SCMF_EYECOLOUR_R); /* Chin buttons */ this->SetWidgetsDisabledState(_cmf_info[CMFV_CHIN].valid_values[this->ge] < 2, - WID_SCMF_CHIN, WID_SCMF_CHIN_L, WID_SCMF_CHIN_R, WIDGET_LIST_END); + WID_SCMF_CHIN, WID_SCMF_CHIN_L, WID_SCMF_CHIN_R); /* Eyebrows buttons */ this->SetWidgetsDisabledState(_cmf_info[CMFV_EYEBROWS].valid_values[this->ge] < 2, - WID_SCMF_EYEBROWS, WID_SCMF_EYEBROWS_L, WID_SCMF_EYEBROWS_R, WIDGET_LIST_END); + WID_SCMF_EYEBROWS, WID_SCMF_EYEBROWS_L, WID_SCMF_EYEBROWS_R); /* Lips or (if it a male face with a moustache) moustache buttons */ this->SetWidgetsDisabledState(_cmf_info[this->is_moust_male ? CMFV_MOUSTACHE : CMFV_LIPS].valid_values[this->ge] < 2, - WID_SCMF_LIPS_MOUSTACHE, WID_SCMF_LIPS_MOUSTACHE_L, WID_SCMF_LIPS_MOUSTACHE_R, WIDGET_LIST_END); + WID_SCMF_LIPS_MOUSTACHE, WID_SCMF_LIPS_MOUSTACHE_L, WID_SCMF_LIPS_MOUSTACHE_R); /* Nose buttons | male faces with moustache haven't any nose options */ this->SetWidgetsDisabledState(_cmf_info[CMFV_NOSE].valid_values[this->ge] < 2 || this->is_moust_male, - WID_SCMF_NOSE, WID_SCMF_NOSE_L, WID_SCMF_NOSE_R, WIDGET_LIST_END); + WID_SCMF_NOSE, WID_SCMF_NOSE_L, WID_SCMF_NOSE_R); /* Hair buttons */ this->SetWidgetsDisabledState(_cmf_info[CMFV_HAIR].valid_values[this->ge] < 2, - WID_SCMF_HAIR, WID_SCMF_HAIR_L, WID_SCMF_HAIR_R, WIDGET_LIST_END); + WID_SCMF_HAIR, WID_SCMF_HAIR_L, WID_SCMF_HAIR_R); /* Jacket buttons */ this->SetWidgetsDisabledState(_cmf_info[CMFV_JACKET].valid_values[this->ge] < 2, - WID_SCMF_JACKET, WID_SCMF_JACKET_L, WID_SCMF_JACKET_R, WIDGET_LIST_END); + WID_SCMF_JACKET, WID_SCMF_JACKET_L, WID_SCMF_JACKET_R); /* Collar buttons */ this->SetWidgetsDisabledState(_cmf_info[CMFV_COLLAR].valid_values[this->ge] < 2, - WID_SCMF_COLLAR, WID_SCMF_COLLAR_L, WID_SCMF_COLLAR_R, WIDGET_LIST_END); + WID_SCMF_COLLAR, WID_SCMF_COLLAR_L, WID_SCMF_COLLAR_R); /* Tie/earring buttons | female faces without earring haven't any earring options */ this->SetWidgetsDisabledState(_cmf_info[CMFV_TIE_EARRING].valid_values[this->ge] < 2 || (this->is_female && GetCompanyManagerFaceBits(this->face, CMFV_HAS_TIE_EARRING, this->ge) == 0), - WID_SCMF_TIE_EARRING, WID_SCMF_TIE_EARRING_L, WID_SCMF_TIE_EARRING_R, WIDGET_LIST_END); + WID_SCMF_TIE_EARRING, WID_SCMF_TIE_EARRING_L, WID_SCMF_TIE_EARRING_R); /* Glasses buttons | faces without glasses haven't any glasses options */ this->SetWidgetsDisabledState(_cmf_info[CMFV_GLASSES].valid_values[this->ge] < 2 || GetCompanyManagerFaceBits(this->face, CMFV_HAS_GLASSES, this->ge) == 0, - WID_SCMF_GLASSES, WID_SCMF_GLASSES_L, WID_SCMF_GLASSES_R, WIDGET_LIST_END); + WID_SCMF_GLASSES, WID_SCMF_GLASSES_L, WID_SCMF_GLASSES_R); this->DrawWidgets(); } diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index 0acc15a02d..28d5d6ea11 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -755,8 +755,7 @@ struct DepotWindow : Window { WID_D_BUILD, WID_D_CLONE, WID_D_RENAME, - WID_D_AUTOREPLACE, - WIDGET_LIST_END); + WID_D_AUTOREPLACE); this->DrawWidgets(); } diff --git a/src/dock_gui.cpp b/src/dock_gui.cpp index f2a4d60305..ee3446e7ba 100644 --- a/src/dock_gui.cpp +++ b/src/dock_gui.cpp @@ -128,8 +128,7 @@ struct BuildDocksToolbarWindow : Window { this->SetWidgetsDisabledState(!can_build, WID_DT_DEPOT, WID_DT_STATION, - WID_DT_BUOY, - WIDGET_LIST_END); + WID_DT_BUOY); if (!can_build) { CloseWindowById(WC_BUILD_STATION, TRANSPORT_WATER); CloseWindowById(WC_BUILD_DEPOT, TRANSPORT_WATER); diff --git a/src/genworld_gui.cpp b/src/genworld_gui.cpp index ab4a332b53..b93c206a39 100644 --- a/src/genworld_gui.cpp +++ b/src/genworld_gui.cpp @@ -535,7 +535,7 @@ struct GenerateLandscapeWindow : public Window { this->SetWidgetDisabledState(WID_GL_VARIETY_PULLDOWN, _settings_newgame.game_creation.land_generator == LG_ORIGINAL); this->SetWidgetDisabledState(WID_GL_BORDERS_RANDOM, _settings_newgame.game_creation.land_generator == LG_ORIGINAL || !_settings_newgame.construction.freeform_edges); this->SetWidgetsDisabledState(_settings_newgame.game_creation.land_generator == LG_ORIGINAL || !_settings_newgame.construction.freeform_edges || _settings_newgame.game_creation.water_borders == BORDERS_RANDOM, - WID_GL_WATER_NW, WID_GL_WATER_NE, WID_GL_WATER_SE, WID_GL_WATER_SW, WIDGET_LIST_END); + WID_GL_WATER_NW, WID_GL_WATER_NE, WID_GL_WATER_SE, WID_GL_WATER_SW); this->SetWidgetLoweredState(WID_GL_BORDERS_RANDOM, _settings_newgame.game_creation.water_borders == BORDERS_RANDOM); @@ -545,7 +545,7 @@ struct GenerateLandscapeWindow : public Window { this->SetWidgetLoweredState(WID_GL_WATER_SW, HasBit(_settings_newgame.game_creation.water_borders, BORDER_SW)); this->SetWidgetsDisabledState(_settings_newgame.game_creation.land_generator == LG_ORIGINAL && (_settings_newgame.game_creation.landscape == LT_ARCTIC || _settings_newgame.game_creation.landscape == LT_TROPIC), - WID_GL_TERRAIN_PULLDOWN, WID_GL_WATER_PULLDOWN, WIDGET_LIST_END); + WID_GL_TERRAIN_PULLDOWN, WID_GL_WATER_PULLDOWN); } /* Disable snowline if not arctic */ diff --git a/src/group_gui.cpp b/src/group_gui.cpp index 721125d62a..cc7992497c 100644 --- a/src/group_gui.cpp +++ b/src/group_gui.cpp @@ -519,16 +519,14 @@ public: this->SetWidgetsDisabledState(this->vehicles.size() == 0 || _local_company != this->vli.company, WID_GL_STOP_ALL, WID_GL_START_ALL, - WID_GL_MANAGE_VEHICLES_DROPDOWN, - WIDGET_LIST_END); + WID_GL_MANAGE_VEHICLES_DROPDOWN); /* Disable the group specific function when we select the default group or all vehicles */ this->SetWidgetsDisabledState(IsDefaultGroupID(this->vli.index) || IsAllGroupID(this->vli.index) || _local_company != this->vli.company, WID_GL_DELETE_GROUP, WID_GL_RENAME_GROUP, WID_GL_LIVERY_GROUP, - WID_GL_REPLACE_PROTECTION, - WIDGET_LIST_END); + WID_GL_REPLACE_PROTECTION); /* Disable remaining buttons for non-local companies * Needed while changing _local_company, eg. by cheats @@ -538,8 +536,7 @@ public: */ this->SetWidgetsDisabledState(_local_company != this->vli.company, WID_GL_CREATE_GROUP, - WID_GL_AVAILABLE_VEHICLES, - WIDGET_LIST_END); + WID_GL_AVAILABLE_VEHICLES); /* If not a default group and the group has replace protection, show an enabled replace sprite. */ uint16_t protect_sprite = SPR_GROUP_REPLACE_OFF_TRAIN; diff --git a/src/music_gui.cpp b/src/music_gui.cpp index 1f0d626377..7ef06425ce 100644 --- a/src/music_gui.cpp +++ b/src/music_gui.cpp @@ -670,8 +670,7 @@ struct MusicWindow : public Window { this->SetWidgetsDisabledState( BaseMusic::GetUsedSet()->num_available == 0, WID_M_PREV, WID_M_NEXT, WID_M_STOP, WID_M_PLAY, WID_M_SHUFFLE, - WID_M_ALL, WID_M_OLD, WID_M_NEW, WID_M_EZY, WID_M_CUSTOM1, WID_M_CUSTOM2, - WIDGET_LIST_END + WID_M_ALL, WID_M_OLD, WID_M_NEW, WID_M_EZY, WID_M_CUSTOM1, WID_M_CUSTOM2 ); } diff --git a/src/newgrf_gui.cpp b/src/newgrf_gui.cpp index 8036a3f629..9a36d51f9a 100644 --- a/src/newgrf_gui.cpp +++ b/src/newgrf_gui.cpp @@ -1280,8 +1280,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { this->SetWidgetDisabledState(WID_NS_APPLY_CHANGES, !((this->editable && this->modified) || _settings_client.gui.newgrf_developer_tools)); this->SetWidgetsDisabledState(!this->editable, WID_NS_PRESET_LIST, - WID_NS_TOGGLE_PALETTE, - WIDGET_LIST_END + WID_NS_TOGGLE_PALETTE ); this->SetWidgetDisabledState(WID_NS_ADD, !this->editable || this->avail_sel == nullptr || HasBit(this->avail_sel->flags, GCF_INVALID)); this->SetWidgetDisabledState(WID_NS_UPGRADE, !this->editable || this->actives == nullptr || !this->CanUpgradeCurrent()); @@ -1290,8 +1289,7 @@ struct NewGRFWindow : public Window, NewGRFScanCallback { this->SetWidgetsDisabledState(disable_all, WID_NS_REMOVE, WID_NS_MOVE_UP, - WID_NS_MOVE_DOWN, - WIDGET_LIST_END + WID_NS_MOVE_DOWN ); const GRFConfig *selected_config = (this->avail_sel == nullptr) ? this->active_sel : this->avail_sel; diff --git a/src/road_gui.cpp b/src/road_gui.cpp index 5f5acde8d1..3a2f567aa7 100644 --- a/src/road_gui.cpp +++ b/src/road_gui.cpp @@ -350,8 +350,7 @@ struct BuildRoadToolbarWindow : Window { this->SetWidgetsDisabledState(!can_build, WID_ROT_DEPOT, WID_ROT_BUS_STATION, - WID_ROT_TRUCK_STATION, - WIDGET_LIST_END); + WID_ROT_TRUCK_STATION); if (!can_build) { CloseWindowById(WC_BUS_STATION, TRANSPORT_ROAD); CloseWindowById(WC_TRUCK_STATION, TRANSPORT_ROAD); diff --git a/src/script/script_gui.cpp b/src/script/script_gui.cpp index 90be17a5d5..c528734191 100644 --- a/src/script/script_gui.cpp +++ b/src/script/script_gui.cpp @@ -779,7 +779,7 @@ struct ScriptDebugWindow : public Window { this->querystrings[WID_SCRD_BREAK_STR_EDIT_BOX] = &this->break_editbox; - SetWidgetsDisabledState(!this->show_break_box, WID_SCRD_BREAK_STR_ON_OFF_BTN, WID_SCRD_BREAK_STR_EDIT_BOX, WID_SCRD_MATCH_CASE_BTN, WIDGET_LIST_END); + SetWidgetsDisabledState(!this->show_break_box, WID_SCRD_BREAK_STR_ON_OFF_BTN, WID_SCRD_BREAK_STR_EDIT_BOX, WID_SCRD_MATCH_CASE_BTN); /* Restore the break string value from static variable */ this->break_editbox.text.Assign(this->break_string); diff --git a/src/settings_gui.cpp b/src/settings_gui.cpp index 28a466b927..319e2faf9b 100644 --- a/src/settings_gui.cpp +++ b/src/settings_gui.cpp @@ -386,7 +386,7 @@ struct GameOptionsWindow : Window { void SetTab(int widget) { - this->SetWidgetsLoweredState(false, WID_GO_TAB_GENERAL, WID_GO_TAB_GRAPHICS, WID_GO_TAB_SOUND, WIDGET_LIST_END); + this->SetWidgetsLoweredState(false, WID_GO_TAB_GENERAL, WID_GO_TAB_GRAPHICS, WID_GO_TAB_SOUND); this->LowerWidget(widget); int pane = 0; diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp index 291131b3c5..d02ff5ef42 100644 --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -2019,9 +2019,9 @@ struct MainToolbarWindow : Window { /* If spectator, disable all construction buttons * ie : Build road, rail, ships, airports and landscaping * Since enabled state is the default, just disable when needed */ - this->SetWidgetsDisabledState(_local_company == COMPANY_SPECTATOR, WID_TN_RAILS, WID_TN_ROADS, WID_TN_TRAMS, WID_TN_WATER, WID_TN_AIR, WID_TN_LANDSCAPE, WIDGET_LIST_END); + this->SetWidgetsDisabledState(_local_company == COMPANY_SPECTATOR, WID_TN_RAILS, WID_TN_ROADS, WID_TN_TRAMS, WID_TN_WATER, WID_TN_AIR, WID_TN_LANDSCAPE); /* disable company list drop downs, if there are no companies */ - this->SetWidgetsDisabledState(Company::GetNumItems() == 0, WID_TN_STATIONS, WID_TN_FINANCES, WID_TN_TRAINS, WID_TN_ROADVEHS, WID_TN_SHIPS, WID_TN_AIRCRAFT, WIDGET_LIST_END); + this->SetWidgetsDisabledState(Company::GetNumItems() == 0, WID_TN_STATIONS, WID_TN_FINANCES, WID_TN_TRAINS, WID_TN_ROADVEHS, WID_TN_SHIPS, WID_TN_AIRCRAFT); this->SetWidgetDisabledState(WID_TN_GOAL, Goal::GetNumItems() == 0); this->SetWidgetDisabledState(WID_TN_STORY, StoryPage::GetNumItems() == 0); @@ -2475,7 +2475,7 @@ struct ScenarioEditorToolbarWindow : Window { void OnTimeout() override { - this->SetWidgetsLoweredState(false, WID_TE_DATE_BACKWARD, WID_TE_DATE_FORWARD, WIDGET_LIST_END); + this->SetWidgetsLoweredState(false, WID_TE_DATE_BACKWARD, WID_TE_DATE_FORWARD); this->SetWidgetDirty(WID_TE_DATE_BACKWARD); this->SetWidgetDirty(WID_TE_DATE_FORWARD); } diff --git a/src/town_gui.cpp b/src/town_gui.cpp index 48e84dc3a6..f66b0c7237 100644 --- a/src/town_gui.cpp +++ b/src/town_gui.cpp @@ -1169,9 +1169,9 @@ public: void UpdateButtons(bool check_availability) { if (check_availability && _game_mode != GM_EDITOR) { - this->SetWidgetsDisabledState(true, WID_TF_RANDOM_TOWN, WID_TF_MANY_RANDOM_TOWNS, WID_TF_EXPAND_ALL_TOWNS, WID_TF_SIZE_LARGE, WIDGET_LIST_END); + this->SetWidgetsDisabledState(true, WID_TF_RANDOM_TOWN, WID_TF_MANY_RANDOM_TOWNS, WID_TF_EXPAND_ALL_TOWNS, WID_TF_SIZE_LARGE); this->SetWidgetsDisabledState(_settings_game.economy.found_town != TF_CUSTOM_LAYOUT, - WID_TF_LAYOUT_ORIGINAL, WID_TF_LAYOUT_BETTER, WID_TF_LAYOUT_GRID2, WID_TF_LAYOUT_GRID3, WID_TF_LAYOUT_RANDOM, WIDGET_LIST_END); + WID_TF_LAYOUT_ORIGINAL, WID_TF_LAYOUT_BETTER, WID_TF_LAYOUT_GRID2, WID_TF_LAYOUT_GRID3, WID_TF_LAYOUT_RANDOM); if (_settings_game.economy.found_town != TF_CUSTOM_LAYOUT) town_layout = _settings_game.economy.town_layout; } diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index bf2f939dad..9758036a13 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -2005,8 +2005,7 @@ public: this->SetWidgetsDisabledState(this->vehicles.size() == 0, WID_VL_MANAGE_VEHICLES_DROPDOWN, WID_VL_STOP_ALL, - WID_VL_START_ALL, - WIDGET_LIST_END); + WID_VL_START_ALL); } /* Set text of group by dropdown widget. */ diff --git a/src/window.cpp b/src/window.cpp index 37de6e85ca..4c6643f92e 100644 --- a/src/window.cpp +++ b/src/window.cpp @@ -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. diff --git a/src/window_gui.h b/src/window_gui.h index e5e438f91d..281525797a 100644 --- a/src/window_gui.h +++ b/src/window_gui.h @@ -434,8 +434,30 @@ public: int GetRowFromWidget(int clickpos, int widget, int padding, int line_height = -1) const; void RaiseButtons(bool autoraise = false); - void CDECL SetWidgetsDisabledState(bool disab_stat, int widgets, ...); - void CDECL SetWidgetsLoweredState(bool lowered_stat, int widgets, ...); + + /** + * 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 + */ + template + void SetWidgetsDisabledState(bool disab_stat, Args... widgets) + { + (SetWidgetDisabledState(widgets, disab_stat), ...); + } + + /** + * 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 + */ + template + void SetWidgetsLoweredState(bool lowered_stat, Args... widgets) + { + (SetWidgetLoweredState(widgets, lowered_stat), ...); + } void SetWidgetDirty(byte widget_index) const; void DrawWidgets() const;