Esp32-RBGridUI
Library for creating UIs for the RBController app
Loading...
Searching...
No Matches
checkbox.h
Go to the documentation of this file.
1#pragma once
2
3#include "../widgets/checkbox.h"
4#include "widget.h"
5
6namespace gridui {
7namespace builder {
8
11class Checkbox : public Widget, public BuilderMixin<Checkbox, gridui::Checkbox> {
12 static const char* name() { return "Checkbox"; }
13
14 friend class gridui::_GridUi;
15 using Widget::Widget;
16
17public:
19 extra().set("fontSize", fontSize);
20 return *this;
21 }
22
24 extra().set("checked", new rbjson::Bool(checked));
25 return *this;
26 }
27
28 Checkbox& color(const std::string& color) {
29 extra().set("color", color);
30 return *this;
31 }
32
33 Checkbox& text(const std::string& text) {
34 extra().set("text", text);
35 return *this;
36 }
37
41 addCallback("checked", cb);
42 return *this;
43 }
44};
45
46};
47};
std::function< void(gridui::Checkbox &)> callback_t
Definition widget.h:41
void addCallback(const std::string &name, const callback_t &cb)
Definition widget.h:54
Checkbox & checked(bool checked)
Definition checkbox.h:23
Checkbox & fontSize(float fontSize)
Definition checkbox.h:18
Checkbox & color(const std::string &color)
Definition checkbox.h:28
Checkbox & text(const std::string &text)
Definition checkbox.h:33
rbjson::Object & extra()
Definition widget.cpp:16
Checkbox & onChanged(callback_t cb)
Definition checkbox.h:40
Definition arm.h:8