MCPcopy Create free account
hub / github.com/FastLED/FastLED / JsonUiButtonInternal

Class JsonUiButtonInternal

src/platforms/shared/ui/json/button.cpp.hpp:13–39  ·  view source on GitHub ↗

Definition of the internal class that was previously in button_internal.h

Source from the content-addressed store, hash-verified

11
12// Definition of the internal class that was previously in button_internal.h
13class JsonUiButtonInternal : public JsonUiInternal {
14private:
15 bool mPressed;
16
17public:
18 // Constructor: Initializes the base JsonUiInternal with name, and sets initial pressed state.
19 JsonUiButtonInternal(const fl::string& name, bool pressed = false)
20 FL_NOEXCEPT : JsonUiInternal(name), mPressed(pressed) {}
21
22 // Override toJson to serialize the button's data directly.
23 void toJson(fl::json& json) const FL_NOEXCEPT override {
24 json.set("name", name());
25 json.set("type", "button");
26 json.set("group", groupName());
27 json.set("id", id());
28 json.set("pressed", mPressed);
29 }
30
31 // Override updateInternal to handle updates from JSON.
32 void updateInternal(const fl::json& json) FL_NOEXCEPT override {
33 mPressed = json | false;
34 }
35
36 // Accessors for the button state.
37 bool isPressed() const FL_NOEXCEPT { return mPressed; }
38 void setPressed(bool pressed) FL_NOEXCEPT { mPressed = pressed; }
39};
40
41JsonButtonImpl::JsonButtonImpl(const string &name) FL_NOEXCEPT {
42 // Create an instance of the new internal class

Callers

nothing calls this directly

Calls 2

idClass · 0.85
setMethod · 0.45

Tested by

no test coverage detected