| 1 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 2 | // Copyright 2019 Juan Palacios <[email protected]> |
| 3 | |
| 4 | #pragma once |
| 5 | |
| 6 | #include "core/components/controls/control.h" |
| 7 | #include <memory> |
| 8 | #include <string> |
| 9 | #include <string_view> |
| 10 | #include <vector> |
| 11 | |
| 12 | /// A control that aggregates other controls. |
| 13 | class ControlGroup : public Control |
| 14 | { |
| 15 | public: |
| 16 | ControlGroup(std::string_view id, |
| 17 | std::vector<std::unique_ptr<IControl>> &&controls, |
| 18 | bool active) noexcept; |
| 19 | |
| 20 | void preInit(ICommandQueue &ctlCmds) override; |
| 21 | void postInit(ICommandQueue &ctlCmds) override; |
| 22 | void init() final override; |
| 23 | std::string const &ID() const final override; |
| 24 | |
| 25 | void activate(bool active) final override; |
| 26 | |
| 27 | void cleanOnce() final override; |
| 28 | |
| 29 | protected: |
| 30 | void importControl(IControl::Importer &i) final override; |
| 31 | void exportControl(IControl::Exporter &e) const final override; |
| 32 | |
| 33 | void cleanControl(ICommandQueue &ctlCmds) override; |
| 34 | void syncControl(ICommandQueue &ctlCmds) override; |
| 35 | |
| 36 | private: |
| 37 | std::string const id_; |
| 38 | std::vector<std::unique_ptr<IControl>> const controls_; |
| 39 | }; |