Library to display menus on TextLCDs. Interaction with functions Up,Down and Select (Buttons or RPG) Based on menu-library from pyeh9

Fork of Menu by Peihsun Yeh

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers MenuItem.h Source File

MenuItem.h

00001 #ifndef MENUITEM_H
00002 #define MENUITEM_H
00003 
00004 #include "Menu.h"
00005 
00006 class Menu; 
00007 
00008 /** MenuItem is a menu-item of menu
00009 */
00010 class MenuItem {
00011     private:
00012         
00013     public:
00014         /** modes of MenuItems
00015         */
00016         enum mode{
00017             /** default mode: just display the Menu-Text an perform user_action
00018             */
00019             mode_default = 0,
00020             
00021             /** wait_select: Call user_action and then only accept a select
00022             * use for displaying text, values,...
00023             * the menu is paused until select is pressed
00024             */
00025             mode_wait_select = 1,
00026             
00027             /** mode_yes_no: show text and ask user for yes/no
00028             * 
00029             */
00030             mode_yes_no = 2,
00031             
00032             //** mode_long_text: show a long text with scrollbars and wait for select()
00033             mode_show_longtext = 3
00034             };
00035          
00036         /** structure to pass data to menu and back
00037         */
00038         struct menu_data{
00039             // Longer text to display.
00040             // For Yes/No-Question
00041             // or show_longtext
00042             char * text;
00043             //Yes/No Value In and Out
00044             bool yes_no;
00045         };   
00046     
00047         /** pointer to user-action to execute when menu item is selected
00048         */
00049         void (*userAction)();   
00050         /** Text of Menue-Item to display
00051         */
00052         char* selText;   
00053         /** position of menuitem in menu
00054         */
00055         int pos;         
00056         /** Pointer to child-menue
00057         */
00058         Menu *childMenu; 
00059         /** itemMode
00060         */
00061         uint8_t itemMode;
00062         
00063         menu_data * menu_parameter;
00064         
00065         /** a sub-menu
00066         */
00067         MenuItem(void (*)(), int, Menu *, char *, uint8_t = mode_default, menu_data * = NULL); 
00068          
00069 };
00070 
00071 #endif