FastLED 3.10.8
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_NO_EXCEPT = 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_NO_EXCEPT = default;
19 virtual bool isPressed() const FL_NO_EXCEPT = 0;
20 virtual bool clicked() const FL_NO_EXCEPT = 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_NO_EXCEPT { mGroupName = groupName; }
32
34 bool hasGroup() const FL_NO_EXCEPT { 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 ~IButtonInput() FL_NO_EXCEPT=default
virtual bool clicked() const FL_NO_EXCEPT=0
virtual bool isPressed() const FL_NO_EXCEPT=0
virtual void setGroup(const fl::string &groupName) FL_NO_EXCEPT
Definition element.h:31
UIElement() FL_NO_EXCEPT
fl::string getGroup() const FL_NO_EXCEPT
Definition element.h:33
fl::string mGroupName
Definition element.h:37
VIRTUAL_IF_NOT_AVR ~UIElement() FL_NO_EXCEPT
Definition element.h:30
bool hasGroup() const FL_NO_EXCEPT
Definition element.h:34
#define VIRTUAL_IF_NOT_AVR
u8 u8 fract8 blur_amount FL_NO_EXCEPT
Definition blur.h:186
Base definition for an LED controller.
Definition crgb.hpp:179