eGUI alias D4D  Release 3.0
Reference Manual
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
d4d_combo_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_COMBO_BOX_H
47 #define __D4D_COMBO_BOX_H
48 
50 void D4D_ComboBoxListFeedBack(D4D_OBJECT* pThis, D4D_EVENTID eventId);
51 void D4D_ComboBoxEditFeedBack(D4D_OBJECT* pThis, D4D_EVENTID eventId);
55 /******************************************************************************
56 * Constants
57 ******************************************************************************/
58 
59 /******************************************************************************
60 * D4D COMBO BOX setting constants
61 *
62 */
68 #ifndef D4D_COMBO_BOX_F_DEFAULT
69  #define D4D_COMBO_BOX_F_DEFAULT (D4D_OBJECT_F_VISIBLE | D4D_OBJECT_F_ENABLED | D4D_OBJECT_F_TABSTOP | D4D_OBJECT_F_TOUCHENABLE | D4D_OBJECT_F_FOCUSRECT | D4D_OBJECT_F_MOUSE_NORMAL | D4D_OBJECT_F_BEVEL_RAISED)
70 #endif
71 
74 #ifndef D4D_COMBO_BOX_F_EDITBOX_DEFAULT
75  #define D4D_COMBO_BOX_F_EDITBOX_DEFAULT (D4D_OBJECT_F_VISIBLE | D4D_OBJECT_F_ENABLED | D4D_OBJECT_F_TABSTOP | D4D_OBJECT_F_TOUCHENABLE | D4D_OBJECT_F_FASTTOUCH | D4D_OBJECT_F_MOUSE_NORMAL | D4D_OBJECT_F_BEVEL_DENTED)
76 #endif
77 
80 #ifndef D4D_COMBO_BOX_F_BTN_DEFAULT
81  #define D4D_COMBO_BOX_F_BTN_DEFAULT (D4D_OBJECT_F_VISIBLE | D4D_OBJECT_F_ENABLED | D4D_OBJECT_F_TABSTOP | D4D_OBJECT_F_TOUCHENABLE | D4D_OBJECT_F_FASTTOUCH | D4D_OBJECT_F_MOUSE_NORMAL | D4D_OBJECT_F_BEVEL_RAISED | D4D_BTN_F_3D | D4D_BTN_F_CONT_RECT)
82 #endif
83 
86 #ifndef D4D_COMBO_BOX_F_LISTBOX_DEFAULT
87  #define D4D_COMBO_BOX_F_LISTBOX_DEFAULT (D4D_OBJECT_F_ENABLED | D4D_OBJECT_F_TABSTOP | D4D_OBJECT_F_TOUCHENABLE | D4D_OBJECT_F_FASTTOUCH | D4D_OBJECT_F_FOCUSRECT | D4D_OBJECT_F_MOUSE_NORMAL | D4D_OBJECT_F_BEVEL_RAISED)
88 #endif
89 
92 #ifndef D4D_COMBO_BOX_ITEM_FNT_PRTY_DEFAULT
93  #define D4D_COMBO_BOX_ITEM_FNT_PRTY_DEFAULT ( 0 )
94 #endif
95 
98 #ifndef D4D_COMBO_BOX_STR_MAX_LEN
99  #define D4D_COMBO_BOX_STR_MAX_LEN (20)
100 #endif
101 
104 /******************************************************************************
105 * D4D COMBO BOX setting public types
106 *
107 */
111 /**************************************************************************/
119 typedef void (*D4D_CMBBX_ON_EVENT)(D4D_OBJECT* pThis, D4D_EVENTID eventId);
120 
123 // ComboBox configuration (goes to ROM by default)
124 
125 
126 
127 /******************************************************************************
128 * Private Types
129 ******************************************************************************/
132 
133 typedef struct D4D_COMBO_BOX_DATA_S
134 {
137 
138 typedef struct D4D_COMBO_BOX_S
139 {
144 
145 
146 #define D4D_COMBO_BOX_CHILD_EDIT_BOX_IX 1
147 #define D4D_COMBO_BOX_CHILD_BUTTON_IX 2
148 #define D4D_COMBO_BOX_CHILD_LIST_BOX_IX 3
149 
150 D4D_EXTERN_BMP(bmp_arrow);
151 
152 /******************************************************************************
153 * Macros
154 ******************************************************************************/
155 
156 // getting the COMBO_BOX structure from general OBJECT
157 #define D4D_GET_COMBO_BOX(pObj) ((D4D_COMBO_BOX*)((pObj)->pParam))
158 #define D4D_GET_COMBO_BOX_DATA(pObj) ((D4D_COMBO_BOX_DATA*)((D4D_GET_COMBO_BOX(pObj))->pData))
159 
160 #define D4D_GET_COMBO_BOX_EDIT_BOX(pObj) ((D4D_OBJECT*)((pObj)->pRelations[D4D_COMBO_BOX_CHILD_EDIT_BOX_IX]))
161 #define D4D_GET_COMBO_BOX_BUTTON(pObj) ((D4D_OBJECT*)((pObj)->pRelations[D4D_COMBO_BOX_CHILD_BUTTON_IX]))
162 #define D4D_GET_COMBO_BOX_LIST_BOX(pObj) ((D4D_OBJECT*)((pObj)->pRelations[D4D_COMBO_BOX_CHILD_LIST_BOX_IX]))
163 
164 /******************************************************************************
165 * D4D COMBO BOX setting public macros
166 *
167 */
171 /**************************************************************************/
199 #define _D4D_DECLARE_COMBO_BOX_BEGIN(type, name, x, y, cx, cy, cy_list, radius, pMargin, pParent, flags, pScheme,\
200  itemsFontId, maxStrLen, posCnt, comboBoxItemsOff, pUser, pOnEvent, pOnUsrMsg) \
201  extern type D4D_OBJECT name##_EditBox;\
202  extern type D4D_OBJECT name##_Button;\
203  extern type D4D_OBJECT name##_ListBox;\
204  static D4D_COMBO_BOX_DATA name##_data = {-1};\
205  static const D4D_OBJECT * type name##_relations[] = {pParent, &name##_EditBox, &name##_Button, &name##_ListBox, NULL};\
206  static type D4D_COMBO_BOX name##_params = \
207  { \
208  cy_list, \
209  &(name##_data), \
210  pOnEvent \
211  }; \
212  \
213  D4D_DECLARE_OBJECT(type, name, x, y, (cx), (D4D_COOR)((cy) + cy_list), radius, pMargin, name##_relations, pOnUsrMsg, &d4d_comboBoxSysFunc, &(name##_params), (flags/* & ~(D4D_OBJECT_F_BEVEL_MASK | D4D_OBJECT_F_FOCUSRECT)*/), pUser, pScheme)\
214  \
215  static const D4D_OBJECT* const name##_EditBoxRelations[] = {&name, NULL};\
216  _D4D_DECLARE_EDIT_BOX(type, name##_EditBox, 0, 0, (D4D_COOR)((cx) - (cy)), (cy), radius, (D4D_MARGIN*)&d4d_marginDefault, name##_EditBoxRelations, D4D_COMBO_BOX_F_EDITBOX_DEFAULT, pScheme, NULL, itemsFontId, maxStrLen, (void*)&name, D4D_ComboBoxEditFeedBack, NULL) \
217  static const D4D_OBJECT* const name##_ButtonsRelations[] = {&name, NULL};\
218  _D4D_DECLARE_BUTTON(type, name##_Button, NULL, (D4D_COOR)((cx) - (cy)), 0, (cy), (cy), radius, NULL, name##_ButtonsRelations, D4D_COMBO_BOX_F_BTN_DEFAULT, &bmp_arrow, &bmp_arrow, pScheme, 0, (void*)&name, D4D_ComboBoxButtonFeedBack, D4D_ComboBoxButtonMsgFeedBack) \
219  _D4D_DECLARE_LIST_BOX_BEGIN(type, name##_ListBox, 0, (cy), (cx), cy_list, radius, (D4D_MARGIN*)&d4d_marginDefault, &name, D4D_COMBO_BOX_F_LISTBOX_DEFAULT, pScheme, itemsFontId, posCnt, comboBoxItemsOff, (void*)&name, D4D_ComboBoxListFeedBack, D4D_ComboBoxListBoxMsgFeedBack)
220 
221 /**************************************************************************/
234 #define D4D_DECLARE_COMBO_BOX_ITEM D4D_DECLARE_LIST_BOX_ITEM
235 
236 /**************************************************************************/
247 #define D4D_DECLARE_COMBO_BOX_END D4D_DECLARE_LIST_BOX_END
248 
249 
250 /**************************************************************************/
276 #define D4D_DECLARE_COMBO_BOX_BEGIN(name, x, y, cx, cy, cy_list, flags, pParent, pScheme, itemsFontId, maxStrLen, posCnt, comboBoxItemsOff, pUser, pOnEvent, pOnUsrMsg) \
277  _D4D_DECLARE_COMBO_BOX_BEGIN(D4D_CONST, name, x, y, cx, cy, cy_list, 0, (D4D_MARGIN*)&comboBox_marginDefault, pParent, flags, pScheme,\
278  itemsFontId, maxStrLen, posCnt, comboBoxItemsOff, pUser, pOnEvent, pOnUsrMsg)
279 
280 /**************************************************************************/
299 #define D4D_DECLARE_STD_COMBO_BOX_BEGIN(name, x, y, cx, cy, cy_list, pParent, itemsFontId, pOnEvent) \
300  D4D_DECLARE_COMBO_BOX_BEGIN(name, x, y, cx, cy, cy_list, (D4D_COMBO_BOX_F_DEFAULT), pParent, NULL, itemsFontId, D4D_COMBO_BOX_STR_MAX_LEN, 0, 0, NULL, pOnEvent, NULL)
301 
302 // Rounded comboBox definition
303 /**************************************************************************/
330 #define D4D_DECLARE_RCOMBO_BOX_BEGIN(name, x, y, cx, cy, cy_list, radius, flags, pParent, pScheme, itemsFontId, maxStrLen, posCnt, comboBoxItemsOff, pUser, pOnEvent, pOnUsrMsg) \
331  _D4D_DECLARE_COMBO_BOX_BEGIN(D4D_CONST, name, x, y, cx, cy, cy_list, radius, (D4D_MARGIN*)&comboBox_marginDefault, pParent, flags, pScheme,\
332  itemsFontId, maxStrLen, posCnt, comboBoxItemsOff, pUser, pOnEvent, pOnUsrMsg)
333 
334 /**************************************************************************/
354 #define D4D_DECLARE_STD_RCOMBO_BOX_BEGIN(name, x, y, cx, cy, cy_list, radius, pParent, itemsFontId, pOnEvent) \
355  D4D_DECLARE_RCOMBO_BOX_BEGIN(name, x, y, cx, cy, cy_list, radius, (D4D_COMBO_BOX_F_DEFAULT), pParent, NULL, itemsFontId, D4D_COMBO_BOX_STR_MAX_LEN, 0, 0, NULL, pOnEvent, NULL)
356 
357 
358 //IN RAM instantions macros
359 /**************************************************************************/
362 #define D4D_DECLARE_COMBO_BOX_BEGIN_INRAM(name, x, y, cx, cy, cy_list, flags, pParent, pScheme, itemsFontId, maxStrLen, posCnt, comboBoxItemsOff, pUser, pOnEvent, pOnUsrMsg) \
363  _D4D_DECLARE_COMBO_BOX_BEGIN(D4D_NO_CONST, name, x, y, cx, cy, cy_list, 0, (D4D_MARGIN*)&comboBox_marginDefault, pParent, flags, pScheme,\
364  itemsFontId, maxStrLen, posCnt, comboBoxItemsOff, pUser, pOnEvent, pOnUsrMsg)
365 
366 /**************************************************************************/
369 #define D4D_DECLARE_STD_COMBO_BOX_BEGIN_INRAM(name, x, y, cx, cy, cy_list, pParent, itemsFontId, pOnEvent) \
370  D4D_DECLARE_COMBO_BOX_BEGIN_INRAM(name, x, y, cx, cy, cy_list, (D4D_COMBO_BOX_F_DEFAULT), pParent, NULL, itemsFontId, D4D_COMBO_BOX_STR_MAX_LEN, 0, 0, NULL, pOnEvent, NULL)
371 
372 
373 // Rounded comboBox definition
374 /**************************************************************************/
377 #define D4D_DECLARE_RCOMBO_BOX_BEGIN_INRAM(name, x, y, cx, cy, cy_list, radius, flags, pParent, pScheme, itemsFontId, maxStrLen, posCnt, comboBoxItemsOff, pUser, pOnEvent, pOnUsrMsg) \
378  _D4D_DECLARE_COMBO_BOX_BEGIN(D4D_NO_CONST, name, x, y, cx, cy, cy_list, radius, (D4D_MARGIN*)&comboBox_marginDefault, pParent, flags, pScheme,\
379  itemsFontId, maxStrLen, posCnt, comboBoxItemsOff, pUser, pOnEvent, pOnUsrMsg)
380 
381 /**************************************************************************/
384 #define D4D_DECLARE_STD_RCOMBO_BOX_BEGIN_INRAM(name, x, y, cx, cy, cy_list, radius, pParent, itemsFontId, pOnEvent) \
385  D4D_DECLARE_RCOMBO_BOX_BEGIN_INRAM(name, x, y, cx, cy, cy_list, radius, (D4D_COMBO_BOX_F_DEFAULT), pParent, NULL, itemsFontId, D4D_COMBO_BOX_STR_MAX_LEN, 0, 0, NULL, pOnEvent, NULL)
386 
389 /******************************************************************************
390 * Global variables
391 ******************************************************************************/
393 
394 /******************************************************************************
395 * Global functions
396 ******************************************************************************/
397 
398 /******************************************************************************
399 * Begin of D4D_COMBO_BOX public functions
400 */
404 /**************************************************************************/
410 #define D4D_ComboBoxGetItemCount(pThis) D4D_ListBoxGetItemCount(D4D_GET_COMBO_BOX_LIST_BOX(pThis))
411 
412 /**************************************************************************/
419 #define D4D_ComboBoxFindUserDataItem(pThis, pUser) D4D_ListBoxFindUserDataItem(D4D_GET_COMBO_BOX_LIST_BOX(pThis), pUser)
420 
421 /**************************************************************************/
427 #define D4D_ComboBoxGetItemUserData(pThis) D4D_ListBoxGetItemUserData(D4D_GET_COMBO_BOX_LIST_BOX(pThis))
428 
429 /**************************************************************************/
435 #define D4D_ComboBoxGetItemText(pThis) D4D_ListBoxGetItemText(D4D_GET_COMBO_BOX_LIST_BOX(pThis))
436 
437 /**************************************************************************/
444 #define D4D_ComboBoxGetItemTextIx(pThis, ix) D4D_ListBoxGetItemTextIx(D4D_GET_COMBO_BOX_LIST_BOX(pThis), ix)
445 
446 /**************************************************************************/
452 #define D4D_ComboBoxEnsureVisible(pThis) D4D_ListBoxEnsureVisible(D4D_GET_COMBO_BOX_LIST_BOX(pThis))
453 
454 /**************************************************************************/
461 #define D4D_ComboBoxChangeItemList(pThis, pItems) D4D_ListBoxChangeItemList(D4D_GET_COMBO_BOX_LIST_BOX(pThis), pItems)
462 
463 /**************************************************************************/
469 #define D4D_ComboBoxGetItemList(pThis) D4D_ListBoxGetItemList(D4D_GET_COMBO_BOX_LIST_BOX(pThis))
470 
471 /******************************************************************************
472 * End of public functions */
474 /******************************************************************************/
475 #endif /* __D4D_COMBO_BOX_H */
476 
477 
478 
479 
const D4D_OBJECT_SYS_FUNCTION d4d_comboBoxSysFunc
Definition: d4d_combo_box.c:87
D4D_COOR list_size_y
Byte D4D_ComboBoxButtonMsgFeedBack(D4D_MESSAGE *pMsg)
This is list box item variable type.
Definition: d4d_list_box.h:131
D4D object messages structure.
Definition: d4d_base.h:400
void D4D_ComboBoxEditFeedBack(D4D_OBJECT *pThis, D4D_EVENTID eventId)
void D4D_ComboBoxButtonFeedBack(D4D_OBJECT *pThis)
D4D_LIST_BOX_INDEX D4D_COMBO_BOX_INDEX
D4D_EXTERN_BMP(bmp_arrow)
D4D_COMBO_BOX_DATA * pData
void(* D4D_CMBBX_ON_EVENT)(D4D_OBJECT *pThis, D4D_EVENTID eventId)
Type definition of combo box on event callback function.
Byte D4D_ComboBoxListBoxMsgFeedBack(D4D_MESSAGE *pMsg)
void D4D_ComboBoxListFeedBack(D4D_OBJECT *pThis, D4D_EVENTID eventId)
D4D_CMBBX_ON_EVENT OnEvent
Byte D4D_COOR
Type definition of eGUI coordination variables.
Definition: d4d_types.h:219
unsigned char Byte
Type definition of Byte (unsigned 8-bit).
Definition: d4d_types.h:151
sByte D4D_LIST_BOX_INDEX
This is list box item index variable type.
Definition: d4d_list_box.h:128
D4D_EVENTID
D4D events that is handled by object callback functions.
Definition: d4d_base.h:429
D4D_LIST_BOX_INDEX real_ix
The object main structure type definition.
Definition: d4d_object.h:167
const D4D_MARGIN comboBox_marginDefault
Definition: d4d_combo_box.c:95
The object system function needed for each object - this is part of D4D_OBJECT main structure...
Definition: d4d_object.h:134
D4D_LIST_BOX_ITEM D4D_COMBO_BOX_ITEM
struct D4D_COMBO_BOX_DATA_S D4D_COMBO_BOX_DATA
struct D4D_COMBO_BOX_S D4D_COMBO_BOX
Type definition of eGUI client area margin structure.
Definition: d4d_types.h:244