Windows requires setting files to binary mode
[kugel-rb.git] / apps / menu.h
blob644e0c147b67aad7317a97804cbe7c649663eec9
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2002 Robert E. Hak
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
20 #ifndef __MENU_H__
21 #define __MENU_H__
23 #include <stdbool.h>
25 /* button definitions */
26 #if CONFIG_KEYPAD == IRIVER_H100_PAD
27 #define MENU_NEXT BUTTON_DOWN
28 #define MENU_PREV BUTTON_UP
29 #define MENU_EXIT BUTTON_LEFT
30 #define MENU_EXIT2 BUTTON_OFF
31 #define MENU_ENTER BUTTON_RIGHT
32 #define MENU_ENTER2 BUTTON_SELECT
34 #elif CONFIG_KEYPAD == RECORDER_PAD
35 #define MENU_NEXT BUTTON_DOWN
36 #define MENU_PREV BUTTON_UP
37 #define MENU_EXIT BUTTON_LEFT
38 #define MENU_EXIT2 BUTTON_OFF
39 #define MENU_EXIT3 BUTTON_F1
40 #define MENU_ENTER BUTTON_RIGHT
41 #define MENU_ENTER2 BUTTON_PLAY
43 #elif CONFIG_KEYPAD == PLAYER_PAD
44 #define MENU_NEXT BUTTON_RIGHT
45 #define MENU_PREV BUTTON_LEFT
46 #define MENU_EXIT BUTTON_STOP
47 #define MENU_EXIT2 BUTTON_MENU
48 #define MENU_ENTER BUTTON_PLAY
50 #elif CONFIG_KEYPAD == ONDIO_PAD
51 #define MENU_NEXT BUTTON_DOWN
52 #define MENU_PREV BUTTON_UP
53 #define MENU_EXIT BUTTON_LEFT
54 #define MENU_EXIT2 BUTTON_MENU
55 #define MENU_ENTER BUTTON_RIGHT
57 #endif
59 struct menu_item {
60 unsigned char *desc; /* string or ID */
61 bool (*function) (void); /* return true if USB was connected */
64 int menu_init(const struct menu_item* mitems, int count, int (*callback)(int, int),
65 const char *button1, const char *button2, const char *button3);
66 void menu_exit(int menu);
68 void put_cursorxy(int x, int y, bool on);
70 /* Returns below define, or number of selected menu item*/
71 int menu_show(int m);
72 #define MENU_ATTACHED_USB -1
73 #define MENU_SELECTED_EXIT -2
75 bool menu_run(int menu);
76 int menu_cursor(int menu);
77 char* menu_description(int menu, int position);
78 void menu_delete(int menu, int position);
79 int menu_count(int menu);
80 bool menu_moveup(int menu);
81 bool menu_movedown(int menu);
82 void menu_draw(int menu);
83 void menu_insert(int menu, int position, char *desc, bool (*function) (void));
85 #endif /* End __MENU_H__ */