eGUI alias D4D  Release 3.0
Reference Manual
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
d4d_radio_button.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_RADIOBUTTON_H
47 #define __D4D_RADIOBUTTON_H
48 
50 
51 /******************************************************************************
52 * D4D RADIO BUTTON setting constants
53 *
54 */
58 //********************* Radio Button flags for radio button specific flags *****************
71 #define D4D_RADIOBUTTON_F_ICON_RING (0x01 << D4D_OBJECT_F_OBJECT_SHIFT)
72 
74 //******************************************************************************
75 
79 #ifndef D4D_RADIOBUTTON_F_DEFAULT
80  #define D4D_RADIOBUTTON_F_DEFAULT (D4D_OBJECT_F_VISIBLE | D4D_OBJECT_F_ENABLED | D4D_OBJECT_F_TABSTOP | D4D_OBJECT_F_TOUCHENABLE\
81  | D4D_OBJECT_F_MOUSE_NORMAL | D4D_OBJECT_F_FOCUSRECT | D4D_RADIOBUTTON_F_ICON_RING )
82 #endif
83 
84 
87 #ifndef D4D_RADIOBUTTON_TXT_PRTY_DEFAULT
88  #define D4D_RADIOBUTTON_TXT_PRTY_DEFAULT (D4D_ALIGN_H_LEFT_MASK | D4D_ALIGN_V_CENTER_MASK)
89 #endif
90 
93 #ifndef D4D_RADIOBUTTON_FNT_PRTY_DEFAULT
94  #define D4D_RADIOBUTTON_FNT_PRTY_DEFAULT ( 0 )
95 #endif
96 
99 #ifndef D4D_RADIOBUTTON_BORDER_OFFSET
100  #define D4D_RADIOBUTTON_BORDER_OFFSET 3
101 #endif
102 
105 #ifndef D4D_RADIOBUTTON_TEXT_OFFSET
106  #define D4D_RADIOBUTTON_TEXT_OFFSET 4
107 #endif
108 
111 #ifndef D4D_RADIOBUTTON_ICON_RING
112  #define D4D_RADIOBUTTON_ICON_RING 2
113 #endif
114 
117 #ifndef D4D_RADIOBUTTON_MIN_SIZE
118  #define D4D_RADIOBUTTON_MIN_SIZE 8
119 #endif
120 
123 #ifndef D4D_COLOR_RADIOBUTTON_ICON_BCKG
124  #define D4D_COLOR_RADIOBUTTON_ICON_BCKG D4D_COLOR_WHITE
125 #endif
126 
129 /******************************************************************************
130 * D4D RADIO BUTTON setting public types
131 *
132 */
136 /**************************************************************************/
143 typedef void (*D4D_RDBTN_ON_CHANGE)(D4D_OBJECT* pThis);
144 
147 /******************************************************************************
148 * Private Types
149 ******************************************************************************/
150 
151 
152 
154 
155 #define D4D_RADIOBUTTON_STATUS_PRESSED_MASK (0x01)
156 #define D4D_RADIOBUTTON_STATUS_CHECKED_MASK (0x02)
157 
158 typedef struct
159 {
160  D4D_STRING textBuff; // button text
161  const D4D_BMP* pBmpChecked; // Checked state bitmap
162  const D4D_BMP* pBmpUnChecked; // Checked state bitmap
166 
167 
168 /******************************************************************************
169 * Macros
170 ******************************************************************************/
171 
172 // getting the Radio Button structure from general OBJECT
173 #define D4D_GET_RADIOBUTTON(pObj) ((D4D_RADIOBUTTON*)((pObj)->pParam))
174 #define D4D_GET_RADIOBUTTON_STATUS(pObj) ((D4D_RADIOBUTTON_STATUS*)(D4D_GET_RADIOBUTTON(pObj)->pStatus))
175 
176 
177 /******************************************************************************
178 * D4D RADIO BUTTON setting public macros
179 *
180 */
184 /**************************************************************************/
209 #define _D4D_DECLARE_RADIOBUTTON(type, name, text, x, y, cx, cy, radius, pMargin, pRelations, flags, pbmpChecked, pbmpUnChecked, pScheme, fontId, pUser, onchange, pOnUsrMsg) \
210  static D4D_RADIOBUTTON_STATUS name##_status = { 0 }; \
211  static D4D_STR_PROPERTIES name##_strPrties = { D4D_RADIOBUTTON_FNT_PRTY_DEFAULT, D4D_RADIOBUTTON_TXT_PRTY_DEFAULT}; \
212  static type D4D_RADIOBUTTON name##_params = \
213  { \
214  { text, D4D_TEXT_LEN(text), fontId, &name##_strPrties, D4D_OBJECT_MAX_TEXT_LEN(text), 0}, /* textBuff */ \
215  pbmpChecked, /* pBmpChecked */ \
216  pbmpUnChecked, /* pBmpUnChecked */ \
217  &(name##_status), /* Status clear */ \
218  onchange /* Click event */ \
219  }; \
220  \
221  D4D_DECLARE_OBJECT(type, name, x, y, cx, cy, radius, pMargin, pRelations, pOnUsrMsg, &d4d_radioButtonSysFunc, &(name##_params), flags, pUser, pScheme)
222 
223 
224 /**************************************************************************/
246 #define D4D_DECLARE_RADIOBUTTON(name, text, x, y, cx, cy, flags, pbmpChecked, pbmpUnChecked, pScheme, fontId, pUser, onchange, pOnUsrMsg) \
247  _D4D_DECLARE_RADIOBUTTON(D4D_CONST, name, text, x, y, cx, cy, 0, flags, NULL, NULL, pbmpChecked, pbmpUnChecked, pScheme, fontId, pUser, onchange, pOnUsrMsg)
248 
249 /**************************************************************************/
267 #define D4D_DECLARE_STD_RADIOBUTTON(name, text, x, y, cx, cy, pbmpChecked, pbmpUnChecked, fontId, onchange) \
268  D4D_DECLARE_RADIOBUTTON(name, text, x, y, cx, cy, (D4D_RADIOBUTTON_F_DEFAULT), pbmpChecked, pbmpUnChecked, NULL, fontId, NULL, onchange, NULL)
269 
270 // Rounded radio button definition
271 
272 /**************************************************************************/
295 #define D4D_DECLARE_RRADIOBUTTON(name, text, x, y, cx, cy, radius, flags, pbmpChecked, pbmpUnChecked, pScheme, fontId, pUser, onchange, pOnUsrMsg) \
296  _D4D_DECLARE_RADIOBUTTON(D4D_CONST, name, text, x, y, cx, cy, radius, NULL, NULL, flags, pbmpChecked, pbmpUnChecked, pScheme, fontId, pUser, onchange, pOnUsrMsg)
297 
298 /**************************************************************************/
317 #define D4D_DECLARE_STD_RRADIOBUTTON(name, text, x, y, cx, cy, radius, pbmpChecked, pbmpUnChecked, fontId, onchange) \
318  D4D_DECLARE_RRADIOBUTTON(name, text, x, y, cx, cy, radius, (D4D_RADIOBUTTON_F_DEFAULT), pbmpChecked, pbmpUnChecked, NULL, fontId, NULL, onchange, NULL)
319 
320 
321 
322 // IN RAM instantions macros
323 /**************************************************************************/
326 #define D4D_DECLARE_RADIOBUTTON_INRAM(name, text, x, y, cx, cy, flags, pbmpChecked, pbmpUnChecked, pScheme, fontId, pUser, onchange, pOnUsrMsg) \
327  _D4D_DECLARE_RADIOBUTTON(D4D_NO_CONST, name, text, x, y, cx, cy, 0, NULL, NULL, flags, pbmpChecked, pbmpUnChecked, pScheme, fontId, pUser, onchange, pOnUsrMsg)
328 
329 /**************************************************************************/
332 #define D4D_DECLARE_STD_RADIOBUTTON_INRAM(name, text, x, y, cx, cy, pbmpChecked, pbmpUnChecked, fontId, onchange) \
333  D4D_DECLARE_RADIOBUTTON_INRAM(name, text, x, y, cx, cy, (D4D_RADIOBUTTON_F_DEFAULT), pbmpChecked, pbmpUnChecked, NULL, fontId, NULL, onchange, NULL)
334 
335 
336 // Rounded radio button definition
337 
338 /**************************************************************************/
341 #define D4D_DECLARE_RRADIOBUTTON_INRAM(name, text, x, y, cx, cy, radius, flags, pbmpChecked, pbmpUnChecked, pScheme, fontId, pUser, onchange, pOnUsrMsg) \
342  _D4D_DECLARE_RADIOBUTTON(D4D_NO_CONST, name, text, x, y, cx, cy, radius, NULL, NULL, flags, pbmpChecked, pbmpUnChecked, pScheme, fontId, pUser, onchange, pOnUsrMsg)
343 
344 /**************************************************************************/
347 #define D4D_DECLARE_STD_RRADIOBUTTON_INRAM(name, text, x, y, cx, cy, radius, pbmpChecked, pbmpUnChecked, fontId, onchange) \
348  D4D_DECLARE_RRADIOBUTTON_INRAM(name, text, x, y, cx, cy, radius, (D4D_RADIOBUTTON_F_DEFAULT), pbmpChecked, pbmpUnChecked, NULL, fontId, NULL, onchange, NULL)
349 
353 /******************************************************************************
354 * Global functions
355 ******************************************************************************/
358 
359 // Obsolete functions, replaced by any general
360 #define D4D_RadioButtonSetText D4D_SetText
361 
362 
363 
364 #endif /*__D4D_RADIOBUTTON_H*/
365 
366 
367 
368 
369 
370 
371 
372 
373 
374 
375 
376 
const D4D_OBJECT_SYS_FUNCTION d4d_radioButtonSysFunc
The string type. This structure contains all properties about string in eGUI.
Definition: d4d_string.h:100
void D4D_RadioButtonSetValue(D4D_OBJECT_PTR pThis, D4D_BOOL value)
Function Sets the the radio button value.
D4D_RADIOBUTTON_STATUS * pStatus
const D4D_BMP * pBmpChecked
D4D_BOOL D4D_RadioButtonGetValue(D4D_OBJECT_PTR pThis)
Function Gets the the radio button value.
unsigned char Byte
Type definition of Byte (unsigned 8-bit).
Definition: d4d_types.h:151
Byte D4D_RADIOBUTTON_STATUS
D4D_BMP eGUI main image structure.
Definition: d4d_bmp.h:100
D4D_RDBTN_ON_CHANGE OnChange
const D4D_BMP * pBmpUnChecked
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
LWord D4D_BOOL
Type definition of eGUI boolean.
Definition: d4d_types.h:204
void(* D4D_RDBTN_ON_CHANGE)(D4D_OBJECT *pThis)
Type definition of radio button on change callback function.