1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
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_
24 #include "buttonbar.h"
28 #ifdef HAVE_REMOTE_LCD
33 #if defined(HAVE_REMOTE_LCD) && !defined (ROCKBOX_HAS_LOGF)
40 #define FOR_NB_SCREENS(i) i = 0;
42 #define FOR_NB_SCREENS(i) for(i = 0; i < NB_SCREENS; i++)
45 #ifdef HAVE_LCD_CHARCELLS
46 #define MAX_LINES_ON_SCREEN 2
53 enum screen_type screen_type
;
57 #if (CONFIG_LED == LED_VIRTUAL) || defined(HAVE_REMOTE_LCD)
63 void (*setmargins
)(int x
, int y
);
64 int (*getxmargin
)(void);
65 int (*getymargin
)(void);
67 int (*getstringsize
)(const unsigned char *str
, int *w
, int *h
);
68 #if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) /* always bitmap */
69 void (*setfont
)(int newfont
);
71 void (*scroll_step
)(int pixels
);
72 void (*puts_style_offset
)(int x
, int y
, const unsigned char *str
,
73 int style
, int offset
);
74 void (*puts_scroll_style
)(int x
, int y
, const unsigned char *string
,
76 void (*puts_scroll_style_offset
)(int x
, int y
, const unsigned char *string
,
77 int style
, int offset
);
78 void (*mono_bitmap
)(const unsigned char *src
,
79 int x
, int y
, int width
, int height
);
80 void (*mono_bitmap_part
)(const unsigned char *src
, int src_x
, int src_y
,
81 int stride
, int x
, int y
, int width
, int height
);
82 void (*bitmap
)(const fb_data
*src
,
83 int x
, int y
, int width
, int height
);
84 void (*bitmap_part
)(const fb_data
*src
, int src_x
, int src_y
,
85 int stride
, int x
, int y
, int width
, int height
);
86 void (*transparent_bitmap
)(const fb_data
*src
,
87 int x
, int y
, int width
, int height
);
88 void (*transparent_bitmap_part
)(const fb_data
*src
, int src_x
, int src_y
,
89 int stride
, int x
, int y
, int width
, int height
);
90 void (*set_drawmode
)(int mode
);
91 #if defined(HAVE_LCD_COLOR) && defined(LCD_REMOTE_DEPTH) && LCD_REMOTE_DEPTH > 1
92 unsigned (*color_to_native
)(unsigned color
);
94 #if (LCD_DEPTH > 1) || (defined(LCD_REMOTE_DEPTH) && (LCD_REMOTE_DEPTH > 1))
95 unsigned (*get_background
)(void);
96 unsigned (*get_foreground
)(void);
97 void (*set_background
)(unsigned background
);
98 void (*set_foreground
)(unsigned foreground
);
99 #endif /* (LCD_DEPTH > 1) || (LCD_REMOTE_DEPTH > 1) */
100 void (*update_rect
)(int x
, int y
, int width
, int height
);
101 void (*fillrect
)(int x
, int y
, int width
, int height
);
102 void (*drawrect
)(int x
, int y
, int width
, int height
);
103 void (*drawpixel
)(int x
, int y
);
104 void (*drawline
)(int x1
, int y1
, int x2
, int y2
);
105 void (*vline
)(int x
, int y1
, int y2
);
106 void (*hline
)(int x1
, int x2
, int y
);
107 void (*invertscroll
) (int x
, int y
);
108 #endif /* HAVE_LCD_BITMAP || HAVE_REMOTE_LCD */
110 #ifdef HAVE_LCD_CHARCELLS /* no charcell remote LCDs so far */
111 void (*double_height
)(bool on
);
112 void (*putc
)(int x
, int y
, unsigned long ucs
);
113 void (*icon
)(int icon
, bool enable
);
114 unsigned long (*get_locked_pattern
)(void);
115 void (*define_pattern
)(unsigned long ucs
, const char *pattern
);
118 void (*putsxy
)(int x
, int y
, const unsigned char *str
);
119 void (*puts
)(int x
, int y
, const unsigned char *str
);
120 void (*puts_offset
)(int x
, int y
, const unsigned char *str
, int offset
);
121 void (*puts_scroll
)(int x
, int y
, const unsigned char *string
);
122 void (*puts_scroll_offset
)(int x
, int y
, const unsigned char *string
,
124 void (*scroll_speed
)(int speed
);
125 void (*scroll_delay
)(int ms
);
126 void (*stop_scroll
)(void);
127 void (*clear_display
)(void);
128 #if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) || defined(SIMULATOR)
129 void (*update
)(void);
131 void (*backlight_on
)(void);
132 void (*backlight_off
)(void);
133 bool (*is_backlight_on
)(void);
134 void (*backlight_set_timeout
)(int index
);
138 * Initializes the given screen structure for a given display
139 * - screen : the screen structure
140 * - display_type : currently 2 possibles values : MAIN or REMOTE
142 extern void screen_init(struct screen
* screen
, enum screen_type screen_type
);
146 * Sets if the given screen has a buttonbar or not
147 * - screen : the screen structure
148 * - has : a boolean telling wether the current screen will have a buttonbar or not
150 #define screen_has_buttonbar(screen, has_btnb) \
151 (screen)->has_buttonbar=has_btnb;
155 * Sets the x margin in pixels for the given screen
156 * - screen : the screen structure
157 * - xmargin : the number of pixels to the left of the screen
159 #define screen_set_xmargin(screen, xmargin) \
160 (screen)->setmargins(xmargin, (screen)->getymargin());
163 * Sets the y margin in pixels for the given screen
164 * - screen : the screen structure
165 * - xmargin : the number of pixels to the top of the screen
167 #define screen_set_ymargin(screen, ymargin) \
168 (screen)->setmargins((screen)->getxmargin(), ymargin);
170 #if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD)
172 * Clear only a given area of the screen
173 * - screen : the screen structure
174 * - xstart, ystart : where the area starts
175 * - width, height : size of the area
177 void screen_clear_area(struct screen
* display
, int xstart
, int ystart
,
178 int width
, int height
);
182 * Initializes the whole screen_access api
184 extern void screen_access_init(void);
187 * exported screens array that should be used
188 * by each app that wants to write to access display
190 extern struct screen screens
[NB_SCREENS
];
192 #endif /*_SCREEN_ACCESS_H_*/