eGUI alias D4D  Release 3.0
Reference Manual
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
d4d_text_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 
50 typedef struct
51 {
52  D4D_TCHAR* pWord;
53  D4D_FONT fnt;
54  D4D_COOR cur_pos;
55  D4D_COOR pixLen;
56  D4D_INDEX charCnt;
57  D4D_BOOL newLine;
58  D4D_TAB* pTab;
59  D4D_INDEX offset;
60 }D4D_TXTBX_WORD_DESC;
61 
62 // Internal API
65 
66 
67 
69 static D4D_INDEX D4D_TextBoxGetMaxLineChars(D4D_TCHAR* pText, D4D_INDEX offset, D4D_TAB* pTab, D4D_COOR len, D4D_FONT fnt);
70 static D4D_BOOL D4D_TextBoxGetWordSpec(D4D_TXTBX_WORD_DESC* wordDesc);
71 static D4D_BOOL D4D_TextBoxGetCharsToLine(D4D_TXTBX_WORD_DESC* wordDesc);
74 static void D4D_TextBoxOnInit(D4D_OBJECT* pObject);
75 
76 
78 {
79  D4D_DEFSTR("Text Box"),
81  NULL,
82  NULL
83 };
84 
85 typedef struct
86 {
87  D4D_POINT position;
88  D4D_GEOMETRY contentGeom;
89  D4D_GEOMETRY txtGeom;
90  D4D_INDEX lineCount;
91 } D4D_TXTBX_TMP_VAL;
92 
93 #define _calc (*((D4D_TXTBX_TMP_VAL*)d4d_scratchPad))
94 
95 static void D4D_TextBoxValue2Coor(D4D_OBJECT* pThis)
96 {
97  D4D_TEXTBOX* pTextBox = D4D_GET_TEXTBOX(pThis);
98  D4D_INDEX tmpIx;
99 
100  _calc.position = D4D_GetClientToScreenPoint(pThis, &pThis->position);
101  D4D_ComputeGeometry(&(_calc.contentGeom), pThis);
102 
103  _calc.txtGeom = _calc.contentGeom;
104 
105 #if D4D_ROUND_CORNER_ENABLE == D4D_TRUE
106  _calc.txtGeom.pnt.y += (D4D_COOR)(pThis->radius / 2);
107  _calc.txtGeom.pnt.x += (D4D_COOR)(pThis->radius / 2);
108 #endif
109 
110  if(D4D_GET_TEXTBOX_SCROLL_BAR_HOR(pThis)->pData->flags & D4D_OBJECT_F_VISIBLE)
111  _calc.txtGeom.sz.cx -= D4D_TXTBX_SCRLBR_WIDTH;
112 
114  _calc.txtGeom.sz.cx -= pThis->radius;
115  _calc.txtGeom.sz.cy -= pThis->radius;
116 #endif
117 
118  // Compute the lines count in object
119  _calc.lineCount = (D4D_COOR) (_calc.txtGeom.sz.cy / D4D_GetFontHeight(pTextBox->textFontId));
120 
121  tmpIx = D4D_TextBoxGetLineCount(pThis);
122 
123  if(_calc.lineCount > tmpIx)
124  _calc.lineCount = tmpIx;
125 
126 }
127 
128 static D4D_BOOL D4D_TextBoxGetWordSpecInt(D4D_TCHAR ch, D4D_TXTBX_WORD_DESC* wordDesc)
129 {
130  D4D_COOR tab;
131 
132  // normal char or any special char
133  if(ch <= ' ')
134  {
135  // special char
136 
137  if(wordDesc->charCnt) // if any chars are decoded (Word loaded) finish the function
138  return D4D_FALSE;
139 
140  switch(ch)
141  {
142  case ' ': // space
143  wordDesc->pixLen = D4D_GetCharWidth(wordDesc->fnt, ' ');
144  break;
145 
146  case '\n': // new line
147  wordDesc->newLine = D4D_TRUE;
148  break;
149 
150  case '\t': // Tab
151  tab = D4D_GetNextTab(wordDesc->pTab, wordDesc->cur_pos);
152 
153  if(tab)
154  wordDesc->pixLen = (D4D_COOR)(tab - wordDesc->cur_pos);
155  else
156  wordDesc->pixLen = D4D_GetCharWidth(wordDesc->fnt, '\t');
157  break;
158 
159  default:
160  // unsupported char
161  break;
162  }
163 
164  wordDesc->charCnt++; // increament the one processed char
165  return D4D_FALSE;
166 
167  }else
168  {
169  // normal char
170  wordDesc->pixLen += D4D_GetCharWidth(wordDesc->fnt, ch);
171  }
172  return D4D_TRUE;
173 
174 }
175 
176 
177 
178 static D4D_BOOL D4D_TextBoxGetWordSpec(D4D_TXTBX_WORD_DESC* wordDesc)
179 {
180  D4D_TCHAR* pTmpWord = wordDesc->pWord;
181  D4D_TCHAR* pTextInt;
182  wordDesc->newLine = D4D_FALSE;
183  wordDesc->pixLen = 0;
184  wordDesc->charCnt = 0;
185 
186  if(pTmpWord == NULL)
187  return D4D_TRUE;
188 
189  pTextInt = D4D_GetInternalStringPointer(pTmpWord);
190 
191 #if D4D_EXTSRC_TEXT_ENABLE != D4D_FALSE
192 
193  if(pTextInt == NULL)
194  {
195  D4D_INDEX charCnt = 0;
196  D4D_INDEX charOff = wordDesc->offset;
197  D4D_INDEX charCntTmp;
198 
200 
201  if(!((D4D_TCHAR*)d4d_extsrcBuffer)[0])
202  return D4D_TRUE;
203 
204  do
205  {
206  charOff += charCnt;
207 
209 
210 
211  for(charCntTmp = 0; charCntTmp < charCnt; charCntTmp++)
212  {
213  if(D4D_TextBoxGetWordSpecInt(((D4D_TCHAR*)d4d_extsrcBuffer)[charCntTmp], wordDesc))
214  {
215 
216  wordDesc->charCnt++; // increament the one processed char
217  }else
218  return D4D_FALSE;
219  }
220  }while(charCnt == D4D_EXTSRC_BUFF_SIZE);
221  }
222  else
223  #endif
224 
225  {
226  pTextInt += wordDesc->offset;
227 
228  if(! *pTextInt)
229  return D4D_TRUE;
230 
231  while(*pTextInt) // check if the tested strings isn't on end
232  {
233  if(D4D_TextBoxGetWordSpecInt(*pTextInt, wordDesc))
234  {
235 
236  wordDesc->charCnt++; // increament the one processed char
237  pTextInt++; // increment WORD pointer to next char
238  }else
239  return D4D_FALSE;
240  }
241  }
242 
243  return D4D_FALSE;
244 
245 }
246 
247 
248 static D4D_BOOL D4D_TextBoxGetCharsToLine(D4D_TXTBX_WORD_DESC* wordDesc)
249 {
250  D4D_TCHAR* pTmpWord = wordDesc->pWord;
251  D4D_COOR len, tmp_len;
252 
253  len = wordDesc->pixLen;
254  wordDesc->pixLen = 0;
255  wordDesc->newLine = D4D_FALSE;
256  wordDesc->charCnt = 0;
257 
258  if(pTmpWord == NULL)
259  return D4D_FALSE;
260 
261  pTmpWord = D4D_GetInternalStringPointer(pTmpWord);
262 
263  #if D4D_EXTSRC_TEXT_ENABLE != D4D_FALSE
264 
265  if(pTmpWord == NULL)
266  {
267  D4D_INDEX charCnt = 0;
268  D4D_INDEX charOff = wordDesc->offset;
269  D4D_INDEX charCntTmp;
270 
271 
272  do
273  {
274  charOff += charCnt;
275 
277 
278 
279  for(charCntTmp = 0; charCntTmp < charCnt; charCntTmp++)
280  {
281  tmp_len = D4D_GetCharWidth(wordDesc->fnt, ((D4D_TCHAR*)d4d_extsrcBuffer)[charCntTmp]);
282 
283  // normal char
284  if((wordDesc->pixLen + tmp_len) > len)
285  return D4D_TRUE;
286 
287  wordDesc->pixLen += tmp_len;
288  wordDesc->charCnt++; // increament the one processed char
289  }
290  }while(charCnt == D4D_EXTSRC_BUFF_SIZE);
291  }
292  else
293  #endif
294 
295  {
296  pTmpWord += wordDesc->offset;
297 
298  while(*pTmpWord) // check if the tested strings isn't on end
299  {
300  tmp_len = D4D_GetCharWidth(wordDesc->fnt, *pTmpWord);
301 
302  // normal char
303  if((wordDesc->pixLen + tmp_len) > len)
304  return D4D_TRUE;
305 
306  wordDesc->pixLen += tmp_len;
307  wordDesc->charCnt++; // increament the one processed char
308  pTmpWord++; // increment WORD pointer to next char
309  }
310  }
311 
312  return D4D_TRUE;
313 }
314 
315 
316 
317 
319 {
320  D4D_TXTBX_WORD_DESC tmp_wordDesc;
321  D4D_COOR tmp_len = 0;
322  D4D_INDEX res_charCnt = 0;
323 
324  tmp_wordDesc.fnt = fnt;
325  tmp_wordDesc.pWord = pText;
326  tmp_wordDesc.pTab = pTab;
327  tmp_wordDesc.cur_pos = 0;
328  tmp_wordDesc.offset = offset;
329 
330  while(!D4D_TextBoxGetWordSpec(&tmp_wordDesc))
331  {
332  if((tmp_len + tmp_wordDesc.pixLen) > len)
333  {
334  if(tmp_len == 0)
335  {
336  // very long word - longer than one line
337  tmp_wordDesc.pixLen = len;
338  (void)D4D_TextBoxGetCharsToLine(&tmp_wordDesc);
339  }else
340  return res_charCnt;
341  }
342 
343 
344  tmp_len += tmp_wordDesc.pixLen;
345  res_charCnt += tmp_wordDesc.charCnt;
346 
347  if(tmp_wordDesc.newLine)
348  return res_charCnt;
349 
350  //tmp_wordDesc.pWord = &pText[res_charCnt];
351  tmp_wordDesc.offset += tmp_wordDesc.charCnt;
352  tmp_wordDesc.cur_pos = tmp_len;
353  }
354 
355  return (D4D_INDEX)(tmp_wordDesc.charCnt + res_charCnt);
356 }
357 
359 {
360  // The function counts with filled _calc variable
361  D4D_TEXTBOX* pTextBox = D4D_GET_TEXTBOX(pThis);
362  D4D_TCHAR* pText = pTextBox->pData->pTxtArr;
363  D4D_INDEX lineCharCnt;
364  D4D_INDEX textIx = 0;
365  D4D_INDEX lineCnt = 0;
366  D4D_TAB tmp_strTab;
367  D4D_TAB* pTab = NULL;
368  // Try to check if the Text Box needs scroll Bar
369 
370  if(pTextBox->pTabTable)
371  {
372  tmp_strTab.pTabTable = pTextBox->pTabTable;
373  tmp_strTab.tabOffset = (D4D_COOR)(_calc.contentGeom.pnt.x - _calc.position.x);
374  pTab = &tmp_strTab;
375  }
376 
377  do
378  {
379  lineCharCnt = D4D_TextBoxGetMaxLineChars(pText, textIx, pTab, _calc.txtGeom.sz.cx, pTextBox->textFontId);
380  textIx += lineCharCnt;
381 
382  if(lineCharCnt)
383  lineCnt++;
384 
385  }while(lineCharCnt);
386 
387  return lineCnt;
388 }
389 
390 
392 {
393  // The function counts with filled _calc variablez;
394  D4D_TEXTBOX* pTextBox = D4D_GET_TEXTBOX(pThis);
395  D4D_TCHAR* pText = pTextBox->pData->pTxtArr;
396  D4D_INDEX lineCharCnt;
397  D4D_INDEX textIx = 0;
398  D4D_INDEX lineCnt = 0;
399  D4D_TAB tmp_strTab;
400  D4D_TAB* pTab = NULL;
401 
402  D4D_TextBoxValue2Coor(pThis);
403 
404  if(pTextBox->pTabTable)
405  {
406  tmp_strTab.pTabTable = pTextBox->pTabTable;
407  tmp_strTab.tabOffset = (D4D_COOR)(_calc.txtGeom.pnt.x - _calc.position.x);
408  pTab = &tmp_strTab;
409  }
410 
411  do
412  {
413  if(line == lineCnt)
414  return textIx;
415 
416  lineCharCnt = D4D_TextBoxGetMaxLineChars(pText, textIx, pTab, _calc.txtGeom.sz.cx, pTextBox->textFontId);
417 
418  textIx += lineCharCnt;
419 
420  if(lineCharCnt)
421  lineCnt++;
422 
423  }while(lineCharCnt);
424 
425  return 0;
426 }
427 
428 
429 
431 {
432 
433  // Try to check if the Text Box needs scroll Bar
434 
435  // Switch off possible scroll bar in refresh case
436  D4D_GET_TEXTBOX_SCROLL_BAR_HOR(pObject)->pData->flags &= ~D4D_OBJECT_F_VISIBLE;
437 
438  D4D_TextBoxValue2Coor(pObject);
439 
440  if(D4D_TextBoxGetLineCount(pObject) > _calc.lineCount)
441  {
442  D4D_GET_TEXTBOX_SCROLL_BAR_HOR(pObject)->pData->flags |= D4D_OBJECT_F_VISIBLE;
443 
444  D4D_TextBoxValue2Coor(pObject);
445 
449  return D4D_TRUE;
450  }
451  return D4D_FALSE;
452 }
453 
454 
455 /*******************************************************
456 *
457 * TEXTBOX Drawing routine
458 *
459 *******************************************************/
460 
461 static void D4D_TextBoxOnDraw(D4D_MESSAGE* pMsg)
462 {
463  D4D_OBJECT* pThis = pMsg->pObject;
464  D4D_TEXTBOX* pTextBox = D4D_GET_TEXTBOX(pThis);
465  D4D_TXTBX_DATA* pData = pTextBox->pData;
466  D4D_OBJECT_DRAWFLAGS draw = pMsg->prm.draw;
467  D4D_COLOR clrT, clrB;
468  D4D_INDEX line_cnt;
469  D4D_POINT tmp_point;
470  D4D_SIZE tmp_size;
471  D4D_STRING tmp_txtbuff;
472  D4D_STR_PROPERTIES tmp_strPrties;
473  D4D_TAB tmp_strTab;
474  D4D_TAB* pTab = NULL;
475 
476  D4D_TextBoxValue2Coor(pThis);
477 
478  clrT = D4D_ObjectGetForeFillColor(pThis);
479  clrB = D4D_ObjectGetBckgFillColor(pThis);
480 
481  // draw the rectangle around the text
483  {
484 
485  D4D_FillRRect(&_calc.position, &pThis->size, clrB, pThis->radius);
486  pData->redrawText = D4D_TRUE;
487 
488  }
489 
490  // Draw the frame
491  if(draw & (D4D_OBJECT_DRAWFLAGS_COMPLETE | D4D_OBJECT_DRAWFLAGS_STATE))
492  D4D_DrawFrame(pThis, clrT, clrB);
493 
494 
495  if(pData->redrawText)
496  {
497  D4D_INDEX tmp_index = pData->firstShowedCharIx;
498 
499  pData->redrawText = D4D_FALSE;
500 
501  tmp_txtbuff.fontId = pTextBox->textFontId;
502  tmp_txtbuff.str_properties = &tmp_strPrties;
503 
504  tmp_strPrties.font_properties = 0;
505  tmp_strPrties.text_properties = 0;
506 
507  // Draw all lines of textbox
508  tmp_point = _calc.txtGeom.pnt;
509  tmp_size.cx = _calc.txtGeom.sz.cx;
510  tmp_size.cy = D4D_GetFontHeight(pTextBox->textFontId);
511 
512  tmp_txtbuff.pText = pData->pTxtArr;
513  tmp_txtbuff.buffSize = 0;
514 
515  if(pTextBox->pTabTable)
516  {
517  tmp_strTab.pTabTable = pTextBox->pTabTable;
518  tmp_strTab.tabOffset = (D4D_COOR)(_calc.txtGeom.pnt.x - _calc.position.x);
519  pTab = &tmp_strTab;
520  }
521 
522  for(line_cnt = 0; line_cnt < _calc.lineCount; line_cnt++)
523  {
524  tmp_txtbuff.printLen = D4D_TextBoxGetMaxLineChars(tmp_txtbuff.pText, tmp_index, pTab, tmp_size.cx, tmp_txtbuff.fontId);
525  tmp_txtbuff.printOff = tmp_index;
526  tmp_index += tmp_txtbuff.printLen;
527 
528  D4D_DrawTextRectTab(&tmp_point, &tmp_size, &tmp_txtbuff, pTab, clrT, clrB);
529 
530  tmp_point.y += tmp_size.cy;
531  }
532  }
533 }
534 
535 static void D4D_TextBoxOnInit(D4D_OBJECT* pObject)
536 {
537  D4D_TEXTBOX* pTextBox = D4D_GET_TEXTBOX(pObject);
538 
539  pTextBox->pData->firstShowedCharIx = 0;
540 
541  (void)D4D_TextBoxScrollBarSetup(pObject);
542 
543  // set flag to redraw screen
544  D4D_InvalidateObject(pObject, D4D_TRUE);
545 }
546 
547 /**************************************************************/
557 void D4D_TextBoxScrollBarsFeedBack(D4D_OBJECT* pThis, D4D_INDEX old_position, D4D_INDEX new_position)
558 {
560 
561  D4D_UNUSED(old_position);
562 
563  // compute the start char of current screen
565 
566  // set flag to redraw screen
568  pData->redrawText = D4D_TRUE;
569 }
570 
571 /**************************************************************/
581 /******************************************************************************
582 * Begin of D4D_TEXT_BOX public functions
583 */
587 /**************************************************************************/
594 {
595  if(pObject == NULL)
596  return;
597 
598  D4D_TextBoxOnInit(pObject);
599 }
600 
601 /**************************************************************************/
609 {
610  D4D_TXTBX_DATA* pData = D4D_GET_TEXTBOX_DATA(pObject);
611 
612  // check the intput pointers
613  if(pObject == NULL)
614  return;
615 
616  if(pText == NULL)
617  return;
618 
619  // change the text pointer
620  pData->pTxtArr = pText;
621 
622  // refresh whole object
623  D4D_TextBoxOnInit(pObject);
624 
625 }
626 /******************************************************************************
627 * End of public functions */
629 /******************************************************************************/
630 
631 /**************************************************************/
641 /*******************************************************
642 *
643 * The TEXTBOX message handler
644 *
645 *******************************************************/
646 
648 {
649  D4D_OBJECT* pThis = pMsg->pObject;
650 
651  switch(pMsg->nMsgId)
652  {
653  case D4D_MSG_DRAW:
654  D4D_TextBoxOnDraw(pMsg);
655  break;
656 
657  case D4D_MSG_ONINIT:
658  pThis->pData->flags &= ~D4D_OBJECT_F_NOTINIT;
659 
660  D4D_TextBoxOnInit(pThis);
661  break;
662 
663 #ifdef D4D_LLD_TCH
664  case D4D_MSG_TOUCHED:
665  D4D_FocusSet(pMsg->pScreen, pThis);
666  D4D_CaptureKeys(pThis);
667  break;
668 #endif
669 
670 #ifdef D4D_LLD_MOUSE
672  D4D_FocusSet(pMsg->pScreen, pThis);
673  D4D_CaptureKeys(pThis);
674  break;
675 
677  if(D4D_GET_TEXTBOX_SCROLL_BAR_HOR(pThis)->pData->flags & D4D_OBJECT_F_VISIBLE)
679  break;
681  if(D4D_GET_TEXTBOX_SCROLL_BAR_HOR(pThis)->pData->flags & D4D_OBJECT_F_VISIBLE)
683  break;
684 #endif
685 
686  case D4D_MSG_KEYUP:
687  {
688  D4D_KEY_SCANCODE tmp_key = pMsg->prm.key;
689  // capture the keyboard if enter is pressed
690  if(tmp_key == D4D_KEY_SCANCODE_ENTER)
691  D4D_CaptureKeys(pThis);
692 
693  // exit capture
694  if(tmp_key == D4D_KEY_SCANCODE_ESC)
696  }
697  break;
698 
699  case D4D_MSG_KILLFOCUS:
701  case D4D_MSG_SETFOCUS:
702  case D4D_MSG_SETCAPTURE:
703  case D4D_MSG_KILLCAPTURE:
704  //D4D_InvalidateObject(pThis, D4D_FALSE);
705  break;
706 
707 
708  default:
709  // call the default behavior of all objects
710  D4D_ObjOnMessage(pMsg);
711  }
712 }
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
Byte D4D_FONT
Definition: d4d_font.h:171
D4D_OBJECT * D4D_GetParentObject(D4D_OBJECT *pObject)
Definition: d4d_object.c:498
#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_STRING * D4D_TextBoxGetTextBuffer(D4D_OBJECT *pThis)
D4D_TEXT_PROPERTIES text_properties
Text properties structure.
Definition: d4d_string.h:96
D4D_INDEX printLen
Length of string that should be used (printed).
Definition: d4d_string.h:106
D4D_COOR * pTabTable
Definition: d4d_text_box.h:118
Type definition of eGUI point structure.
Definition: d4d_types.h:223
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
const D4D_OBJECT_SYS_FUNCTION d4d_textboxSysFunc
Definition: d4d_text_box.c:77
D4D_COOR * pTabTable
Pointer to tabulator table.
Definition: d4d_types.h:255
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
D4D_COOR tabOffset
Start offset of tabulator.
Definition: d4d_types.h:256
The string type. This structure contains all properties about string in eGUI.
Definition: d4d_string.h:100
D4D_COLOR D4D_ObjectGetForeFillColor(D4D_OBJECT *pObj)
Function return object current fill fore color.
Definition: d4d_scheme.c:208
static void D4D_TextBoxValue2Coor(D4D_OBJECT *pThis)
Definition: d4d_text_box.c:95
void D4D_ScrlBrSetPosition(D4D_OBJECT_PTR pObj, D4D_INDEX position)
The function sets the scroll bar position.
void D4D_DrawTextRectTab(D4D_POINT *ppt, D4D_SIZE *psz, D4D_STRING *buffText, D4D_TAB *pTab, D4D_COLOR colorText, D4D_COLOR colorBkgd)
Function draw text with TAB function in rectangle.
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 D4D_BOOL D4D_TextBoxGetWordSpec(D4D_TXTBX_WORD_DESC *wordDesc)
Definition: d4d_text_box.c:178
void D4D_TextBoxChangeText(D4D_OBJECT *pObject, D4D_TCHAR *pText)
The function change the text of the text box.
Definition: d4d_text_box.c:608
Set Focus message - is send when the object is getting focus.
Definition: d4d_base.h:373
#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.
D4D_TCHAR * pTxtArr
Definition: d4d_text_box.h:110
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
static D4D_BOOL D4D_TextBoxGetCharsToLine(D4D_TXTBX_WORD_DESC *wordDesc)
Definition: d4d_text_box.c:248
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_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.
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_DEFSTR(str)
Macro that helps declare the strings in eGUI.
Definition: d4d_string.h:246
D4D_COOR cx
Size in axis X (width)
Definition: d4d_types.h:232
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.
void D4D_ObjOnMessage(D4D_MESSAGE *pMsg)
Definition: d4d_object.c:443
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
#define D4D_EXTSRC_BUFF_SIZE
This macro is used to specify size of buffer that is using when external file support is enabled...
Definition: d4d_base.h:167
#define NULL
Type definition of null pointer.
Definition: d4d_types.h:184
#define D4D_TXTBX_SCRLBR_WIDTH
This is text box embedded scroll bar width If not defined, it sets to 20 pixels as a default...
Definition: d4d_text_box.h:86
#define D4D_GET_TEXTBOX(pObj)
Definition: d4d_text_box.h:131
D4D_TCHAR * pText
pointer to text array
Definition: d4d_string.h:102
static D4D_INDEX D4D_TextBoxGetMaxLineChars(D4D_TCHAR *pText, D4D_INDEX offset, D4D_TAB *pTab, D4D_COOR len, D4D_FONT fnt)
Definition: d4d_text_box.c:318
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
#define D4D_OBJECT_F_NOTINIT
Definition: d4d_object.h:113
D4D_BOOL redrawText
Definition: d4d_text_box.h:111
D4D_MSGID nMsgId
Type of message.
Definition: d4d_base.h:404
D4D_SIZE size
Size of the object.
Definition: d4d_object.h:170
#define D4D_ROUND_CORNER_ENABLE
This macro is used to enable the round corners feature. If not defined, the round corners are disable...
Definition: d4d_base.h:88
const D4DLOCALE_FUNCTIONS d4d_extsrcLocale
static D4D_INDEX D4D_TextBoxGetLineCount(D4D_OBJECT *pThis)
Definition: d4d_text_box.c:358
void D4D_TextBoxRefreshAll(D4D_OBJECT *pObject)
The function reinitialize whole object.
Definition: d4d_text_box.c:593
static void D4D_TextBoxOnDraw(D4D_MESSAGE *pMsg)
Definition: d4d_text_box.c:461
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
Type definition of eGUI tabulation structure.
Definition: d4d_types.h:253
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
static D4D_INDEX D4D_TextBoxFindLineStartChar(D4D_OBJECT *pThis, D4D_INDEX line)
Definition: d4d_text_box.c:391
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
Draw message - is send when the object should be redrawed.
Definition: d4d_base.h:371
D4D_INDEX firstShowedCharIx
Definition: d4d_text_box.h:109
#define D4D_TXTBX_SCRLBR_STEP
This is text box embedded scroll bar change step If not defined, it sets to 2 step as a default...
Definition: d4d_text_box.h:92
static void D4D_TextBoxOnInit(D4D_OBJECT *pObject)
Definition: d4d_text_box.c:535
void D4D_ComputeGeometry(D4D_GEOMETRY *pGeometry, D4D_OBJECT *pObject)
Definition: d4d_base.c:1047
#define D4D_GET_TEXTBOX_DATA(pObj)
Definition: d4d_text_box.h:132
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
void D4D_TextBoxScrollBarsFeedBack(D4D_OBJECT *pThis, D4D_INDEX old_position, D4D_INDEX new_position)
Definition: d4d_text_box.c:557
#define D4D_OBJECT_F_VISIBLE
Object after initialization is visible on the screen.
Definition: d4d_object.h:72
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
#define D4D_GET_TEXTBOX_SCROLL_BAR_HOR(pObj)
Definition: d4d_text_box.h:134
static D4D_BOOL D4D_TextBoxGetWordSpecInt(D4D_TCHAR ch, D4D_TXTBX_WORD_DESC *wordDesc)
Definition: d4d_text_box.c:128
static D4D_BOOL D4D_TextBoxScrollBarSetup(D4D_OBJECT *pObject)
Definition: d4d_text_box.c:430
void D4D_ScrlBrChangePosition(D4D_OBJECT_PTR pObj, D4D_INDEX_DELTA change)
The function change the scroll bar position.
D4D_FONT_SIZE D4D_GetCharWidth(D4D_FONT ix, D4D_TCHAR ch)
Definition: d4d_font.c:415
Kill Capture message - is send when the object is losing capture keys status.
Definition: d4d_base.h:376
D4D_OBJECT_DRAWFLAGS draw
Contains draw flags - is valid with D4D_MSG_DRAW and D4D_MSG_DRAWDONE message.
Definition: d4d_base.h:408
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.
Type definition of eGUI geometry structure.
Definition: d4d_types.h:237
D4D_TXTBX_DATA * pData
Definition: d4d_text_box.h:120
Set Capture message - is send when the object is getting capture keys status.
Definition: d4d_base.h:375
void D4D_TextBoxOnMessage(D4D_MESSAGE *pMsg)
Definition: d4d_text_box.c:647
#define _calc
Definition: d4d_text_box.c:93
Byte d4d_extsrcBuffer[D4D_EXTSRC_BUFF_SIZE]
void D4D_InvalidateObject(D4D_OBJECT_PTR pObject, D4D_BOOL bComplete)
Function invalidate object to redraw on screen.
Definition: d4d_object.c:71
D4D_COOR D4D_GetNextTab(D4D_TAB *pTab, D4D_COOR pos)
Definition: d4d_font.c:618
Byte D4D_KEY_SCANCODE
Type definition of eGUI keys scan code.
Definition: d4d_types.h:304
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
D4DLOCALE_TRANSLATE_STR D4DLOCALE_TranslateStr
Pointer to Translate String Function.
Definition: d4d_extsrc.h:190
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
D4D_FONT textFontId
Definition: d4d_text_box.h:119
D4D_INDEX printOff
Offset of string that should be used (printed).
Definition: d4d_string.h:107
Kill Focus message - is send when the object is losing focus.
Definition: d4d_base.h:374
union D4D_MESSAGE_S::@0 prm
Additional data for some type of messages.