diff options
Diffstat (limited to 'apps/menu.c')
-rw-r--r-- | apps/menu.c | 21 |
1 files changed, 21 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 | ||
443 | void 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 | */ |