eGUI alias D4D  Release 3.0
Reference Manual
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
d4d_list_box.c
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 #include "d4d.h"
48 
49 //Internal API
51 
52 
53 static void D4D_ListBoxOnInit(D4D_OBJECT* pThis);
55 
57 {
58  D4D_DEFSTR("List Box"),
60  NULL,
61  NULL
62 };
63 
65 {
69  D4D_BEVEL_WIDTH
70 };
71 
72 // temporary structure for listBox temporary value calculation
73 typedef struct
74 {
75  D4D_POINT position;
76  D4D_POINT contentPos;
77  D4D_SIZE contentSize;
78  D4D_LIST_BOX_INDEX posCnt;
79  D4D_LIST_BOX_INDEX itemsCnt;
80  D4D_COOR textOff;
81 } D4D_LIST_BOX_TMP_VAL;
82 
83 #define _calc (*((D4D_LIST_BOX_TMP_VAL*)d4d_scratchPad))
84 
85 
86 
87 
88 /*******************************************************
89 *
90 * LIST_BOX Helper computing routines
91 *
92 *******************************************************/
94 {
95  D4D_LIST_BOX_INDEX i = 0;
96 
97  while(pListBox->pData->pItems[i].pText)
98  i++;
99 
100  return i;
101 }
102 
104 {
105  D4D_LIST_BOX* pListBox = D4D_GET_LIST_BOX(pThis);
106  D4D_LIST_BOX_INDEX index;
107  D4D_COOR fontHeight;
108  D4D_COOR sizey;
109 
110  if(pListBox->posCnt)
111  return pListBox->posCnt;
112 
113  sizey = pThis->size.cy;
114 
115 
116  if(pThis->pMargin)
117  {
118  sizey -= (D4D_COOR)(pThis->pMargin->top + pThis->pMargin->bottom);
119  }
120 
121  fontHeight = (D4D_COOR)(D4D_GetFontHeight(pListBox->itemsFontId) + 2);
122 
123  index = (D4D_LIST_BOX_INDEX)(sizey / fontHeight);
124 
125 
126  if(sizey % fontHeight)
127  index--;
128 
129  return index;
130 }
131 
132 
134 {
135  D4D_LIST_BOX* pListBox = D4D_GET_LIST_BOX(pThis);
136  _calc.position = D4D_GetClientToScreenPoint(pThis, &pThis->position);
137  _calc.contentPos = _calc.position;
138  _calc.contentSize = pThis->size;
139  _calc.posCnt = D4D_GetPositionCount(pThis);
140  _calc.itemsCnt = D4D_GetItemsCount(pListBox);
141  _calc.textOff = pListBox->textOff;
142 
143  if(pThis->pMargin)
144  {
145  _calc.contentPos.x += pThis->pMargin->left;
146  _calc.contentPos.y += pThis->pMargin->top;
147  _calc.contentSize.cx -= (pThis->pMargin->left + pThis->pMargin->right);
148  _calc.contentSize.cy -= (pThis->pMargin->top + pThis->pMargin->bottom);
149 
150  }else
151  {
152  if(pThis->initFlags & D4D_OBJECT_F_FOCUSRECT)
153  {
154  _calc.contentPos.x++;
155  _calc.contentPos.y++;
156  _calc.contentSize.cx -= 2;
157  _calc.contentSize.cy -= 2;
158  }
159  }
160 
162  _calc.contentSize.cx -= D4D_LIST_BOX_SCRLBR_WIDTH;
163 
164  // if count of items position or text offsets are not declared , then use automatic values
165  if(!_calc.textOff)
166  {
167  if(_calc.posCnt > 1)
168  _calc.textOff = (D4D_COOR)( _calc.contentSize.cy / (_calc.posCnt));
169  else
170  _calc.textOff = (D4D_COOR)(_calc.contentSize.cy / 2);
171  }
172 }
173 
174 /*******************************************************
175 *
176 * LIST_BOX Drawing routine
177 *
178 *******************************************************/
179 
180 static void D4D_ListBoxOnDraw(D4D_MESSAGE* pMsg)
181 {
182  D4D_OBJECT* pThis = pMsg->pObject;
183  D4D_LIST_BOX* pListBox = D4D_GET_LIST_BOX(pThis);
184  D4D_OBJECT_DRAWFLAGS draw = pMsg->prm.draw;
185  D4D_COLOR clrT, clrB;
186  D4D_POINT tmp_point;
187  D4D_SIZE tmp_size;
188  D4D_STRING tmp_txtbuff;
189  D4D_STR_PROPERTIES tmp_str_prty;
190  Byte tmpB;
191 
192  // Prepare the D4D-STRING structure to print items texts
193  tmp_txtbuff.str_properties = &tmp_str_prty;
194  tmp_txtbuff.printOff = 0;
195 
196  // Get background simple color
197  clrT = D4D_ObjectGetForeColor(pThis, draw);
198  clrB = D4D_ObjectGetBckgFillColor(pThis);
199 
200  #ifdef D4D_DEBUG
201  // sanity check
203  #endif
204 
205  // Compute all tempoarary values
206  D4D_ListBoxValue2Coor(pThis);
207 
208 
209  // draw just a color rectangle instead of bitmap
211  {
212  // Draw the background
213  #if D4D_ROUND_CORNER_ENABLE != D4D_FALSE
214  if(pThis->radius)
215  D4D_FillRRect(&_calc.position, &pThis->size, clrB, pThis->radius);
216  else
217  #endif
218  D4D_FillRect(&_calc.position, &pThis->size, clrB);
219  }
220 
221  // Draw the frame
222  if(draw & (D4D_OBJECT_DRAWFLAGS_COMPLETE | D4D_OBJECT_DRAWFLAGS_STATE))
223  D4D_DrawFrame(pThis, clrT, clrB);
224 
225  // Prepare all "constant" variables to draw list
226  tmp_point = _calc.contentPos;
227  tmp_size.cx = _calc.contentSize.cx;
228  tmp_size.cy = _calc.textOff;
229 
230  tmp_txtbuff.fontId = pListBox->itemsFontId;
231  tmp_txtbuff.buffSize = 0;
234 
235 
236  // Draw the list
237  for(tmpB = pListBox->pData->page_ix; tmpB < _calc.itemsCnt; tmpB++)
238  {
239  // Check end if list
240  if((tmpB - pListBox->pData->page_ix) >= _calc.posCnt)
241  break;
242 
243  if((pListBox->pData->ix != tmpB) || (!D4D_IsEnabled(pThis)))
244  {
245  clrT = D4D_ObjectGetForeFillColor(pThis);
246  clrB = D4D_ObjectGetBckgFillColor(pThis);
247  }
248  else
249  {
250  D4D_CLR_SCHEME *pScheme_tmp = D4D_ObjectGetScheme(pThis);
251  clrT = pScheme_tmp->foreFocus;
252  clrB = pScheme_tmp->bckgFocus;
253  }
254 
255  // Draw listBox item text
256  if(pListBox->pData->pItems[tmpB].pText != NULL)
257  {
258  tmp_txtbuff.pText = pListBox->pData->pItems[tmpB].pText;
259  tmp_txtbuff.printLen = D4D_GetTextLength(tmp_txtbuff.pText);
260 
261  #if D4D_ROUND_CORNER_ENABLE != D4D_FALSE
262  if(pThis->radius)
263  D4D_DrawTextRRect(&tmp_point, &tmp_size, &tmp_txtbuff, clrT, clrB, pThis->radius);
264  else
265  #endif
266  D4D_DrawTextRect(&tmp_point, &tmp_size, &tmp_txtbuff, clrT, clrB);
267 
268  tmp_point.y += _calc.textOff;
269  }
270  }
271 
272 
273 }
274 
275 /*******************************************************
276 *
277 * LIST_BOX object focus next item routine
278 *
279 *******************************************************/
281 {
282  D4D_LIST_BOX* pListBox = D4D_GET_LIST_BOX(pThis);
283  D4D_LIST_BOX_INDEX tmpPosCnt = D4D_GetPositionCount(pThis);
284  D4D_LIST_BOX_INDEX tmpItemsCnt = D4D_GetItemsCount(pListBox);
285 
286  pListBox->pData->ix++;
287 
288  if(pListBox->pData->ix >= tmpItemsCnt)
289  pListBox->pData->ix = 0;
290 
291  if(pListBox->OnEvent)
292  pListBox->OnEvent(pThis, D4D_EVENT_ONCHANGE);
293 
295 
297 }
298 
299 /*******************************************************
300 *
301 * LIST_BOX object focus previous item routine
302 *
303 *******************************************************/
305 {
306  D4D_LIST_BOX* pListBox = D4D_GET_LIST_BOX(pThis);
307  D4D_LIST_BOX_INDEX tmpPosCnt = D4D_GetPositionCount(pThis);
308  D4D_LIST_BOX_INDEX tmpItemsCnt = D4D_GetItemsCount(pListBox);
309 
310  pListBox->pData->ix--;
311 
312  if(pListBox->pData->ix < 0)
313  pListBox->pData->ix = (D4D_LIST_BOX_INDEX)(tmpItemsCnt - 1);
314 
315  if(pListBox->OnEvent)
316  pListBox->OnEvent(pThis, D4D_EVENT_ONCHANGE);
317 
319 
321 }
322 
323 /*******************************************************
324 *
325 * LIST_BOX key handling routine
326 *
327 *******************************************************/
328 
329 //static void D4D_ListBoxOnKeyDown(D4D_MESSAGE* pMsg)
330 //{
331 
332 //}
333 
334 /*******************************************************
335 *
336 * LIST_BOX key handling routine
337 *
338 *******************************************************/
339 
340 static void D4D_ListBoxOnKeyUp(D4D_MESSAGE* pMsg)
341 {
342  if(D4D_GetCapturedObject() == pMsg->pObject)
343  {
344  D4D_LIST_BOX* pListBox = D4D_GET_LIST_BOX(pMsg->pObject);
345 
346  switch(pMsg->prm.key)
347  {
350  break;
351 
352  case D4D_KEY_SCANCODE_UP:
354  break;
355 
357  if(pListBox->OnEvent)
358  pListBox->OnEvent(pMsg->pObject, D4D_EVENT_ONCLICK);
359 
362  break;
363  }
364  }else
365  if(pMsg->prm.key == D4D_KEY_SCANCODE_ENTER)
366  D4D_CaptureKeys(pMsg->pObject);
367 
368 
369 }
370 
371 /*******************************************************
372 *
373 * LIST_BOX touch screen handling routine
374 *
375 *******************************************************/
376 #if defined(D4D_LLD_TCH) || defined(D4D_LLD_MOUSE)
377 static void D4D_ListBoxOnTouch(D4D_MESSAGE* pMsg, D4D_POINT* pPoint)
378 {
379  D4D_OBJECT* pThis = pMsg->pObject;
380  D4D_LIST_BOX* pListBox = D4D_GET_LIST_BOX(pThis);
381 
382  if(pThis->pData->flags & D4D_OBJECT_F_TABSTOP)
383  {
384  if((D4D_GetFocusedObject(pMsg->pScreen) == pThis) || (pThis->pData->flags & D4D_OBJECT_F_FASTTOUCH))
385  {
386  D4D_FocusSet(pMsg->pScreen, pThis);
387 
388  D4D_ListBoxValue2Coor(pThis);
389 
390  if(pPoint->x < (pThis->position.x + pThis->size.cx - ((pThis->pRelations[D4D_LIST_BOX_CHILD_SCROLL_BAR_IX]->pData->flags & D4D_OBJECT_F_VISIBLE)? D4D_LIST_BOX_SCRLBR_WIDTH:0)))
391  {
392  // Select ListBox Item
393  D4D_COOR tmp_y;
394  Byte tmpB;
395  D4D_LIST_BOX_INDEX tmpItemsCnt = D4D_GetItemsCount(pListBox);
396 
397  tmp_y = (D4D_COOR)(pPoint->y - pThis->position.y);
398 
399  // now is in tmp_y offset of y from title bar
400 
401  // Check the list
402  for(tmpB = pListBox->pData->page_ix; tmpB < _calc.itemsCnt; tmpB++)
403  {
404  // Check end if list
405  if((tmpB - pListBox->pData->page_ix) >= _calc.posCnt)
406  break;
407 
408  if(tmp_y < _calc.textOff)
409  {
410  // founded touched line
411  if(pListBox->pData->ix != tmpB)
412  {
413  // Touched line is not focused
414  pListBox->pData->ix = (D4D_LIST_BOX_INDEX)tmpB;
415 
416  if(pListBox->OnEvent)
417  pListBox->OnEvent(pThis, D4D_EVENT_ONCHANGE);
418  }else
419  {
420  if(pListBox->OnEvent)
421  pListBox->OnEvent(pThis, D4D_EVENT_ONCLICK);
422  }
423  break;
424  }
425  tmp_y -= _calc.textOff;
426  }
428  }
429  }else
430  {
431  D4D_FocusSet(pMsg->pScreen, pThis);
432  }
433 
434  }
435 }
436 #endif
437 
438 static void D4D_ListBoxOnInit(D4D_OBJECT* pThis)
439 {
440  D4D_LIST_BOX* pListBox = D4D_GET_LIST_BOX(pThis);
441  D4D_LIST_BOX_INDEX tmpItemsCnt = D4D_GetItemsCount(pListBox);
442  D4D_BOOL showScrollBar;
443  // Try to check if the ListBox needs scroll Bar
444  D4D_ListBoxValue2Coor(pThis);
445 
446  pListBox->pData->ix = 0;
447  pListBox->pData->page_ix = 0;
448 
449  showScrollBar = ((D4D_GetPositionCount(pThis) < tmpItemsCnt) || (pThis->initFlags & D4D_LIST_BOX_F_SIDEBAR));
450 
452 
453  if(showScrollBar)
454  {
455  if(tmpItemsCnt < D4D_GetPositionCount(pThis))
457  else
459 
462  }
463 
464  if(pListBox->OnEvent)
465  pListBox->OnEvent(pThis, D4D_EVENT_ONRELOAD);
466 
467  // set flag to redraw screen
469 }
470 
471 
472 void D4D_ListBoxScrollBarsFeedBack(D4D_OBJECT* pThis, D4D_INDEX old_position, D4D_INDEX new_position)
473 {
474  D4D_LIST_BOX* pListBox = D4D_GET_LIST_BOX((D4D_OBJECT*)(pThis->userData));
475 
476  D4D_UNUSED(old_position);
477 
478  pListBox->pData->page_ix = (D4D_LIST_BOX_INDEX)new_position;
479 
481 }
482 /******************************************************************************
483 * Begin of D4D_COMBO_BOX public functions
484 */
488 /**************************************************************************/
495 {
496  D4D_LIST_BOX* pListBox = D4D_GET_LIST_BOX(pThis);
497  D4D_LIST_BOX_INDEX tmpPosCnt = D4D_GetPositionCount(pThis);
498  D4D_LIST_BOX_INDEX tmpItemsCnt = D4D_GetItemsCount(pListBox);
499 
500  // Check if the selected item is already visible
501  if((pListBox->pData->ix >= pListBox->pData->page_ix) && (pListBox->pData->ix < (pListBox->pData->page_ix + tmpPosCnt)))
502  return;
503 
504  if(pListBox->pData->ix < pListBox->pData->page_ix)
506  else
507  D4D_ScrlBrSetPosition(pThis->pRelations[D4D_LIST_BOX_CHILD_SCROLL_BAR_IX], (D4D_INDEX)(pListBox->pData->ix - tmpPosCnt + 1));
508 }
509 
510 /**************************************************************************/
517 {
518  D4D_LIST_BOX* pListBox = D4D_GET_LIST_BOX(pThis);
519 
520  if(pThis == NULL)
521  return 0;
522 
523  return pListBox->pData->ix;
524 }
525 
526 /**************************************************************************/
534 {
535  D4D_LIST_BOX* pListBox = D4D_GET_LIST_BOX(pThis);
536 
537  if(pThis == NULL)
538  return;
539 
540  if(ix > D4D_GetItemsCount(pListBox))
541  ix = D4D_GetItemsCount(pListBox);
542 
543  if(pListBox->pData->ix == ix)
544  return;
545 
546  pListBox->pData->ix = ix;
547 
549 
550  if(pListBox->OnEvent)
551  pListBox->OnEvent(pThis, D4D_EVENT_ONCHANGE);
552 }
553 
554 /**************************************************************************/
561 {
562  D4D_LIST_BOX* pListBox = D4D_GET_LIST_BOX(pThis);
563 
564  return D4D_GetItemsCount(pListBox);
565 }
566 
567 /**************************************************************************/
575 {
576  D4D_LIST_BOX* pListBox = D4D_GET_LIST_BOX(pThis);
577  D4D_LIST_BOX_INDEX i_max = D4D_GetItemsCount(pListBox);
579 
580  for(i=0;i< i_max;i++)
581  {
582  if(pListBox->pData->pItems[i].pUser == pUser)
583  return i;
584  }
585 
586  return -1;
587 }
588 
589 /**************************************************************************/
596 {
597  D4D_LIST_BOX* pListBox = D4D_GET_LIST_BOX(pThis);
598  return pListBox->pData->pItems[pListBox->pData->ix].pUser;
599 }
600 
601 /**************************************************************************/
608 {
609  D4D_LIST_BOX* pListBox = D4D_GET_LIST_BOX(pThis);
610  return D4D_GetInternalStringPointer(pListBox->pData->pItems[pListBox->pData->ix].pText);
611 }
612 
613 /**************************************************************************/
621 {
622  D4D_LIST_BOX* pListBox = D4D_GET_LIST_BOX(pThis);
623 
624  if(ix < 0 || ix >= D4D_GetItemsCount(pListBox))
625  return NULL;
626 
627  return D4D_GetInternalStringPointer(pListBox->pData->pItems[ix].pText);
628 }
629 
630 /**************************************************************************/
638 {
639  D4D_LIST_BOX* pListBox = D4D_GET_LIST_BOX(pThis);
640 
641  if(pThis == NULL || pItems == NULL)
642  return;
643 
644  pListBox->pData->pItems = pItems;
645 
646  D4D_ListBoxOnInit((D4D_OBJECT*)pThis);
647 }
648 
649 /**************************************************************************/
656 {
657  D4D_LIST_BOX* pListBox = D4D_GET_LIST_BOX(pThis);
658 
659  if(pThis == NULL)
660  return NULL;
661 
662  return (D4D_LIST_BOX_ITEM*)pListBox->pData->pItems;
663 }
664 
665 /******************************************************************************
666 * End of public functions */
668 /******************************************************************************/
669 /**************************************************************/
679 /*******************************************************
680 *
681 * The LIST_BOX message handler
682 *
683 *******************************************************/
684 
686 {
687 #if defined(D4D_LLD_TCH) || defined(D4D_LLD_MOUSE)
688  D4D_POINT touchClickPoint;
689 #endif
690 
691  switch(pMsg->nMsgId)
692  {
693  case D4D_MSG_DRAW:
694  D4D_ListBoxOnDraw(pMsg);
695  break;
696 
697  // case D4D_MSG_KEYDOWN:
698  // D4D_ListBoxOnKeyDown(pMsg);
699  // break;
700 
701  case D4D_MSG_KEYUP:
702  D4D_ListBoxOnKeyUp(pMsg);
703  break;
704 #ifdef D4D_LLD_MOUSE
706  touchClickPoint = D4D_GetMouseCoordinates(pMsg->pObject);
707  D4D_ListBoxOnTouch(pMsg, &touchClickPoint);
708  break;
709 
712  break;
713 
716  break;
717 #endif
718 
719 #ifdef D4D_LLD_TCH
720  case D4D_MSG_TOUCHED:
721  touchClickPoint = D4D_GetTouchScreenCoordinates(pMsg->pObject);
722  D4D_ListBoxOnTouch(pMsg, &touchClickPoint);
723  break;
724 #endif
725  case D4D_MSG_ONINIT:
727  D4D_ListBoxOnInit(pMsg->pObject);
728  break;
729 
730  default:
731  // call the default behavior of all objects
732  D4D_ObjOnMessage(pMsg);
733  }
734 }
D4D_INDEX buffSize
size of text buffer array
Definition: d4d_string.h:103
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_LIST_BOX_ITEM * D4D_ListBoxGetItemList(D4D_OBJECT_PTR pThis)
Function gets the current using item list.
Definition: d4d_list_box.c:655
#define D4D_OBJECT_F_FOCUSRECT
Object has an outlined rectangle.
Definition: d4d_object.h:77
#define D4D_KEY_SCANCODE_ESC
This macro is used to specify Key Scan Code ESC. If not defined, it sets to 0x01 as a default...
Definition: d4d_base.h:305
D4D_COLOR D4D_ObjectGetBckgFillColor(D4D_OBJECT *pObj)
Function return object current fill background color.
Definition: d4d_scheme.c:225
D4D_COLOR D4D_ObjectGetForeColor(D4D_OBJECT *pObj, D4D_OBJECT_DRAWFLAGS draw)
Function return object current fore color.
Definition: d4d_scheme.c:161
static D4D_LIST_BOX_INDEX D4D_GetPositionCount(D4D_OBJECT *pThis)
Definition: d4d_list_box.c:103
void D4D_ListBoxChangeItemList(D4D_OBJECT_PTR pThis, const D4D_LIST_BOX_ITEM *pItems)
Function change the items list using by list box.
Definition: d4d_list_box.c:637
#define D4D_KEY_SCANCODE_UP
This macro is used to specify Key Scan Code UP. If not defined, it sets to 0x51 as a default...
Definition: d4d_base.h:280
const D4D_MARGIN listBox_marginDefault
Definition: d4d_list_box.c:64
D4D_TEXT_PROPERTIES text_properties
Text properties structure.
Definition: d4d_string.h:96
void D4D_FillRect(D4D_POINT *ppt, D4D_SIZE *psz, D4D_COLOR color)
Function draw filled rectangle on the screen.
D4D_INDEX printLen
Length of string that should be used (printed).
Definition: d4d_string.h:106
D4D_LIST_BOX_INDEX D4D_ListBoxGetItemCount(D4D_OBJECT_PTR pThis)
Function gets the count of list box items.
Definition: d4d_list_box.c:560
This is list box item variable type.
Definition: d4d_list_box.h:131
On Reload.
Definition: d4d_base.h:435
Type definition of eGUI point structure.
Definition: d4d_types.h:223
D4D_COOR left
Margin of left side.
Definition: d4d_types.h:246
On Init message - is send for first time when the object is inicialized.
Definition: d4d_base.h:370
D4D object messages structure.
Definition: d4d_base.h:400
D4D_OBJECT_DATA_PTR pData
Pointer on runtime object data.
Definition: d4d_object.h:180
Mouse Whell Move Down message - is send in case that mouse whell move down is detected on this object...
Definition: d4d_base.h:390
#define D4D_FALSE
This is definition of boolean operation value in eGUI - FALSE.
Definition: d4d_types.h:104
The string type. This structure contains all properties about string in eGUI.
Definition: d4d_string.h:100
D4D_TCHAR * pText
pointer to item text
Definition: d4d_list_box.h:133
D4D_COLOR D4D_ObjectGetForeFillColor(D4D_OBJECT *pObj)
Function return object current fill fore color.
Definition: d4d_scheme.c:208
D4D_OBJECT_INITFLAGS initFlags
The initializations object flags.
Definition: d4d_object.h:178
#define D4D_OBJECT_F_TABSTOP
Object can be focused.
Definition: d4d_object.h:74
#define D4D_DrawTextRect(ppt, psz, buffText, colorText, colorBkgd)
Function that draw text into defined rectangle on the screen.
void D4D_ScrlBrSetPosition(D4D_OBJECT_PTR pObj, D4D_INDEX position)
The function sets the scroll bar position.
#define D4D_LIST_BOX_SCRLBR_WIDTH
This is list box embedded scroll bar width If not defined, it sets to 20 pixels as a default...
Definition: d4d_list_box.h:87
D4D_TCHAR * D4D_GetInternalStringPointer(const D4D_TCHAR *originTxt)
The function gets the real internal pointer to string.
Definition: d4d_string.c:108
D4D_FONT fontId
index of used font
Definition: d4d_string.h:104
static void D4D_ListBoxValue2Coor(D4D_OBJECT *pThis)
Definition: d4d_list_box.c:133
const D4D_OBJECT_SYS_FUNCTION d4d_listBoxSysFunc
Definition: d4d_list_box.c:56
D4D_POINT D4D_GetTouchScreenCoordinates(D4D_OBJECT *pObject)
D4D_COOR textOff
Definition: d4d_list_box.h:154
#define D4D_TRUE
This is definition of boolean operation value in eGUI - TRUE.
Definition: d4d_types.h:106
void D4D_DrawFrame(D4D_OBJECT *pObject, D4D_COLOR clrT, D4D_COLOR clrB)
Function draw standard object frame based on the object settings and current state.
#define D4D_LIST_BOX_F_SIDEBAR
Force to used always side bar scroll bar.
Definition: d4d_list_box.h:69
D4D_FONT itemsFontId
Definition: d4d_list_box.h:152
struct D4D_OBJECT_S * pObject
Pointer to object who is receiver of this message. If the receiver is just screen this field must be ...
Definition: d4d_base.h:402
Key Up message - is send when the object get new Key Up event.
Definition: d4d_base.h:377
D4D Driver main header file.
#define D4D_KEY_SCANCODE_ENTER
This macro is used to specify Key Scan Code ENTER. If not defined, it sets to 0x1C as a default...
Definition: d4d_base.h:300
D4D_OBJECT_FLAGS flags
runtime object flags
Definition: d4d_object.h:145
The string properties type. This structure contains as Font as Text properties.
Definition: d4d_string.h:93
#define D4D_GetMouseCoordinates(pObject)
Definition: d4d_mouse.h:226
#define D4D_OBJECT_DRAWFLAGS_COMPLETE
Draw complete flag.
Definition: d4d_base.h:361
void D4D_ScrlBrSetRange(D4D_OBJECT_PTR pObj, D4D_INDEX minimum, D4D_INDEX maximum)
The function sets the range of scroll bar scale.
D4D_LIST_BOX_DATA * pData
Definition: d4d_list_box.h:155
#define D4D_SCRATCHPAD_SIZE
Call back function raised by any new input event (touch, mouse, keys).
Definition: d4d_base.h:579
D4D_LIST_BOX_INDEX D4D_ListBoxGetIndex(D4D_OBJECT *pThis)
Function returns the current selected item index.
Definition: d4d_list_box.c:516
Mouse Left Button Release message - is send in case that mouse left release is detected on this objec...
Definition: d4d_base.h:384
D4D Driver private header file.
#define D4D_KEY_SCANCODE_DOWN
This macro is used to specify Key Scan Code DOWN. If not defined, it sets to 0x50 as a default...
Definition: d4d_base.h:285
#define D4D_DEFSTR(str)
Macro that helps declare the strings in eGUI.
Definition: d4d_string.h:246
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
D4D_TCHAR * D4D_ListBoxGetItemTextIx(D4D_OBJECT_PTR pThis, D4D_LIST_BOX_INDEX ix)
Function gets the text of item choosed by item index.
Definition: d4d_list_box.c:620
D4D_COOR cx
Size in axis X (width)
Definition: d4d_types.h:232
void D4D_ListBoxOnMessage(D4D_MESSAGE *pMsg)
Definition: d4d_list_box.c:685
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
#define D4D_OBJECT_DRAWFLAGS_STATE
Draw just change of state flag.
Definition: d4d_base.h:364
D4D_COOR radius
Object corners radius.
Definition: d4d_object.h:171
void D4D_ScrlBrSetStep(D4D_OBJECT_PTR pObj, D4D_INDEX page, D4D_INDEX step)
The function sets the step and page of scroll bar scale.
unsigned char Byte
Type definition of Byte (unsigned 8-bit).
Definition: d4d_types.h:151
#define D4D_GET_LIST_BOX(pObj)
Definition: d4d_list_box.h:167
D4D_COOR bottom
Margin of bottom side.
Definition: d4d_types.h:249
void D4D_ObjOnMessage(D4D_MESSAGE *pMsg)
Definition: d4d_object.c:443
D4D_LIST_BOX_INDEX D4D_ListBoxFindUserDataItem(D4D_OBJECT_PTR pThis, void *pUser)
Function finds the index of items with specified user data.
Definition: d4d_list_box.c:574
#define D4D_LIST_BOX_ITEM_TXT_PRTY_DEFAULT
This is list box init text properties. If not defined, it sets to (D4D_ALIGN_H_LEFT_MASK | D4D_ALIGN_...
Definition: d4d_list_box.h:99
void D4D_ShowObject(D4D_OBJECT_PTR pObject, D4D_BOOL bShow)
Function control visibility of object on screen.
Definition: d4d_object.c:92
D4D_COOR right
Margin of right side.
Definition: d4d_types.h:248
#define _calc
Definition: d4d_list_box.c:83
void D4D_ListBoxScrollBarsFeedBack(D4D_OBJECT *pThis, D4D_INDEX old_position, D4D_INDEX new_position)
Definition: d4d_list_box.c:472
void D4D_FocusSet(const D4D_SCREEN *pScreen, D4D_OBJECT_PTR pObject)
The function set the obejct focus to new object.
Definition: d4d_screen.c:430
D4D_INDEX D4D_GetTextLength(D4D_TCHAR *pText)
The function returns lenght of text.
Definition: d4d_string.c:329
void D4D_ListBoxSetIndex(D4D_OBJECT *pThis, D4D_LIST_BOX_INDEX ix)
Function select new item by index.
Definition: d4d_list_box.c:533
#define NULL
Type definition of null pointer.
Definition: d4d_types.h:184
sByte D4D_LIST_BOX_INDEX
This is list box item index variable type.
Definition: d4d_list_box.h:128
#define D4D_ASSERT(cond)
Definition: d4d_base.h:583
D4D_OBJECT_USR_DATA userData
The pointer on user data container (user pointer and optionaly parent/children).
Definition: d4d_object.h:176
D4D_CLR_SCHEME * D4D_ObjectGetScheme(D4D_OBJECT *pObj)
Function return the pointer to current use object scheme of object.
Definition: d4d_scheme.c:109
D4D_TCHAR * pText
pointer to text array
Definition: d4d_string.h:102
D4D_STR_PROPERTIES * str_properties
pointer to string properties
Definition: d4d_string.h:105
D4D_COOR y
Coordination in axis Y.
Definition: d4d_types.h:226
D4D_COLOR bckgFocus
The object background color in focused state.
Definition: d4d_scheme.h:583
#define D4D_OBJECT_F_NOTINIT
Definition: d4d_object.h:113
#define D4D_LIST_BOX_SCRLBR_STEP
This is list box embedded scroll bar change step If not defined, it sets to 1 step as a default...
Definition: d4d_list_box.h:93
D4D_OBJECT_PTR D4D_GetFocusedObject(const D4D_SCREEN *pScreen)
The function returns pointer to object that is focused in given screen.
Definition: d4d_screen.c:266
D4D_MSGID nMsgId
Type of message.
Definition: d4d_base.h:404
D4D_SIZE size
Size of the object.
Definition: d4d_object.h:170
void D4D_ListBoxEnsureVisible(D4D_OBJECT *pThis)
Function ensure that the selected item in list will be scrolled to visible area.
Definition: d4d_list_box.c:494
D4D_KEY_SCANCODE key
There will be stored only code of key without release / press information - is valid with D4D_MSG_KEY...
Definition: d4d_base.h:409
D4D_BOOL D4D_IsVisible(D4D_OBJECT *pObject)
Function find out if the object is visible or not.
Definition: d4d_object.c:325
#define D4D_GET_LIST_BOX_SCROLL_BAR(pObj)
Definition: d4d_list_box.h:169
D4D_POINT D4D_GetClientToScreenPoint(D4D_OBJECT *pObject, D4D_POINT *nClientPoint)
The function convert client point on the screen to the global screen point.
Definition: d4d_screen.c:536
LWord D4D_INDEX
Type definition of eGUI general index variables.
Definition: d4d_types.h:206
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
#define D4D_BEVEL_WIDTH
D4D_BEVEL_WIDTH constant declaration - can&#39;t be changed!
Draw message - is send when the object should be redrawed.
Definition: d4d_base.h:371
static void D4D_ListBoxOnDraw(D4D_MESSAGE *pMsg)
Definition: d4d_list_box.c:180
D4D_TCHAR * D4D_ListBoxGetItemText(D4D_OBJECT_PTR pThis)
Function gets the selected item text.
Definition: d4d_list_box.c:607
#define D4D_LIST_BOX_ITEM_FNT_PRTY_DEFAULT
This is list box init font properties. If not defined, it sets to ( 0 ) as a default.
Definition: d4d_list_box.h:105
D4D_COOR cy
Size in axis Y (height)
Definition: d4d_types.h:233
The object system function needed for each object - this is part of D4D_OBJECT main structure...
Definition: d4d_object.h:134
D4D_OBJECT_RELATIONS pRelations
Relationship between the objects.
Definition: d4d_object.h:177
D4D_LIST_BOX_INDEX page_ix
Definition: d4d_list_box.h:146
#define D4D_OBJECT_F_VISIBLE
Object after initialization is visible on the screen.
Definition: d4d_object.h:72
#define D4D_OBJECT_F_FASTTOUCH
Object has enabled fast touch screen capability. This option supports only a some objects (button...
Definition: d4d_object.h:76
Touched message - is send when the object is touched by touch screen driver.
Definition: d4d_base.h:379
LWord D4D_BOOL
Type definition of eGUI boolean.
Definition: d4d_types.h:204
#define D4D_UNUSED(x)
Macro used just for notify compiler that the input parameter is not used.
Definition: d4d_base.h:504
Type definition of eGUI size structure.
Definition: d4d_types.h:230
D4D_LSTBX_ON_EVENT OnEvent
Definition: d4d_list_box.h:156
#define D4D_DrawTextRRect(ppt, psz, buffText, colorText, colorBkgd, radius)
Function that draw text into defined rectangle on the screen with corner radius.
D4D_OBJECT_DRAWFLAGS draw
Contains draw flags - is valid with D4D_MSG_DRAW and D4D_MSG_DRAWDONE message.
Definition: d4d_base.h:408
D4D_LIST_BOX_INDEX posCnt
Definition: d4d_list_box.h:153
void D4D_FillRRect(D4D_POINT *ppt, D4D_SIZE *psz, D4D_COLOR color, D4D_COOR radius)
Function draw filled rectangle on the screen with round corners.
void * D4D_ListBoxGetItemUserData(D4D_OBJECT_PTR pThis)
Function gets the selected item user data.
Definition: d4d_list_box.c:595
const D4D_LIST_BOX_ITEM * pItems
Definition: d4d_list_box.h:147
D4D_LIST_BOX_INDEX ix
Definition: d4d_list_box.h:145
On Click Event.
Definition: d4d_base.h:431
static void D4D_ListBoxFocusPreviousItem(D4D_OBJECT *pThis)
Definition: d4d_list_box.c:304
static void D4D_ListBoxFocusNextItem(D4D_OBJECT *pThis)
Definition: d4d_list_box.c:280
static void D4D_ListBoxOnInit(D4D_OBJECT *pThis)
Definition: d4d_list_box.c:438
On Change Event.
Definition: d4d_base.h:433
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
void * pUser
pointer to void (it can be retype to any other user data in size or less that is pointer size) ...
Definition: d4d_list_box.h:134
Byte D4D_OBJECT_DRAWFLAGS
Drawing object flags type, handled to object in D4D_MSG_DRAW events.
Definition: d4d_base.h:359
LWord D4D_COLOR
Type definition of eGUI color variables.
Definition: d4d_types.h:262
struct D4D_SCREEN_S * pScreen
Pointer to screen who is receiver of this message.
Definition: d4d_base.h:403
D4D_FONT_PROPERTIES font_properties
Font properties structure.
Definition: d4d_string.h:95
D4D_FONT_SIZE D4D_GetFontHeight(D4D_FONT ix)
Definition: d4d_font.c:381
Mouse Whell Move Up message - is send in case that mouse whell move up is detected on this object...
Definition: d4d_base.h:389
static D4D_LIST_BOX_INDEX D4D_GetItemsCount(D4D_LIST_BOX *pListBox)
Definition: d4d_list_box.c:93
D4D_INDEX printOff
Offset of string that should be used (printed).
Definition: d4d_string.h:107
D4D_COLOR foreFocus
The object fore color in focused state.
Definition: d4d_scheme.h:587
D4D_COOR top
Margin of top side.
Definition: d4d_types.h:247
D4D_COOR x
Coordination in axis X.
Definition: d4d_types.h:225
union D4D_MESSAGE_S::@0 prm
Additional data for some type of messages.
Type definition of eGUI client area margin structure.
Definition: d4d_types.h:244
static void D4D_ListBoxOnKeyUp(D4D_MESSAGE *pMsg)
Definition: d4d_list_box.c:340
D4D_BOOL D4D_IsEnabled(D4D_OBJECT *pObject)
Function find out if the object is enabled or not.
Definition: d4d_object.c:303
#define D4D_LIST_BOX_CHILD_SCROLL_BAR_IX
Definition: d4d_list_box.h:160
D4D_OBJECT * D4D_GetCapturedObject(void)
Function returns the current keys capturing object pointer.
Definition: d4d_object.c:241