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)
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
,
79 void (*puts_scroll_offset
)(int x
, int y
, const unsigned char *string
,
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
);
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
);
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);
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
);
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;
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
);
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_*/