Forgot the #
[kugel-rb.git] / apps / gui / viewport.h
blob6a4dd026549db8d3735005bc1509a2cb3daab941
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 #define THEME_STATUSBAR (BIT_N(0))
35 #define THEME_UI_VIEWPORT (BIT_N(1))
36 #define THEME_BUTTONBAR (BIT_N(2))
37 #define THEME_LANGUAGE (BIT_N(3))
38 #define THEME_ALL (~(0u))
40 #ifndef __PCTOOL__
42 * Initialize the viewportmanager, which in turns initializes the UI vp and
43 * statusbar stuff
45 void viewportmanager_init(void) INIT_ATTR;
47 void viewport_set_defaults(struct viewport *vp,
48 const enum screen_type screen);
49 void viewport_set_fullscreen(struct viewport *vp,
50 const enum screen_type screen);
52 #ifdef HAVE_LCD_BITMAP
53 void viewportmanager_theme_enable(enum screen_type screen, bool enable,
54 struct viewport *viewport);
55 /* Force will cause a redraw even if the theme was previously and
56 * currently enabled (i,e the undo doing nothing).
57 * Should almost always be set to false except coming out of fully skinned screens */
58 void viewportmanager_theme_undo(enum screen_type screen, bool force_redraw);
60 /* call this when a theme changed */
61 void viewportmanager_theme_changed(const int);
63 #ifdef HAVE_TOUCHSCREEN
64 bool viewport_point_within_vp(const struct viewport *vp,
65 const int x, const int y);
66 #endif
68 #else /* HAVE_LCD_CHARCELL */
69 #define viewportmanager_theme_changed(a)
70 #define viewportmanager_theme_enable(...)
71 #define viewportmanager_theme_undo(...)
72 #endif
74 #endif /* __PCTOOL__ */
76 #ifdef HAVE_LCD_BITMAP
79 * Parse a viewport definition (vp_def), which looks like:
81 * Screens with depth > 1:
82 * X|Y|width|height|font|foregorund color|background color
83 * Screens with depth = 1:
84 * X|Y|width|height|font
86 * | is a separator and can be specified via the parameter
88 * Returns the pointer to the char after the last character parsed
89 * if everything went OK or NULL if an error happened (some values
90 * not specified in the definition)
92 const char* viewport_parse_viewport(struct viewport *vp,
93 enum screen_type screen,
94 const char *vp_def,
95 const char separator);
96 #endif /* HAVE_LCD_BITMAP */
97 #endif /* __VIEWPORT_H__ */