|
15 | 15 |
|
16 | 16 | #include "../../ESPEasy_common.h" |
17 | 17 |
|
18 | | -// ******************************************************************************** |
19 | | -// Add Selector |
20 | | -// ******************************************************************************** |
21 | | -void addSelector(const __FlashStringHelper *id, |
22 | | - int optionCount, |
23 | | - const __FlashStringHelper *options[], |
24 | | - const int indices[], |
25 | | - const String attr[], |
26 | | - int selectedIndex, |
27 | | - bool reloadonchange, |
28 | | - bool enabled) |
29 | | -{ |
30 | | - addSelector(String(id), optionCount, options, indices, attr, selectedIndex, reloadonchange, enabled, F("wide")); |
31 | | -} |
32 | | - |
33 | | -void addSelector(const String & id, |
34 | | - int optionCount, |
35 | | - const __FlashStringHelper *options[], |
36 | | - const int indices[], |
37 | | - const String attr[], |
38 | | - int selectedIndex, |
39 | | - bool reloadonchange, |
40 | | - bool enabled) |
41 | | -{ |
42 | | - addSelector(id, optionCount, options, indices, attr, selectedIndex, reloadonchange, enabled, F("wide")); |
43 | | -} |
44 | | - |
45 | | -void addSelector(const String& id, |
46 | | - int optionCount, |
47 | | - const String options[], |
48 | | - const int indices[], |
49 | | - const String attr[], |
50 | | - int selectedIndex, |
51 | | - bool reloadonchange, |
52 | | - bool enabled) |
53 | | -{ |
54 | | - addSelector(id, optionCount, options, indices, attr, selectedIndex, reloadonchange, enabled, F("wide")); |
55 | | -} |
56 | | - |
57 | | -void addSelector(const String & id, |
58 | | - int optionCount, |
59 | | - const __FlashStringHelper *options[], |
60 | | - const int indices[], |
61 | | - const String attr[], |
62 | | - int selectedIndex, |
63 | | - bool reloadonchange, |
64 | | - bool enabled, |
65 | | - const __FlashStringHelper * classname |
66 | | - #if FEATURE_TOOLTIPS |
67 | | - , const String & tooltip |
68 | | - #endif // if FEATURE_TOOLTIPS |
69 | | - ) |
70 | | -{ |
71 | | - // FIXME TD-er Change bool to disabled |
72 | | - if (reloadonchange) |
73 | | - { |
74 | | - addSelector_Head_reloadOnChange(id, classname, !enabled |
75 | | - #if FEATURE_TOOLTIPS |
76 | | - , tooltip |
77 | | - #endif // if FEATURE_TOOLTIPS |
78 | | - ); |
79 | | - } else { |
80 | | - do_addSelector_Head(id, classname, EMPTY_STRING, !enabled |
81 | | - #if FEATURE_TOOLTIPS |
82 | | - , tooltip |
83 | | - #endif // if FEATURE_TOOLTIPS |
84 | | - ); |
85 | | - } |
86 | | - addSelector_options(optionCount, options, indices, attr, selectedIndex); |
87 | | - addSelector_Foot(); |
88 | | -} |
89 | | - |
90 | | -void addSelector_reloadOnChange( |
91 | | - const String& id, |
92 | | - int optionCount, |
93 | | - const String options[], |
94 | | - const int indices[], |
95 | | - const String attr[], |
96 | | - int selectedIndex, |
97 | | - const String& onChangeCall, |
98 | | - bool enabled, |
99 | | - const __FlashStringHelper * classname |
100 | | - #if FEATURE_TOOLTIPS |
101 | | - , |
102 | | - const String& tooltip |
103 | | - #endif // if FEATURE_TOOLTIPS |
104 | | - ) |
105 | | -{ |
106 | | - // FIXME TD-er Change bool to disabled |
107 | | - do_addSelector_Head(id, classname, onChangeCall, !enabled |
108 | | - #if FEATURE_TOOLTIPS |
109 | | - , tooltip |
110 | | - #endif // if FEATURE_TOOLTIPS |
111 | | - ); |
112 | | - addSelector_options(optionCount, options, indices, attr, selectedIndex); |
113 | | - addSelector_Foot(); |
114 | | -} |
115 | | - |
116 | | - |
117 | | -void addSelector(const String & id, |
118 | | - int optionCount, |
119 | | - const String options[], |
120 | | - const int indices[], |
121 | | - const String attr[], |
122 | | - int selectedIndex, |
123 | | - bool reloadonchange, |
124 | | - bool enabled, |
125 | | - const __FlashStringHelper * classname |
126 | | - #if FEATURE_TOOLTIPS |
127 | | - , const String& tooltip |
128 | | - #endif // if FEATURE_TOOLTIPS |
129 | | - ) |
130 | | -{ |
131 | | - // FIXME TD-er Change bool to disabled |
132 | | - if (reloadonchange) |
133 | | - { |
134 | | - addSelector_Head_reloadOnChange(id, classname, !enabled |
135 | | - #if FEATURE_TOOLTIPS |
136 | | - , tooltip |
137 | | - #endif // if FEATURE_TOOLTIPS |
138 | | - ); |
139 | | - } else { |
140 | | - do_addSelector_Head(id, classname, EMPTY_STRING, !enabled |
141 | | - #if FEATURE_TOOLTIPS |
142 | | - , tooltip |
143 | | - #endif // if FEATURE_TOOLTIPS |
144 | | - ); |
145 | | - } |
146 | | - addSelector_options(optionCount, options, indices, attr, selectedIndex); |
147 | | - addSelector_Foot(); |
148 | | -} |
149 | | - |
150 | | -void addSelector_options(int optionCount, const __FlashStringHelper *options[], const int indices[], const String attr[], int selectedIndex) |
151 | | -{ |
152 | | - for (uint8_t x = 0; x < optionCount; ++x) |
153 | | - { |
154 | | - const int index = indices ? indices[x] : x; |
155 | | - addSelector_Item( |
156 | | - options[x], |
157 | | - index, |
158 | | - selectedIndex == index, |
159 | | - false, |
160 | | - attr ? attr[x] : EMPTY_STRING); |
161 | | - if ((x & 0x07) == 0) delay(0); |
162 | | - } |
163 | | -} |
164 | | - |
165 | | -void addSelector_options(int optionCount, const String options[], const int indices[], const String attr[], int selectedIndex) |
166 | | -{ |
167 | | - for (uint8_t x = 0; x < optionCount; ++x) |
168 | | - { |
169 | | - const int index = indices ? indices[x] : x; |
170 | | - addSelector_Item( |
171 | | - options[x], |
172 | | - index, |
173 | | - selectedIndex == index, |
174 | | - false, |
175 | | - attr ? attr[x] : EMPTY_STRING); |
176 | | - if ((x & 0x07) == 0) delay(0); |
177 | | - } |
178 | | -} |
179 | | - |
180 | 18 | void addSelector_Head(const String& id) { |
181 | 19 | do_addSelector_Head(id, F("wide"), EMPTY_STRING, false |
182 | 20 | #if FEATURE_TOOLTIPS |
|
0 commit comments