Fix buttonbar handling/theme changed handling in lists.
[kugel-rb.git] / apps / gui / viewport.h
blobd431766ab5168f50377e7626f18a78b4b19f4fd9
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_BUTTONBAR (BIT_N(2))
62 #define THEME_ALL (~(0u))
64 #define VP_SB_HIDE_ALL 0
65 #define VP_SB_ONSCREEN(screen) BIT_N(screen)
66 #define VP_SB_IGNORE_SETTING(screen) BIT_N(4+screen)
67 #define VP_SB_ALLSCREENS (VP_SB_ONSCREEN(0)|VP_SB_ONSCREEN(1))
70 * Initialize the viewportmanager, which in turns initializes the UI vp and
71 * statusbar stuff
73 void viewportmanager_init(void);
74 int viewportmanager_get_statusbar(void);
75 int viewportmanager_set_statusbar(int enabled);
77 /* call this when a theme changed */
78 void viewportmanager_theme_changed(int);
81 * Initializes the given viewport with maximum dimensions minus status- and
82 * buttonbar
84 void viewport_set_fullscreen(struct viewport *vp, enum screen_type screen);
86 #ifdef HAVE_LCD_BITMAP
89 * Parse a viewport definition (vp_def), which looks like:
91 * Screens with depth > 1:
92 * X|Y|width|height|font|foregorund color|background color
93 * Screens with depth = 1:
94 * X|Y|width|height|font
96 * | is a separator and can be specified via the parameter
98 * Returns the pointer to the char after the last character parsed
99 * if everything went OK or NULL if an error happened (some values
100 * not specified in the definition)
102 const char* viewport_parse_viewport(struct viewport *vp,
103 enum screen_type screen,
104 const char *vp_def,
105 const char separator);
108 * Returns a pointer to the current viewport
109 * - That could be the UI vp, or a viewport passed to do_menu() or the like
111 struct viewport* viewport_get_current_vp(void);
114 * Set the UI vp pointer to a different one - NULL to reset to the UI vp
116 * This is needed since the UI viewport needs is kept in RAM.
118 void viewport_set_current_vp(struct viewport* vp);
121 * returns true if the ui viewport is active on the screen
123 bool viewport_ui_vp_get_state(enum screen_type screen);
124 #ifdef HAVE_TOUCHSCREEN
125 bool viewport_point_within_vp(const struct viewport *vp, int x, int y);
126 #endif
128 #else /* HAVE_LCD_CHARCELL */
129 #define viewport_set_current_vp(a)
130 #define viewport_get_current_vp() NULL
131 #endif
132 #endif /* __VIEWPORT_H__ */