VAPOR3 3.9.4
AbstractWidgetGroup.h
Go to the documentation of this file.
1#pragma once
2
3#include <initializer_list>
4#include <vector>
5
9
10template<class This, class Widget> class AbstractWidgetGroup {
11protected:
12 std::vector<Widget *> _children;
13
14public:
15 typedef std::initializer_list<Widget *> List;
16
18 virtual This *Add(Widget *w)
19 {
20 _children.push_back(w);
21 return (This *)this;
22 }
25 This *AddM(const List &list)
26 {
27 for (const auto &w : list) Add(w);
28 return (This *)this;
29 }
30};
31
35
36template<class This, class Widget, class That> class WidgetGroupWrapper : public AbstractWidgetGroup<This, Widget> {
37protected:
38 That *_group;
39
40public:
41 WidgetGroupWrapper(That *group) : _group(group) {}
42
43 virtual This *Add(Widget *w) override
44 {
45 _group->Add(w);
47 }
48};
Provides an interface that standardizes widget grouping classes.
virtual This * Add(Widget *w)
Adds a widget.
std::initializer_list< Widget * > List
std::vector< Widget * > _children
This * AddM(const List &list)
Automates the creation of widget groups that wrap other widget groups.
WidgetGroupWrapper(That *group)
virtual This * Add(Widget *w) override
Adds a widget.