1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
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 ****************************************************************************/
25 /* button definitions */
26 #if (CONFIG_KEYPAD == IRIVER_H100_PAD) || \
27 (CONFIG_KEYPAD == IRIVER_H300_PAD)
28 #define MENU_EXIT BUTTON_LEFT
29 #define MENU_EXIT2 BUTTON_OFF
30 #define MENU_EXIT_MENU BUTTON_MODE
31 #define MENU_ENTER BUTTON_RIGHT
32 #define MENU_ENTER2 BUTTON_SELECT
34 #define MENU_RC_EXIT BUTTON_RC_STOP
35 #define MENU_RC_EXIT_MENU BUTTON_RC_MODE
36 #define MENU_RC_ENTER BUTTON_RC_ON
37 #define MENU_RC_ENTER2 BUTTON_RC_MENU
40 #elif CONFIG_KEYPAD == RECORDER_PAD
42 #define MENU_EXIT BUTTON_LEFT
43 #define MENU_EXIT2 BUTTON_OFF
44 #define MENU_EXIT_MENU BUTTON_F1
45 #define MENU_ENTER BUTTON_RIGHT
46 #define MENU_ENTER2 BUTTON_PLAY
48 #define MENU_RC_EXIT BUTTON_RC_STOP
49 #define MENU_RC_ENTER BUTTON_RC_PLAY
51 #elif CONFIG_KEYPAD == PLAYER_PAD
52 #define MENU_EXIT BUTTON_STOP
53 #define MENU_EXIT_MENU BUTTON_MENU
54 #define MENU_ENTER BUTTON_PLAY
56 #define MENU_RC_EXIT BUTTON_RC_STOP
57 #define MENU_RC_ENTER BUTTON_RC_PLAY
59 #elif CONFIG_KEYPAD == ONDIO_PAD
60 #define MENU_EXIT BUTTON_LEFT
61 #define MENU_EXIT_MENU BUTTON_MENU
62 #define MENU_ENTER BUTTON_RIGHT
64 #elif CONFIG_KEYPAD == GMINI100_PAD
65 #define MENU_EXIT BUTTON_LEFT
66 #define MENU_EXIT2 BUTTON_OFF
67 #define MENU_EXIT_MENU BUTTON_MENU
68 #define MENU_ENTER BUTTON_RIGHT
69 #define MENU_ENTER2 BUTTON_PLAY
71 #elif (CONFIG_KEYPAD == IPOD_3G_PAD) || (CONFIG_KEYPAD == IPOD_4G_PAD)
73 /* TODO: Check menu button assignments */
75 #define MENU_NEXT BUTTON_DOWN
76 #define MENU_PREV BUTTON_UP
77 #define MENU_EXIT BUTTON_LEFT
78 #define MENU_EXIT_MENU BUTTON_MENU
79 #define MENU_ENTER BUTTON_RIGHT
80 #define MENU_ENTER2 BUTTON_SELECT
82 #elif CONFIG_KEYPAD == IRIVER_IFP7XX_PAD
84 #define MENU_NEXT BUTTON_DOWN
85 #define MENU_PREV BUTTON_UP
86 #define MENU_EXIT BUTTON_LEFT
87 #define MENU_EXIT_MENU BUTTON_PLAY
88 #define MENU_ENTER BUTTON_RIGHT
90 #elif CONFIG_KEYPAD == IAUDIO_X5_PAD
92 #define MENU_NEXT BUTTON_DOWN
93 #define MENU_PREV BUTTON_UP
94 #define MENU_EXIT BUTTON_LEFT
95 #define MENU_EXIT_MENU BUTTON_REC
96 #define MENU_ENTER BUTTON_RIGHT
97 #define MENU_ENTER2 BUTTON_SELECT
99 #elif CONFIG_KEYPAD == GIGABEAT_PAD
101 #define MENU_EXIT BUTTON_LEFT
102 #define MENU_EXIT2 BUTTON_A
103 #define MENU_EXIT_MENU BUTTON_MENU
104 #define MENU_ENTER BUTTON_RIGHT
105 #define MENU_ENTER2 BUTTON_SELECT
106 #define MENU_NEXT BUTTON_DOWN
107 #define MENU_PREV BUTTON_UP
109 #elif CONFIG_KEYPAD == IRIVER_H10_PAD
111 #define MENU_NEXT BUTTON_SCROLL_DOWN
112 #define MENU_PREV BUTTON_SCROLL_UP
113 #define MENU_EXIT BUTTON_LEFT
114 #define MENU_EXIT_MENU BUTTON_REW
115 #define MENU_ENTER BUTTON_RIGHT
116 #define MENU_ENTER2 BUTTON_FF
121 unsigned char *desc
; /* string or ID */
122 bool (*function
) (void); /* return true if USB was connected */
125 int menu_init(const struct menu_item
* mitems
, int count
, int (*callback
)(int, int),
126 const char *button1
, const char *button2
, const char *button3
);
127 void menu_exit(int menu
);
129 void put_cursorxy(int x
, int y
, bool on
);
131 /* Returns below define, or number of selected menu item*/
132 int menu_show(int m
);
133 #define MENU_ATTACHED_USB -1
134 #define MENU_SELECTED_EXIT -2
136 bool menu_run(int menu
);
137 int menu_cursor(int menu
);
138 char* menu_description(int menu
, int position
);
139 void menu_delete(int menu
, int position
);
140 int menu_count(int menu
);
141 bool menu_moveup(int menu
);
142 bool menu_movedown(int menu
);
143 void menu_draw(int menu
);
144 void menu_insert(int menu
, int position
, char *desc
, bool (*function
) (void));
145 void menu_set_cursor(int menu
, int position
);
146 void menu_talk_selected(int m
);
148 #endif /* End __MENU_H__ */