eGUI alias D4D  Release 3.0
Reference Manual
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
d4d_icon.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_ICON_H
47 #define __D4D_ICON_H
48 
50 
51 /******************************************************************************
52 * D4D ICON setting constants
53 *
54 */
60 #ifndef D4D_ICON_F_DEFAULT
61  #define D4D_ICON_F_DEFAULT (D4D_OBJECT_F_VISIBLE | D4D_OBJECT_F_ENABLED)
62 #endif
63 
66 #ifndef D4D_ICON_TXT_PRTY_DEFAULT
67  #define D4D_ICON_TXT_PRTY_DEFAULT (D4D_ALIGN_H_CENTER_MASK | D4D_ALIGN_V_CENTER_MASK)
68 #endif
69 
72 #ifndef D4D_ICON_FNT_PRTY_DEFAULT
73  #define D4D_ICON_FNT_PRTY_DEFAULT ( 0 )
74 #endif
75 
78 #ifndef D4D_ICON_ENABLE_ANIMATION
79  #define D4D_ICON_ENABLE_ANIMATION D4D_TRUE
80 #endif
81 
84 #ifndef D4D_ICON_ANIMATION_TICK_COUNTER
85  #define D4D_ICON_ANIMATION_TICK_COUNTER ( 4 )
86 #endif
87 
88 
91 /******************************************************************************
92 * D4D ICON setting public types
93 *
94 */
98 /**************************************************************************/
105 typedef void (*D4D_ICON_ON_CHANGE)(D4D_OBJECT* pThis);
106 
109 
113 /******************************************************************************
114 * Private Types
115 ******************************************************************************/
116 
117 
118 
120 
121 typedef struct
122 {
123  D4D_ICON_INDEX index; // current value
124 
125 #if D4D_ICON_ENABLE_ANIMATION == D4D_TRUE
129 #endif
130 
131 } D4D_ICON_DATA;
132 
133 // ICON configuration (in ROM by default)
134 
135 typedef struct
136 {
137  D4D_STRING textBuff; // ICON text
138  D4D_POINT txtOff; // text coordinates as offset from scrPos
139  const D4D_ICON_BMPS* const* pBmpX; // ICON state X idication bitmaps
142 } D4D_ICON;
143 
144 /******************************************************************************
145 * Macros
146 ******************************************************************************/
147 
148 // getting the ICON structure from general OBJECT
149 #define D4D_GET_ICON(pObj) ((D4D_ICON*)((pObj)->pParam))
150 
151 /******************************************************************************
152 * D4D ICON setting public macros
153 *
154 */
158 /**************************************************************************/
192 #define _D4D_DECLARE_ICON_BEGIN(type, name, text, x, y, cx, cy, tx, ty, radius, pMargin, pRelations, flags, pScheme, fontId, pUser, pOnValch, pOnUsrMsg) \
193  extern const D4D_ICON_BMPS* const name##_bmps[];\
194  static D4D_ICON_DATA name##_data; \
195  static D4D_STR_PROPERTIES name##_strPrties = { D4D_ICON_FNT_PRTY_DEFAULT, D4D_ICON_TXT_PRTY_DEFAULT}; \
196  static type D4D_ICON name##_params = \
197  { \
198  { text, D4D_TEXT_LEN(text), fontId, &name##_strPrties, D4D_OBJECT_MAX_TEXT_LEN(text), 0}, /* textBuff */ \
199  { tx, ty }, /* txtOff */ \
200  &(name##_bmps[0]), /* pBmpX */ \
201  pOnValch, /* OnValueCanged */ \
202  &(name##_data) /* RAM-based data */ \
203  }; \
204  \
205  D4D_DECLARE_OBJECT(type, name, x, y, cx, cy, radius, pMargin, pRelations, pOnUsrMsg, &d4d_iconSysFunc, &(name##_params), (flags), pUser, pScheme)\
206  \
207  const D4D_ICON_BMPS* const name##_bmps[] = \
208  {
209 
210 /**************************************************************************/
223 #define D4D_DECLARE_ICON_BMP(pBmp) (pBmp),
224 
225 /**************************************************************************/
237 #define D4D_DECLARE_ICON_END() NULL };
238 
239 /**************************************************************************/
270 #define D4D_DECLARE_ICON_BEGIN(name, text, x, y, cx, cy, tx, ty, flags, pScheme, fontId, pUser, pOnValch, pOnUsrMsg) \
271  _D4D_DECLARE_ICON_BEGIN(D4D_CONST, name, text, x, y, cx, cy, tx, ty, 0, NULL, NULL, flags, pScheme, fontId, pUser, pOnValch, pOnUsrMsg)
272 
273 /**************************************************************************/
300 #define D4D_DECLARE_STD_ICON_BEGIN(name, text, x, y, cx, cy, tx, ty, fontId, pOnValch) \
301  D4D_DECLARE_ICON_BEGIN(name, text, x, y, cx, cy, tx, ty, (D4D_ICON_F_DEFAULT), NULL, fontId, NULL, pOnValch, NULL)
302 
303 
304 // Rounded icon definition
305 /**************************************************************************/
337 #define D4D_DECLARE_RICON_BEGIN(name, text, x, y, cx, cy, tx, ty, radius, flags, pScheme, fontId, pUser, pOnValch, pOnUsrMsg) \
338  _D4D_DECLARE_ICON_BEGIN(D4D_CONST, name, text, x, y, cx, cy, tx, ty, radius, NULL, NULL, flags, pScheme, fontId, pUser, pOnValch, pOnUsrMsg)
339 
340 /**************************************************************************/
368 #define D4D_DECLARE_STD_RICON_BEGIN(name, text, x, y, cx, cy, tx, ty, radius, fontId, pOnValch) \
369  D4D_DECLARE_RICON_BEGIN(name, text, x, y, cx, cy, tx, ty, radius, (D4D_ICON_F_DEFAULT), NULL, fontId, NULL, pOnValch, NULL)
370 
371 
372 // IN RAM instantions macros
373 /**************************************************************************/
376 #define D4D_DECLARE_ICON_BEGIN_INRAM(name, text, x, y, cx, cy, tx, ty, flags, pScheme, fontId, pUser, pOnValch, pOnUsrMsg) \
377  _D4D_DECLARE_ICON_BEGIN(D4D_NO_CONST, name, text, x, y, cx, cy, tx, ty, 0, NULL, NULL, flags, pScheme, fontId, pUser, pOnValch, pOnUsrMsg)
378 
379 /**************************************************************************/
382 #define D4D_DECLARE_STD_ICON_BEGIN_INRAM(name, text, x, y, cx, cy, tx, ty, fontId, onvalch) \
383  D4D_DECLARE_ICON_BEGIN_INRAM(name, text, x, y, cx, cy, tx, ty, (D4D_ICON_F_DEFAULT), NULL, fontId, NULL, onvalch, NULL)
384 
385 
386 // Rounded icon definition
387 /**************************************************************************/
390 #define D4D_DECLARE_RICON_BEGIN_INRAM(name, text, x, y, cx, cy, tx, ty, radius, flags, pScheme, fontId, pUser, pOnValch, pOnUsrMsg) \
391  _D4D_DECLARE_ICON_BEGIN(D4D_NO_CONST, name, text, x, y, cx, cy, tx, ty, radius, NULL, NULL, flags, pScheme, fontId, pUser, pOnValch, pOnUsrMsg)
392 
393 /**************************************************************************/
396 #define D4D_DECLARE_STD_RICON_BEGIN_INRAM(name, text, x, y, cx, cy, tx, ty, radius, fontId, onvalch) \
397  D4D_DECLARE_RICON_BEGIN_INRAM(name, text, x, y, cx, cy, tx, ty, radius, (D4D_ICON_F_DEFAULT), NULL, fontId, NULL, onvalch, NULL)
398 
401  // Obsolete macros
402 #define D4D_DECLARE_STD_ICON1(name, text, x, y, cx, cy, tx, ty, pBmp0, font, onvalch) \
403  D4D_DECLARE_ICON_BEGIN(name, text, x, y, cx, cy, tx, ty, (D4D_ICON_F_DEFAULT), NULL, font, NULL, onvalch, NULL)\
404  D4D_DECLARE_ICON_BMP((pBmp0))\
405  D4D_DECLARE_ICON_END()
406 
407 #define D4D_DECLARE_STD_ICON2(name, text, x, y, cx, cy, tx, ty, pBmp1, pBmp0, font, onvalch) \
408  D4D_DECLARE_ICON_BEGIN(name, text, x, y, cx, cy, tx, ty, (D4D_ICON_F_DEFAULT), NULL, font, NULL, onvalch, NULL)\
409  D4D_DECLARE_ICON_BMP((pBmp0))\
410  D4D_DECLARE_ICON_BMP((pBmp1))\
411  D4D_DECLARE_ICON_END()
412 
413 #define D4D_DECLARE_STD_ICON1_INRAM(name, text, x, y, cx, cy, tx, ty, pBmp0, font, onvalch) \
414  D4D_DECLARE_ICON_BEGIN_INRAM(name, text, x, y, cx, cy, tx, ty, (D4D_ICON_F_DEFAULT), NULL, font, NULL, onvalch, NULL)\
415  D4D_DECLARE_ICON_BMP((pBmp0))\
416  D4D_DECLARE_ICON_END()
417 
418 #define D4D_DECLARE_STD_ICON2_INRAM(name, text, x, y, cx, cy, tx, ty, pBmp1, pBmp0, font, onvalch) \
419  D4D_DECLARE_ICON_BEGIN_INRAM(name, text, x, y, cx, cy, tx, ty, (D4D_ICON_F_DEFAULT), NULL, font, NULL, onvalch, NULL)\
420  D4D_DECLARE_ICON_BMP((pBmp0))\
421  D4D_DECLARE_ICON_BMP((pBmp1))\
422  D4D_DECLARE_ICON_END()
423 
424 /******************************************************************************
425 * Global variables
426 ******************************************************************************/
427 
428 /******************************************************************************
429 * Global functions
430 ******************************************************************************/
431 
432 /*********************************************************
433 *
434 * global functions
435 *
436 *********************************************************/
438 void D4D_IconChangeIndex(D4D_OBJECT_PTR pThis, sByte incr);
440 
441 #if D4D_ICON_ENABLE_ANIMATION == D4D_TRUE
445 #endif
446 
448 // Obsolete functions, replaced by any general
449 #define D4D_IconSetText D4D_SetText
450 
451 
452 
453 
454 #endif /* __D4D_ICON_H */
455 
456 
D4D_ICON_DATA * pData
Definition: d4d_icon.h:141
Type definition of eGUI point structure.
Definition: d4d_types.h:223
D4D_ICON_ON_CHANGE OnValueChanged
Definition: d4d_icon.h:140
The string type. This structure contains all properties about string in eGUI.
Definition: d4d_string.h:100
Word tickCounter
Definition: d4d_icon.h:127
const D4D_ICON_BMPS *const * pBmpX
Definition: d4d_icon.h:139
void D4D_IconAnimationStart(D4D_OBJECT_PTR pThis)
Function starts the animation of icon.
Definition: d4d_icon.c:221
unsigned char Byte
Type definition of Byte (unsigned 8-bit).
Definition: d4d_types.h:151
D4D_POINT txtOff
Definition: d4d_icon.h:138
D4D_BMP eGUI main image structure.
Definition: d4d_bmp.h:100
void(* D4D_ICON_ON_CHANGE)(D4D_OBJECT *pThis)
Type definition of icon on change callback function.
Definition: d4d_icon.h:105
The object main structure type definition.
Definition: d4d_object.h:167
signed char sByte
Type definition of sByte (signed 8-bit).
Definition: d4d_types.h:155
D4D_ICON_INDEX D4D_IconGetIndex(D4D_OBJECT_PTR pThis)
Function returns current visible bitmap index.
Definition: d4d_icon.c:206
D4D_ICON_INDEX index
Definition: d4d_icon.h:123
The object system function needed for each object - this is part of D4D_OBJECT main structure...
Definition: d4d_object.h:134
LWord D4D_BOOL
Type definition of eGUI boolean.
Definition: d4d_types.h:204
Byte D4D_ICON_INDEX
This is icon index variable, it used in API functions to choose the active icon in the list...
Definition: d4d_icon.h:108
D4D_BOOL animationEnabled
Definition: d4d_icon.h:126
void D4D_IconAnimationStop(D4D_OBJECT_PTR pThis)
Function stops the animation of icon.
Definition: d4d_icon.c:241
D4D_BMP D4D_ICON_BMPS
Definition: d4d_icon.h:119
Word tickCounterTrshld
Definition: d4d_icon.h:128
D4D_STRING textBuff
Definition: d4d_icon.h:137
D4D_ICON_INDEX D4D_IconGetBmpCount(D4D_OBJECT_PTR pThis)
Function returns the icon bitmap count.
Definition: d4d_icon.c:136
const D4D_OBJECT_SYS_FUNCTION d4d_iconSysFunc
Definition: d4d_icon.c:53
void D4D_IconSetIndex(D4D_OBJECT_PTR pThis, D4D_ICON_INDEX index)
Function sets the new bitmap of icon by icon index.
Definition: d4d_icon.c:157
void D4D_IconAnimationSetCounts(D4D_OBJECT_PTR pThis, Word cnt)
Function sets the time tick tresholds for animation speed.
Definition: d4d_icon.c:258
void D4D_IconChangeIndex(D4D_OBJECT_PTR pThis, sByte incr)
Function sets the new bitmap of icon by icon index difference.
Definition: d4d_icon.c:189
unsigned short Word
Type definition of Word (unsigned 16-bit).
Definition: d4d_types.h:159