eGUI alias D4D  Release 3.0
Reference Manual
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
d4d_edit_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_EDIT_BOX_H
47 #define __D4D_EDIT_BOX_H
48 
50 /******************************************************************************
51 * D4D EDIT BOX setting constants
52 *
53 */
59 #ifndef D4D_EDIT_BOX_F_DEFAULT
60  #define D4D_EDIT_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_DENTED)
61 #endif
62 
65 #ifndef D4D_EDIT_BOX_FNT_PRTY_DEFAULT
66  #define D4D_EDIT_BOX_FNT_PRTY_DEFAULT ( 0 )
67 #endif
68 
71 #ifndef D4D_EDIT_BOX_TXT_PRTY_DEFAULT
72  #define D4D_EDIT_BOX_TXT_PRTY_DEFAULT ( D4D_ALIGN_V_CENTER_MASK | D4D_ALIGN_H_LEFT_MASK )
73 #endif
74 
77 #ifndef D4D_EDIT_BOX_CURSOR_BLINK_TICK_COUNTER
78  #define D4D_EDIT_BOX_CURSOR_BLINK_TICK_COUNTER ( 10 )
79 #endif
80 
83 /******************************************************************************
84 * D4D EDIT BOX setting public types
85 *
86 */
90 /**************************************************************************/
98 typedef void (*D4D_EDIT_BOX_ON_EVENT)(D4D_OBJECT* pThis, D4D_EVENTID eventId);
99 
102 /******************************************************************************
103 * Private Types
104 ******************************************************************************/
105 
107 
109 
110 #define D4D_EDIT_BOX_FLAGS_REDRAWTEXT (0x04)
111 #define D4D_EDIT_BOX_FLAGS_MOVECURSOR (0x08)
112 #define D4D_EDIT_BOX_FLAGS_REDRAWCURSOR (0x10)
113 #define D4D_EDIT_BOX_FLAGS_CURSORSTATE (0x20)
114 #define D4D_EDIT_BOX_FLAGS_FULL (0x40)
115 #define D4D_EDIT_BOX_FLAGS_CHANGETEXT (0x80)
116 
117 
118 
119 
120 typedef struct
121 {
127 
128 // EditBox configuration (goes to ROM by default)
129 typedef struct
130 {
132  D4D_EDIT_BOX_DATA* pData; // EditBox volatile data struct
134 } D4D_EDIT_BOX;
135 
136 /******************************************************************************
137 * Macros
138 ******************************************************************************/
139 
140 // getting the EDIT_BOX structure from general OBJECT
141 #define D4D_GET_EDIT_BOX(pObj) ((D4D_EDIT_BOX*)((pObj)->pParam))
142 #define D4D_GET_EDIT_BOX_DATA(pEditBox) ((pEditBox)->pData)
143 
144 /******************************************************************************
145 * D4D EDIT BOX setting public macros
146 *
147 */
151 /**************************************************************************/
175 #define _D4D_DECLARE_EDIT_BOX(type, name, x, y, cx, cy, radius, pMargin, pRelations, flags, pScheme, pInitText, fontId, maxStr, pUser, pOnEvent, pOnUsrMsg) \
176  static D4D_STR_PROPERTIES name##_strPrties = {D4D_EDIT_BOX_FNT_PRTY_DEFAULT, D4D_EDIT_BOX_TXT_PRTY_DEFAULT};\
177  static D4D_TCHAR name##_txtArray[maxStr + 1];\
178  static D4D_EDIT_BOX_DATA name##_data = { {name##_txtArray, maxStr, fontId, &name##_strPrties, 0, 0}, 0, 0, 0};\
179  static type D4D_EDIT_BOX name##_params = \
180  { \
181  pInitText,\
182  &(name##_data), \
183  pOnEvent \
184  }; \
185  \
186  D4D_DECLARE_OBJECT(type, name, x, y, cx, cy, radius, pMargin, pRelations, pOnUsrMsg, &d4d_editBoxSysFunc, &(name##_params), flags, pUser, pScheme)
187 
188 
189 /**************************************************************************/
211 #define D4D_DECLARE_EDIT_BOX(name, x, y, cx, cy, pRelations, flags, pScheme, pInitText, fontId, maxStr, pUser, pOnEvent, pOnUsrMsg) \
212  _D4D_DECLARE_EDIT_BOX(D4D_CONST, name, x, y, cx, cy, 0, (D4D_MARGIN*)&d4d_marginDefault, pRelations, flags, pScheme, pInitText,\
213  fontId, maxStr, pUser, pOnEvent, pOnUsrMsg)
214 
215 /**************************************************************************/
233 #define D4D_DECLARE_STD_EDIT_BOX(name, x, y, cx, cy, pRelations, pInitText, fontId, maxStr, pOnEvent) \
234  D4D_DECLARE_EDIT_BOX(name, x, y, cx, cy, pRelations, (D4D_EDIT_BOX_F_DEFAULT), NULL, pInitText, fontId, maxStr, NULL, pOnEvent, NULL)
235 
236 // Rounded editBox definition
237 /**************************************************************************/
260 #define D4D_DECLARE_REDIT_BOX(name, x, y, cx, cy, radius, pRelations, flags, pScheme, pInitText, fontId, maxStr, pUser, pOnEvent, pOnUsrMsg) \
261  _D4D_DECLARE_EDIT_BOX(D4D_CONST, name, x, y, cx, cy, radius, (D4D_MARGIN*)&d4d_marginDefault, pRelations, flags, pScheme, pInitText,\
262  fontId, maxStr, pUser, pOnEvent, pOnUsrMsg)
263 
264 /**************************************************************************/
283 #define D4D_DECLARE_STD_REDIT_BOX(name, x, y, cx, cy, radius, pRelations, pInitText, fontId, maxStr, pOnEvent) \
284  D4D_DECLARE_REDIT_BOX(name, x, y, cx, cy, radius, pRelations, (D4D_EDIT_BOX_F_DEFAULT), NULL, pInitText, fontId, maxStr, NULL, pOnEvent, NULL)
285 
286 
287 //IN RAM instantions macros
288 /**************************************************************************/
291 #define D4D_DECLARE_EDIT_BOX_INRAM(name, x, y, cx, cy, pRelations, flags, pScheme, pInitText, fontId, maxStr, pUser, pOnEvent, pOnUsrMsg) \
292  _D4D_DECLARE_EDIT_BOX(D4D_NO_CONST, name, x, y, cx, cy, 0, (D4D_MARGIN*)&d4d_marginDefault, pRelations, flags, pScheme, pInitText,\
293  fontId, maxStr, pUser, pOnEvent, pOnUsrMsg)
294 
295 /**************************************************************************/
298 #define D4D_DECLARE_STD_EDIT_BOX_INRAM(name, x, y, cx, cy, pRelations, pInitText, fontId, maxStr, pOnEvent) \
299  D4D_DECLARE_EDIT_BOX_INRAM(name, x, y, cx, cy, pRelations, (D4D_EDIT_BOX_F_DEFAULT), NULL, pInitText, fontId, maxStr, NULL, pOnEvent, NULL)
300 
301 // Rounded editBox definition
302 /**************************************************************************/
305 #define D4D_DECLARE_REDIT_BOX_INRAM(name, x, y, cx, cy, radius, pRelations, flags, pScheme, pInitText, fontId, maxStr, pUser, pOnEvent, pOnUsrMsg) \
306  _D4D_DECLARE_EDIT_BOX(D4D_NO_CONST, name, x, y, cx, cy, radius, (D4D_MARGIN*)&d4d_marginDefault, pRelations, flags, pScheme, pInitText,\
307  fontId, maxStr, pUser, pOnEvent, pOnUsrMsg)
308 
309 /**************************************************************************/
312 #define D4D_DECLARE_STD_REDIT_BOX_INRAM(name, x, y, cx, cy, radius, pRelations, pInitText, fontId, maxStr, pOnEvent) \
313  D4D_DECLARE_REDIT_BOX_INRAM(name, x, y, cx, cy, radius, pRelations, (D4D_EDIT_BOX_F_DEFAULT), NULL, pInitText, fontId, maxStr, NULL, pOnEvent, NULL)
314 
316 /******************************************************************************
317 * Global variables
318 ******************************************************************************/
319 
320 /******************************************************************************
321 * Global functions
322 ******************************************************************************/
329 
330 #endif /* __D4D_EDIT_BOX_H */
331 
332 
333 
334 
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
The string type. This structure contains all properties about string in eGUI.
Definition: d4d_string.h:100
const D4D_OBJECT_SYS_FUNCTION d4d_editBoxSysFunc
Definition: d4d_edit_box.c:56
D4D_EDIT_BOX_FLAGS flags
Definition: d4d_edit_box.h:125
sByte D4D_EDIT_BOX_INDEX
Definition: d4d_edit_box.h:106
D4D_TCHAR * pInitText
Definition: d4d_edit_box.h:131
unsigned char Byte
Type definition of Byte (unsigned 8-bit).
Definition: d4d_types.h:151
D4D_INDEX tickCounter
Definition: d4d_edit_box.h:124
D4D_EVENTID
D4D events that is handled by object callback functions.
Definition: d4d_base.h:429
void D4D_EditBoxClearAll(D4D_OBJECT_PTR pObj)
The function clear whole edit box data.
Definition: d4d_edit_box.c:621
D4D_STRING string
Definition: d4d_edit_box.h:122
D4D_INDEX D4D_EditBoxSetCursor(D4D_OBJECT_PTR pObj, D4D_INDEX newPos)
The function chenge the cursor position to new one.
Definition: d4d_edit_box.c:490
void(* D4D_EDIT_BOX_ON_EVENT)(D4D_OBJECT *pThis, D4D_EVENTID eventId)
Type definition of edit box on event callback function.
Definition: d4d_edit_box.h:98
D4D_TCHAR * D4D_EditBoxGetText(D4D_OBJECT_PTR pObj)
The function returns the pointer to the edit box text buffer.
Definition: d4d_edit_box.c:652
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
signed char sByte
Type definition of sByte (signed 8-bit).
Definition: d4d_types.h:155
Byte D4D_EDIT_BOX_FLAGS
Definition: d4d_edit_box.h:108
D4D_EDIT_BOX_DATA * pData
Definition: d4d_edit_box.h:132
The object system function needed for each object - this is part of D4D_OBJECT main structure...
Definition: d4d_object.h:134
D4D_EDIT_BOX_ON_EVENT pOnEvent
Definition: d4d_edit_box.h:133
LWord D4D_BOOL
Type definition of eGUI boolean.
Definition: d4d_types.h:204
D4D_BOOL D4D_EditBoxPutString(D4D_OBJECT_PTR pObj, D4D_TCHAR *pText)
The function puts string on cursor position and updates cursor.
Definition: d4d_edit_box.c:455
D4D_BOOL D4D_EditBoxPutChar(D4D_OBJECT_PTR pObj, D4D_TCHAR ch)
The function puts one char on cursor position and updates cursor.
Definition: d4d_edit_box.c:393
D4D_INDEX D4D_EditBoxGetCursor(D4D_OBJECT_PTR pObj)
The function returns the cursor position.
Definition: d4d_edit_box.c:604