From 82586a69e6d2e14154b5703b558c6bf56d53bfa5 Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Mon, 5 Jul 2004 14:26:58 +0000 Subject: Added menu_insert() git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4826 a1c6a512-1295-4272-9138-f99709370657 --- apps/menu.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'apps/menu.c') 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) 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" */ -- cgit v1.2.3