Added menu_insert()
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4826 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
b40591947d
commit
82586a69e6
2 changed files with 23 additions and 0 deletions
21
apps/menu.c
21
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"
|
||||
*/
|
||||
|
|
|
@ -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__ */
|
||||
|
|
Loading…
Reference in a new issue