summaryrefslogtreecommitdiff
path: root/apps/menu.c
diff options
context:
space:
mode:
authorLinus Nielsen Feltzing <linus@haxx.se>2004-07-05 14:26:58 +0000
committerLinus Nielsen Feltzing <linus@haxx.se>2004-07-05 14:26:58 +0000
commit82586a69e6d2e14154b5703b558c6bf56d53bfa5 (patch)
tree105a4f41ac8a936bdf2c8d21792393123c36ab90 /apps/menu.c
parentb40591947d6fa225e12dee839a04faf59917d4e2 (diff)
downloadrockbox-82586a69e6d2e14154b5703b558c6bf56d53bfa5.tar.gz
rockbox-82586a69e6d2e14154b5703b558c6bf56d53bfa5.zip
Added menu_insert()
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4826 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/menu.c')
-rw-r--r--apps/menu.c21
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
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 */