Esp32-RBGridUI
Library for creating UIs for the RBController app
Loading...
Searching...
No Matches
button.h
Go to the documentation of this file.
1#pragma once
2
3#include "../widgets/button.h"
4#include "widget.h"
5
6namespace gridui {
7namespace builder {
8
11class Button : public Widget, public BuilderMixin<Button, gridui::Button> {
12 static const char* name() { return "Button"; }
13
14 friend class gridui::_GridUi;
15 using Widget::Widget;
16
17public:
18 Button& text(const char* text) {
19 extra().set("text", text);
20 return *this;
21 }
22
23 Button& text(const std::string& text) {
24 extra().set("text", text);
25 return *this;
26 }
27
29 extra().set("fontSize", fontSize);
30 return *this;
31 }
32
33 Button& color(const std::string& color) {
34 extra().set("color", color);
35 return *this;
36 }
37
38 Button& background(const std::string& background) {
39 extra().set("background", background);
40 return *this;
41 }
42
43 Button& align(const std::string& align) {
44 extra().set("align", align);
45 return *this;
46 }
47
48 Button& valign(const std::string& valign) {
49 extra().set("valign", valign);
50 return *this;
51 }
52
54 extra().set("disabled", new rbjson::Bool(disabled));
55 return *this;
56 }
57
61 addCallback("press", cb);
62 return *this;
63 }
64
68 addCallback("release", cb);
69 return *this;
70 }
71};
72
73};
74};
std::function< void(gridui::Button &)> callback_t
Definition widget.h:41
void addCallback(const std::string &name, const callback_t &cb)
Definition widget.h:54
Button & align(const std::string &align)
Definition button.h:43
Button & disabled(bool disabled)
Definition button.h:53
Button & background(const std::string &background)
Definition button.h:38
Button & valign(const std::string &valign)
Definition button.h:48
Button & text(const std::string &text)
Definition button.h:23
Button & text(const char *text)
Definition button.h:18
Button & color(const std::string &color)
Definition button.h:33
Button & fontSize(float fontSize)
Definition button.h:28
rbjson::Object & extra()
Definition widget.cpp:16
Button & onRelease(callback_t cb)
Definition button.h:67
Button & onPress(callback_t cb)
Definition button.h:60
Definition arm.h:8