"Trash Metal" should be "Thrash Metal". Reported as FS#6503, checked against Winamp.
[Rockbox.git] / apps / screen_access.h
blobcf74a97ba1f09a50ff7c375f36022a07adef931e
1 /***************************************************************************
2 * __________ __ ___.
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
7 * \/ \/ \/ \/ \/
8 * $Id$
10 * Copyright (C) 2005 by Kevin Ferrare
12 * All files in this archive are subject to the GNU General Public License.
13 * See the file COPYING in the source tree root for full license agreement.
15 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
16 * KIND, either express or implied.
18 ****************************************************************************/
20 #ifndef _SCREEN_ACCESS_H_
21 #define _SCREEN_ACCESS_H_
23 #include "lcd.h"
24 #include "buttonbar.h"
26 enum screen_type {
27 SCREEN_MAIN
28 #ifdef HAVE_REMOTE_LCD
29 ,SCREEN_REMOTE
30 #endif
33 #if defined(HAVE_REMOTE_LCD) && !defined (ROCKBOX_HAS_LOGF)
34 #define NB_SCREENS 2
35 #else
36 #define NB_SCREENS 1
37 #endif
39 #if NB_SCREENS == 1
40 #define FOR_NB_SCREENS(i) i = 0;
41 #else
42 #define FOR_NB_SCREENS(i) for(i = 0; i < NB_SCREENS; i++)
43 #endif
45 #ifdef HAVE_LCD_CHARCELLS
46 #define MAX_LINES_ON_SCREEN 2
47 #endif
49 struct screen
51 int width, height;
52 int nb_lines;
53 enum screen_type screen_type;
54 int depth;
55 int char_width;
56 int char_height;
57 #if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
58 bool has_disk_led;
59 #endif
60 #ifdef HAS_BUTTONBAR
61 bool has_buttonbar;
62 #endif
64 #if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) /* always bitmap */
65 void (*setmargins)(int x, int y);
66 int (*getxmargin)(void);
67 int (*getymargin)(void);
69 void (*setfont)(int newfont);
70 int (*getstringsize)(const unsigned char *str, int *w, int *h);
71 void (*putsxy)(int x, int y, const unsigned char *str);
73 void (*scroll_step)(int pixels);
74 void (*puts_offset)(int x, int y, const unsigned char *str, int offset);
75 void (*puts_style_offset)(int x, int y, const unsigned char *str,
76 int style, int offset);
77 void (*puts_scroll_style)(int x, int y, const unsigned char *string,
78 int style);
79 void (*puts_scroll_offset)(int x, int y, const unsigned char *string,
80 int offset);
81 void (*puts_scroll_style_offset)(int x, int y, const unsigned char *string,
82 int style, int offset);
83 void (*mono_bitmap)(const unsigned char *src,
84 int x, int y, int width, int height);
85 void (*mono_bitmap_part)(const unsigned char *src, int src_x, int src_y,
86 int stride, int x, int y, int width, int height);
87 void (*bitmap)(const fb_data *src,
88 int x, int y, int width, int height);
89 void (*bitmap_part)(const fb_data *src, int src_x, int src_y,
90 int stride, int x, int y, int width, int height);
91 void (*transparent_bitmap)(const fb_data *src,
92 int x, int y, int width, int height);
93 void (*transparent_bitmap_part)(const fb_data *src, int src_x, int src_y,
94 int stride, int x, int y, int width, int height);
95 void (*set_drawmode)(int mode);
96 #if defined(HAVE_LCD_COLOR) && LCD_REMOTE_DEPTH > 1
97 unsigned (*color_to_native)(unsigned color);
98 #endif
99 #if (LCD_DEPTH > 1) || (LCD_REMOTE_DEPTH > 1)
100 unsigned (*get_background)(void);
101 unsigned (*get_foreground)(void);
102 void (*set_background)(unsigned background);
103 void (*set_foreground)(unsigned foreground);
104 #endif /* (LCD_DEPTH > 1) || (LCD_REMOTE_DEPTH > 1) */
105 void (*update_rect)(int x, int y, int width, int height);
106 void (*fillrect)(int x, int y, int width, int height);
107 void (*drawrect)(int x, int y, int width, int height);
108 void (*drawpixel)(int x, int y);
109 void (*drawline)(int x1, int y1, int x2, int y2);
110 void (*vline)(int x, int y1, int y2);
111 void (*hline)(int x1, int x2, int y);
112 void (*invertscroll) (int x, int y);
113 #endif /* HAVE_LCD_BITMAP || HAVE_REMOTE_LCD */
115 #ifdef HAVE_LCD_CHARCELLS /* no charcell remote LCDs so far */
116 void (*double_height)(bool on);
117 void (*putc)(int x, int y, unsigned short ch);
118 void (*icon)(int icon, bool enable);
119 #endif
120 void (*init)(void);
121 void (*puts_scroll)(int x, int y, const unsigned char *string);
122 void (*scroll_speed)(int speed);
123 void (*scroll_delay)(int ms);
124 void (*stop_scroll)(void);
125 void (*clear_display)(void);
126 unsigned char (*get_locked_pattern)(void);
127 void (*define_pattern)(int pat, const char *pattern);
128 #if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) || defined(SIMULATOR)
129 void (*update)(void);
130 #endif
131 void (*backlight_on)(void);
132 void (*backlight_off)(void);
133 bool (*is_backlight_on)(void);
134 void (*backlight_set_timeout)(int index);
135 void (*puts)(int x, int y, const unsigned char *str);
139 * Initializes the given screen structure for a given display
140 * - screen : the screen structure
141 * - display_type : currently 2 possibles values : MAIN or REMOTE
143 extern void screen_init(struct screen * screen, enum screen_type screen_type);
145 #ifdef HAS_BUTTONBAR
147 * Sets if the given screen has a buttonbar or not
148 * - screen : the screen structure
149 * - has : a boolean telling wether the current screen will have a buttonbar or not
151 #define screen_has_buttonbar(screen, has_btnb) \
152 (screen)->has_buttonbar=has_btnb;
153 #endif
156 * Sets the x margin in pixels for the given screen
157 * - screen : the screen structure
158 * - xmargin : the number of pixels to the left of the screen
160 #define screen_set_xmargin(screen, xmargin) \
161 (screen)->setmargins(xmargin, (screen)->getymargin());
164 * Sets the y margin in pixels for the given screen
165 * - screen : the screen structure
166 * - xmargin : the number of pixels to the top of the screen
168 #define screen_set_ymargin(screen, ymargin) \
169 (screen)->setmargins((screen)->getxmargin(), ymargin);
171 #if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD)
173 * Clear only a given area of the screen
174 * - screen : the screen structure
175 * - xstart, ystart : where the area starts
176 * - width, height : size of the area
178 void screen_clear_area(struct screen * display, int xstart, int ystart,
179 int width, int height);
180 #endif
183 * Initializes the whole screen_access api
185 extern void screen_access_init(void);
188 * exported screens array that should be used
189 * by each app that wants to write to access display
191 extern struct screen screens[NB_SCREENS];
193 #endif /*_SCREEN_ACCESS_H_*/