diff options
Diffstat (limited to 'apps/menu.h')
-rw-r--r-- | apps/menu.h | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/apps/menu.h b/apps/menu.h index 7b26bbc90c..0c1000ab2f 100644 --- a/apps/menu.h +++ b/apps/menu.h | |||
@@ -98,9 +98,26 @@ struct menu_item_ex { | |||
98 | 98 | ||
99 | typedef int (*menu_callback_type)(int action, | 99 | typedef int (*menu_callback_type)(int action, |
100 | const struct menu_item_ex *this_item); | 100 | const struct menu_item_ex *this_item); |
101 | int do_menu(const struct menu_item_ex *menu, int *start_selected); | ||
102 | bool do_setting_from_menu(const struct menu_item_ex *temp); | 101 | bool do_setting_from_menu(const struct menu_item_ex *temp); |
103 | 102 | ||
103 | /* | ||
104 | int do_menu(const struct menu_item_ex *menu, int *start_selected) | ||
105 | |||
106 | Return value - usually one of the GO_TO_* values from root_menu.h, | ||
107 | however, some of the following defines can cause this to | ||
108 | return a different value. | ||
109 | |||
110 | *menu - The menu to run, can be a pointer to a MAKE_MENU() variable, | ||
111 | MENUITEM_STRINGLIST() or MENUITEM_RETURNVALUE() variable. | ||
112 | |||
113 | *start_selected - the item to select when the menu is first run. | ||
114 | When do_menu() returns, this will be set to the | ||
115 | index of the selected item at the time of the exit. | ||
116 | This is always set, even if the menu was cancelled. | ||
117 | If NULL it is ignored and the firs item starts selected | ||
118 | */ | ||
119 | int do_menu(const struct menu_item_ex *menu, int *start_selected); | ||
120 | |||
104 | /* In all the following macros the argument names are as follows: | 121 | /* In all the following macros the argument names are as follows: |
105 | - name: The name for the variable (so it can be used in a MAKE_MENU() | 122 | - name: The name for the variable (so it can be used in a MAKE_MENU() |
106 | - str: the string to display for this menu item. use ID2P() for LANG_* id's | 123 | - str: the string to display for this menu item. use ID2P() for LANG_* id's |
@@ -126,8 +143,9 @@ bool do_setting_from_menu(const struct menu_item_ex *temp); | |||
126 | {.callback_and_desc = & name##__}}; | 143 | {.callback_and_desc = & name##__}}; |
127 | 144 | ||
128 | /* Use this To create a list of Strings (or ID2P()'s ) | 145 | /* Use this To create a list of Strings (or ID2P()'s ) |
129 | When the user enters this list and selects one, the menu will exits | 146 | When the user enters this list and selects one, the menu will exit |
130 | and its return value will be the index of the chosen item */ | 147 | and do_menu() will return value the index of the chosen item. |
148 | if the user cancels, GO_TO_PREVIOUS will be returned */ | ||
131 | #define MENUITEM_STRINGLIST(name, str, callback, ... ) \ | 149 | #define MENUITEM_STRINGLIST(name, str, callback, ... ) \ |
132 | static const char *name##_[] = {__VA_ARGS__}; \ | 150 | static const char *name##_[] = {__VA_ARGS__}; \ |
133 | static const struct menu_callback_with_desc name##__ = \ | 151 | static const struct menu_callback_with_desc name##__ = \ |
@@ -138,7 +156,7 @@ bool do_setting_from_menu(const struct menu_item_ex *temp); | |||
138 | { .strings = name##_},{.callback_and_desc = & name##__}}; | 156 | { .strings = name##_},{.callback_and_desc = & name##__}}; |
139 | 157 | ||
140 | 158 | ||
141 | /* returns a value associated with the item */ | 159 | /* causes do_menu() to return a value associated with the item */ |
142 | #define MENUITEM_RETURNVALUE(name, str, val, cb, icon) \ | 160 | #define MENUITEM_RETURNVALUE(name, str, val, cb, icon) \ |
143 | static const struct menu_callback_with_desc name##_ = {cb,str,icon}; \ | 161 | static const struct menu_callback_with_desc name##_ = {cb,str,icon}; \ |
144 | static const struct menu_item_ex name = \ | 162 | static const struct menu_item_ex name = \ |