FreeCalypso > hg > fc-tourmaline
comparison src/ui/atb/ATBEditor.h @ 3:67bfe9f274f6
src/ui: import of src/ui3 from Magnetite
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 16 Oct 2020 06:33:10 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
2:3a14ee9a9843 | 3:67bfe9f274f6 |
---|---|
1 /******************************************************************************* | |
2 | |
3 CONDAT (UK) | |
4 | |
5 ******************************************************************************** | |
6 | |
7 This software product is the property of Condat (UK) Ltd and may not be | |
8 disclosed to any third party without the express permission of the owner. | |
9 | |
10 ******************************************************************************** | |
11 | |
12 $Project name: | |
13 $Project code: | |
14 $Module: | |
15 $File: ATBEditor.h | |
16 $Revision: | |
17 | |
18 $Author: Condat(UK) | |
19 $Date: | |
20 | |
21 ******************************************************************************** | |
22 | |
23 Description: Header file for ATB Editor component. | |
24 | |
25 REQUIRES: ATBCommon.h, ATBDisplay.h | |
26 | |
27 ******************************************************************************** | |
28 | |
29 $History: ATBEditor.h | |
30 Feb 02, 2006 DR: OMAPS00061468 - x0035544. | |
31 Description: SAT 27.22.4.22.2 SET UP IDLE MODE TEXT (Icon support) fails | |
32 Solution:Enum is defined to support mode of SAT info display | |
33 | |
34 Jan 16, 2006 DR: OMAPS00061460 - Shashi Shekar B.S. | |
35 Description: SAT Icon support | |
36 Solution : Structure definition displaying title icon through editor. | |
37 | |
38 $End | |
39 | |
40 *******************************************************************************/ | |
41 | |
42 | |
43 #ifndef ATB_EDITOR_H | |
44 #define ATB_EDITOR_H | |
45 | |
46 #ifndef DSPL_H | |
47 #include "dspl.h" | |
48 #endif | |
49 | |
50 /********************************************** | |
51 * CONSTANTS | |
52 * | |
53 *********************************************/ | |
54 | |
55 enum | |
56 { | |
57 ED_CURSOR_NONE, /* No cursor, read only */ | |
58 ED_CURSOR_BAR, /* Vertical bar thin */ | |
59 ED_CURSOR_UNDERLINE, /* Underline-style cursor */ | |
60 ED_CURSOR_BLOCK /* Highlights current character */ | |
61 }; | |
62 | |
63 enum | |
64 { | |
65 ED_MODE_ALPHA = 0x01, /* Alphanumeric Multi-tap mode */ | |
66 ED_MODE_OVERWRITE = 0x02, /* Overwrite mode */ | |
67 ED_MODE_PREDTEXT = 0x04, /* Predictive text mode */ | |
68 ED_MODE_FORMATTED = 0x08, /* Formatted input mode for WAP */ | |
69 ED_MODE_HIDDEN = 0x10, /* Hidden mode - *'s appear in place */ | |
70 ED_MODE_READONLY = 0x20, /* Read only mode */ | |
71 ED_MODE_ALL = 0xFFFF /* Allows switching off of all modes */ | |
72 }; | |
73 | |
74 /* Editor visibility */ | |
75 | |
76 enum | |
77 { | |
78 ED_INVISIBLE = 0, /* Editor is not displayed */ | |
79 ED_VISIBLE = 1 /* Editor is displayed */ | |
80 }; | |
81 | |
82 /* Editor updates */ | |
83 | |
84 #define ED_UPDATE_DEFAULT 0 /* Update everything by default */ | |
85 #define ED_UPDATE_TRIVIAL 1 /* Trivial change - no scrolling or reformatting req.*/ | |
86 #define ED_UPDATE_PARTIAL 2 /* Partial change */ | |
87 #define ED_UPDATE_FULL 3 /* Full update required */ | |
88 | |
89 | |
90 /********************************************** | |
91 * ED_RES | |
92 * | |
93 * Result of editor functions | |
94 *********************************************/ | |
95 | |
96 typedef enum | |
97 { | |
98 ED_OK, | |
99 ED_BAD_HANDLE, | |
100 ED_ERROR, | |
101 ED_DONE | |
102 } | |
103 ED_RES; | |
104 | |
105 | |
106 /********************************************** | |
107 * T_ED_CB | |
108 * | |
109 * Callback type | |
110 *********************************************/ | |
111 | |
112 typedef int (*T_ED_CB) (ULONG, void*); | |
113 | |
114 | |
115 /********************************************** | |
116 * EDITOR CONTROL CHARACTERS | |
117 * | |
118 *********************************************/ | |
119 | |
120 typedef enum | |
121 { | |
122 ctrlNone = 0, /* no valid edit control */ | |
123 ctrlLeft, /* cursor left */ | |
124 ctrlRight, /* cursor right */ | |
125 ctrlUp, /* cursor up */ | |
126 ctrlDown, /* cursor down */ | |
127 ctrlTop, /* cursor to top of text */ | |
128 ctrlBottom, /* cursor to end of text */ | |
129 ctrlBack, /* backspace */ | |
130 ctrlDel, /* delete */ | |
131 ctrlEnter, /* return key */ | |
132 ctrlEscape, /* escape key */ | |
133 ctrlMax /* Highest control character */ | |
134 } T_ED_CONTROLS; | |
135 | |
136 | |
137 /* This type indicates whether or not the cursor is within a fixed field */ | |
138 | |
139 enum | |
140 { | |
141 ENTRY_NOT_IN_FIELD = 0, | |
142 ENTRY_ENTERING_FIELD, | |
143 ENTRY_IN_FIELD | |
144 }; | |
145 | |
146 | |
147 /* Output types for ATB_edit_FindPrev() */ | |
148 | |
149 enum | |
150 { | |
151 FINDPREV_NO_CHANGE, | |
152 FINDPREV_PREV_FOUND, | |
153 FINDPREV_FIRST_CHAR, | |
154 FINDPREV_LAST_CHAR | |
155 }; | |
156 | |
157 //Sudha.V., x0035544, Feb 02, 2006 DR: OMAPS00061468 | |
158 #ifdef FF_MMI_SAT_ICON | |
159 typedef enum | |
160 { | |
161 SAT_ICON_NONE = -1, | |
162 SAT_ICON_DISPLAY_TEXT, | |
163 SAT_ICON_IDLEMODE_TEXT | |
164 } T_DISPLAY_TYPE; | |
165 | |
166 | |
167 // Shashi Shekar B.S., a0876501, 16-Jan-2006, OMAPS00061460 | |
168 /* T_ATB_EDITOR_TITLE_ICON */ | |
169 | |
170 typedef struct | |
171 { | |
172 UBYTE width; | |
173 UBYTE height; | |
174 char* data; | |
175 BOOL isTitle; | |
176 T_DISPLAY_TYPE display_type; | |
177 BOOL selfExplanatory; | |
178 | |
179 } T_ATB_EDITOR_TITLE_ICON; | |
180 #endif | |
181 | |
182 /********************************************** | |
183 * T_ED_ATTR | |
184 * | |
185 * Editor attributes, provided by user | |
186 *********************************************/ | |
187 | |
188 typedef struct | |
189 { | |
190 T_ATB_WIN_SIZE win_size; /* Editor position and size */ | |
191 ULONG colour; /* Foreground and background colour */ | |
192 UBYTE font; /* Character font */ | |
193 USHORT cursor; /* cursor type */ | |
194 USHORT mode; /* Edit Mode */ | |
195 T_ATB_TEXT text; /* Edit buffer */ | |
196 USHORT size; /* Buffer size */ | |
197 char *FormatString; /* Formatting string for WAP formatted input */ | |
198 T_DS_TEXTFORMAT startFormat; /* Text format to be applied to the start of text */ | |
199 // Shashi Shekar B.S., a0876501, 16-Jan-2006, OMAPS00061460 | |
200 #ifdef FF_MMI_SAT_ICON | |
201 T_ATB_EDITOR_TITLE_ICON TitleIcon; | |
202 #endif | |
203 } T_ED_ATTR; | |
204 | |
205 /********************************************** | |
206 * T_ED_LINE | |
207 * | |
208 * Information about a line of text in the editor | |
209 *********************************************/ | |
210 | |
211 typedef struct T_ED_LINE_TAG | |
212 { | |
213 UBYTE height; /* The height of the line */ | |
214 USHORT pos; /* The position of the start of the line in the buffer */ | |
215 T_DS_TEXTFORMAT format; /* The format attributes at the start of the line */ | |
216 struct T_ED_LINE_TAG *next; /* The succeeding line */ | |
217 } T_ED_LINE; | |
218 | |
219 | |
220 /********************************************** | |
221 * T_ED_CHAR | |
222 * | |
223 * Information about a character in the editor | |
224 *********************************************/ | |
225 | |
226 typedef struct | |
227 { | |
228 USHORT width; // The width of the character | |
229 USHORT height; // The height of the character | |
230 USHORT pos; // The position of the character | |
231 T_DS_TEXTFORMAT format; // The format attributes of the character | |
232 USHORT lineHeight; // Height of the line, so far | |
233 USHORT lineWidth; // Width of the current line (in pixels) | |
234 } T_ED_CHAR; | |
235 | |
236 | |
237 /********************************************** | |
238 * T_ED_CURSOR | |
239 * | |
240 * Information about cursor | |
241 *********************************************/ | |
242 | |
243 typedef struct | |
244 { | |
245 SHORT x; // Cursor X position, relative to top left corner of editor | |
246 SHORT y; // Cursor Y position, relative to top left corner of editor | |
247 SHORT width; // Size of cursor | |
248 SHORT height; // Height of cursor | |
249 USHORT attr; // Format attributes under the cursor | |
250 USHORT pos; /* cursor position */ | |
251 SHORT line; // The line the cursor is on (with respect to the whole text) | |
252 } T_ED_CURSOR; | |
253 | |
254 | |
255 /********************************************** | |
256 * T_ED_DATA | |
257 * | |
258 * Main editor information | |
259 *********************************************/ | |
260 | |
261 typedef struct | |
262 { | |
263 T_ED_CB handler; /* event handler */ | |
264 T_ED_ATTR *attr; /* editor attributes */ | |
265 | |
266 /* Various flags */ | |
267 | |
268 BOOL initialised; // TRUE if important values have been set up | |
269 BOOL display; /* Whether editor is hidden or not. */ | |
270 UBYTE update; /* Which portions of the editor to update */ | |
271 UBYTE multitap; /* Stores status of multi-tap */ | |
272 UBYTE textcase; /* Case of text entry (upper, lower, numeric etc) */ | |
273 | |
274 /* Word wrap information */ | |
275 | |
276 T_ED_CURSOR cursor; /* Properties of cursor */ | |
277 T_ED_CHAR thischar; /* Properties of current character */ | |
278 T_ED_CHAR space; /* Properties of the last space */ | |
279 T_ED_LINE *line; /* Properties of lines in editor */ | |
280 | |
281 BOOL startOfLine; /* TRUE indicates the start of a text line */ | |
282 BOOL endOfLine; /* TRUE indicates end of a text line */ | |
283 BOOL endOfText; /* TRUE indicates no more chars in text */ | |
284 BOOL precedingEOL; /* Character preceding current character is an End Of Line */ | |
285 BOOL precedingSpace; /* Character preceding current character is a space */ | |
286 | |
287 USHORT startPos; /* Character position, or start of current block */ | |
288 USHORT numLines; /* Total number of lines in the editor */ | |
289 SHORT winStartLine; /* The first line to be displayed in the current window */ | |
290 USHORT linesPerScreen; /* No of lines that fit on current screen */ | |
291 | |
292 /* Display properties */ | |
293 | |
294 USHORT totalHeight; /* Total height (in pixels) of the whole text string */ | |
295 USHORT viewHeight; /* The height visible in the editor */ | |
296 USHORT viewStartPos; /* Start position of view in pixels */ | |
297 | |
298 /* WAP delimited input information */ | |
299 | |
300 SHORT formatIndex; // Position in formatting string | |
301 SHORT fieldIndex; // Position within a delimited field | |
302 | |
303 /* Hidden input information */ | |
304 | |
305 T_ATB_TEXT *hiddenText; /* Hidden text is stored in this buffer */ | |
306 } T_ED_DATA; | |
307 | |
308 | |
309 /********************************************** | |
310 * T_ED_CASE | |
311 * | |
312 * The case of the current text | |
313 *********************************************/ | |
314 typedef enum | |
315 { | |
316 ED_CASE_UPPER, /* Upper case */ | |
317 ED_CASE_LOWER, /* Lower case */ | |
318 ED_CASE_CAPS, /* Capitalise starts of sentences */ | |
319 ED_CASE_NUM /* Numbers */ | |
320 } T_ED_CASE; | |
321 | |
322 | |
323 /********************************************** | |
324 * T_ED_CASE_PREF | |
325 * | |
326 * Preference for case input | |
327 *********************************************/ | |
328 | |
329 typedef enum | |
330 { | |
331 ED_CASEPREF_NONE, /* End of string - no case */ | |
332 ED_CASEPREF_NUM, /* Any numeric character */ | |
333 ED_CASEPREF_ALPHA_UC, /* Any symbolic or alphabetic uppercase character */ | |
334 ED_CASEPREF_ALPHA_LC, /* Any symbolic or alphabetic lowercase character */ | |
335 ED_CASEPREF_ALPHANUM, /* Any symbolic, numeric, or alphabetic character */ | |
336 ED_CASEPREF_ALPHANUM_UC, /* Any symbolic, numeric, or alphabetic uppercase character */ | |
337 ED_CASEPREF_ALPHANUM_LC /* Any symbolic, numeric, or alphabetic lowercase character */ | |
338 } T_ED_CASE_PREF; | |
339 | |
340 | |
341 /********************************************** | |
342 * FUNCTION PROTOTYPES | |
343 * | |
344 *********************************************/ | |
345 | |
346 ED_RES ATB_edit_Init (T_ED_DATA *editor); | |
347 T_ED_DATA* ATB_edit_Create (T_ED_ATTR *editAttr, T_ED_CB callback); | |
348 ED_RES ATB_edit_Destroy (T_ED_DATA *editor); | |
349 ED_RES ATB_edit_Reset (T_ED_DATA *editor); | |
350 ED_RES ATB_edit_Show (T_ED_DATA *editor); | |
351 ED_RES ATB_edit_Refresh (T_ED_DATA *editor); | |
352 ED_RES ATB_edit_Hide (T_ED_DATA *editor); | |
353 ED_RES ATB_edit_Unhide (T_ED_DATA *editor); | |
354 | |
355 ED_RES ATB_edit_Char (T_ED_DATA *editor, USHORT character, UBYTE update); | |
356 ED_RES ATB_edit_AsciiChar (T_ED_DATA *editor, char character, UBYTE update); | |
357 ED_RES ATB_edit_MultiTap(T_ED_DATA *editor, USHORT character, BOOL multitap); | |
358 ED_RES ATB_edit_AsciiMultiTap(T_ED_DATA *editor, char character, BOOL multitap); | |
359 ED_RES ATB_edit_MoveCursor (T_ED_DATA *editor, USHORT control, UBYTE update); | |
360 ED_RES ATB_edit_DeleteLeft (T_ED_DATA *editor, UBYTE update); /* SPR#2342 - SH */ | |
361 ED_RES ATB_edit_DeleteRight (T_ED_DATA *editor, UBYTE update); /* SPR#2342 - SH */ | |
362 ED_RES ATB_edit_ClearAll (T_ED_DATA *editor); | |
363 | |
364 ED_RES ATB_edit_HiddenInit(T_ED_DATA *editor); | |
365 ED_RES ATB_edit_HiddenExit(T_ED_DATA *editor); | |
366 ED_RES ATB_edit_InsertString (T_ED_DATA *editor, T_ATB_TEXT *insText);/* Insert a word at the cursor pos */ | |
367 USHORT ATB_edit_GetCursorChar(T_ED_DATA *editor, int offset); | |
368 BOOL ATB_edit_CapitaliseWord(T_ED_DATA *editor); | |
369 USHORT ATB_edit_FindCapital(USHORT small_char); | |
370 T_ED_LINE *ATB_edit_LineGet(T_ED_DATA *editor, SHORT lineNo); | |
371 | |
372 void ATB_edit_SetAttr(T_ED_DATA *editor, T_ATB_WIN_SIZE *win_size, ULONG colour, UBYTE font, USHORT mode, USHORT cursor, T_ATB_TEXT *text, USHORT size); | |
373 UBYTE ATB_edit_Mode(T_ED_DATA *editor, USHORT mode); | |
374 void ATB_edit_SetMode(T_ED_DATA *editor, USHORT mode); | |
375 void ATB_edit_ResetMode(T_ED_DATA *editor, USHORT mode); | |
376 void ATB_edit_SetStyle(T_ED_DATA *editor, USHORT style); | |
377 UBYTE ATB_edit_GetCase(T_ED_DATA *editor); | |
378 void ATB_edit_SetCase(T_ED_DATA *editor, UBYTE textcase); | |
379 T_ED_CASE_PREF ATB_edit_GetCasePref(T_ED_DATA *editor); | |
380 #endif | |
381 |