@@ -26,6 +26,7 @@ for encoders, joysticks, keyboards or touch a stream must be made out of them
2626 class prompt ;
2727 class menu ;
2828 class menuOut ;
29+ template <typename T> class menuField ;
2930
3031 #define CONCATENATE (arg1, arg2 ) CONCATENATE1(arg1, arg2)
3132 #define CONCATENATE1 (arg1, arg2 ) CONCATENATE2(arg1, arg2)
@@ -97,16 +98,17 @@ for encoders, joysticks, keyboards or touch a stream must be made out of them
9798 menu id (text,sizeof (id##_data)/sizeof(prompt*),id##_data);
9899
99100 #define OP (...) OP_(__COUNTER__,__VA_ARGS__)
100- #define FIELD (...) FIELD_ (__COUNTER__,__VA_ARGS__)
101+ #define FIELD_INT (...) FIELD_INT_ (__COUNTER__,__VA_ARGS__)
101102
102103 #define DECL_OP_ (cnt,...) prompt op##cnt(__VA_ARGS__);
103- #define DECL_FIELD_ (cnt,...) menuField _menuField ##cnt(__VA_ARGS__);
104+ #define DECL_FIELD_INT_ (cnt,...) menuField< int > _menuField_int ##cnt(__VA_ARGS__);
104105 #define DECL_SUBMENU (id )
105106
106107 #define DEF_OP_ (cnt,...) &op##cnt
107- #define DEF_FIELD_ (cnt,...) &_menuField ##cnt
108+ #define DEF_FIELD_INT_ (cnt,...) &_menuField_int ##cnt
108109 #define DEF_SUBMENU (id ) &id
109110
111+
110112 // ///////////////////////////////////////////////////////
111113 // menu pure virtual output device, use derived
112114 // this base class represents the output device either derived to serial, LCD or other
@@ -132,6 +134,7 @@ for encoders, joysticks, keyboards or touch a stream must be made out of them
132134 virtual void print (double )=0;
133135 virtual void println (double )=0;
134136 virtual void print (prompt &o,bool selected,int idx,int posY,int width)=0;
137+ virtual void print (menuField<int > &o,bool selected,int idx,int posY,int width)=0;
135138 virtual void printMenu (menu&,bool drawExit)=0;
136139 };
137140
@@ -166,7 +169,7 @@ for encoders, joysticks, keyboards or touch a stream must be made out of them
166169 const char *text;
167170 promptAction action;
168171 bool enabled;
169- prompt (const char * text):text(text),enabled(true ) {}
172+ prompt (const char * text, bool enabled= true ):text(text),enabled(enabled ) {}
170173 prompt (const char * text,promptAction action)
171174 :text(text),action(action),enabled(true ) {}
172175 virtual size_t printTo (Print& p) {p.print (text);return strlen (text);}
0 commit comments