Esp32-RBGridUI
Library for creating UIs for the RBController app
Loading...
Searching...
No Matches
text.h
Go to the documentation of this file.
1#pragma once
2
3#include "widget.h"
4
5namespace gridui {
6
9class Text : 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 setPrefix(const std::string& prefix) {
65 m_state->set("prefix", new rbjson::String(prefix));
66 }
67
68 std::string prefix() const {
69 return data().getString("prefix");
70 }
71
72 void setSuffix(const std::string& suffix) {
73 m_state->set("suffix", new rbjson::String(suffix));
74 }
75
76 std::string suffix() const {
77 return data().getString("suffix");
78 }
79
80 void setNumber(float number) {
81 rbjson::Number n(number);
82 setText(n.str());
83 }
84};
85
86};
std::string color() const
Definition text.h:36
void setValign(const std::string &valign)
Definition text.h:56
void setSuffix(const std::string &suffix)
Definition text.h:72
void setAlign(const std::string &align)
Definition text.h:48
void setFontSize(float fontSize)
Definition text.h:24
std::string valign() const
Definition text.h:60
std::string background() const
Definition text.h:44
void setPrefix(const std::string &prefix)
Definition text.h:64
void setText(const std::string &text)
Definition text.h:16
std::string suffix() const
Definition text.h:76
float fontSize() const
Definition text.h:28
void setBackground(const std::string &background)
Definition text.h:40
void setNumber(float number)
Definition text.h:80
void setColor(const std::string &color)
Definition text.h:32
std::string text() const
Definition text.h:20
std::string prefix() const
Definition text.h:68
std::string align() const
Definition text.h:52
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