FastLED 3.9.15
Loading...
Searching...
No Matches
element.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 "platforms/ui_defs.h" // IWYU pragma: keep
7
8#define FL_NO_COPY(CLASS) \
9 CLASS(const CLASS &) = delete; \
10 CLASS &operator=(const CLASS &) FL_NOEXCEPT = delete;
11
12namespace fl {
13
14// Virtual interface for physical button input - breaks fl.cpp -> fl.sensors+ link chain.
15// Concrete Button class implements this in fl/sensors/button.h.
17 public:
18 virtual ~IButtonInput() FL_NOEXCEPT = default;
19 virtual bool isPressed() const FL_NOEXCEPT = 0;
20 virtual bool clicked() const FL_NOEXCEPT = 0;
21};
22
23// Forward declaration only - concrete type lives in fl/sensors/button.h
24class Button;
25
26// Base class for UI elements that provides string-based group functionality
27class UIElement {
28 public:
31 virtual void setGroup(const fl::string& groupName) FL_NOEXCEPT { mGroupName = groupName; }
32
34 bool hasGroup() const FL_NOEXCEPT { return !mGroupName.empty(); }
35
36 private:
38};
39
40#define FASTLED_UI_DEFINE_OPERATORS(UI_CLASS) \
41 FASTLED_DEFINE_POD_COMPARISON_OPERATOR(UI_CLASS, >=) \
42 FASTLED_DEFINE_POD_COMPARISON_OPERATOR(UI_CLASS, <=) \
43 FASTLED_DEFINE_POD_COMPARISON_OPERATOR(UI_CLASS, >) \
44 FASTLED_DEFINE_POD_COMPARISON_OPERATOR(UI_CLASS, <) \
45 FASTLED_DEFINE_POD_COMPARISON_OPERATOR(UI_CLASS, ==) \
46 FASTLED_DEFINE_POD_COMPARISON_OPERATOR(UI_CLASS, !=)
47
48} // namespace fl
virtual bool clicked() const FL_NOEXCEPT=0
virtual ~IButtonInput() FL_NOEXCEPT=default
virtual bool isPressed() const FL_NOEXCEPT=0
virtual void setGroup(const fl::string &groupName) FL_NOEXCEPT
Definition element.h:31
bool hasGroup() const FL_NOEXCEPT
Definition element.h:34
fl::string mGroupName
Definition element.h:37
fl::string getGroup() const FL_NOEXCEPT
Definition element.h:33
UIElement() FL_NOEXCEPT
VIRTUAL_IF_NOT_AVR ~UIElement() FL_NOEXCEPT
Definition element.h:30
Base definition for an LED controller.
Definition crgb.hpp:179
#define VIRTUAL_IF_NOT_AVR
#define FL_NOEXCEPT