Fixes a problem where the sim would try to start the WPS on HAVE_RTC_ALARM sims ...
[Rockbox.git] / apps / screen_access.h
blob6333251d296962609b1254570ef7d88a2baf5303
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 typedef void screen_bitmap_part_func(const void *src, int src_x, int src_y,
50 int stride, int x, int y, int width, int height);
51 typedef void screen_bitmap_func(const void *src, int x, int y, int width,
52 int height);
54 /* if this struct is changed the plugin api may break so bump the api
55 versions in plugin.h */
56 struct screen
58 enum screen_type screen_type;
59 int width, height;
60 int depth;
61 int nb_lines;
62 #ifdef HAVE_LCD_BITMAP
63 int pixel_format;
64 #endif
65 int char_width;
66 int char_height;
67 bool is_color;
68 #if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
69 bool has_disk_led;
70 #endif
71 #ifdef HAS_BUTTONBAR
72 bool has_buttonbar;
73 #endif
74 void (*setmargins)(int x, int y);
75 int (*getxmargin)(void);
76 int (*getymargin)(void);
77 int (*getstringsize)(const unsigned char *str, int *w, int *h);
78 #if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) /* always bitmap */
79 void (*setfont)(int newfont);
81 void (*scroll_step)(int pixels);
82 void (*puts_style_offset)(int x, int y, const unsigned char *str,
83 int style, int offset);
84 void (*puts_scroll_style)(int x, int y, const unsigned char *string,
85 int style);
86 void (*puts_scroll_style_offset)(int x, int y, const unsigned char *string,
87 int style, int offset);
88 void (*mono_bitmap)(const unsigned char *src,
89 int x, int y, int width, int height);
90 void (*mono_bitmap_part)(const unsigned char *src, int src_x, int src_y,
91 int stride, int x, int y, int width, int height);
92 void (*bitmap)(const void *src,
93 int x, int y, int width, int height);
94 void (*bitmap_part)(const void *src, int src_x, int src_y,
95 int stride, int x, int y, int width, int height);
96 void (*transparent_bitmap)(const void *src,
97 int x, int y, int width, int height);
98 void (*transparent_bitmap_part)(const void *src, int src_x, int src_y,
99 int stride, int x, int y, int width, int height);
100 void (*set_drawmode)(int mode);
101 #if defined(HAVE_LCD_COLOR) && defined(LCD_REMOTE_DEPTH) && LCD_REMOTE_DEPTH > 1
102 unsigned (*color_to_native)(unsigned color);
103 #endif
104 #if (LCD_DEPTH > 1) || (defined(LCD_REMOTE_DEPTH) && (LCD_REMOTE_DEPTH > 1))
105 unsigned (*get_background)(void);
106 unsigned (*get_foreground)(void);
107 void (*set_background)(unsigned background);
108 void (*set_foreground)(unsigned foreground);
109 #endif /* (LCD_DEPTH > 1) || (LCD_REMOTE_DEPTH > 1) */
110 #if defined(HAVE_LCD_COLOR)
111 void (*set_selector_start)(unsigned selector);
112 void (*set_selector_end)(unsigned selector);
113 void (*set_selector_text)(unsigned selector_text);
114 #endif
115 void (*update_rect)(int x, int y, int width, int height);
116 void (*fillrect)(int x, int y, int width, int height);
117 void (*drawrect)(int x, int y, int width, int height);
118 void (*drawpixel)(int x, int y);
119 void (*drawline)(int x1, int y1, int x2, int y2);
120 void (*vline)(int x, int y1, int y2);
121 void (*hline)(int x1, int x2, int y);
122 void (*invertscroll) (int x, int y);
123 #endif /* HAVE_LCD_BITMAP || HAVE_REMOTE_LCD */
125 #ifdef HAVE_LCD_CHARCELLS /* no charcell remote LCDs so far */
126 void (*double_height)(bool on);
127 void (*putc)(int x, int y, unsigned long ucs);
128 void (*icon)(int icon, bool enable);
129 unsigned long (*get_locked_pattern)(void);
130 void (*define_pattern)(unsigned long ucs, const char *pattern);
131 void (*unlock_pattern)(unsigned long ucs);
132 #endif
133 void (*putsxy)(int x, int y, const unsigned char *str);
134 void (*puts)(int x, int y, const unsigned char *str);
135 void (*puts_offset)(int x, int y, const unsigned char *str, int offset);
136 void (*puts_scroll)(int x, int y, const unsigned char *string);
137 void (*puts_scroll_offset)(int x, int y, const unsigned char *string,
138 int offset);
139 void (*scroll_speed)(int speed);
140 void (*scroll_delay)(int ms);
141 void (*stop_scroll)(void);
142 void (*clear_display)(void);
143 void (*update)(void);
144 void (*backlight_on)(void);
145 void (*backlight_off)(void);
146 bool (*is_backlight_on)(void);
147 void (*backlight_set_timeout)(int index);
150 #ifdef HAS_BUTTONBAR
152 * Sets if the given screen has a buttonbar or not
153 * - screen : the screen structure
154 * - has : a boolean telling wether the current screen will have a buttonbar or not
156 #define screen_has_buttonbar(screen, has_btnb) \
157 (screen)->has_buttonbar=has_btnb;
158 #endif
161 * Sets the x margin in pixels for the given screen
162 * - screen : the screen structure
163 * - xmargin : the number of pixels to the left of the screen
165 #define screen_set_xmargin(screen, xmargin) \
166 (screen)->setmargins(xmargin, (screen)->getymargin());
169 * Sets the y margin in pixels for the given screen
170 * - screen : the screen structure
171 * - xmargin : the number of pixels to the top of the screen
173 #define screen_set_ymargin(screen, ymargin) \
174 (screen)->setmargins((screen)->getxmargin(), ymargin);
176 #if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD)
178 * Clear only a given area of the screen
179 * - screen : the screen structure
180 * - xstart, ystart : where the area starts
181 * - width, height : size of the area
183 void screen_clear_area(struct screen * display, int xstart, int ystart,
184 int width, int height);
185 #endif
188 * Initializes the whole screen_access api
190 extern void screen_access_init(void);
193 * exported screens array that should be used
194 * by each app that wants to write to access display
196 extern struct screen screens[NB_SCREENS];
198 #endif /*_SCREEN_ACCESS_H_*/