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);
48 void viewport_set_defaults(struct viewport
*vp
,
49 const enum screen_type screen
);
50 void viewport_set_fullscreen(struct viewport
*vp
,
51 const enum screen_type screen
);
53 #ifdef HAVE_LCD_BITMAP
54 void viewportmanager_theme_enable(enum screen_type screen
, bool enable
,
55 struct viewport
*viewport
);
57 void viewportmanager_theme_undo(enum screen_type screen
);
59 /* call this when a theme changed */
60 void viewportmanager_theme_changed(const int);
62 #ifdef HAVE_TOUCHSCREEN
63 bool viewport_point_within_vp(const struct viewport
*vp
,
64 const int x
, const int y
);
67 #else /* HAVE_LCD_CHARCELL */
68 #define viewportmanager_theme_changed(a)
69 #define viewportmanager_theme_enable(...)
70 #define viewportmanager_theme_undo(...)
73 #endif /* __PCTOOL__ */
75 #ifdef HAVE_LCD_BITMAP
78 * Parse a viewport definition (vp_def), which looks like:
80 * Screens with depth > 1:
81 * X|Y|width|height|font|foregorund color|background color
82 * Screens with depth = 1:
83 * X|Y|width|height|font
85 * | is a separator and can be specified via the parameter
87 * Returns the pointer to the char after the last character parsed
88 * if everything went OK or NULL if an error happened (some values
89 * not specified in the definition)
91 const char* viewport_parse_viewport(struct viewport
*vp
,
92 enum screen_type screen
,
94 const char separator
);
95 #endif /* HAVE_LCD_BITMAP */
96 #endif /* __VIEWPORT_H__ */