|
27 | 27 | return ((uint16_t*)&tmp)[sizeof(this)/sizeof(uint16_t)-1]; |
28 | 28 | } |
29 | 29 | inline prompt(constMEM promptShadow& shadow):shadow(&shadow) {} |
30 | | - inline prompt(const char* t,action a=doNothing,eventMask e=noEvent,styles s=noStyle,systemStyles ss=_noStyle) |
| 30 | + inline prompt(constText* t,action a=doNothing,eventMask e=noEvent,styles s=noStyle,systemStyles ss=_noStyle) |
31 | 31 | :shadow(new promptShadow(t,a,e,s,ss)) {} |
32 | 32 | inline void enable() {enabled=enabledStatus;} |
33 | 33 | inline void disable() {enabled=disabledStatus;} |
34 | | - inline const char* getText() const {return shadow->getText();} |
| 34 | + inline constText* getText() const {return shadow->getText();} |
35 | 35 |
|
36 | 36 | inline systemStyles sysStyles() const {return shadow->_sysStyles();} |
37 | 37 | inline styles style() const {return shadow->_style();} |
|
69 | 69 | #endif |
70 | 70 | #ifdef MENU_ASYNC |
71 | 71 | virtual prompt* seek(idx_t* uri,idx_t len) {return len?NULL:this;} |
72 | | - virtual bool async(const char *uri,navRoot& root,idx_t lvl) { |
| 72 | + virtual bool async(constText*uri,navRoot& root,idx_t lvl) { |
73 | 73 | return ((!*uri)||(uri[0]=='/'&&!uri[1])); |
74 | 74 | } |
75 | 75 | //some functions to use on htmlFmt |
|
85 | 85 |
|
86 | 86 | class Exit:public prompt { |
87 | 87 | public: |
88 | | - Exit(const char* t):prompt(t,(callback)doExit,enterEvent) {} |
| 88 | + Exit(constText* t):prompt(t,(callback)doExit,enterEvent) {} |
89 | 89 | }; |
90 | 90 |
|
91 | 91 | //-------------------------------------------------------------------------- |
|
94 | 94 | class navTarget:public prompt { |
95 | 95 | public: |
96 | 96 | navTarget(constMEM promptShadow& shadow):prompt(shadow) {} |
97 | | - navTarget(const char* t,action a=doNothing,eventMask e=noEvent,styles s=noStyle,systemStyles ss=_noStyle) |
| 97 | + navTarget(constText* t,action a=doNothing,eventMask e=noEvent,styles s=noStyle,systemStyles ss=_noStyle) |
98 | 98 | :prompt(t,a,e,s,ss) {} |
99 | 99 | virtual void parseInput(navNode& nav,menuIn& in); |
100 | 100 | virtual void doNav(navNode& nav,navCmd cmd); |
|
109 | 109 | idx_t cursor=0; |
110 | 110 | textField(constMEM textFieldShadow& shadow):navTarget(shadow) {} |
111 | 111 | textField( |
112 | | - const char*label, |
| 112 | + constText*label, |
113 | 113 | char* b, |
114 | 114 | idx_t sz, |
115 | | - const char* constMEM* v, |
| 115 | + constText* constMEM* v, |
116 | 116 | action a=doNothing, |
117 | 117 | eventMask e=noEvent, |
118 | 118 | styles style=noStyle, |
119 | 119 | systemStyles ss=(Menu::systemStyles)(_noStyle|_canNav|_parentDraw) |
120 | 120 | ):navTarget(*new textFieldShadow(label,b,sz,v,a,e,style,ss)) {} |
121 | 121 | inline char* buffer() const {return ((textFieldShadow*)shadow)->_buffer();} |
122 | 122 | inline idx_t sz() const {return ((textFieldShadow*)shadow)->_sz();} |
123 | | - const char* validator(int i) {return ((textFieldShadow*)shadow)->operator[](i%sz());} |
| 123 | + constText* validator(int i) {return ((textFieldShadow*)shadow)->operator[](i%sz());} |
124 | 124 | void doNav(navNode& nav,navCmd cmd) override; |
125 | 125 | Used printTo(navRoot &root,bool sel,menuOut& out, idx_t idx,idx_t len,idx_t panelNr=0) override; |
126 | 126 | }; |
|
135 | 135 | virtual classes type() const {return fieldClass;} |
136 | 136 | #endif |
137 | 137 | #ifdef MENU_ASYNC |
138 | | - bool async(const char *uri,navRoot& root,idx_t lvl) override; |
| 138 | + bool async(constText*uri,navRoot& root,idx_t lvl) override; |
139 | 139 | #endif |
140 | | - inline const char* units() {return ((fieldBaseShadow*)shadow)->_units();} |
| 140 | + inline constText* units() {return ((fieldBaseShadow*)shadow)->_units();} |
141 | 141 | void doNav(navNode& nav,navCmd cmd) override; |
142 | 142 | virtual bool canTune()=0; |
143 | 143 | virtual void constrainField()=0; |
|
153 | 153 | menuField(constMEM menuFieldShadow<T> & shadow):fieldBase(shadow) {} |
154 | 154 | menuField( |
155 | 155 | T &value, |
156 | | - const char * text, |
157 | | - const char *units, |
| 156 | + constText* text, |
| 157 | + constText*units, |
158 | 158 | T low, |
159 | 159 | T high, |
160 | 160 | T step, |
|
206 | 206 | class menuValue:public prompt { |
207 | 207 | public: |
208 | 208 | menuValue(constMEM menuValueShadow<T>& shadow):prompt(shadow) {} |
209 | | - menuValue(const char * text,T value,action a=doNothing,eventMask e=noEvent) |
| 209 | + menuValue(constText* text,T value,action a=doNothing,eventMask e=noEvent) |
210 | 210 | :menuValue(*new menuValueShadow<T>(text,value,a,e)) {} |
211 | 211 | // #ifdef DEBUG |
212 | 212 | // bool changed(const navNode &nav,const menuOut& out,bool sub=true) override {return false;} |
|
222 | 222 | class menuNode:public navTarget { |
223 | 223 | public: |
224 | 224 | menuNode(constMEM menuNodeShadow& s):navTarget(s) {} |
225 | | - menuNode(const char* text,idx_t sz,prompt* constMEM data[],action a=noAction,eventMask e=noEvent,styles style=wrapStyle,systemStyles ss=(systemStyles)(_menuData|_canNav)) |
| 225 | + menuNode(constText* text,idx_t sz,prompt* constMEM data[],action a=noAction,eventMask e=noEvent,styles style=wrapStyle,systemStyles ss=(systemStyles)(_menuData|_canNav)) |
226 | 226 | :navTarget(*new menuNodeShadow(text,sz,data,a,e,style,ss)) {} |
227 | 227 | #ifdef MENU_FMT_WRAPS |
228 | 228 | virtual classes type() const {return menuClass;} |
|
236 | 236 | prompt* seek(idx_t* uri,idx_t len) override; |
237 | 237 | #endif |
238 | 238 | #ifdef MENU_ASYNC |
239 | | - bool async(const char *uri,navRoot& root,idx_t lvl=0) override; |
| 239 | + bool async(constText*uri,navRoot& root,idx_t lvl=0) override; |
240 | 240 | #endif |
241 | 241 | }; |
242 | 242 |
|
|
263 | 263 | public: |
264 | 264 | idx_t reflex; |
265 | 265 | menuVariant(constMEM menuNodeShadow& s):menuVariantBase(s) {} |
266 | | - menuVariant(const char* text,T &target,idx_t sz,prompt* constMEM* data,action a,eventMask e,styles style) |
| 266 | + menuVariant(constText* text,T &target,idx_t sz,prompt* constMEM* data,action a,eventMask e,styles style) |
267 | 267 | :menuVariantBase(*new menuVariantShadow<T>(text,target,sz,data,a,e,style)) {} |
268 | 268 | idx_t sync() override { |
269 | 269 | for(idx_t i=0;i<sz();i++) |
|
301 | 301 | public: |
302 | 302 | select(constMEM menuNodeShadow& s):menuVariant<T>(s) {} |
303 | 303 | select( |
304 | | - const char* text, |
| 304 | + constText* text, |
305 | 305 | T &target, |
306 | 306 | idx_t sz, |
307 | 307 | prompt* constMEM* data, |
|
320 | 320 | public: |
321 | 321 | toggle(constMEM menuNodeShadow& s):menuVariant<T>(s) {} |
322 | 322 | toggle( |
323 | | - const char* text, |
| 323 | + constText* text, |
324 | 324 | T &target, |
325 | 325 | idx_t sz, |
326 | 326 | prompt* constMEM* data, |
|
355 | 355 | public: |
356 | 356 | choose(constMEM menuNodeShadow& s):menuVariant<T>(s) {} |
357 | 357 | choose( |
358 | | - const char* text, |
| 358 | + constText* text, |
359 | 359 | T &target, |
360 | 360 | idx_t sz, |
361 | 361 | prompt* constMEM* data, |
|
0 commit comments