FS#4770 - Add USB charging for the H300 series
[Rockbox.git] / apps / gui / statusbar.h
blob516598dd00ae9f28b50d978fabee7b8019d3cc8d
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2005 by Kevin Ferrare
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 _GUI_STATUSBAR_H_
21 #define _GUI_STATUSBAR_H_
23 #include "config.h"
24 #include "status.h"
25 #include "screen_access.h"
26 #include "button.h"
28 #define STATUSBAR_X_POS 0
29 #define STATUSBAR_Y_POS 0 /* MUST be a multiple of 8 */
30 #define STATUSBAR_HEIGHT 8
32 struct status_info {
33 int battlevel;
34 int batt_charge_step;
35 int volume;
36 int playmode;
37 int repeat;
38 #ifdef CONFIG_RTC
39 int hour;
40 int minute;
41 #endif
43 #ifdef CONFIG_CHARGING
44 bool inserted;
45 #endif
46 #ifdef HAVE_USB_POWER
47 bool usb_inserted;
48 #endif
49 bool battery_state;
50 bool shuffle;
51 bool keylock;
52 #ifdef HAS_REMOTE_BUTTON_HOLD
53 bool keylockremote;
54 #endif
55 #if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
56 bool led; /* disk LED simulation in the status bar */
57 #endif
61 struct gui_statusbar
63 long battery_icon_switch_tick;
65 long volume_icon_switch_tick;
66 int last_volume;
67 bool redraw_volume; /* true if the volume gauge needs updating */
69 struct status_info info;
70 struct status_info lastinfo;
72 struct screen * display;
76 extern struct gui_syncstatusbar statusbars;
79 * Initializes a status bar
80 * - bar : the bar to initialize
82 extern void gui_statusbar_init(struct gui_statusbar * bar);
85 * Attach the status bar to a screen
86 * (The previous screen attachement is lost)
87 * - bar : the statusbar structure
88 * - display : the screen to attach
90 #define gui_statusbar_set_screen(gui_statusbar, _display) \
91 (gui_statusbar)->display = (_display);
95 * Draws the status bar on the attached screen
96 * - bar : the statusbar structure
98 extern void gui_statusbar_draw(struct gui_statusbar * bar, bool force_redraw);
100 void gui_statusbar_icon_battery(struct screen * display, int percent, int batt_charge_step);
101 bool gui_statusbar_icon_volume(struct gui_statusbar * bar, int volume);
102 void gui_statusbar_icon_play_state(struct screen * display, int state);
103 void gui_statusbar_icon_play_mode(struct screen * display, int mode);
104 void gui_statusbar_icon_shuffle(struct screen * display);
105 void gui_statusbar_icon_lock(struct screen * display);
106 void gui_statusbar_icon_lock_remote(struct screen * display);
107 void gui_statusbar_led(struct screen * display);
108 #ifdef HAVE_RECORDING
109 void gui_statusbar_icon_recording_info(struct screen * display);
110 #endif
112 #ifdef CONFIG_RTC
113 void gui_statusbar_time(struct screen * display, int hour, int minute);
114 #endif
117 struct gui_syncstatusbar
119 struct gui_statusbar statusbars[NB_SCREENS];
122 extern void gui_syncstatusbar_init(struct gui_syncstatusbar * bars);
123 extern void gui_syncstatusbar_draw(struct gui_syncstatusbar * bars, bool force_redraw);
125 #endif /*_GUI_STATUSBAR_H_*/