eGUI alias D4D  Release 3.0
Reference Manual
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
d4d_object.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_OBJECT_H
47 #define __D4D_OBJECT_H
48 
49 /******************************************************************************
50 * Includes
51 ******************************************************************************/
52 
53 /******************************************************************************
54 * D4D OBJECT setting constants
55 *
56 */
60 // Common flags as for initial as for runtime
72 #define D4D_OBJECT_F_VISIBLE 0x0001
73 #define D4D_OBJECT_F_ENABLED 0x0002
74 #define D4D_OBJECT_F_TABSTOP 0x0004
75 #define D4D_OBJECT_F_TOUCHENABLE 0x0008
76 #define D4D_OBJECT_F_FASTTOUCH 0x0010
77 #define D4D_OBJECT_F_FOCUSRECT 0x0020
78 #define D4D_OBJECT_F_TIMETICK 0x0040
79 #define D4D_OBJECT_F_RESERVED1 0x0080
80 
81 #define D4D_OBJECT_F_BEVEL_MASK 0x0300
82 #define D4D_OBJECT_F_BEVEL_SHIFT 8
83 
84 #define D4D_OBJECT_F_BEVEL_RAISED 0x0100
85 #define D4D_OBJECT_F_BEVEL_DENTED 0x0200
86 
87 #define D4D_OBJECT_F_MOUSE_MASK 0x0C00
88 #define D4D_OBJECT_F_MOUSE_SHIFT 10
89 
90 #define D4D_OBJECT_F_MOUSE_NORMAL 0x0400
91 #define D4D_OBJECT_F_MOUSE_BUSY 0x0800
92 #define D4D_OBJECT_F_MOUSE_UNAVAILABLE 0x0C00
93 
94 #define D4D_OBJECT_F_SYSTEM_MASK 0x000FFFFF
95 #define D4D_OBJECT_F_OBJECT_MASK 0xFFF00000
96 #define D4D_OBJECT_F_OBJECT_SHIFT 20
97 
98 
101 #define D4D_OBJECT_USR_DATA_PARENT_IX 0
102 
103 #define D4D_OBJECT_USR_DATA_CHILD_IX 1
104 
106 /******************************************************************************
107 * Internal constants
108 ******************************************************************************/
109 // just runtime flags
110 #define D4D_OBJECT_F_REDRAW 0x10000
111 #define D4D_OBJECT_F_REDRAWC 0x20000
112 #define D4D_OBJECT_F_REDRAWSTATE 0x40000
113 #define D4D_OBJECT_F_NOTINIT 0x80000
114 
115 struct D4D_OBJECT_S;
116 struct D4D_SCREEN_S;
117 struct D4D_MESSAGE_S;
118 struct D4D_CLR_SCHEME_S;
119 
120 /******************************************************************************
121 * D4D Object types
122 *
123 */
129 
132 
135 {
137  void (*OnSysMessage)(struct D4D_MESSAGE_S* pMsg);
139  struct D4D_STRING_S* (*GetTextBuffer)(struct D4D_OBJECT_S* pObj);
141 
143 typedef struct D4D_OBJECT_DATA_S
144 {
148 
150 typedef void* D4D_OBJECT_USR_DATA;
151 
153 typedef const struct D4D_OBJECT_S* const * D4D_OBJECT_RELATIONS;
154 
155 /**************************************************************************/
162 typedef Byte (*D4D_ON_USR_MSG)(struct D4D_MESSAGE_S* pMsg);
163 
164 // this is allocated in ROM always
167 typedef struct D4D_OBJECT_S
168 {
173  void* pParam;
177  D4D_OBJECT_RELATIONS pRelations;
180  D4D_OBJECT_DATA_PTR pData;
181 } D4D_OBJECT;
182 
184 typedef const D4D_OBJECT* D4D_OBJECT_PTR;
185 
186 
187 
188 
190 /******************************************************************************
191 * Internal types
192 ******************************************************************************/
193 
194 
195 /******************************************************************************
196 * D4D Object macros
197 *
198 */
202 /**************************************************************************/
207 #define D4D_EXTERN_OBJECT(name) \
208  extern const D4D_OBJECT name;
209 
210 /**************************************************************************/
216 #define D4D_GET_OBJECT_DATA(pObject) ((pObject)->pData)
217 
218 /**************************************************************************/
224 #define D4D_BORDER_WIDTH(flags) (((flags) & D4D_OBJECT_F_BEVEL_MASK)? (D4D_BEVEL_WIDTH) : (((flags) & D4D_OBJECT_F_FOCUSRECT)? 1:0))
225 
226 /**************************************************************************/
232 #define D4D_OBJECT_FLAGS2BEVEL(pObject) ((D4D_BEVEL)(((pObject)->pData->flags & D4D_OBJECT_F_BEVEL_MASK) >> D4D_OBJECT_F_BEVEL_SHIFT))
233 
234 
235 /**************************************************************************/
255 #define D4D_DECLARE_OBJECT(type, name, x, y, cx, cy, rad, margin, relations, onusrmsg, sysFunc , param, initFlags, userData, pScheme) \
256  D4D_OBJECT_DATA name##_Data = {(D4D_OBJECT_FLAGS)((initFlags | D4D_OBJECT_F_NOTINIT) & D4D_OBJECT_F_SYSTEM_MASK), NULL}; \
257  type D4D_OBJECT name = \
258  { \
259  {x, y},\
260  {cx, cy},\
261  rad,\
262  margin,\
263  (void*)param, \
264  (D4D_OBJECT_SYS_FUNCTION*)sysFunc, \
265  onusrmsg, \
266  (D4D_OBJECT_USR_DATA)userData, \
267  relations,\
268  initFlags, \
269  pScheme, \
270  &(name##_Data) \
271  };
272 
273 /**************************************************************************/
280  #define D4D_DECLARE_OBJECT_RELATIONS(name, pParent, ...)\
281  const D4D_OBJECT * const name[] = {pParent, __VA_ARGS__ , NULL};
282 
283  // next way how to define object relation array
284 
285 /**************************************************************************/
291  #define D4D_DECLARE_OBJECT_RELATIONS_BEGIN(name, pParent)\
292  const D4D_OBJECT * const name[] = \
293  {\
294  pParent,
295 
296 /**************************************************************************/
301  #define D4D_DECLARE_OBJECT_RELATIONS_CHILD(child) &child,
302 
303 /**************************************************************************/
307  #define D4D_DECLARE_OBJECT_RELATIONS_END NULL };
308 
310  #define D4D_OBJECT_MAX_TEXT_LEN(str) 1000
311 
312 
313 
314 /******************************************************************************
315 * Public functions
316 ******************************************************************************/
321 void D4D_EnableTabStop(D4D_OBJECT_PTR pObj, D4D_BOOL bEnable);
322 void D4D_EnableObject(D4D_OBJECT_PTR pObj, D4D_BOOL bEnable);
323 void D4D_EnableTouchScreen(D4D_OBJECT_PTR pObj, D4D_BOOL bEnable, D4D_BOOL bFastTouch);
324 void D4D_ShowObject(D4D_OBJECT_PTR pObject, D4D_BOOL bShow);
325 void D4D_EnableTimeTicks(D4D_OBJECT_PTR pObj, D4D_BOOL bEnable);
326 void D4D_InvalidateObject(D4D_OBJECT_PTR pObject, D4D_BOOL bComplete);
327 void* D4D_GetUserPointer(D4D_OBJECT *pThis);
331 
332 #endif /* __D4D_OBJECT_H */
D4D_WCHAR D4D_TCHAR
Type definition of eGUI character (it depends on UNICODE setting if this is D4D_CHAR or D4D_WCHAR)...
Definition: d4d_types.h:284
D4D_BOOL D4D_IsMineFocus(D4D_OBJECT *pObject)
Function find out if the object (including compounded objects) is focused.
Definition: d4d_object.c:348
void(* OnSysMessage)(struct D4D_MESSAGE_S *pMsg)
Object system message receiver function pointer.
Definition: d4d_object.h:137
D4D_OBJECT_SYS_FUNCTION * pObjFunc
The pointer on object system functions.
Definition: d4d_object.h:174
void * pParam
The object depends parameters.
Definition: d4d_object.h:173
D4D_ON_USR_MSG OnUsrMessage
The pointer on user message.
Definition: d4d_object.h:175
void D4D_EnableTabStop(D4D_OBJECT_PTR pObj, D4D_BOOL bEnable)
Function enables TabStop on the object.
Definition: d4d_object.c:255
struct D4D_SCREEN_S * pScreen
pointer to object screen owner - it is placed in RAM bacause one object could be used in multiply scr...
Definition: d4d_object.h:146
Type definition of eGUI point structure.
Definition: d4d_types.h:223
D4D object messages structure.
Definition: d4d_base.h:400
D4D_OBJECT_DATA_PTR pData
Pointer on runtime object data.
Definition: d4d_object.h:180
The string type. This structure contains all properties about string in eGUI.
Definition: d4d_string.h:100
D4D_OBJECT_INITFLAGS initFlags
The initializations object flags.
Definition: d4d_object.h:178
void * D4D_OBJECT_USR_DATA
The object user data type definition.
Definition: d4d_object.h:150
D4D_BOOL D4D_ObjectCheckCoordinates(D4D_OBJECT *pThis, D4D_POINT point)
Definition: d4d_object.c:459
struct D4D_OBJECT_SYS_FUNCTION_S D4D_OBJECT_SYS_FUNCTION
The object system function needed for each object - this is part of D4D_OBJECT main structure...
D4D_OBJECT_FLAGS flags
runtime object flags
Definition: d4d_object.h:145
The object changeble data structure - this is part of D4D_OBJECT main structure.
Definition: d4d_object.h:143
struct D4D_CLR_SCHEME_S * clrScheme
Pointer on used color scheme.
Definition: d4d_object.h:179
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
void D4D_EnableObject(D4D_OBJECT_PTR pObj, D4D_BOOL bEnable)
Function enables object.
Definition: d4d_object.c:273
Byte D4D_COOR
Type definition of eGUI coordination variables.
Definition: d4d_types.h:219
D4D_POINT position
Position on the screen/object.
Definition: d4d_object.h:169
LWord D4D_OBJECT_FLAGS
The object flags type. The masks are described here D4D OBJECT Defines masks of object behaviour flag...
Definition: d4d_object.h:128
D4D_COOR radius
Object corners radius.
Definition: d4d_object.h:171
unsigned char Byte
Type definition of Byte (unsigned 8-bit).
Definition: d4d_types.h:151
LWord D4D_OBJECT_INITFLAGS
The object init flags type. The masks are described here D4D OBJECT Defines masks of object behaviour...
Definition: d4d_object.h:131
D4D_BOOL(* CheckCoordinates)(struct D4D_OBJECT_S *pObj, D4D_POINT point)
Object check coordinates function pointer (return true or false if the input point fits into the obje...
Definition: d4d_object.h:138
void D4D_ShowObject(D4D_OBJECT_PTR pObject, D4D_BOOL bShow)
Function control visibility of object on screen.
Definition: d4d_object.c:92
D4D_OBJECT_USR_DATA userData
The pointer on user data container (user pointer and optionaly parent/children).
Definition: d4d_object.h:176
unsigned long LWord
Type definition of LWord (unsigned 32-bit).
Definition: d4d_types.h:167
D4D_SIZE size
Size of the object.
Definition: d4d_object.h:170
D4D_BOOL D4D_IsVisible(D4D_OBJECT *pObject)
Function find out if the object is visible or not.
Definition: d4d_object.c:325
The object main structure type definition.
Definition: d4d_object.h:167
void D4D_CaptureKeys(D4D_OBJECT_PTR pObj)
Function switch on capturing the keys to objects.
Definition: d4d_object.c:190
struct D4D_OBJECT_S *const * D4D_OBJECT_RELATIONS
The object relations type definition. In fact this is array of object pointer , where on position 0 i...
Definition: d4d_object.h:153
The object system function needed for each object - this is part of D4D_OBJECT main structure...
Definition: d4d_object.h:134
void * D4D_GetUserPointer(D4D_OBJECT *pThis)
Function return the object user data.
Definition: d4d_object.c:131
D4D_OBJECT_RELATIONS pRelations
Relationship between the objects.
Definition: d4d_object.h:177
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 D4D_EnableTimeTicks(D4D_OBJECT_PTR pObj, D4D_BOOL bEnable)
Function enable or diasble receiving timeticks for an OBJECT.
Definition: d4d_object.c:172
The screen structure type. The main screen structure that contains all needed data to run the eGUI sc...
Definition: d4d_screen.h:162
Byte(* D4D_ON_USR_MSG)(struct D4D_MESSAGE_S *pMsg)
Type definition of object on User message handler function.
Definition: d4d_object.h:162
D4D_TCHAR * strName
Object type (widget) name, it also could be used as a identifier of object type.
Definition: d4d_object.h:136
struct D4D_OBJECT_DATA_S D4D_OBJECT_DATA
The object changeble data structure - this is part of D4D_OBJECT main structure.
void D4D_InvalidateObject(D4D_OBJECT_PTR pObject, D4D_BOOL bComplete)
Function invalidate object to redraw on screen.
Definition: d4d_object.c:71
D4D_MARGIN * pMargin
Object inner margin.
Definition: d4d_object.h:172
struct D4D_OBJECT_S D4D_OBJECT
The object main structure type definition.
void D4D_EnableTouchScreen(D4D_OBJECT_PTR pObj, D4D_BOOL bEnable, D4D_BOOL bFastTouch)
Function enables touchs screen capability and sets also mode of touch event.
Definition: d4d_object.c:151
D4D_SIZE D4D_GetClientScreenSize(D4D_OBJECT *pObject)
The function return the real client size of object.
Definition: d4d_object.c:382
struct D4D_OBJECT_DATA_S * D4D_OBJECT_DATA_PTR
Type definition of eGUI client area margin structure.
Definition: d4d_types.h:244
D4D_BOOL D4D_IsEnabled(D4D_OBJECT *pObject)
Function find out if the object is enabled or not.
Definition: d4d_object.c:303
const D4D_OBJECT * D4D_OBJECT_PTR
The type definition of object pointer to ROM.
Definition: d4d_object.h:184
D4D_OBJECT * D4D_GetCapturedObject(void)
Function returns the current keys capturing object pointer.
Definition: d4d_object.c:241