14#include "platforms/ui_defs.h"
17#define FL_NO_COPY(CLASS) \
18 CLASS(const CLASS &) = delete; \
19 CLASS &operator=(const CLASS &) = delete;
31 float max = 255,
float step = -1.f)
33 float value()
const {
return Super::value(); }
35 float min = Super::getMin();
36 float max = Super::getMax();
40 return (
value() - min) / (max - min);
42 float getMax()
const {
return Super::getMax(); }
44 operator float()
const {
return Super::value(); }
45 operator uint8_t()
const {
return static_cast<uint8_t
>(Super::value()); }
46 operator uint16_t()
const {
return static_cast<uint16_t
>(Super::value()); }
47 operator int()
const {
return static_cast<int>(Super::value()); }
48 template <
typename T> T
as()
const {
49 return static_cast<T
>(Super::value());
52 int as_int()
const {
return static_cast<int>(Super::value()); }
55 Super::setValue(
value);
59 Super::setValue(
static_cast<float>(
value));
112 if (Super::isPressed()) {
123 if (Super::clicked()) {
198 operator bool()
const {
return value(); }
199 explicit operator int()
const {
return static_cast<int>(
value()); }
329#define FASTLED_UI_DEFINE_OPERATORS(UI_CLASS) \
330 FASTLED_DEFINE_POD_COMPARISON_OPERATOR(UI_CLASS, >=) \
331 FASTLED_DEFINE_POD_COMPARISON_OPERATOR(UI_CLASS, <=) \
332 FASTLED_DEFINE_POD_COMPARISON_OPERATOR(UI_CLASS, >) \
333 FASTLED_DEFINE_POD_COMPARISON_OPERATOR(UI_CLASS, <) \
334 FASTLED_DEFINE_POD_COMPARISON_OPERATOR(UI_CLASS, ==) \
335 FASTLED_DEFINE_POD_COMPARISON_OPERATOR(UI_CLASS, !=)
static void addListener(Listener *listener, int priority=0)
static void removeListener(Listener *listener)
UIAudio(const char *name)
FL_NO_COPY(UIAudio) using Super
UIAudioImpl(const char *name)
UICheckbox & operator=(bool value)
FunctionList< UICheckbox & > mCallbacks
void onChanged(function< void(UICheckbox &)> callback)
bool mLastFrameValueValid
UICheckbox(const char *name, bool value=false)
UICheckboxImpl(const char *name, bool value=false)
FL_NO_COPY(UIDescription)
UIDescription(const char *name)
UIDescriptionImpl(const char *name)
UINumberField & operator=(double value)
FunctionList< UINumberField & > mCallbacks
UINumberField & operator=(int value)
FL_NO_COPY(UINumberField)
UINumberField(const char *name, double value, double min=0, double max=100)
bool mLastFrameValueValid
void setValue(double value)
void onChanged(function< void(UINumberField &)> callback)
UINumberFieldImpl(const char *name, double value, double min=0, double max=100)
void setValue(double value)
bool mLastFramevalueValid
UISlider & operator=(int value)
UISlider(const char *name, float value=128.0f, float min=1, float max=255, float step=-1.f)
FL_NO_COPY(UISlider) using Super
void setValue(float value)
FunctionList< UISlider & > mCallbacks
UISlider & operator=(float value)
float value_normalized() const
int onChanged(function< void(UISlider &)> callback)
UISliderImpl(const char *name, float value=128.0f, float min=1, float max=255, float step=-1.f)
UITitle(const char *name)
UITitleImpl(const char *name)
#define ALMOST_EQUAL(a, b, small)
Implements the FastLED namespace macros.
Implements a simple red square effect for 2D LED grids.
void onBeginFrame() override
Listener(UICheckbox *owner)
void addToEngineEventsOnce()
Listener(UINumberField *owner)
void addToEngineEventsOnce()
void onBeginFrame() override
void addToEngineEventsOnce()
void onBeginFrame() override
Listener(UISlider *owner)
#define FASTLED_UI_DEFINE_OPERATORS(UI_CLASS)