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 #ifdef HAVE_REMOTE_LCD
39 #ifdef HAVE_LCD_CHARCELLS
40 #define MAX_LINES_ON_SCREEN 2
47 enum screen_type screen_type
;
56 #ifdef HAVE_LCD_BITMAP
58 void (*setmargins
)(int x
, int y
);
59 int (*getxmargin
)(void);
60 int (*getymargin
)(void);
62 void (*setfont
)(int newfont
);
63 int (*getstringsize
)(const unsigned char *str
, int *w
, int *h
);
64 void (*putsxy
)(int x
, int y
, const unsigned char *str
);
66 void (*scroll_step
)(int pixels
);
67 void (*puts_scroll_style
)(int x
, int y
,
68 const unsigned char *string
, int style
);
69 void (*mono_bitmap
)(const unsigned char *src
,
70 int x
, int y
, int width
, int height
);
71 void (*set_drawmode
)(int mode
);
73 void (*set_background
)(int brightness
);
74 #endif /* LCD_DEPTH > 1 */
75 void (*update_rect
)(int x
, int y
, int width
, int height
);
76 void (*fillrect
)(int x
, int y
, int width
, int height
);
77 void (*drawrect
)(int x
, int y
, int width
, int height
);
78 void (*drawpixel
)(int x
, int y
);
79 void (*drawline
)(int x1
, int y1
, int x2
, int y2
);
80 void (*vline
)(int x
, int y1
, int y2
);
81 void (*hline
)(int x1
, int x2
, int y
);
82 #endif /* HAVE_LCD_BITMAP */
84 #ifdef HAVE_LCD_CHARCELLS
85 void (*double_height
)(bool on
);
86 void (*putc
)(int x
, int y
, unsigned short ch
);
87 void (*icon
)(int icon
, bool enable
);
90 void (*puts_scroll
)(int x
, int y
, const unsigned char *string
);
91 void (*scroll_speed
)(int speed
);
92 void (*scroll_delay
)(int ms
);
93 void (*stop_scroll
)(void);
94 void (*clear_display
)(void);
95 #if defined(HAVE_LCD_BITMAP) || defined(SIMULATOR)
99 void (*puts
)(int x
, int y
, const unsigned char *str
);
103 * Initializes the given screen structure for a given display
104 * - screen : the screen structure
105 * - display_type : currently 2 possibles values : MAIN or REMOTE
107 extern void screen_init(struct screen
* screen
, enum screen_type screen_type
);
110 * Compute the number of text lines the display can draw with the current font
111 * - screen : the screen structure
112 * Returns the number of text lines
114 extern void screen_update_nblines(struct screen
* screen
);
118 * Sets if the given screen has a buttonbar or not
119 * - screen : the screen structure
120 * - has : a boolean telling wether the current screen will have a buttonbar or not
122 #define screen_has_buttonbar(screen, has_btnb) \
123 (screen)->has_buttonbar=has_btnb;
126 #ifdef HAVE_LCD_BITMAP
128 * Compute the number of pixels from which text can be displayed
129 * - screen : the screen structure
130 * Returns the number of pixels
132 #define screen_get_text_y_start(screen) \
133 ( (global_settings.statusbar)? STATUSBAR_HEIGHT : 0)
136 * Compute the number of pixels below which text can't be displayed
137 * - screen : the screen structure
138 * Returns the number of pixels
141 #define screen_get_text_y_end(screen) \
142 ( (screen)->height - ( (global_settings.buttonbar && \
143 (screen)->has_buttonbar)? \
144 BUTTONBAR_HEIGHT : 0) )
146 #define screen_get_text_y_end(screen) \
148 #endif /* HAS_BUTTONBAR */
150 #endif /* HAVE_LCD_BITMAP */
153 * Initializes the whole screen_access api
155 extern void screen_access_init(void);
158 * Just recalculate the number of text lines that can be displayed
159 * on each screens in case of poilice change for example
161 extern void screen_access_update_nb_lines(void);
164 * exported screens array that should be used
165 * by each app that wants to write to access display
167 extern struct screen screens
[NB_SCREENS
];
169 #endif /*_SCREEN_ACCESS_H_*/