-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
Markup.h
344 lines (298 loc) · 13.9 KB
/
Markup.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
#ifndef WEBSERVER_WEBSERVER_MARKUP_H
#define WEBSERVER_WEBSERVER_MARKUP_H
#include "../WebServer/common.h"
#include "../Globals/Plugins.h"
#include "../Helpers/StringGenerator_GPIO.h"
// ********************************************************************************
// Add Selector
// ********************************************************************************
void addSelector(const __FlashStringHelper *id,
int optionCount,
const __FlashStringHelper *options[],
const int indices[],
const String attr[],
int selectedIndex,
bool reloadonchange = false,
bool enabled = true);
void addSelector(const String & id,
int optionCount,
const __FlashStringHelper *options[],
const int indices[],
const String attr[],
int selectedIndex,
bool reloadonchange = false,
bool enabled = true);
void addSelector(const String& id,
int optionCount,
const String options[],
const int indices[],
const String attr[],
int selectedIndex,
bool reloadonchange = false,
bool enabled = true);
void addSelector(const String & id,
int optionCount,
const __FlashStringHelper *options[],
const int indices[],
const String attr[],
int selectedIndex,
bool reloadonchange,
bool enabled,
const __FlashStringHelper * classname
#if FEATURE_TOOLTIPS
,
const String & tooltip = EMPTY_STRING
#endif // if FEATURE_TOOLTIPS
);
void addSelector(const String& id,
int optionCount,
const String options[],
const int indices[],
const String attr[],
int selectedIndex,
bool reloadonchange,
bool enabled,
const __FlashStringHelper * classname
#if FEATURE_TOOLTIPS
,
const String& tooltip = EMPTY_STRING
#endif // if FEATURE_TOOLTIPS
);
void addSelector_reloadOnChange(
const String& id,
int optionCount,
const String options[],
const int indices[],
const String attr[],
int selectedIndex,
const String& onChangeCall,
bool enabled,
const __FlashStringHelper * classname
#if FEATURE_TOOLTIPS
,
const String& tooltip = EMPTY_STRING
#endif // if FEATURE_TOOLTIPS
);
void addSelector_options(int optionCount,
const __FlashStringHelper *options[],
const int indices[],
const String attr[],
int selectedIndex);
void addSelector_options(int optionCount,
const String options[],
const int indices[],
const String attr[],
int selectedIndex);
void addSelector_Head(const String& id);
void addSelector_Head_reloadOnChange(const __FlashStringHelper * id);
//void addSelector_Head_reloadOnChange(const String& id);
void addSelector_Head_reloadOnChange(const String& id,
const __FlashStringHelper * classname,
bool disabled
#if FEATURE_TOOLTIPS
,
const String& tooltip = EMPTY_STRING
#endif // if FEATURE_TOOLTIPS
);
void addSelector_Head_reloadOnChange(const String& id,
const __FlashStringHelper * classname,
const String& onChangeCall,
bool disabled
#if FEATURE_TOOLTIPS
,
const String& tooltip = EMPTY_STRING
#endif // if FEATURE_TOOLTIPS
);
void do_addSelector_Head(const String& id,
const __FlashStringHelper * classname,
const String& onChangeCall,
const bool& disabled
#if FEATURE_TOOLTIPS
,
const String& tooltip = EMPTY_STRING
#endif // if FEATURE_TOOLTIPS
);
void addPinSelector_Item(PinSelectPurpose purpose,
const String & gpio_label,
int gpio,
bool selected,
bool disabled = false,
const String & attr = EMPTY_STRING);
void addSelector_Item(const __FlashStringHelper *option,
int index,
bool selected,
bool disabled = false,
const String & attr = EMPTY_STRING);
void addSelector_Item(const String& option,
int index,
bool selected,
bool disabled = false,
const String& attr = EMPTY_STRING);
void addSelector_Foot();
void addUnit(const __FlashStringHelper *unit);
void addUnit(const String& unit);
void addUnit(char unit);
void addRowLabel_tr_id(const __FlashStringHelper *label,
const __FlashStringHelper *id);
void addRowLabel_tr_id(const __FlashStringHelper *label,
const String & id);
void addRowLabel_tr_id(const String& label,
const String& id);
void addRowLabel(const __FlashStringHelper *label);
void addRowLabel(const String& label,
const String& id = EMPTY_STRING);
// Add a row label and mark it with copy markers to copy it to clipboard.
void addRowLabel_copy(const __FlashStringHelper *label);
void addRowLabel_copy(const String& label);
void addRowLabel(LabelType::Enum label);
void addRowLabelValue(LabelType::Enum label);
void addRowLabelValue_copy(LabelType::Enum label);
// ********************************************************************************
// Add a header
// ********************************************************************************
void addTableSeparator(const __FlashStringHelper *label,
int colspan,
int h_size);
void addTableSeparator(const __FlashStringHelper *label,
int colspan,
int h_size,
const __FlashStringHelper *helpButton);
void addTableSeparator(const String& label,
int colspan,
int h_size,
const String& helpButton = EMPTY_STRING);
void addFormHeader(const __FlashStringHelper *header);
void addFormHeader(const __FlashStringHelper *header,
const __FlashStringHelper *helpButton);
void addFormHeader(const __FlashStringHelper *header,
const __FlashStringHelper *helpButton,
const __FlashStringHelper *rtdHelpButton);
/*
void addFormHeader(const String& header,
const String& helpButton = EMPTY_STRING);
void addFormHeader(const String& header,
const String& helpButton,
const String& rtdHelpButton);
*/
// ********************************************************************************
// Add a sub header
// ********************************************************************************
void addFormSubHeader(const __FlashStringHelper *header);
void addFormSubHeader(const String& header);
// ********************************************************************************
// Add a checkbox
// ********************************************************************************
void addCheckBox(const String& id,
bool checked,
bool disabled = false
#if FEATURE_TOOLTIPS
,
const String& tooltip = EMPTY_STRING
#endif // if FEATURE_TOOLTIPS
);
void addCheckBox(const __FlashStringHelper *id,
bool checked,
bool disabled = false);
// ********************************************************************************
// Add a numeric box
// ********************************************************************************
#if FEATURE_TOOLTIPS
void addNumericBox(const String& id,
int value,
int min,
int max,
const __FlashStringHelper * classname,
const String& tooltip = EMPTY_STRING);
#endif // if FEATURE_TOOLTIPS
void addFloatNumberBox(const String& id,
float value,
float min,
float max,
unsigned int nrDecimals = 6,
float stepsize = 0.0f
#if FEATURE_TOOLTIPS
,
const String& tooltip = EMPTY_STRING
#endif // if FEATURE_TOOLTIPS
);
void addNumericBox(const __FlashStringHelper *id,
int value,
int min,
int max);
void addNumericBox(const String& id,
int value,
int min,
int max);
// ********************************************************************************
// Add Textbox
// ********************************************************************************
void addTextBox(const __FlashStringHelper * id,
const String& value,
int maxlength,
bool readonly = false,
bool required = false,
const String& pattern = EMPTY_STRING);
void addTextBox(const String& id,
const String& value,
int maxlength,
bool readonly = false,
bool required = false,
const String& pattern = EMPTY_STRING);
void addTextBox(const String& id,
const String& value,
int maxlength,
bool readonly,
bool required,
const String& pattern,
const __FlashStringHelper * classname
#if FEATURE_TOOLTIPS
,
const String& tooltip = EMPTY_STRING
#endif // if FEATURE_TOOLTIPS
);
// ********************************************************************************
// Add Textarea
// ********************************************************************************
void addTextArea(const String& id,
const String& value,
int maxlength,
int rows,
int columns,
bool readonly,
bool required
#if FEATURE_TOOLTIPS
,
const String& tooltip = EMPTY_STRING
#endif // if FEATURE_TOOLTIPS
);
// ********************************************************************************
// Add Help Buttons
// ********************************************************************************
// adds a Help Button with points to the the given Wiki Subpage
// If url starts with "RTD", it will be considered as a Read-the-docs link
void addHelpButton(const __FlashStringHelper *url);
void addHelpButton(const String& url);
void addRTDHelpButton(const String& url);
void addHelpButton(const String& url,
bool isRTD);
void addRTDPluginButton(pluginID_t taskDeviceNumber);
String makeDocLink(const String& url,
bool isRTD);
void addPinSelect(PinSelectPurpose purpose,
const __FlashStringHelper *id,
int choice);
void addPinSelect(PinSelectPurpose purpose,
const String & id,
int choice);
#ifdef ESP32
enum class AdcPinSelectPurpose {
TouchOnly,
ADC_Touch,
ADC_Touch_HallEffect,
ADC_Touch_Optional
};
void addADC_PinSelect(AdcPinSelectPurpose purpose,
const String & id,
int choice);
#endif // ifdef ESP32
#endif // ifndef WEBSERVER_WEBSERVER_MARKUP_H