FastLED 3.9.15
Loading...
Searching...
No Matches
checkbox.cpp.hpp
Go to the documentation of this file.
1#include "fl/ui/checkbox.h"
2#include "fl/stl/noexcept.h"
3
4namespace fl {
5
7 : mImpl(name, value), mLastFrameValue(false), mLastFrameValueValid(false), mListener(this) {
8 mListener.addToEngineEventsOnce();
9}
10
12
14 UICheckbox &owner = *mOwner;
15 if (!owner.mLastFrameValueValid) {
16 owner.mLastFrameValue = owner.value();
17 owner.mLastFrameValueValid = true;
18 return;
19 }
20 bool value = owner.value();
21 if (value != owner.mLastFrameValue) {
22 owner.mCallbacks.invoke(owner);
23 owner.mLastFrameValue = value;
24 }
25}
26
27} // namespace fl
UICheckbox(const char *name, bool value=false) FL_NOEXCEPT
Listener mListener
Definition checkbox.h:105
~UICheckbox() FL_NOEXCEPT
function_list< void(UICheckbox &)> mCallbacks
Definition checkbox.h:102
bool mLastFrameValue
Definition checkbox.h:103
bool value() const FL_NOEXCEPT
Definition checkbox.h:59
UICheckboxImpl mImpl
Definition checkbox.h:76
bool mLastFrameValueValid
Definition checkbox.h:104
Base definition for an LED controller.
Definition crgb.hpp:179
#define FL_NOEXCEPT
UICheckbox * mOwner
Definition checkbox.h:97
void onBeginFrame() FL_NOEXCEPT override