Calibrate iPod Classic battery gauge a bit better
[kugel-rb.git] / apps / gui / statusbar.h
blob281cf3f5b94e70d9b7ddea1b1e4267f262111b2b
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2005 by Kevin Ferrare
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
22 #ifndef _GUI_STATUSBAR_H_
23 #define _GUI_STATUSBAR_H_
25 #include "status.h"
26 #include "screen_access.h"
27 #include "events.h"
29 #define STATUSBAR_X_POS 0
30 #define STATUSBAR_Y_POS 0 /* MUST be a multiple of 8 */
31 #define STATUSBAR_HEIGHT 8
33 struct status_info {
34 int battlevel;
35 int batt_charge_step;
36 int volume;
37 int playmode;
38 int repeat;
39 #if CONFIG_CHARGING
40 bool inserted;
41 #endif
42 #ifdef HAVE_USB_POWER
43 bool usb_inserted;
44 #endif
45 bool battery_state;
46 bool shuffle;
47 bool keylock;
48 #ifdef HAS_REMOTE_BUTTON_HOLD
49 bool keylockremote;
50 #endif
51 #if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
52 bool led; /* disk LED simulation in the status bar */
53 #endif
57 /* statusbar visibility/position, used for settings also */
58 enum statusbar_values { STATUSBAR_OFF = 0, STATUSBAR_TOP, STATUSBAR_BOTTOM };
60 struct gui_statusbar
62 long battery_icon_switch_tick;
64 long volume_icon_switch_tick;
65 int last_volume;
66 bool redraw_volume; /* true if the volume gauge needs updating */
68 struct status_info info;
69 struct status_info lastinfo;
70 #if CONFIG_RTC
71 struct tm *time;
72 int last_tm_min;
73 #endif
74 struct screen * display;
78 extern struct gui_syncstatusbar statusbars;
81 * Attach the status bar to a screen
82 * (The previous screen attachement is lost)
83 * - bar : the statusbar structure
84 * - display : the screen to attach
86 #define gui_statusbar_set_screen(gui_statusbar, _display) \
87 (gui_statusbar)->display = (_display);
91 * Draws the status bar on the attached screen
92 * - bar : the statusbar structure
94 extern void gui_statusbar_draw(struct gui_statusbar * bar,
95 bool force_redraw, struct viewport *vp);
98 struct gui_syncstatusbar
100 struct gui_statusbar statusbars[NB_SCREENS];
103 extern void gui_syncstatusbar_init(struct gui_syncstatusbar * bars) INIT_ATTR;
104 extern void gui_syncstatusbar_draw(struct gui_syncstatusbar * bars,
105 bool force_redraw);
106 #if !defined(HAVE_REMOTE_LCD) || defined(__PCTOOL__)
107 #include "settings.h"
108 #define statusbar_position(a) ((enum statusbar_values)global_settings.statusbar)
109 #else
110 enum statusbar_values statusbar_position(int screen);
111 #endif
113 #endif /*_GUI_STATUSBAR_H_*/