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