Update Swedish translation.
[kugel-rb.git] / apps / gui / viewport.h
blob54424339ca537a324f7e1e0eff4841efc1e5ac03
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2008 by Jonathan Gordon
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 __VIEWPORT_H__
23 #define __VIEWPORT_H__
26 #include "config.h"
27 #include "lcd.h"
28 #include "system.h"
29 #include "screen_access.h"
31 /* return the number of text lines in the vp viewport */
32 int viewport_get_nb_lines(const struct viewport *vp);
34 void viewport_set_defaults(struct viewport *vp,
35 const 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_BUTTONBAR (BIT_N(2))
62 #define THEME_LANGUAGE (BIT_N(3))
63 #define THEME_ALL (~(0u))
65 #define VP_SB_HIDE_ALL 0
66 #define VP_SB_ONSCREEN(screen) BIT_N(screen)
67 #define VP_SB_IGNORE_SETTING(screen) BIT_N(4+screen)
68 #define VP_SB_ALLSCREENS (VP_SB_ONSCREEN(0)|VP_SB_ONSCREEN(1))
70 #ifndef __PCTOOL__
72 * Initialize the viewportmanager, which in turns initializes the UI vp and
73 * statusbar stuff
75 void viewportmanager_init(void);
76 int viewportmanager_get_statusbar(void);
77 int viewportmanager_set_statusbar(const int enabled);
81 * Initializes the given viewport with maximum dimensions minus status- and
82 * buttonbar
84 void viewport_set_fullscreen(struct viewport *vp,
85 const enum screen_type screen);
87 #ifdef HAVE_LCD_BITMAP
89 /* call this when a theme changed */
90 void viewportmanager_theme_changed(const int);
92 #ifdef HAVE_TOUCHSCREEN
93 bool viewport_point_within_vp(const struct viewport *vp,
94 const int x, const int y);
95 #endif
97 #else /* HAVE_LCD_CHARCELL */
98 #define viewport_set_current_vp(a)
99 #define viewport_get_current_vp() NULL
100 #define viewportmanager_theme_changed(a)
101 #endif
103 #endif /* __PCTOOL__ */
105 #ifdef HAVE_LCD_BITMAP
108 * Parse a viewport definition (vp_def), which looks like:
110 * Screens with depth > 1:
111 * X|Y|width|height|font|foregorund color|background color
112 * Screens with depth = 1:
113 * X|Y|width|height|font
115 * | is a separator and can be specified via the parameter
117 * Returns the pointer to the char after the last character parsed
118 * if everything went OK or NULL if an error happened (some values
119 * not specified in the definition)
121 const char* viewport_parse_viewport(struct viewport *vp,
122 enum screen_type screen,
123 const char *vp_def,
124 const char separator);
125 #endif /* HAVE_LCD_BITMAP */
126 #endif /* __VIEWPORT_H__ */