Lucas Borges
/
MenuLCD_Copy
this locks like shit
Fork of MenuLCD_copy by
menbed/include/menbedMenuItem.h@1:f105b690aeb7, 2017-05-19 (annotated)
- Committer:
- LucasMatBorges
- Date:
- Fri May 19 18:48:04 2017 +0000
- Revision:
- 1:f105b690aeb7
- Parent:
- 0:92357d1220f3
R?row mein
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ViniR | 0:92357d1220f3 | 1 | #ifndef _MENBEDMENUITEM_H_ |
ViniR | 0:92357d1220f3 | 2 | #define _MENBEDMENUITEM_H_ |
ViniR | 0:92357d1220f3 | 3 | |
ViniR | 0:92357d1220f3 | 4 | #include <vector> |
ViniR | 0:92357d1220f3 | 5 | #include "mbed.h" |
ViniR | 0:92357d1220f3 | 6 | #include "menbedMenu.h" |
ViniR | 0:92357d1220f3 | 7 | #include "menbedMenuParam.h" |
ViniR | 0:92357d1220f3 | 8 | |
ViniR | 0:92357d1220f3 | 9 | class MenbedMenu; |
ViniR | 0:92357d1220f3 | 10 | |
ViniR | 0:92357d1220f3 | 11 | class MenbedMenuItem { |
ViniR | 0:92357d1220f3 | 12 | public: |
ViniR | 0:92357d1220f3 | 13 | // Pointer to function that will be called when menu item selected. This |
ViniR | 0:92357d1220f3 | 14 | // may be a null pointer if no function should be called. |
ViniR | 0:92357d1220f3 | 15 | void (*selFcn)(); |
ViniR | 0:92357d1220f3 | 16 | // New menu to display when item selected. This can be set to null if a |
ViniR | 0:92357d1220f3 | 17 | // new menu item should not be called when the menu item is selected. |
ViniR | 0:92357d1220f3 | 18 | MenbedMenu **childMenu; |
ViniR | 0:92357d1220f3 | 19 | // If true, childMenuIsAncestor indicates that the child menu's parent menu |
ViniR | 0:92357d1220f3 | 20 | // should be set to null. This will prevent the user from moving to the |
ViniR | 0:92357d1220f3 | 21 | // from the child menu back to the current menu. This is useful when the |
ViniR | 0:92357d1220f3 | 22 | // menu item is something like "Goto root menu". Once the user is in the |
ViniR | 0:92357d1220f3 | 23 | // root menu, we don't want the user to press and hold the select key or |
ViniR | 0:92357d1220f3 | 24 | // press the cancel key in order to return to the current menu. |
ViniR | 0:92357d1220f3 | 25 | bool childMenuIsAncestor; |
ViniR | 0:92357d1220f3 | 26 | // Pointer a structure which itself points to a float that will be displayed |
ViniR | 0:92357d1220f3 | 27 | // in place of the %f in the text of the menu item. If the param struct |
ViniR | 0:92357d1220f3 | 28 | // has an inc memeber that is non-zero, the parameter can be modified by the |
ViniR | 0:92357d1220f3 | 29 | // user. In particular, when the user selects this menu item, the parameter |
ViniR | 0:92357d1220f3 | 30 | // is highlighted and the user can then use the up and down buttons to |
ViniR | 0:92357d1220f3 | 31 | // modify its value. |
ViniR | 0:92357d1220f3 | 32 | MenbedMenuParam *param; |
ViniR | 0:92357d1220f3 | 33 | // Array of char pointers to the strings that will be catenated to form |
ViniR | 0:92357d1220f3 | 34 | // the text of the menu item. To insert either a menu parameter or state |
ViniR | 0:92357d1220f3 | 35 | // variable into the menu item text, make one of the strings a printf-style |
ViniR | 0:92357d1220f3 | 36 | // conversion specifier for a float. (Note: only floats are allowed, |
ViniR | 0:92357d1220f3 | 37 | // integer are not.) The last string must be an empty string ("") to |
ViniR | 0:92357d1220f3 | 38 | // indicate it is the last string in the array. If the empty string is |
ViniR | 0:92357d1220f3 | 39 | // omitted, unpredictable behavior will result. |
ViniR | 0:92357d1220f3 | 40 | char *text; |
ViniR | 0:92357d1220f3 | 41 | |
ViniR | 0:92357d1220f3 | 42 | MenbedMenuItem (void (*selFcn)(), MenbedMenu **childMenu, |
ViniR | 0:92357d1220f3 | 43 | bool childMenuIsAncestor, MenbedMenuParam *param, |
ViniR | 0:92357d1220f3 | 44 | char *text); |
ViniR | 0:92357d1220f3 | 45 | }; |
ViniR | 0:92357d1220f3 | 46 | |
ViniR | 0:92357d1220f3 | 47 | #endif /* _MENBEDMENUITEM_H_ */ |