FastLED 3.9.15
Loading...
Searching...
No Matches
group.h
Go to the documentation of this file.
1#pragma once
2
3#include "fl/stl/string.h"
4#include "fl/stl/compiler_control.h" // IWYU pragma: keep
5#include "fl/stl/noexcept.h"
6#include "fl/ui/element.h"
7#include "platforms/ui_defs.h"
8
9#ifndef FASTLED_HAS_UI_GROUP
10#define FASTLED_HAS_UI_GROUP 0
11#endif
12
13namespace fl {
14
15#if !FASTLED_HAS_UI_GROUP
16
18 public:
24
25 private:
27};
28
29#endif
30
31class UIGroup {
32 public:
34
35 UIGroup(const fl::string& groupName) FL_NOEXCEPT;
36
37 template<typename... UIElements>
38 UIGroup(const fl::string& groupName, UIElements&... elements) FL_NOEXCEPT
39 : mImpl(groupName.c_str()) {
40 add(elements...);
41 }
42
44
45 fl::string name() const FL_NOEXCEPT { return mImpl.name(); }
46
47 operator fl::string() const FL_NOEXCEPT { return name(); }
48
49 template<typename T>
50 void addControl(T* control) FL_NOEXCEPT {
51 control->setGroup(name());
52 }
53
54 protected:
56
57 private:
58 template<typename T>
59 void add(T& control) FL_NOEXCEPT {
60 control.setGroup(name());
61 }
62
63 template<typename T, typename... Rest>
64 void add(T& control, Rest&... rest) FL_NOEXCEPT {
65 control.setGroup(name());
66 add(rest...);
67 }
68};
69
70} // namespace fl
void add(T &control) FL_NOEXCEPT
Definition group.h:59
UIGroup(const fl::string &groupName, UIElements &... elements) FL_NOEXCEPT
Definition group.h:38
fl::string name() const FL_NOEXCEPT
Definition group.h:45
UIGroup(const fl::string &groupName) FL_NOEXCEPT
Definition group.cpp.hpp:6
void add(T &control, Rest &... rest) FL_NOEXCEPT
Definition group.h:64
FL_NO_COPY(UIGroup)
UIGroupImpl mImpl
Definition group.h:55
~UIGroup() FL_NOEXCEPT
Definition group.cpp.hpp:7
void addControl(T *control) FL_NOEXCEPT
Definition group.h:50
fl::string name() const FL_NOEXCEPT
Definition group.h:23
UIGroupImpl(const char *name) FL_NOEXCEPT
Definition group.h:19
~UIGroupImpl() FL_NOEXCEPT
Definition group.h:22
fl::string mGroupName
Definition group.h:26
Base definition for an LED controller.
Definition crgb.hpp:179
#define FASTLED_UNUSED(x)
#define FL_NOEXCEPT