Team Alpha / Mbed 2 deprecated UserIntefaceLCD

Dependencies:   mbed mbed-rtos MLX90614

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Menu.h Source File

Menu.h

00001 #ifndef _MENU_H_
00002 #define _MENU_H_
00003 
00004 #include "Item.h"
00005 
00006 int const MAX_ITEMS = 16;
00007 int const TITLE_LINE = 1;
00008 int const FIRST_ITEM_LINE = 2;
00009 int const LAST_ITEM_LINE = 7;
00010 int const ITEMS_PER_SCREEN = 6;
00011 
00012 class Menu: public Item {
00013     public:
00014         Item ** items;
00015         int size, selected, current_line;
00016         bool isScreen;
00017         
00018         //menu constructor
00019         Menu(char * t, ST7565 *lcd){
00020             title = t;
00021             st7565 = lcd;
00022             items = new Item*[MAX_ITEMS];
00023             selected = size = 0;
00024             current_line = FIRST_ITEM_LINE;
00025             isScreen = false;
00026             isSelectable = false;
00027         }
00028         
00029         //menu item constructor - go to a screen
00030         Menu(char * t, Item *screen){
00031             title = t;
00032             st7565 = NULL;
00033             items = new Item*[1];
00034             items[0] = screen;
00035             selected = 0;
00036             size = 1;
00037             current_line = FIRST_ITEM_LINE;
00038             isScreen = true;
00039             isSelectable = true;
00040         }
00041         
00042         //display the menu
00043         virtual void display(void);
00044         
00045         //update current selection
00046         virtual void update(char c);
00047         
00048         //set the title
00049         void setTitle(char * t){
00050             title = t;
00051         }
00052         
00053          //highlights the current selection
00054         void addItem(Item * i);
00055         
00056         private:
00057              //display items on a new screen starting with a specific index
00058              void display_items(int index);
00059 };
00060 
00061 #endif
00062