1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
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__
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))
42 * Initialize the viewportmanager, which in turns initializes the UI vp and
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
);
51 int get_viewport_default_colour(enum screen_type screen
, bool fgcolour
);
53 #ifdef HAVE_LCD_BITMAP
54 void viewportmanager_theme_enable(enum screen_type screen
, bool enable
,
55 struct viewport
*viewport
);
56 /* Force will cause a redraw even if the theme was previously and
57 * currently enabled (i,e the undo doing nothing).
58 * Should almost always be set to false except coming out of fully skinned screens */
59 void viewportmanager_theme_undo(enum screen_type screen
, bool force_redraw
);
61 /* call this when a theme changed */
62 void viewportmanager_theme_changed(const int);
64 #ifdef HAVE_TOUCHSCREEN
65 bool viewport_point_within_vp(const struct viewport
*vp
,
66 const int x
, const int y
);
69 #else /* HAVE_LCD_CHARCELL */
70 #define viewportmanager_theme_changed(a)
71 #define viewportmanager_theme_enable(...)
72 #define viewportmanager_theme_undo(...)
75 #endif /* __PCTOOL__ */
77 #ifdef HAVE_LCD_BITMAP
80 * Parse a viewport definition (vp_def), which looks like:
82 * Screens with depth > 1:
83 * X|Y|width|height|font|foregorund color|background color
84 * Screens with depth = 1:
85 * X|Y|width|height|font
87 * | is a separator and can be specified via the parameter
89 * Returns the pointer to the char after the last character parsed
90 * if everything went OK or NULL if an error happened (some values
91 * not specified in the definition)
93 const char* viewport_parse_viewport(struct viewport
*vp
,
94 enum screen_type screen
,
96 const char separator
);
97 #endif /* HAVE_LCD_BITMAP */
98 #endif /* __VIEWPORT_H__ */