1
0
mirror of https://github.com/s00500/ESPUI.git synced 2025-06-14 02:30:41 +00:00

Merge pull request #147 from iangray001/designupdates

Separators, grouped controls, and wide controls
This commit is contained in:
Ian Gray
2022-01-09 11:01:46 +00:00
committed by GitHub
13 changed files with 424 additions and 894 deletions

View File

@ -714,6 +714,10 @@ uint16_t ESPUIClass::gauge(const char* label, ControlColor color, int number, in
return numberId;
}
uint16_t ESPUIClass::separator(const char* label) {
return addControl(ControlType::Separator, label, "", ControlColor::Alizarin, Control::noParent, nullptr);
}
uint16_t ESPUIClass::accelerometer(const char* label, void (*callback)(Control*, int), ControlColor color)
{
return addControl(ControlType::Accel, label, "", color, Control::noParent, callback);
@ -821,6 +825,14 @@ void ESPUIClass::setElementStyle(uint16_t id, String style, int clientId)
}
}
void ESPUIClass::setPanelWide(uint16_t id, bool wide) {
Control* control = getControl(id);
if (control)
{
control->wide = wide;
}
}
void ESPUIClass::updateControl(uint16_t id, int clientId)
{
Control* control = getControl(id);
@ -1034,6 +1046,8 @@ Control* ESPUIClass::prepareJSONChunk(AsyncWebSocketClient* client, Control* con
item["panelStyle"] = String(control->panelStyle);
if (control->elementStyle != 0)
item["elementStyle"] = String(control->elementStyle);
if (control->wide == true)
item["wide"] = true;
if (control->parentControl != Control::noParent)
{

View File

@ -55,6 +55,7 @@ enum ControlType : uint8_t
Step,
Gauge,
Accel,
Separator,
UpdateOffset = 100,
UpdatePad = 101,
@ -74,6 +75,7 @@ enum ControlType : uint8_t
UpdateStep,
UpdateGauge,
UpdateAccel,
UpdateSeparator,
InitialGui = 200,
Reload = 201,
@ -136,6 +138,7 @@ public:
String value;
ControlColor color;
bool visible;
bool wide;
uint16_t parentControl;
String panelStyle;
String elementStyle;
@ -151,6 +154,7 @@ public:
value(value),
color(color),
visible(visible),
wide(false),
parentControl(parentControl),
next(nullptr)
{
@ -257,6 +261,7 @@ public:
uint16_t graph(const char* label, ControlColor color); // Create Graph display
uint16_t gauge(const char* label, ControlColor color, int value, int min = 0,
int max = 100); // Create Gauge display
uint16_t separator(const char* label); //Create separator
// Input only
uint16_t accelerometer(const char* label, void (*callback)(Control*, int), ControlColor color);
@ -287,6 +292,8 @@ public:
void setPanelStyle(uint16_t id, String style, int clientId = -1);
void setElementStyle(uint16_t id, String style, int clientId = -1);
void setPanelWide(uint16_t id, bool wide);
// Variables
const char* ui_title = "ESPUI"; // Store UI Title and Header Name
Control* controls = nullptr;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long