eGUI alias D4D  Release 3.0
Reference Manual
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
d4d_text_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_TEXTBOX_H
47 #define __D4D_TEXTBOX_H
48 
50 void D4D_TextBoxScrollBarsFeedBack(D4D_OBJECT* pThis, D4D_INDEX old_position, D4D_INDEX new_position);
51 
52 /******************************************************************************
53 * D4D TEXT BOX setting constants
54 *
55 */
61 #ifndef D4D_TXTBX_F_DEFAULT
62  #define D4D_TXTBX_F_DEFAULT (D4D_OBJECT_F_VISIBLE | D4D_OBJECT_F_ENABLED | D4D_OBJECT_F_FOCUSRECT | D4D_OBJECT_F_TOUCHENABLE | D4D_OBJECT_F_TABSTOP | D4D_OBJECT_F_MOUSE_NORMAL)
63 #endif
64 
67 #ifndef D4D_TXTBX_F_SCRLBRS_DEFAULT
68  #define D4D_TXTBX_F_SCRLBRS_DEFAULT (D4D_OBJECT_F_ENABLED | D4D_OBJECT_F_TOUCHENABLE | D4D_OBJECT_F_FASTTOUCH | D4D_OBJECT_F_FOCUSRECT | D4D_OBJECT_F_MOUSE_NORMAL)
69 #endif
70 
73 #ifndef D4D_TXTBX_TXT_PRTY_DEFAULT
74  #define D4D_TXTBX_TXT_PRTY_DEFAULT (D4D_ALIGN_H_LEFT_MASK | D4D_ALIGN_V_CENTER_MASK)
75 #endif
76 
79 #ifndef D4D_TXTBX_FNT_PRTY_DEFAULT
80  #define D4D_TXTBX_FNT_PRTY_DEFAULT ( 0 )
81 #endif
82 
85 #ifndef D4D_TXTBX_SCRLBR_WIDTH
86  #define D4D_TXTBX_SCRLBR_WIDTH ( 20 )
87 #endif
88 
91 #ifndef D4D_TXTBX_SCRLBR_STEP
92  #define D4D_TXTBX_SCRLBR_STEP ( 2 )
93 #endif
94 
97 /******************************************************************************
98 * Types
99 ******************************************************************************/
100 
101 
102 
103 
104 
105 
106 
107 typedef struct D4D_TXTBX_DATA_S
108 {
110  D4D_TCHAR* pTxtArr; // Pointer on text array that will use TextBox to store all lines
113 
114 // label configuration (goes to ROM by default)
115 
116 typedef struct
117 {
119  D4D_FONT textFontId; // Used font for whole text
120  D4D_TXTBX_DATA* pData; // Run time data needed for TextBox
121 } D4D_TEXTBOX;
122 
123 
124 /******************************************************************************
125 * Macros
126 ******************************************************************************/
127 #define D4D_TEXTBOX_CHILD_SCROLL_BAR_VER_IX 1
128 
129 
130 // getting the TEXTBOX structure from general OBJECT
131 #define D4D_GET_TEXTBOX(pObj) ((D4D_TEXTBOX*)((pObj)->pParam))
132 #define D4D_GET_TEXTBOX_DATA(pObj) (D4D_GET_TEXTBOX(pObj)->pData)
133 
134 #define D4D_GET_TEXTBOX_SCROLL_BAR_HOR(pObj) ((D4D_OBJECT*)((pObj)->pRelations[D4D_TEXTBOX_CHILD_SCROLL_BAR_VER_IX]))
135 
136 /******************************************************************************
137 * D4D TEXT BOX setting public macros
138 *
139 */
143 /**************************************************************************/
166 #define _D4D_DECLARE_TEXTBOX(type, name, x, y, cx, cy, radius, pMargin, pParent, pTextArray, pTabTable, flags, pScheme, fontId, pUser, pOnUsrMsg) \
167  static D4D_TXTBX_DATA name##_data = { 0, (D4D_TCHAR*)pTextArray, D4D_TRUE};\
168  extern type D4D_OBJECT name##_scrollBarVer;\
169  static const D4D_OBJECT * const name##_relations[] = {pParent, &name##_scrollBarVer, NULL};\
170  static type D4D_TEXTBOX name##_params = \
171  { \
172  (D4D_COOR*)pTabTable, /* pTabTable */ \
173  fontId, /* textFontId */ \
174  &name##_data, /* pData */ \
175  }; \
176  \
177  D4D_DECLARE_OBJECT(type, name, x, y, cx, cy, radius, pMargin, name##_relations, pOnUsrMsg, &d4d_textboxSysFunc, &(name##_params), flags, pUser, pScheme)\
178  \
179  static const D4D_OBJECT* const name##_scrollBarRelations[] = {&name, NULL};\
180  \
181  _D4D_DECLARE_SCROLL_BAR(type, name##_scrollBarVer, (D4D_COOR)(cx - D4D_BORDER_WIDTH(flags) - D4D_TXTBX_SCRLBR_WIDTH), D4D_BORDER_WIDTH(flags), D4D_TXTBX_SCRLBR_WIDTH, (D4D_COOR)(cy - 2*D4D_BORDER_WIDTH(flags)),\
182  ((radius > D4D_TXTBX_SCRLBR_WIDTH / 2)? (D4D_COOR)(D4D_TXTBX_SCRLBR_WIDTH / 2) : radius), NULL, name##_scrollBarRelations, D4D_TXTBX_F_SCRLBRS_DEFAULT, pScheme, NULL, D4D_TextBoxScrollBarsFeedBack, NULL)
183 
184 
185 /**************************************************************************/
205 #define D4D_DECLARE_TEXTBOX(name, x, y, cx, cy, pTextArray, pTabTable, flags, pScheme, fontId, pUser, pOnUsrMsg) \
206  _D4D_DECLARE_TEXTBOX(D4D_CONST, name, x, y, cx, cy, 0, NULL, NULL, pTextArray, pTabTable, flags, pScheme, fontId, pUser, pOnUsrMsg)
207 
208 /**************************************************************************/
224 #define D4D_DECLARE_STD_TEXTBOX(name, x, y, cx, cy, pTextArray, pTabTable, fontId) \
225  D4D_DECLARE_TEXTBOX(name, x, y, cx, cy, pTextArray, pTabTable, D4D_TXTBX_F_DEFAULT, NULL, fontId, NULL, NULL)
226 
227 /**************************************************************************/
248 #define D4D_DECLARE_RTEXTBOX(name, x, y, cx, cy, radius, pTextArray, pTabTable, flags, pScheme, fontId, pUser, pOnUsrMsg) \
249  _D4D_DECLARE_TEXTBOX(D4D_CONST, name, x, y, cx, cy, radius, NULL, NULL, pTextArray, pTabTable, flags, pScheme, fontId, pUser, pOnUsrMsg)
250 
251 /**************************************************************************/
268 #define D4D_DECLARE_STD_RTEXTBOX(name, x, y, cx, cy, radius, pTextArray, pTabTable, fontId) \
269  D4D_DECLARE_RTEXTBOX(name, x, y, cx, cy, radius, pTextArray, pTabTable, D4D_TXTBX_F_DEFAULT, NULL, fontId, NULL, NULL)
270 
271 //IN RAM instantions macros
272 /**************************************************************************/
275 #define D4D_DECLARE_TEXTBOX_INRAM(name, x, y, cx, cy, pTextArray, pTabTable, flags, pScheme, fontId, pUser, pOnUsrMsg) \
276  _D4D_DECLARE_TEXTBOX(D4D_NO_CONST, name, x, y, cx, cy, 0, NULL, NULL, pTextArray, pTabTable, flags, pScheme, fontId, pUser, pOnUsrMsg)
277 
278 /**************************************************************************/
281 #define D4D_DECLARE_STD_TEXTBOX_INRAM(name, x, y, cx, cy, pTextArray, pTabTable, fontId) \
282  D4D_DECLARE_TEXTBOX_INRAM(name, x, y, cx, cy, pTextArray, pTabTable, D4D_TXTBX_F_DEFAULT, NULL, fontId, NULL, NULL)
283 
284 // Rounded text box definition
285 /**************************************************************************/
288 #define D4D_DECLARE_RTEXTBOX_INRAM(name, x, y, cx, cy, radius, pTextArray, pTabTable, flags, pScheme, fontId, pUser, pOnUsrMsg) \
289  _D4D_DECLARE_TEXTBOX(D4D_NO_CONST, name, x, y, cx, cy, radius, NULL, NULL, pTextArray, pTabTable, flags, pScheme, fontId, pUser, pOnUsrMsg)
290 
291 /**************************************************************************/
294 #define D4D_DECLARE_STD_RTEXTBOX_INRAM(name, x, y, cx, cy, radius, pTextArray, pTabTable, fontId) \
295  D4D_DECLARE_RTEXTBOX_INRAM(name, x, y, cx, cy, radius, pTextArray, pTabTable, D4D_TXTBX_F_DEFAULT, NULL, fontId, NULL, NULL)
296 
299 /******************************************************************************
300 * Global variables
301 ******************************************************************************/
302 
303 
304 /******************************************************************************
305 * Global functions
306 ******************************************************************************/
307 
308 /*********************************************************
309 *
310 * Object API
311 *
312 *********************************************************/
313 void D4D_TextBoxRefreshAll(D4D_OBJECT* pObject);
314 void D4D_TextBoxChangeText(D4D_OBJECT* pObject, D4D_TCHAR* pText);
315 
316 #endif /* __D4D_TEXTBOX_H */
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_COOR * pTabTable
Definition: d4d_text_box.h:118
const D4D_OBJECT_SYS_FUNCTION d4d_textboxSysFunc
Definition: d4d_text_box.c:77
struct D4D_TXTBX_DATA_S D4D_TXTBX_DATA
void D4D_TextBoxChangeText(D4D_OBJECT *pObject, D4D_TCHAR *pText)
The function change the text of the text box.
Definition: d4d_text_box.c:608
D4D_TCHAR * pTxtArr
Definition: d4d_text_box.h:110
Byte D4D_COOR
Type definition of eGUI coordination variables.
Definition: d4d_types.h:219
D4D_BOOL redrawText
Definition: d4d_text_box.h:111
void D4D_TextBoxRefreshAll(D4D_OBJECT *pObject)
The function reinitialize whole object.
Definition: d4d_text_box.c:593
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
D4D_INDEX firstShowedCharIx
Definition: d4d_text_box.h:109
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
LWord D4D_BOOL
Type definition of eGUI boolean.
Definition: d4d_types.h:204
D4D_TXTBX_DATA * pData
Definition: d4d_text_box.h:120
D4D_FONT textFontId
Definition: d4d_text_box.h:119