Esp32-RBGridUI
Library for creating UIs for the RBController app
Loading...
Searching...
No Matches
builder
widget.cpp
Go to the documentation of this file.
1
#include <esp_log.h>
2
#include <stdio.h>
3
4
#include "
widget.h
"
5
6
#define TAG "UiBuilderWidget"
7
8
namespace
gridui
{
9
namespace
builder {
10
11
Widget::Widget
(
const
char
* type,
WidgetState
& state)
12
: m_state(state)
13
, m_type(type)
14
, m_style(nullptr) {
15
}
16
17
Widget::~Widget
() {
18
}
19
20
rbjson::Object&
Widget::extra
() {
21
return
m_state
.
data
();
22
}
23
24
rbjson::Object&
Widget::style
() {
25
auto
* res =
extra
().getObject(
"css"
);
26
if
(res ==
nullptr
) {
27
res =
new
rbjson::Object;
28
extra
().set(
"css"
, res);
29
}
30
return
*res;
31
}
32
33
void
Widget::serialize
(std::stringstream& ss) {
34
ss <<
"{"
;
35
{
36
ss <<
"\"uuid\":"
<<
m_state
.
uuid
() <<
","
;
37
ss <<
"\"type\":\""
<< m_type <<
"\","
;
38
ss <<
"\"state\":"
;
39
extra
().serialize(ss);
40
}
41
ss <<
"}"
;
42
}
43
};
44
45
};
gridui::WidgetState
Definition
widget.h:68
gridui::WidgetState::uuid
uint16_t uuid() const
Definition
widget.h:78
gridui::WidgetState::data
const rbjson::Object & data() const
Definition
widget.h:79
gridui::Widget::Widget
Widget()
Definition
widget.h:136
gridui::builder::Widget::extra
rbjson::Object & extra()
Definition
widget.cpp:20
gridui::builder::Widget::m_state
WidgetState & m_state
Definition
widget.h:90
gridui::builder::Widget::~Widget
virtual ~Widget()
Definition
widget.cpp:17
gridui::builder::Widget::serialize
virtual void serialize(std::stringstream &ss)
Definition
widget.cpp:33
gridui::builder::Widget::style
rbjson::Object & style()
Definition
widget.cpp:24
gridui
Definition
arm.h:8
widget.h
Generated on Tue Apr 30 2024 15:48:30 for Esp32-RBGridUI by
1.9.8