jpayne@69
|
1 /****************************************************************************
|
jpayne@69
|
2 * Copyright 2018-2019-2020,2021 Thomas E. Dickey *
|
jpayne@69
|
3 * Copyright 1998-2016,2017 Free Software Foundation, Inc. *
|
jpayne@69
|
4 * *
|
jpayne@69
|
5 * Permission is hereby granted, free of charge, to any person obtaining a *
|
jpayne@69
|
6 * copy of this software and associated documentation files (the *
|
jpayne@69
|
7 * "Software"), to deal in the Software without restriction, including *
|
jpayne@69
|
8 * without limitation the rights to use, copy, modify, merge, publish, *
|
jpayne@69
|
9 * distribute, distribute with modifications, sublicense, and/or sell *
|
jpayne@69
|
10 * copies of the Software, and to permit persons to whom the Software is *
|
jpayne@69
|
11 * furnished to do so, subject to the following conditions: *
|
jpayne@69
|
12 * *
|
jpayne@69
|
13 * The above copyright notice and this permission notice shall be included *
|
jpayne@69
|
14 * in all copies or substantial portions of the Software. *
|
jpayne@69
|
15 * *
|
jpayne@69
|
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
|
jpayne@69
|
17 * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
|
jpayne@69
|
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
|
jpayne@69
|
19 * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
|
jpayne@69
|
20 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
|
jpayne@69
|
21 * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
|
jpayne@69
|
22 * THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
|
jpayne@69
|
23 * *
|
jpayne@69
|
24 * Except as contained in this notice, the name(s) of the above copyright *
|
jpayne@69
|
25 * holders shall not be used in advertising or otherwise to promote the *
|
jpayne@69
|
26 * sale, use or other dealings in this Software without prior written *
|
jpayne@69
|
27 * authorization. *
|
jpayne@69
|
28 ****************************************************************************/
|
jpayne@69
|
29
|
jpayne@69
|
30 /****************************************************************************
|
jpayne@69
|
31 * Author: Juergen Pfeifer, 1995,1997 *
|
jpayne@69
|
32 ****************************************************************************/
|
jpayne@69
|
33
|
jpayne@69
|
34 /* $Id: form.h,v 0.32 2021/06/17 21:26:02 tom Exp $ */
|
jpayne@69
|
35
|
jpayne@69
|
36 #ifndef FORM_H
|
jpayne@69
|
37 #define FORM_H
|
jpayne@69
|
38 /* *INDENT-OFF*/
|
jpayne@69
|
39
|
jpayne@69
|
40 #include <ncursesw/curses.h>
|
jpayne@69
|
41 #include <ncursesw/eti.h>
|
jpayne@69
|
42
|
jpayne@69
|
43 #ifdef __cplusplus
|
jpayne@69
|
44 extern "C" {
|
jpayne@69
|
45 #endif
|
jpayne@69
|
46
|
jpayne@69
|
47 #if defined(BUILDING_FORM)
|
jpayne@69
|
48 # define FORM_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT
|
jpayne@69
|
49 #else
|
jpayne@69
|
50 # define FORM_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT
|
jpayne@69
|
51 #endif
|
jpayne@69
|
52
|
jpayne@69
|
53 #define FORM_WRAPPED_VAR(type,name) extern FORM_IMPEXP type NCURSES_PUBLIC_VAR(name)(void)
|
jpayne@69
|
54
|
jpayne@69
|
55 #define FORM_EXPORT(type) FORM_IMPEXP type NCURSES_API
|
jpayne@69
|
56 #define FORM_EXPORT_VAR(type) FORM_IMPEXP type
|
jpayne@69
|
57
|
jpayne@69
|
58 #ifndef FORM_PRIV_H
|
jpayne@69
|
59 typedef void *FIELD_CELL;
|
jpayne@69
|
60 #endif
|
jpayne@69
|
61
|
jpayne@69
|
62 #ifndef NCURSES_FIELD_INTERNALS
|
jpayne@69
|
63 #define NCURSES_FIELD_INTERNALS /* nothing */
|
jpayne@69
|
64 #endif
|
jpayne@69
|
65
|
jpayne@69
|
66 typedef int Form_Options;
|
jpayne@69
|
67 typedef int Field_Options;
|
jpayne@69
|
68
|
jpayne@69
|
69 /**********
|
jpayne@69
|
70 * _PAGE *
|
jpayne@69
|
71 **********/
|
jpayne@69
|
72
|
jpayne@69
|
73 typedef struct pagenode
|
jpayne@69
|
74 #if !NCURSES_OPAQUE_FORM
|
jpayne@69
|
75 {
|
jpayne@69
|
76 short pmin; /* index of first field on page */
|
jpayne@69
|
77 short pmax; /* index of last field on page */
|
jpayne@69
|
78 short smin; /* index of top leftmost field on page */
|
jpayne@69
|
79 short smax; /* index of bottom rightmost field on page */
|
jpayne@69
|
80 }
|
jpayne@69
|
81 #endif /* !NCURSES_OPAQUE_FORM */
|
jpayne@69
|
82 _PAGE;
|
jpayne@69
|
83
|
jpayne@69
|
84 /**********
|
jpayne@69
|
85 * FIELD *
|
jpayne@69
|
86 **********/
|
jpayne@69
|
87
|
jpayne@69
|
88 typedef struct fieldnode
|
jpayne@69
|
89 #if 1 /* not yet: !NCURSES_OPAQUE_FORM */
|
jpayne@69
|
90 {
|
jpayne@69
|
91 unsigned short status; /* flags */
|
jpayne@69
|
92 short rows; /* size in rows */
|
jpayne@69
|
93 short cols; /* size in cols */
|
jpayne@69
|
94 short frow; /* first row */
|
jpayne@69
|
95 short fcol; /* first col */
|
jpayne@69
|
96 int drows; /* dynamic rows */
|
jpayne@69
|
97 int dcols; /* dynamic cols */
|
jpayne@69
|
98 int maxgrow; /* maximum field growth */
|
jpayne@69
|
99 int nrow; /* off-screen rows */
|
jpayne@69
|
100 short nbuf; /* additional buffers */
|
jpayne@69
|
101 short just; /* justification */
|
jpayne@69
|
102 short page; /* page on form */
|
jpayne@69
|
103 short index; /* into form -> field */
|
jpayne@69
|
104 int pad; /* pad character */
|
jpayne@69
|
105 chtype fore; /* foreground attribute */
|
jpayne@69
|
106 chtype back; /* background attribute */
|
jpayne@69
|
107 Field_Options opts; /* options */
|
jpayne@69
|
108 struct fieldnode * snext; /* sorted order pointer */
|
jpayne@69
|
109 struct fieldnode * sprev; /* sorted order pointer */
|
jpayne@69
|
110 struct fieldnode * link; /* linked field chain */
|
jpayne@69
|
111 struct formnode * form; /* containing form */
|
jpayne@69
|
112 struct typenode * type; /* field type */
|
jpayne@69
|
113 void * arg; /* argument for type */
|
jpayne@69
|
114 FIELD_CELL * buf; /* field buffers */
|
jpayne@69
|
115 void * usrptr; /* user pointer */
|
jpayne@69
|
116 /*
|
jpayne@69
|
117 * The wide-character configuration requires extra information. Because
|
jpayne@69
|
118 * there are existing applications that manipulate the members of FIELD
|
jpayne@69
|
119 * directly, we cannot make the struct opaque, except by changing the ABI.
|
jpayne@69
|
120 * Offsets of members up to this point are the same in the narrow- and
|
jpayne@69
|
121 * wide-character configuration. But note that the type of buf depends on
|
jpayne@69
|
122 * the configuration, and is made opaque for that reason.
|
jpayne@69
|
123 */
|
jpayne@69
|
124 NCURSES_FIELD_INTERNALS
|
jpayne@69
|
125 }
|
jpayne@69
|
126 #endif /* NCURSES_OPAQUE_FORM */
|
jpayne@69
|
127 FIELD;
|
jpayne@69
|
128
|
jpayne@69
|
129
|
jpayne@69
|
130 /*********
|
jpayne@69
|
131 * FORM *
|
jpayne@69
|
132 *********/
|
jpayne@69
|
133
|
jpayne@69
|
134 typedef struct formnode
|
jpayne@69
|
135 #if 1 /* not yet: !NCURSES_OPAQUE_FORM */
|
jpayne@69
|
136 {
|
jpayne@69
|
137 unsigned short status; /* flags */
|
jpayne@69
|
138 short rows; /* size in rows */
|
jpayne@69
|
139 short cols; /* size in cols */
|
jpayne@69
|
140 int currow; /* current row in field window */
|
jpayne@69
|
141 int curcol; /* current col in field window */
|
jpayne@69
|
142 int toprow; /* in scrollable field window */
|
jpayne@69
|
143 int begincol; /* in horiz. scrollable field */
|
jpayne@69
|
144 short maxfield; /* number of fields */
|
jpayne@69
|
145 short maxpage; /* number of pages */
|
jpayne@69
|
146 short curpage; /* index into page */
|
jpayne@69
|
147 Form_Options opts; /* options */
|
jpayne@69
|
148 WINDOW * win; /* window */
|
jpayne@69
|
149 WINDOW * sub; /* subwindow */
|
jpayne@69
|
150 WINDOW * w; /* window for current field */
|
jpayne@69
|
151 FIELD ** field; /* field [maxfield] */
|
jpayne@69
|
152 FIELD * current; /* current field */
|
jpayne@69
|
153 _PAGE * page; /* page [maxpage] */
|
jpayne@69
|
154 void * usrptr; /* user pointer */
|
jpayne@69
|
155
|
jpayne@69
|
156 void (*forminit)(struct formnode *);
|
jpayne@69
|
157 void (*formterm)(struct formnode *);
|
jpayne@69
|
158 void (*fieldinit)(struct formnode *);
|
jpayne@69
|
159 void (*fieldterm)(struct formnode *);
|
jpayne@69
|
160
|
jpayne@69
|
161 }
|
jpayne@69
|
162 #endif /* !NCURSES_OPAQUE_FORM */
|
jpayne@69
|
163 FORM;
|
jpayne@69
|
164
|
jpayne@69
|
165
|
jpayne@69
|
166 /**************
|
jpayne@69
|
167 * FIELDTYPE *
|
jpayne@69
|
168 **************/
|
jpayne@69
|
169
|
jpayne@69
|
170 typedef struct typenode
|
jpayne@69
|
171 #if !NCURSES_OPAQUE_FORM
|
jpayne@69
|
172 {
|
jpayne@69
|
173 unsigned short status; /* flags */
|
jpayne@69
|
174 long ref; /* reference count */
|
jpayne@69
|
175 struct typenode * left; /* ptr to operand for | */
|
jpayne@69
|
176 struct typenode * right; /* ptr to operand for | */
|
jpayne@69
|
177
|
jpayne@69
|
178 void* (*makearg)(va_list *); /* make fieldtype arg */
|
jpayne@69
|
179 void* (*copyarg)(const void *); /* copy fieldtype arg */
|
jpayne@69
|
180 void (*freearg)(void *); /* free fieldtype arg */
|
jpayne@69
|
181
|
jpayne@69
|
182 #if NCURSES_INTEROP_FUNCS
|
jpayne@69
|
183 union {
|
jpayne@69
|
184 bool (*ofcheck)(FIELD *,const void *); /* field validation */
|
jpayne@69
|
185 bool (*gfcheck)(FORM*,FIELD *,const void*); /* generic field validation */
|
jpayne@69
|
186 } fieldcheck;
|
jpayne@69
|
187 union {
|
jpayne@69
|
188 bool (*occheck)(int,const void *); /* character validation */
|
jpayne@69
|
189 bool (*gccheck)(int,FORM*,
|
jpayne@69
|
190 FIELD*,const void*); /* generic char validation */
|
jpayne@69
|
191 } charcheck;
|
jpayne@69
|
192 union {
|
jpayne@69
|
193 bool (*onext)(FIELD *,const void *); /* enumerate next value */
|
jpayne@69
|
194 bool (*gnext)(FORM*,FIELD*,const void*); /* generic enumerate next */
|
jpayne@69
|
195 } enum_next;
|
jpayne@69
|
196 union {
|
jpayne@69
|
197 bool (*oprev)(FIELD *,const void *); /* enumerate prev value */
|
jpayne@69
|
198 bool (*gprev)(FORM*,FIELD*,const void*); /* generic enumerate prev */
|
jpayne@69
|
199 } enum_prev;
|
jpayne@69
|
200 void* (*genericarg)(void*); /* Alternate Arg method */
|
jpayne@69
|
201 #else
|
jpayne@69
|
202 bool (*fcheck)(FIELD *,const void *); /* field validation */
|
jpayne@69
|
203 bool (*ccheck)(int,const void *); /* character validation */
|
jpayne@69
|
204
|
jpayne@69
|
205 bool (*next)(FIELD *,const void *); /* enumerate next value */
|
jpayne@69
|
206 bool (*prev)(FIELD *,const void *); /* enumerate prev value */
|
jpayne@69
|
207 #endif
|
jpayne@69
|
208 }
|
jpayne@69
|
209 #endif /* !NCURSES_OPAQUE_FORM */
|
jpayne@69
|
210 FIELDTYPE;
|
jpayne@69
|
211
|
jpayne@69
|
212 typedef void (*Form_Hook)(FORM *);
|
jpayne@69
|
213
|
jpayne@69
|
214 /***************************
|
jpayne@69
|
215 * miscellaneous #defines *
|
jpayne@69
|
216 ***************************/
|
jpayne@69
|
217
|
jpayne@69
|
218 /* field justification */
|
jpayne@69
|
219 #define NO_JUSTIFICATION (0)
|
jpayne@69
|
220 #define JUSTIFY_LEFT (1)
|
jpayne@69
|
221 #define JUSTIFY_CENTER (2)
|
jpayne@69
|
222 #define JUSTIFY_RIGHT (3)
|
jpayne@69
|
223
|
jpayne@69
|
224 /* field options */
|
jpayne@69
|
225 #define O_VISIBLE (0x0001U)
|
jpayne@69
|
226 #define O_ACTIVE (0x0002U)
|
jpayne@69
|
227 #define O_PUBLIC (0x0004U)
|
jpayne@69
|
228 #define O_EDIT (0x0008U)
|
jpayne@69
|
229 #define O_WRAP (0x0010U)
|
jpayne@69
|
230 #define O_BLANK (0x0020U)
|
jpayne@69
|
231 #define O_AUTOSKIP (0x0040U)
|
jpayne@69
|
232 #define O_NULLOK (0x0080U)
|
jpayne@69
|
233 #define O_PASSOK (0x0100U)
|
jpayne@69
|
234 #define O_STATIC (0x0200U)
|
jpayne@69
|
235 #define O_DYNAMIC_JUSTIFY (0x0400U) /* ncurses extension */
|
jpayne@69
|
236 #define O_NO_LEFT_STRIP (0x0800U) /* ncurses extension */
|
jpayne@69
|
237 #define O_EDGE_INSERT_STAY (0x1000U) /* ncurses extension */
|
jpayne@69
|
238 #define O_INPUT_LIMIT (0x2000U) /* ncurses extension */
|
jpayne@69
|
239
|
jpayne@69
|
240 /* form options */
|
jpayne@69
|
241 #define O_NL_OVERLOAD (0x0001U)
|
jpayne@69
|
242 #define O_BS_OVERLOAD (0x0002U)
|
jpayne@69
|
243
|
jpayne@69
|
244 /* form driver commands */
|
jpayne@69
|
245 #define REQ_NEXT_PAGE (KEY_MAX + 1) /* move to next page */
|
jpayne@69
|
246 #define REQ_PREV_PAGE (KEY_MAX + 2) /* move to previous page */
|
jpayne@69
|
247 #define REQ_FIRST_PAGE (KEY_MAX + 3) /* move to first page */
|
jpayne@69
|
248 #define REQ_LAST_PAGE (KEY_MAX + 4) /* move to last page */
|
jpayne@69
|
249
|
jpayne@69
|
250 #define REQ_NEXT_FIELD (KEY_MAX + 5) /* move to next field */
|
jpayne@69
|
251 #define REQ_PREV_FIELD (KEY_MAX + 6) /* move to previous field */
|
jpayne@69
|
252 #define REQ_FIRST_FIELD (KEY_MAX + 7) /* move to first field */
|
jpayne@69
|
253 #define REQ_LAST_FIELD (KEY_MAX + 8) /* move to last field */
|
jpayne@69
|
254 #define REQ_SNEXT_FIELD (KEY_MAX + 9) /* move to sorted next field */
|
jpayne@69
|
255 #define REQ_SPREV_FIELD (KEY_MAX + 10) /* move to sorted prev field */
|
jpayne@69
|
256 #define REQ_SFIRST_FIELD (KEY_MAX + 11) /* move to sorted first field */
|
jpayne@69
|
257 #define REQ_SLAST_FIELD (KEY_MAX + 12) /* move to sorted last field */
|
jpayne@69
|
258 #define REQ_LEFT_FIELD (KEY_MAX + 13) /* move to left to field */
|
jpayne@69
|
259 #define REQ_RIGHT_FIELD (KEY_MAX + 14) /* move to right to field */
|
jpayne@69
|
260 #define REQ_UP_FIELD (KEY_MAX + 15) /* move to up to field */
|
jpayne@69
|
261 #define REQ_DOWN_FIELD (KEY_MAX + 16) /* move to down to field */
|
jpayne@69
|
262
|
jpayne@69
|
263 #define REQ_NEXT_CHAR (KEY_MAX + 17) /* move to next char in field */
|
jpayne@69
|
264 #define REQ_PREV_CHAR (KEY_MAX + 18) /* move to prev char in field */
|
jpayne@69
|
265 #define REQ_NEXT_LINE (KEY_MAX + 19) /* move to next line in field */
|
jpayne@69
|
266 #define REQ_PREV_LINE (KEY_MAX + 20) /* move to prev line in field */
|
jpayne@69
|
267 #define REQ_NEXT_WORD (KEY_MAX + 21) /* move to next word in field */
|
jpayne@69
|
268 #define REQ_PREV_WORD (KEY_MAX + 22) /* move to prev word in field */
|
jpayne@69
|
269 #define REQ_BEG_FIELD (KEY_MAX + 23) /* move to first char in field */
|
jpayne@69
|
270 #define REQ_END_FIELD (KEY_MAX + 24) /* move after last char in fld */
|
jpayne@69
|
271 #define REQ_BEG_LINE (KEY_MAX + 25) /* move to beginning of line */
|
jpayne@69
|
272 #define REQ_END_LINE (KEY_MAX + 26) /* move after last char in line */
|
jpayne@69
|
273 #define REQ_LEFT_CHAR (KEY_MAX + 27) /* move left in field */
|
jpayne@69
|
274 #define REQ_RIGHT_CHAR (KEY_MAX + 28) /* move right in field */
|
jpayne@69
|
275 #define REQ_UP_CHAR (KEY_MAX + 29) /* move up in field */
|
jpayne@69
|
276 #define REQ_DOWN_CHAR (KEY_MAX + 30) /* move down in field */
|
jpayne@69
|
277
|
jpayne@69
|
278 #define REQ_NEW_LINE (KEY_MAX + 31) /* insert/overlay new line */
|
jpayne@69
|
279 #define REQ_INS_CHAR (KEY_MAX + 32) /* insert blank char at cursor */
|
jpayne@69
|
280 #define REQ_INS_LINE (KEY_MAX + 33) /* insert blank line at cursor */
|
jpayne@69
|
281 #define REQ_DEL_CHAR (KEY_MAX + 34) /* delete char at cursor */
|
jpayne@69
|
282 #define REQ_DEL_PREV (KEY_MAX + 35) /* delete char before cursor */
|
jpayne@69
|
283 #define REQ_DEL_LINE (KEY_MAX + 36) /* delete line at cursor */
|
jpayne@69
|
284 #define REQ_DEL_WORD (KEY_MAX + 37) /* delete word at cursor */
|
jpayne@69
|
285 #define REQ_CLR_EOL (KEY_MAX + 38) /* clear to end of line */
|
jpayne@69
|
286 #define REQ_CLR_EOF (KEY_MAX + 39) /* clear to end of field */
|
jpayne@69
|
287 #define REQ_CLR_FIELD (KEY_MAX + 40) /* clear entire field */
|
jpayne@69
|
288 #define REQ_OVL_MODE (KEY_MAX + 41) /* begin overlay mode */
|
jpayne@69
|
289 #define REQ_INS_MODE (KEY_MAX + 42) /* begin insert mode */
|
jpayne@69
|
290 #define REQ_SCR_FLINE (KEY_MAX + 43) /* scroll field forward a line */
|
jpayne@69
|
291 #define REQ_SCR_BLINE (KEY_MAX + 44) /* scroll field backward a line */
|
jpayne@69
|
292 #define REQ_SCR_FPAGE (KEY_MAX + 45) /* scroll field forward a page */
|
jpayne@69
|
293 #define REQ_SCR_BPAGE (KEY_MAX + 46) /* scroll field backward a page */
|
jpayne@69
|
294 #define REQ_SCR_FHPAGE (KEY_MAX + 47) /* scroll field forward half page */
|
jpayne@69
|
295 #define REQ_SCR_BHPAGE (KEY_MAX + 48) /* scroll field backward half page */
|
jpayne@69
|
296 #define REQ_SCR_FCHAR (KEY_MAX + 49) /* horizontal scroll char */
|
jpayne@69
|
297 #define REQ_SCR_BCHAR (KEY_MAX + 50) /* horizontal scroll char */
|
jpayne@69
|
298 #define REQ_SCR_HFLINE (KEY_MAX + 51) /* horizontal scroll line */
|
jpayne@69
|
299 #define REQ_SCR_HBLINE (KEY_MAX + 52) /* horizontal scroll line */
|
jpayne@69
|
300 #define REQ_SCR_HFHALF (KEY_MAX + 53) /* horizontal scroll half line */
|
jpayne@69
|
301 #define REQ_SCR_HBHALF (KEY_MAX + 54) /* horizontal scroll half line */
|
jpayne@69
|
302
|
jpayne@69
|
303 #define REQ_VALIDATION (KEY_MAX + 55) /* validate field */
|
jpayne@69
|
304 #define REQ_NEXT_CHOICE (KEY_MAX + 56) /* display next field choice */
|
jpayne@69
|
305 #define REQ_PREV_CHOICE (KEY_MAX + 57) /* display prev field choice */
|
jpayne@69
|
306
|
jpayne@69
|
307 #define MIN_FORM_COMMAND (KEY_MAX + 1) /* used by form_driver */
|
jpayne@69
|
308 #define MAX_FORM_COMMAND (KEY_MAX + 57) /* used by form_driver */
|
jpayne@69
|
309
|
jpayne@69
|
310 #if defined(MAX_COMMAND)
|
jpayne@69
|
311 # if (MAX_FORM_COMMAND > MAX_COMMAND)
|
jpayne@69
|
312 # error Something is wrong -- MAX_FORM_COMMAND is greater than MAX_COMMAND
|
jpayne@69
|
313 # elif (MAX_COMMAND != (KEY_MAX + 128))
|
jpayne@69
|
314 # error Something is wrong -- MAX_COMMAND is already inconsistently defined.
|
jpayne@69
|
315 # endif
|
jpayne@69
|
316 #else
|
jpayne@69
|
317 # define MAX_COMMAND (KEY_MAX + 128)
|
jpayne@69
|
318 #endif
|
jpayne@69
|
319
|
jpayne@69
|
320 /*************************
|
jpayne@69
|
321 * standard field types *
|
jpayne@69
|
322 *************************/
|
jpayne@69
|
323 extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_ALPHA;
|
jpayne@69
|
324 extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_ALNUM;
|
jpayne@69
|
325 extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_ENUM;
|
jpayne@69
|
326 extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_INTEGER;
|
jpayne@69
|
327 extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_NUMERIC;
|
jpayne@69
|
328 extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_REGEXP;
|
jpayne@69
|
329
|
jpayne@69
|
330 /************************************
|
jpayne@69
|
331 * built-in additional field types *
|
jpayne@69
|
332 * They are not defined in SVr4 *
|
jpayne@69
|
333 ************************************/
|
jpayne@69
|
334 extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_IPV4; /* Internet IP Version 4 address */
|
jpayne@69
|
335
|
jpayne@69
|
336 /***********************
|
jpayne@69
|
337 * FIELDTYPE routines *
|
jpayne@69
|
338 ***********************/
|
jpayne@69
|
339 extern FORM_EXPORT(FIELDTYPE *) new_fieldtype (
|
jpayne@69
|
340 bool (* const field_check)(FIELD *,const void *),
|
jpayne@69
|
341 bool (* const char_check)(int,const void *));
|
jpayne@69
|
342 extern FORM_EXPORT(FIELDTYPE *) link_fieldtype(
|
jpayne@69
|
343 FIELDTYPE *, FIELDTYPE *);
|
jpayne@69
|
344
|
jpayne@69
|
345 extern FORM_EXPORT(int) free_fieldtype (FIELDTYPE *);
|
jpayne@69
|
346 extern FORM_EXPORT(int) set_fieldtype_arg (FIELDTYPE *,
|
jpayne@69
|
347 void * (* const make_arg)(va_list *),
|
jpayne@69
|
348 void * (* const copy_arg)(const void *),
|
jpayne@69
|
349 void (* const free_arg)(void *));
|
jpayne@69
|
350 extern FORM_EXPORT(int) set_fieldtype_choice (FIELDTYPE *,
|
jpayne@69
|
351 bool (* const next_choice)(FIELD *,const void *),
|
jpayne@69
|
352 bool (* const prev_choice)(FIELD *,const void *));
|
jpayne@69
|
353
|
jpayne@69
|
354 /*******************
|
jpayne@69
|
355 * FIELD routines *
|
jpayne@69
|
356 *******************/
|
jpayne@69
|
357 extern FORM_EXPORT(FIELD *) new_field (int,int,int,int,int,int);
|
jpayne@69
|
358 extern FORM_EXPORT(FIELD *) dup_field (FIELD *,int,int);
|
jpayne@69
|
359 extern FORM_EXPORT(FIELD *) link_field (FIELD *,int,int);
|
jpayne@69
|
360
|
jpayne@69
|
361 extern FORM_EXPORT(int) free_field (FIELD *);
|
jpayne@69
|
362 extern FORM_EXPORT(int) field_info (const FIELD *,int *,int *,int *,int *,int *,int *);
|
jpayne@69
|
363 extern FORM_EXPORT(int) dynamic_field_info (const FIELD *,int *,int *,int *);
|
jpayne@69
|
364 extern FORM_EXPORT(int) set_max_field ( FIELD *,int);
|
jpayne@69
|
365 extern FORM_EXPORT(int) move_field (FIELD *,int,int);
|
jpayne@69
|
366 extern FORM_EXPORT(int) set_field_type (FIELD *,FIELDTYPE *,...);
|
jpayne@69
|
367 extern FORM_EXPORT(int) set_new_page (FIELD *,bool);
|
jpayne@69
|
368 extern FORM_EXPORT(int) set_field_just (FIELD *,int);
|
jpayne@69
|
369 extern FORM_EXPORT(int) field_just (const FIELD *);
|
jpayne@69
|
370 extern FORM_EXPORT(int) set_field_fore (FIELD *,chtype);
|
jpayne@69
|
371 extern FORM_EXPORT(int) set_field_back (FIELD *,chtype);
|
jpayne@69
|
372 extern FORM_EXPORT(int) set_field_pad (FIELD *,int);
|
jpayne@69
|
373 extern FORM_EXPORT(int) field_pad (const FIELD *);
|
jpayne@69
|
374 extern FORM_EXPORT(int) set_field_buffer (FIELD *,int,const char *);
|
jpayne@69
|
375 extern FORM_EXPORT(int) set_field_status (FIELD *,bool);
|
jpayne@69
|
376 extern FORM_EXPORT(int) set_field_userptr (FIELD *, void *);
|
jpayne@69
|
377 extern FORM_EXPORT(int) set_field_opts (FIELD *,Field_Options);
|
jpayne@69
|
378 extern FORM_EXPORT(int) field_opts_on (FIELD *,Field_Options);
|
jpayne@69
|
379 extern FORM_EXPORT(int) field_opts_off (FIELD *,Field_Options);
|
jpayne@69
|
380
|
jpayne@69
|
381 extern FORM_EXPORT(chtype) field_fore (const FIELD *);
|
jpayne@69
|
382 extern FORM_EXPORT(chtype) field_back (const FIELD *);
|
jpayne@69
|
383
|
jpayne@69
|
384 extern FORM_EXPORT(bool) new_page (const FIELD *);
|
jpayne@69
|
385 extern FORM_EXPORT(bool) field_status (const FIELD *);
|
jpayne@69
|
386
|
jpayne@69
|
387 extern FORM_EXPORT(void *) field_arg (const FIELD *);
|
jpayne@69
|
388
|
jpayne@69
|
389 extern FORM_EXPORT(void *) field_userptr (const FIELD *);
|
jpayne@69
|
390
|
jpayne@69
|
391 extern FORM_EXPORT(FIELDTYPE *) field_type (const FIELD *);
|
jpayne@69
|
392
|
jpayne@69
|
393 extern FORM_EXPORT(char *) field_buffer (const FIELD *,int);
|
jpayne@69
|
394
|
jpayne@69
|
395 extern FORM_EXPORT(Field_Options) field_opts (const FIELD *);
|
jpayne@69
|
396
|
jpayne@69
|
397 /******************
|
jpayne@69
|
398 * FORM routines *
|
jpayne@69
|
399 ******************/
|
jpayne@69
|
400
|
jpayne@69
|
401 extern FORM_EXPORT(FORM *) new_form (FIELD **);
|
jpayne@69
|
402
|
jpayne@69
|
403 extern FORM_EXPORT(FIELD **) form_fields (const FORM *);
|
jpayne@69
|
404 extern FORM_EXPORT(FIELD *) current_field (const FORM *);
|
jpayne@69
|
405
|
jpayne@69
|
406 extern FORM_EXPORT(WINDOW *) form_win (const FORM *);
|
jpayne@69
|
407 extern FORM_EXPORT(WINDOW *) form_sub (const FORM *);
|
jpayne@69
|
408
|
jpayne@69
|
409 extern FORM_EXPORT(Form_Hook) form_init (const FORM *);
|
jpayne@69
|
410 extern FORM_EXPORT(Form_Hook) form_term (const FORM *);
|
jpayne@69
|
411 extern FORM_EXPORT(Form_Hook) field_init (const FORM *);
|
jpayne@69
|
412 extern FORM_EXPORT(Form_Hook) field_term (const FORM *);
|
jpayne@69
|
413
|
jpayne@69
|
414 extern FORM_EXPORT(int) free_form (FORM *);
|
jpayne@69
|
415 extern FORM_EXPORT(int) set_form_fields (FORM *,FIELD **);
|
jpayne@69
|
416 extern FORM_EXPORT(int) field_count (const FORM *);
|
jpayne@69
|
417 extern FORM_EXPORT(int) set_form_win (FORM *,WINDOW *);
|
jpayne@69
|
418 extern FORM_EXPORT(int) set_form_sub (FORM *,WINDOW *);
|
jpayne@69
|
419 extern FORM_EXPORT(int) set_current_field (FORM *,FIELD *);
|
jpayne@69
|
420 extern FORM_EXPORT(int) unfocus_current_field (FORM *);
|
jpayne@69
|
421 extern FORM_EXPORT(int) field_index (const FIELD *);
|
jpayne@69
|
422 extern FORM_EXPORT(int) set_form_page (FORM *,int);
|
jpayne@69
|
423 extern FORM_EXPORT(int) form_page (const FORM *);
|
jpayne@69
|
424 extern FORM_EXPORT(int) scale_form (const FORM *,int *,int *);
|
jpayne@69
|
425 extern FORM_EXPORT(int) set_form_init (FORM *,Form_Hook);
|
jpayne@69
|
426 extern FORM_EXPORT(int) set_form_term (FORM *,Form_Hook);
|
jpayne@69
|
427 extern FORM_EXPORT(int) set_field_init (FORM *,Form_Hook);
|
jpayne@69
|
428 extern FORM_EXPORT(int) set_field_term (FORM *,Form_Hook);
|
jpayne@69
|
429 extern FORM_EXPORT(int) post_form (FORM *);
|
jpayne@69
|
430 extern FORM_EXPORT(int) unpost_form (FORM *);
|
jpayne@69
|
431 extern FORM_EXPORT(int) pos_form_cursor (FORM *);
|
jpayne@69
|
432 extern FORM_EXPORT(int) form_driver (FORM *,int);
|
jpayne@69
|
433 # if NCURSES_WIDECHAR
|
jpayne@69
|
434 extern FORM_EXPORT(int) form_driver_w (FORM *,int,wchar_t);
|
jpayne@69
|
435 # endif
|
jpayne@69
|
436 extern FORM_EXPORT(int) set_form_userptr (FORM *,void *);
|
jpayne@69
|
437 extern FORM_EXPORT(int) set_form_opts (FORM *,Form_Options);
|
jpayne@69
|
438 extern FORM_EXPORT(int) form_opts_on (FORM *,Form_Options);
|
jpayne@69
|
439 extern FORM_EXPORT(int) form_opts_off (FORM *,Form_Options);
|
jpayne@69
|
440 extern FORM_EXPORT(int) form_request_by_name (const char *);
|
jpayne@69
|
441
|
jpayne@69
|
442 extern FORM_EXPORT(const char *) form_request_name (int);
|
jpayne@69
|
443
|
jpayne@69
|
444 extern FORM_EXPORT(void *) form_userptr (const FORM *);
|
jpayne@69
|
445
|
jpayne@69
|
446 extern FORM_EXPORT(Form_Options) form_opts (const FORM *);
|
jpayne@69
|
447
|
jpayne@69
|
448 extern FORM_EXPORT(bool) data_ahead (const FORM *);
|
jpayne@69
|
449 extern FORM_EXPORT(bool) data_behind (const FORM *);
|
jpayne@69
|
450
|
jpayne@69
|
451 #if NCURSES_SP_FUNCS
|
jpayne@69
|
452 extern FORM_EXPORT(FORM *) NCURSES_SP_NAME(new_form) (SCREEN*, FIELD **);
|
jpayne@69
|
453 #endif
|
jpayne@69
|
454
|
jpayne@69
|
455 #ifdef __cplusplus
|
jpayne@69
|
456 }
|
jpayne@69
|
457 #endif
|
jpayne@69
|
458 /* *INDENT-ON*/
|
jpayne@69
|
459
|
jpayne@69
|
460 #endif /* FORM_H */
|