eGUI alias D4D  Release 3.0
Reference Manual
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
d4d_check_box.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_CHECKBOX_H
47 #define __D4D_CHECKBOX_H
48 
50 /******************************************************************************
51 * D4D CHECK BOX setting constants
52 *
53 */
59 #ifndef D4D_CHECKBOX_BORDER_OFFSET
60  #define D4D_CHECKBOX_BORDER_OFFSET 3
61 #endif
62 
65 #ifndef D4D_CHECKBOX_TEXT_OFFSET
66  #define D4D_CHECKBOX_TEXT_OFFSET 4
67 #endif
68 
71 #ifndef D4D_COLOR_CHECKBOX_ICON_BCKG
72  #define D4D_COLOR_CHECKBOX_ICON_BCKG D4D_COLOR_WHITE
73 #endif
74 
75 
76 //********************* Check Box flags for check box specific flags *****************
87 #define D4D_CHECKBOX_F_ICON_RECTANGLE (0x01 << D4D_OBJECT_F_OBJECT_SHIFT)
88 
89 
91 //******************************************************************************
92 
96 #ifndef D4D_CHECKBOX_F_DEFAULT
97  #define D4D_CHECKBOX_F_DEFAULT (D4D_OBJECT_F_VISIBLE | D4D_OBJECT_F_ENABLED | D4D_OBJECT_F_TABSTOP | D4D_OBJECT_F_TOUCHENABLE\
98  | D4D_OBJECT_F_MOUSE_NORMAL | D4D_OBJECT_F_BEVEL_RAISED | D4D_CHECKBOX_F_ICON_RECTANGLE )
99 #endif
100 
103 #ifndef D4D_CHECKBOX_TXT_PRTY_DEFAULT
104  #define D4D_CHECKBOX_TXT_PRTY_DEFAULT (D4D_ALIGN_H_LEFT_MASK | D4D_ALIGN_V_CENTER_MASK)
105 #endif
106 
109 #ifndef D4D_CHECKBOX_FNT_PRTY_DEFAULT
110  #define D4D_CHECKBOX_FNT_PRTY_DEFAULT ( 0 )
111 #endif
112 
115 /******************************************************************************
116 * D4D CHECK BOX setting public types
117 *
118 */
122 /**************************************************************************/
129 typedef void (*D4D_CHCKBX_ON_CHANGE)(D4D_OBJECT* pThis);
130 
133 /******************************************************************************
134 * Private Types
135 ******************************************************************************/
136 
137 // Check box configuration (goes to ROM by default)
138 
139 
141 
142 #define D4D_CHECKBOX_STATUS_PRESSED_MASK (0x01)
143 #define D4D_CHECKBOX_STATUS_CHECKED_MASK (0x02)
144 
145 typedef struct
146 {
147  D4D_STRING textBuff; // check box text
148  const D4D_BMP* pBmpChecked; // Checked state bitmap
149  const D4D_BMP* pBmpUnChecked; // Checked state bitmap
152 } D4D_CHECKBOX;
153 
154 
155 /******************************************************************************
156 * Macros
157 ******************************************************************************/
158 
159 // getting the CHECK BOX structure from general OBJECT
160 #define D4D_GET_CHECKBOX(pObj) ((D4D_CHECKBOX*)((pObj)->pParam))
161 #define D4D_GET_CHECKBOX_STATUS(pObj) ((D4D_CHECKBOX_STATUS*)(D4D_GET_CHECKBOX(pObj)->pStatus))
162 
163 
164 
165 /******************************************************************************
166 * D4D CHECK BOX setting public macros
167 *
168 */
172 /**************************************************************************/
197 #define _D4D_DECLARE_CHECKBOX(type, name, text, x, y, cx, cy, radius, pMargin, pRelations, flags, pbmpChecked, pbmpUnChecked, pScheme, fontId, pUser, onchange, pOnUsrMsg) \
198  static D4D_CHECKBOX_STATUS name##_status = { 0 }; \
199  static D4D_STR_PROPERTIES name##_strPrties = { D4D_CHECKBOX_FNT_PRTY_DEFAULT, D4D_CHECKBOX_TXT_PRTY_DEFAULT}; \
200  static type D4D_CHECKBOX name##_params = \
201  { \
202  { text, D4D_TEXT_LEN(text), fontId, &name##_strPrties, D4D_OBJECT_MAX_TEXT_LEN(text), 0}, /* textBuff */ \
203  pbmpChecked, /* pBmpChecked */ \
204  pbmpUnChecked, /* pBmpUnChecked */ \
205  &(name##_status), /* Status clear */ \
206  onchange /* Click event */ \
207  }; \
208  \
209  D4D_DECLARE_OBJECT(type, name, x, y, cx, cy, radius, pMargin, pRelations, pOnUsrMsg, &d4d_checkBoxSysFunc, &(name##_params), flags, pUser, pScheme)
210 
211 /**************************************************************************/
233 #define D4D_DECLARE_CHECKBOX(name, text, x, y, cx, cy, flags, pbmpChecked, pbmpUnChecked, pScheme, fontId, pUser, onchange, pOnUsrMsg) \
234  _D4D_DECLARE_CHECKBOX(D4D_CONST, name, text, x, y, cx, cy, 0, (D4D_MARGIN*)&d4d_marginDefault, NULL, flags, pbmpChecked, pbmpUnChecked, pScheme, fontId, pUser, onchange, pOnUsrMsg)
235 
236 /**************************************************************************/
254 #define D4D_DECLARE_STD_CHECKBOX(name, text, x, y, cx, cy, pbmpChecked, pbmpUnChecked, fontId, onchange) \
255  D4D_DECLARE_CHECKBOX(name, text, x, y, cx, cy, (D4D_CHECKBOX_F_DEFAULT), pbmpChecked, pbmpUnChecked, NULL, fontId, NULL, onchange, NULL)
256 
257 // Rounded check box definition
258 
259 /**************************************************************************/
282 #define D4D_DECLARE_RCHECKBOX(name, text, x, y, cx, cy, radius, flags, pbmpChecked, pbmpUnChecked, pScheme, fontId, pUser, onchange, pOnUsrMsg) \
283  _D4D_DECLARE_CHECKBOX(D4D_CONST, name, text, x, y, cx, cy, radius, (D4D_MARGIN*)&d4d_marginDefault, NULL, flags, pbmpChecked, pbmpUnChecked, pScheme, fontId, pUser, onchange, pOnUsrMsg)
284 
285 /**************************************************************************/
304 #define D4D_DECLARE_STD_RCHECKBOX(name, text, x, y, cx, cy, radius, pbmpChecked, pbmpUnChecked, fontId, onchange) \
305  D4D_DECLARE_RCHECKBOX(name, text, x, y, cx, cy, radius, (D4D_CHECKBOX_F_DEFAULT), pbmpChecked, pbmpUnChecked, NULL, fontId, NULL, onchange, NULL)
306 
307 
308 // IN RAM instantions macros
309 /**************************************************************************/
312 #define D4D_DECLARE_CHECKBOX_INRAM(name, text, x, y, cx, cy, flags, pbmpChecked, pbmpUnChecked, pScheme, fontId, pUser, onchange, pOnUsrMsg) \
313  _D4D_DECLARE_CHECKBOX(D4D_NO_CONST, name, text, x, y, cx, cy, 0, (D4D_MARGIN*)&d4d_marginDefault, NULL, flags, pbmpChecked, pbmpUnChecked, pScheme, fontId, pUser, onchange, pOnUsrMsg)
314 
315 /**************************************************************************/
318 #define D4D_DECLARE_STD_CHECKBOX_INRAM(name, text, x, y, cx, cy, pbmpChecked, pbmpUnChecked, fontId, onchange) \
319  D4D_DECLARE_CHECKBOX_INRAM(name, text, x, y, cx, cy, 0, (D4D_CHECKBOX_F_DEFAULT), pbmpChecked, pbmpUnChecked, NULL, fontId, NULL, onchange, NULL)
320 
321 
322 // Rounded check box definition
323 /**************************************************************************/
326 #define D4D_DECLARE_RCHECKBOX_INRAM(name, text, x, y, cx, cy, radius, flags, pbmpChecked, pbmpUnChecked, pScheme, fontId, pUser, onchange, pOnUsrMsg) \
327  _D4D_DECLARE_CHECKBOX(D4D_NO_CONST, name, text, x, y, cx, cy, radius, (D4D_MARGIN*)&d4d_marginDefault, NULL, flags, pbmpChecked, pbmpUnChecked, pScheme, fontId, pUser, onchange, pOnUsrMsg)
328 
329 /**************************************************************************/
332 #define D4D_DECLARE_STD_RCHECKBOX_INRAM(name, text, x, y, cx, cy, radius, pbmpChecked, pbmpUnChecked, fontId, onchange) \
333  D4D_DECLARE_RCHECKBOX_INRAM(name, text, x, y, cx, cy, radius, (D4D_CHECKBOX_F_DEFAULT), pbmpChecked, pbmpUnChecked, NULL, fontId, NULL, onchange, NULL)
334 
337 /******************************************************************************
338 * Global functions
339 ******************************************************************************/
340 
341 void D4D_CheckBoxSetValue(D4D_OBJECT_PTR pThis, D4D_BOOL value);
343 
344 // Obsolete functions, replaced by any general
345 #define D4D_CheckBoxSetText D4D_SetText
346 
347 
348 
349 #endif /*__D4D_CHECKBOX_H*/
350 
351 
352 
353 
354 
355 
356 
357 
358 
359 
360 
361 
D4D_STRING textBuff
void D4D_CheckBoxSetValue(D4D_OBJECT_PTR pThis, D4D_BOOL value)
Function Sets the the check box value.
The string type. This structure contains all properties about string in eGUI.
Definition: d4d_string.h:100
D4D_CHCKBX_ON_CHANGE OnChange
const D4D_BMP * pBmpChecked
unsigned char Byte
Type definition of Byte (unsigned 8-bit).
Definition: d4d_types.h:151
void(* D4D_CHCKBX_ON_CHANGE)(D4D_OBJECT *pThis)
Type definition of check box on change callback function.
D4D_BMP eGUI main image structure.
Definition: d4d_bmp.h:100
const D4D_OBJECT_SYS_FUNCTION d4d_checkBoxSysFunc
Definition: d4d_check_box.c:53
The object main structure type definition.
Definition: d4d_object.h:167
The object system function needed for each object - this is part of D4D_OBJECT main structure...
Definition: d4d_object.h:134
const D4D_BMP * pBmpUnChecked
LWord D4D_BOOL
Type definition of eGUI boolean.
Definition: d4d_types.h:204
D4D_CHECKBOX_STATUS * pStatus
D4D_BOOL D4D_CheckBoxGetValue(D4D_OBJECT_PTR pThis)
Function Gets the the check box value.
Byte D4D_CHECKBOX_STATUS