Library which creates a serial test console, it supports pages and menu items. The items are added and the pages are added as necessary when the user sets it up. This is a great too for creating an easy to maintain menu system, whether for a test sytem, or anything else.
Dependencies: Terminal
Diff: menuitem.cpp
- Revision:
- 3:f308cd7a34ed
- Parent:
- 0:907d2d5e77f7
- Child:
- 6:e992366d0684
diff -r 399e080c4909 -r f308cd7a34ed menuitem.cpp --- a/menuitem.cpp Fri May 01 13:34:09 2015 +0000 +++ b/menuitem.cpp Fri May 01 15:08:49 2015 +0000 @@ -1,33 +1,34 @@ #include "menuitem.h" +#include "page.h" MenuItem::MenuItem() : - Name(NULL), + name(NULL), level(0), type(display), - callback(NULL), + action(NULL), name_len(0), data_col(0), - target_page(-1) {} - + target_page(-1) +{} -MenuItem::MenuItem(const char * Name_p, callback_function callback_p, int level_p, MenuType type_p, int target_page_p) - :Name(Name_p), level(level_p), type(type_p), target_page(target_page_p){ - callback = callback_p; - name_len = strlen(Name); - - } - -MenuItem::MenuItem(const char * Name_p, int target_page_p ): - Name(Name_p), +MenuItem::MenuItem(const char * name_p, MenuAction *action_p, int level_p, MenuType type_p, int target_page_p): + name(name_p), + level(level_p), + type(type_p), + action(action_p), + name_len(strlen(name_p)), + data_col(0), + target_page(target_page_p) +{} + +MenuItem::MenuItem(Page &target_page_p): + name(target_page_p.Name), level(0), type(menu), - callback(NULL), + action(NULL), + name_len(strlen(name)), data_col(0), - target_page(target_page_p) - { - name_len = strlen(Name); - - - } + target_page(target_page_p.page_num) +{}