eGUI alias D4D  Release 3.0
Reference Manual
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
d4d_screen.h
Go to the documentation of this file.
1 /**************************************************************************
2 *
3 * Copyright 2014 by Petr Gargulak. eGUI Community.
4 * Copyright 2009-2013 by Petr Gargulak. Freescale Semiconductor, Inc.
5 *
6 ***************************************************************************
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU Lesser General Public License Version 3
9 * or later (the "LGPL").
10 *
11 * As a special exception, the copyright holders of the eGUI project give you
12 * permission to link the eGUI sources with independent modules to produce an
13 * executable, regardless of the license terms of these independent modules,
14 * and to copy and distribute the resulting executable under terms of your
15 * choice, provided that you also meet, for each linked independent module,
16 * the terms and conditions of the license of that module.
17 * An independent module is a module which is not derived from or based
18 * on this library.
19 * If you modify the eGUI sources, you may extend this exception
20 * to your version of the eGUI sources, but you are not obligated
21 * to do so. If you do not wish to do so, delete this
22 * exception statement from your version.
23 *
24 * This program is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
27 *
28 * You should have received a copy of the GNU General Public License
29 * and the GNU Lesser General Public License along with this program.
30 * If not, see <http://www.gnu.org/licenses/>.
31 *
32 ***************************************************************************/
46 #ifndef __D4D_SCREEN_H
47 #define __D4D_SCREEN_H
48 
49 /******************************************************************************
50 * D4D SCREEN setting constants
51 *
52 */
58 #ifndef D4D_SCR_TITLE_OFF_X
59  #define D4D_SCR_TITLE_OFF_X 3
60 #endif
61 
64 #ifndef D4D_SCR_TITLE_OFF_Y
65  #define D4D_SCR_TITLE_OFF_Y 1
66 #endif
67 
70 #ifndef D4D_SCR_HEADER_SIZE_MIN_SIZE
71  #define D4D_SCR_HEADER_SIZE_MIN_SIZE 13
72 #endif
73 
76 #ifndef D4D_SCR_TITLE_EXITBTN_MIN_SIZE
77  #define D4D_SCR_TITLE_EXITBTN_MIN_SIZE 6
78 #endif
79 
82 #ifndef D4D_SCR_EXITBTN_CROSS_SIZE
83  #define D4D_SCR_EXITBTN_CROSS_SIZE 2
84 #endif
85 
88 #ifndef D4D_SCR_TITLE_EXITBTN_OFFSET
89  #define D4D_SCR_TITLE_EXITBTN_OFFSET 3
90 #endif
91 
92 // Common flags as for initial as for runtime
103 #define D4D_SCR_F_OUTLINE (0x01)
104 #define D4D_SCR_F_BEVEL (0x02)
105 #define D4D_SCR_F_TITLEBAR (0x04)
106 #define D4D_SCR_F_EXIT (0x08)
107 #define D4D_SCR_F_BCKG (0x10)
108 
109 #define D4D_SCR_F_TOUCHENABLE (D4D_SCR_FINT_TOUCHENABLE << 8)
110 #define D4D_SCR_F_MOUSE_NORMAL (D4D_SCR_FINT_MOUSE_NORMAL << 8)
111 #define D4D_SCR_F_MOUSE_BUSY (D4D_SCR_FINT_MOUSE_BUSY << 8)
112 #define D4D_SCR_F_MOUSE_UNAVAILABLE (D4D_SCR_FINT_MOUSE_UNAVAILABLE << 8)
113 
114 
118 #ifndef D4D_SCR_F_DEFAULT
119  #define D4D_SCR_F_DEFAULT (D4D_SCR_FINT_MOUSE_NORMAL)
120 #endif
121 
124 /******************************************************************************
125 * Internal constants
126 ******************************************************************************/
127 #define D4D_SCR_FINT_INITDONE (0x01)
128 #define D4D_SCR_FINT_TOUCHENABLE (0x02)
129 #define D4D_SCR_FINT_REDRAWC (0x04)
130 #define D4D_SCR_FINT_CHECKOBJECTS (0x08)
131 
132 #define D4D_SCR_FINT_MOUSE_MASK (0x60)
133 #define D4D_SCR_FINT_MOUSE_SHIFT (5)
134 
135 #define D4D_SCR_FINT_MOUSE_NORMAL (0x20)
136 #define D4D_SCR_FINT_MOUSE_BUSY (0x40)
137 #define D4D_SCR_FINT_MOUSE_UNAVAILABLE (0x60)
138 
139 struct D4D_STRING_S;
140 /******************************************************************************
141 * D4D Screen types
142 *
143 */
150 
152 typedef struct
153 {
154  // other runtime data
158 
159 // screen configuration (goes to ROM by default)
160 
162 typedef struct D4D_SCREEN_S
163 {
164  // object list
165  const D4D_OBJECT* const * pObjects;
166 
167  // event handlers
168  void (*OnInit)(void);
169  void (*OnMain)(void);
170  void (*OnActivate)(void);
171  void (*OnDeactivate)(void);
172  Byte (*OnObjectMsg)(struct D4D_MESSAGE_S* pMsg);
173 
174  // Screen advanced properties
180  const D4D_BMP* pIcon;
181 
184 
185  // pointer to runtime data
187 } D4D_SCREEN;
188 
190 /*********************************************************
191 *
192 * static declaration macros
193 *
194 *********************************************************/
195 /******************************************************************************
196 * D4D Screen macros
197 *
198 */
202 /**************************************************************************/
221 #define _D4D_DECLARE_SCREEN_BEGIN(type, name, funcPrefix, x ,y, cx, cy, radius, text, fontId, icon, initFlags, pScheme) \
222  extern const D4D_OBJECT * const name##_objects[]; \
223  static void funcPrefix##OnInit(void); \
224  static void funcPrefix##OnMain(void); \
225  static void funcPrefix##OnActivate(void); \
226  static void funcPrefix##OnDeactivate(void); \
227  static Byte funcPrefix##OnObjectMsg(D4D_MESSAGE* pMsg); \
228  static D4D_SCREEN_DATA name##_data = { NULL, (Byte)((D4D_SCREEN_FLAGS)(initFlags >> 8) & 0x00FF)}; \
229  static D4D_STR_PROPERTIES name##_strPrties = { D4D_FNT_PRTY_TRANSPARENT_YES_MASK, (D4D_ALIGN_H_LEFT_MASK | D4D_ALIGN_V_CENTER_MASK)}; \
230  type D4D_SCREEN name = \
231  { \
232  name##_objects, \
233  funcPrefix##OnInit, \
234  funcPrefix##OnMain, \
235  funcPrefix##OnActivate, \
236  funcPrefix##OnDeactivate, \
237  funcPrefix##OnObjectMsg, \
238  {x, y}, \
239  {cx, cy}, \
240  radius, \
241  NULL, \
242  { text, sizeof(text), fontId, &name##_strPrties, 0, 0}, /* textBuff */ \
243  icon, \
244  (D4D_SCREEN_FLAGS)(initFlags & 0x00FF), \
245  pScheme, \
246  &(name##_data) \
247  }; \
248  const D4D_OBJECT * const name##_objects[] = \
249  {
250 
251 /**************************************************************************/
268 #define D4D_DECLARE_SCREEN_BEGIN(name, funcPrefix, x ,y, cx, cy, text, fontId, icon, initFlags, pScheme)\
269  _D4D_DECLARE_SCREEN_BEGIN(D4D_CONST, name, funcPrefix, x ,y, cx, cy, 0, text, fontId, icon, initFlags, pScheme)
270 
271 /**************************************************************************/
278 #define D4D_DECLARE_STD_SCREEN_BEGIN(name, funcPrefix) D4D_DECLARE_SCREEN_BEGIN(name, funcPrefix, 0 ,0, \
279  (D4D_COOR)(D4D_SCREEN_SIZE_LONGER_SIDE), (D4D_COOR)(D4D_SCREEN_SIZE_SHORTER_SIDE), NULL, 0, NULL, D4D_SCR_F_DEFAULT, NULL)
280 
281 /**************************************************************************/
289 #define D4D_DECLARE_STD_PORTRAIT_SCREEN_BEGIN(name, funcPrefix) D4D_DECLARE_SCREEN_BEGIN(name, funcPrefix, 0 ,0, \
290  (D4D_COOR)(D4D_SCREEN_SIZE_SHORTER_SIDE), (D4D_COOR)(D4D_SCREEN_SIZE_LONGER_SIDE), NULL, 0, NULL, D4D_SCR_F_DEFAULT, NULL)
291 
292 /**************************************************************************/
310 #define D4D_DECLARE_RSCREEN_BEGIN(name, funcPrefix, x ,y, cx, cy, radius, text, fontId, icon, initFlags, pScheme)\
311  _D4D_DECLARE_SCREEN_BEGIN(D4D_CONST, name, funcPrefix, x ,y, cx, cy, radius, text, fontId, icon, initFlags, pScheme)
312 
313 /**************************************************************************/
325 #define D4D_DECLARE_SCREEN_OBJECT(name) &(name),
326 
327 /**************************************************************************/
338 #define D4D_DECLARE_SCREEN_END() NULL };
339 
340 /**************************************************************************/
357 #define D4D_DECLARE_SCREEN_BEGIN_INRAM(name, funcPrefix, x ,y, cx, cy, text, fontId, icon, initFlags, pScheme)\
358  _D4D_DECLARE_SCREEN_BEGIN(D4D_NO_CONST, name, funcPrefix, x ,y, cx, cy, 0, text, fontId, icon, initFlags, pScheme)
359 
360 /**************************************************************************/
367 #define D4D_DECLARE_STD_SCREEN_BEGIN_INRAM(name, funcPrefix) D4D_DECLARE_SCREEN_BEGIN_INRAM(name, funcPrefix, 0 ,0, \
368  (D4D_COOR)(D4D_SCREEN_SIZE_LONGER_SIDE), (D4D_COOR)(D4D_SCREEN_SIZE_SHORTER_SIDE), NULL, 0, NULL, D4D_SCR_F_DEFAULT, NULL)
369 
370 /**************************************************************************/
378 #define D4D_DECLARE_STD_PORTRAIT_SCREEN_BEGIN_INRAM(name, funcPrefix) D4D_DECLARE_SCREEN_BEGIN_INRAM(name, funcPrefix, 0 ,0, \
379  (D4D_COOR)(D4D_SCREEN_SIZE_SHORTER_SIDE), (D4D_COOR)(D4D_SCREEN_SIZE_LONGER_SIDE), NULL, 0, NULL, D4D_SCR_F_DEFAULT, NULL)
380 
381 /**************************************************************************/
399 #define D4D_DECLARE_RSCREEN_BEGIN_INRAM(name, funcPrefix, x ,y, cx, cy, radius, text, fontId, icon, initFlags, pScheme)\
400  _D4D_DECLARE_SCREEN_BEGIN(D4D_NO_CONST, name, funcPrefix, x ,y, cx, cy, radius, text, fontId, icon, initFlags, pScheme)
401 
402 /**************************************************************************/
407 #define D4D_EXTERN_SCREEN(name) \
408  extern D4D_SCREEN name;
409 
412 /**************************************************************/
417 #ifdef D4D_LLD_TCH
418  void D4D_EnableScrTouchScreen(const D4D_SCREEN* pScr, D4D_BOOL bEnable);
419 #else
420  #define D4D_EnableScrTouchScreen(pScr, bEnable)
421 #endif
422 
424 void D4D_ActivateScreen(const D4D_SCREEN* pNewScreen, D4D_BOOL bReplaceCurrent);
425 void D4D_EscapeScreen(void);
426 void D4D_EscapeToBaseScreen(void);
427 void D4D_InitScreen(const D4D_SCREEN* pScreen);
428 void D4D_InvalidateScreen(const D4D_SCREEN* pScreen, D4D_BOOL bComplete);
429 void D4D_SetScreenTextProperties(const D4D_SCREEN* pScreen, D4D_TEXT_PROPERTIES property);
430 void D4D_SetScreenFontProperties(const D4D_SCREEN* pScreen, D4D_FONT_PROPERTIES property);
431 
432 
435 
436 
437 
438 #endif /* __D4D_SCREEN_H */
void D4D_InvalidateScreen(const D4D_SCREEN *pScreen, D4D_BOOL bComplete)
The function mark the screen and its abject as &quot;redraw pending&quot;.
Definition: d4d_screen.c:238
Type definition of eGUI point structure.
Definition: d4d_types.h:223
const D4D_OBJECT *const * pObjects
NULL-terminated array of objects (may lay in ROM)
Definition: d4d_screen.h:165
D4D object messages structure.
Definition: d4d_base.h:400
The string type. This structure contains all properties about string in eGUI.
Definition: d4d_string.h:100
void(* OnMain)(void)
Screen event handler of main screen handler function.
Definition: d4d_screen.h:169
Byte D4D_SCREEN_FLAGS
The screen flags type. The masks are described here D4D SCREEN Defines masks of screen behaviour flag...
Definition: d4d_screen.h:149
struct D4D_CLR_SCHEME_S * clrScheme
Screen color scheme.
Definition: d4d_screen.h:183
D4D_SCREEN_FLAGS flags
Screen behaviour flags.
Definition: d4d_screen.h:182
void D4D_InitScreen(const D4D_SCREEN *pScreen)
The function inits the screen and its objects for first time case.
Definition: d4d_screen.c:184
struct D4D_SCREEN_S D4D_SCREEN
The screen structure type. The main screen structure that contains all needed data to run the eGUI sc...
This is the main structure of the color scheme in the D4D. It contains all the necessary colors to ru...
Definition: d4d_scheme.h:578
Byte D4D_TEXT_PROPERTIES
The string text properties type. The masks are described here D4D BASE Defines masks of aligment prop...
Definition: d4d_string.h:90
Byte D4D_COOR
Type definition of eGUI coordination variables.
Definition: d4d_types.h:219
D4D_COOR radius
Screen corner radius.
Definition: d4d_screen.h:177
unsigned char Byte
Type definition of Byte (unsigned 8-bit).
Definition: d4d_types.h:151
void D4D_ActivateScreen(const D4D_SCREEN *pNewScreen, D4D_BOOL bReplaceCurrent)
The function activate the new screen.
Definition: d4d_screen.c:94
D4D_SCREEN * D4D_GetActiveScreen(void)
Returns pointer to current active screen.
Definition: d4d_screen.c:78
D4D_BMP eGUI main image structure.
Definition: d4d_bmp.h:100
D4D_SIZE size
Screen size (standard screen has full size of physical screen)
Definition: d4d_screen.h:176
Byte flags
Internal screen flags.
Definition: d4d_screen.h:156
void D4D_SetScreenFontProperties(const D4D_SCREEN *pScreen, D4D_FONT_PROPERTIES property)
The function sets the screen font properties.
Definition: d4d_screen.c:503
D4D_POINT D4D_GetClientToScreenPoint(D4D_OBJECT *pObject, D4D_POINT *nClientPoint)
The function convert client point on the screen to the global screen point.
Definition: d4d_screen.c:536
Byte(* OnObjectMsg)(struct D4D_MESSAGE_S *pMsg)
Screen event handler of called before object receives the message.
Definition: d4d_screen.h:172
The object main structure type definition.
Definition: d4d_object.h:167
D4D_SCREEN_DATA * pData
pointer to screen private run time data
Definition: d4d_screen.h:186
const D4D_BMP * pIcon
Screen title icon.
Definition: d4d_screen.h:180
void D4D_EscapeScreen(void)
The function return to previous screen recorded in the history.
Definition: d4d_screen.c:130
void(* OnDeactivate)(void)
Screen event handler of called before deactivating.
Definition: d4d_screen.h:171
D4D_POINT position
Screen coordination on physical screen (standard screen has {0,0})
Definition: d4d_screen.h:175
LWord D4D_BOOL
Type definition of eGUI boolean.
Definition: d4d_types.h:204
Type definition of eGUI size structure.
Definition: d4d_types.h:230
void(* OnInit)(void)
Screen event handler of one-time initialization.
Definition: d4d_screen.h:168
void D4D_EscapeToBaseScreen(void)
The function return to base screen recorded in the history.
Definition: d4d_screen.c:156
The screen structure type. The main screen structure that contains all needed data to run the eGUI sc...
Definition: d4d_screen.h:162
#define D4D_EnableScrTouchScreen(pScr, bEnable)
Definition: d4d_screen.h:420
void(* OnActivate)(void)
Screen event handler of called before screen activation.
Definition: d4d_screen.h:170
D4D_OBJECT * focusedObject
Pointer on currently focused object.
Definition: d4d_screen.h:155
D4D_MARGIN * pMargin
Screen margin of user content.
Definition: d4d_screen.h:178
void D4D_SetScreenTextProperties(const D4D_SCREEN *pScreen, D4D_TEXT_PROPERTIES property)
The function sets the screen text properties.
Definition: d4d_screen.c:519
Byte D4D_FONT_PROPERTIES
Definition: d4d_font.h:116
struct D4D_STRING_S textBuff
Screen title bar text buffer.
Definition: d4d_screen.h:179
Type definition of eGUI client area margin structure.
Definition: d4d_types.h:244
D4D_POINT D4D_GetScreenToClientPoint(D4D_OBJECT *pObject, D4D_POINT *nScreenPoint)
The function convert global screen point on the screen to the client point.
Definition: d4d_screen.c:586
The screen run time data type. It used to internal store the runtime data by eGUI.
Definition: d4d_screen.h:152