Do some #ifdef'ing to make the Player happy.
[kugel-rb.git] / apps / gui / viewport.h
blob2ed138b365458ed58ab918d2a57a8e9236773c81
2 /***************************************************************************
3 * __________ __ ___.
4 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
5 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
6 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
7 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
8 * \/ \/ \/ \/ \/
9 * $Id$
11 * Copyright (C) 2008 by Jonathan Gordon
13 * This program is free software; you can redistribute it and/or
14 * modify it under the terms of the GNU General Public License
15 * as published by the Free Software Foundation; either version 2
16 * of the License, or (at your option) any later version.
18 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 * KIND, either express or implied.
21 ****************************************************************************/
23 #ifndef __VIEWPORT_H__
24 #define __VIEWPORT_H__
27 #include "config.h"
28 #include "lcd.h"
29 #include "system.h"
30 #include "screen_access.h"
32 /* return the number of text lines in the vp viewport */
33 int viewport_get_nb_lines(struct viewport *vp);
35 void viewport_set_defaults(struct viewport *vp, enum screen_type screen);
37 /* Used to specify which screens the statusbar (SB) should be displayed on.
39 * The parameter is a bit OR'ed combination of the following (screen is
40 * SCREEN_MAIN or SCREEN_REMOTE from screen_access.h):
42 * VP_SB_HIDE_ALL means "hide the SB on all screens"
43 * VP_SB_ONSCREEN(screen) means "display the SB on the given screen
44 * as specified by the SB setting for that screen"
45 * VP_SB_IGNORE_SETTING(screen) means "ignore the SB setting for that screen"
46 * VP_SB_ALLSCREENS means "VP_SB_ONSCREEN for all screens"
48 * In most cases, VP_SB_ALLSCREENS should be used which means display the SB
49 * as specified by the settings.
50 * For the WPS (and other possible exceptions) use VP_SB_IGNORE_SETTING() to
51 * FORCE the statusbar on for the given screen (i.e it will show regardless
52 * of the setting)
54 * Returns the status before the call. This value can be used to restore the
55 * SB "displaying rules".
59 #define THEME_STATUSBAR (BIT_N(0))
60 #define THEME_UI_VIEWPORT (BIT_N(1))
61 #define THEME_ALL (~(0u))
63 #define VP_SB_HIDE_ALL 0
64 #define VP_SB_ONSCREEN(screen) BIT_N(screen)
65 #define VP_SB_IGNORE_SETTING(screen) BIT_N(4+screen)
66 #define VP_SB_ALLSCREENS (VP_SB_ONSCREEN(0)|VP_SB_ONSCREEN(1))
69 * Initialize the viewportmanager, which in turns initializes the UI vp and
70 * statusbar stuff
72 void viewportmanager_init(void);
73 int viewportmanager_get_statusbar(void);
74 int viewportmanager_set_statusbar(int enabled);
76 /* call this when a theme changed */
77 void viewportmanager_theme_changed(int);
80 * Initializes the given viewport with maximum dimensions minus status- and
81 * buttonbar
83 void viewport_set_fullscreen(struct viewport *vp, enum screen_type screen);
85 #ifdef HAVE_LCD_BITMAP
88 * Parse a viewport definition (vp_def), which looks like:
90 * Screens with depth > 1:
91 * X|Y|width|height|font|foregorund color|background color
92 * Screens with depth = 1:
93 * X|Y|width|height|font
95 * | is a separator and can be specified via the parameter
97 * Returns the pointer to the char after the last character parsed
98 * if everything went OK or NULL if an error happened (some values
99 * not specified in the definition)
101 const char* viewport_parse_viewport(struct viewport *vp,
102 enum screen_type screen,
103 const char *vp_def,
104 const char separator);
107 * Returns a pointer to the current viewport
108 * - That could be the UI vp, or a viewport passed to do_menu() or the like
110 struct viewport* viewport_get_current_vp(void);
113 * Set the UI vp pointer to a different one - NULL to reset to the UI vp
115 * This is needed since the UI viewport needs is kept in RAM.
117 void viewport_set_current_vp(struct viewport* vp);
119 #else /* HAVE_LCD_CHARCELL */
120 #define viewport_set_current_vp(a)
121 #define viewport_get_current_vp() NULL
122 #endif
123 #endif /* __VIEWPORT_H__ */