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 ca27196cd9..e47523d4e4 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -440,6 +440,27 @@ void menu_delete(int menu, int position)
440 menus[menu].cursor = menus[menu].itemcount - 1; 440 menus[menu].cursor = menus[menu].itemcount - 1;
441} 441}
442 442
443void menu_insert(int menu, int position, char *desc, int voice_id,
444 bool (*function) (void))
445{
446 int i;
447
448 if(position < 0)
449 position = menus[menu].itemcount;
450
451 /* Move the items below one position forward */
452 for( i = menus[menu].itemcount; i > position; i--)
453 menus[menu].items[i] = menus[menu].items[i - 1];
454
455 /* Increase the count */
456 menus[menu].itemcount++;
457
458 /* Update the current item */
459 menus[menu].items[position].desc = desc;
460 menus[menu].items[position].voice_id = voice_id;
461 menus[menu].items[position].function = function;
462}
463
443/* 464/*
444 * Property function - return the "count" of menu items in "menu" 465 * Property function - return the "count" of menu items in "menu"
445 */ 466 */
diff --git a/apps/menu.h b/apps/menu.h
index 166a9336b9..55c480aaab 100644
--- a/apps/menu.h
+++ b/apps/menu.h
@@ -47,5 +47,7 @@ int menu_count(int menu);
47bool menu_moveup(int menu); 47bool menu_moveup(int menu);
48bool menu_movedown(int menu); 48bool menu_movedown(int menu);
49void menu_draw(int menu); 49void menu_draw(int menu);
50void menu_insert(int menu, int position, char *desc, int voice_id,
51 bool (*function) (void));
50 52
51#endif /* End __MENU_H__ */ 53#endif /* End __MENU_H__ */