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 "widget.h"
4
5namespace gridui {
6
9class Button : public Widget {
10 template <typename Self, typename Finished>
12
13 using Widget::Widget;
14
15public:
16 void setText(const std::string& text) {
17 m_state->set("text", new rbjson::String(text));
18 }
19
20 std::string text() const {
21 return data().getString("text");
22 }
23
24 void setFontSize(float fontSize) {
25 m_state->set("fontSize", new rbjson::Number(fontSize));
26 }
27
28 float fontSize() const {
29 return data().getDouble("fontSize");
30 }
31
32 void setColor(const std::string& color) {
33 m_state->set("color", new rbjson::String(color));
34 }
35
36 std::string color() const {
37 return data().getString("color");
38 }
39
40 void setBackground(const std::string& background) {
41 m_state->set("background", new rbjson::String(background));
42 }
43
44 std::string background() const {
45 return data().getString("background");
46 }
47
48 void setAlign(const std::string& align) {
49 m_state->set("align", new rbjson::String(align));
50 }
51
52 std::string align() const {
53 return data().getString("align");
54 }
55
56 void setValign(const std::string& valign) {
57 m_state->set("valign", new rbjson::String(valign));
58 }
59
60 std::string valign() const {
61 return data().getString("valign");
62 }
63
64 void setNumber(float number) {
65 rbjson::Number n(number);
66 setText(n.str());
67 }
68
69 bool pressed() const {
70 return data().getBool("pressed");
71 }
72
73 void setDisabled(bool disabled) {
74 m_state->set("disabled", new rbjson::Bool(disabled));
75 }
76
77 bool disabled() const {
78 return data().getBool("disabled");
79 }
80};
81
82};
void setValign(const std::string &valign)
Definition button.h:56
void setColor(const std::string &color)
Definition button.h:32
bool pressed() const
Definition button.h:69
void setBackground(const std::string &background)
Definition button.h:40
std::string color() const
Definition button.h:36
void setNumber(float number)
Definition button.h:64
std::string align() const
Definition button.h:52
void setText(const std::string &text)
Definition button.h:16
void setAlign(const std::string &align)
Definition button.h:48
void setDisabled(bool disabled)
Definition button.h:73
void setFontSize(float fontSize)
Definition button.h:24
std::string background() const
Definition button.h:44
bool disabled() const
Definition button.h:77
std::string text() const
Definition button.h:20
std::string valign() const
Definition button.h:60
float fontSize() const
Definition button.h:28
bool set(const std::string &key, rbjson::Value *value)
Definition widget.cpp:27
WidgetState * m_state
Definition widget.h:265
const rbjson::Object & data() const
Definition widget.h:263
Definition arm.h:8