summaryrefslogtreecommitdiff
path: root/apps
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
parentb40591947d6fa225e12dee839a04faf59917d4e2 (diff)
downloadrockbox-82586a69e6d2e14154b5703b558c6bf56d53bfa5.zip
rockbox-82586a69e6d2e14154b5703b558c6bf56d53bfa5.tar.gz
rockbox-82586a69e6d2e14154b5703b558c6bf56d53bfa5.tar.bz2
rockbox-82586a69e6d2e14154b5703b558c6bf56d53bfa5.tar.xz
Added menu_insert()
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4826 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-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__ */