path: root/menu/libmenu/menu.h
diff options
authorMurali Krishnan Ganapathy <gmurali@cs.uchicago.edu>2005-12-16 16:25:49 -0600
committerH. Peter Anvin <hpa@zytor.com>2005-12-16 14:29:04 -0800
commita22c4aff0e5649fa22bbb4b7fda9433d7a8c44de (patch)
tree9f1c365dfc9b7174b31fbc7c769faf9bf8a57d0c /menu/libmenu/menu.h
parent1afe52436215236ac88a7c523d779fb2cf4cbd2a (diff)
advanced menu patch
Python code to generate C code from ini-like file format and changes to libmenu to accomodate a one pass parser. Diff is against 3.20-pre3 - Murali
Diffstat (limited to 'menu/libmenu/menu.h')
1 files changed, 11 insertions, 17 deletions
diff --git a/menu/libmenu/menu.h b/menu/libmenu/menu.h
index 1e0a6195..a6fae5d2 100644
--- a/menu/libmenu/menu.h
+++ b/menu/libmenu/menu.h
@@ -155,6 +155,7 @@ typedef struct s_menuitem {
char *status;
char *data; // string containing kernel to run.. but...
// for radio menu's this is a pointer to the item selected or NULL (initially)
+ // for submenu's this string could be name of menu
void * extra_data; // Any other data user can point to
t_item_handler handler; // Pointer to function of type menufn
t_action action;
@@ -169,7 +170,8 @@ typedef t_menuitem *pt_menuitem; // Pointer to type menuitem
typedef struct s_menu {
pt_menuitem *items; // pointer to array of pointer to menuitems
- char *title;
+ char *title; // Title string for menu
+ char *name; // menu can be referred to by this string
int maxmenusize; // the size of array allocated
uchar numitems; // how many items do we actually have
uchar menuwidth;
@@ -215,25 +217,10 @@ typedef struct s_menusystem {
typedef t_menusystem *pt_menusystem; // Pointer to type menusystem
- *
- * All functions which take a string as argument store the pointer
- * for later use. So if you have alloc'ed a space for the string
- * and are passing it to any of these functions, DO NOT deallocate it.
- *
- * If they are constant strings, you may receive warning from the compiler
- * about "converting from char const * to char *". Ignore these errors.
- *
- * This hack/trick of storing these pointers will help in reducing the size
- * of the internal structures by a lot.
- *
- ***************************************************************************
- */
pt_menuitem showmenus(uchar startmenu);
pt_menusystem init_menusystem(const char *title);
void close_menusystem(); // Deallocate memory used
void set_normal_attr(uchar normal, uchar selected, uchar inactivenormal, uchar inactiveselected);
@@ -261,9 +248,16 @@ void reg_ontimeout(t_timeout_handler, unsigned int numsteps, unsigned int stepsi
// So stepsize=0 means numsteps is measured in centiseconds.
void unreg_ontimeout();
+// Find the number of the menu given the name
+// Returns -1 if not found
+uchar find_menu_num(const char *name);
// Create a new menu and return its position
uchar add_menu(const char *title, int maxmenusize);
+// Create a named menu and return its position
+uchar add_named_menu(const char *name, const char *title, int maxmenusize);
void set_menu_pos(uchar row,uchar col); // Set the position of this menu.
// Add item to the "current" menu