summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/menu.c21
-rw-r--r--apps/menu.h2
2 files changed, 23 insertions, 0 deletions
diff --git a/apps/menu.c b/apps/menu.c
index ca27196..e47523d 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -440,6 +440,27 @@ void menu_delete(int menu, int position)
menus[menu].cursor = menus[menu].itemcount - 1;
}
+void menu_insert(int menu, int position, char *desc, int voice_id,
+ bool (*function) (void))
+{
+ int i;
+
+ if(position < 0)
+ position = menus[menu].itemcount;
+
+ /* Move the items below one position forward */
+ for( i = menus[menu].itemcount; i > position; i--)
+ menus[menu].items[i] = menus[menu].items[i - 1];
+
+ /* Increase the count */
+ menus[menu].itemcount++;
+
+ /* Update the current item */
+ menus[menu].items[position].desc = desc;
+ menus[menu].items[position].voice_id = voice_id;
+ menus[menu].items[position].function = function;
+}
+
/*
* Property function - return the "count" of menu items in "menu"
*/
diff --git a/apps/menu.h b/apps/menu.h
index 166a933..55c480a 100644
--- a/apps/menu.h
+++ b/apps/menu.h
@@ -47,5 +47,7 @@ int menu_count(int menu);
bool menu_moveup(int menu);
bool menu_movedown(int menu);
void menu_draw(int menu);
+void menu_insert(int menu, int position, char *desc, int voice_id,
+ bool (*function) (void));
#endif /* End __MENU_H__ */