Warning, file /include/ncursesw/form.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036 #ifndef FORM_H
0037 #define FORM_H
0038
0039
0040 #include <ncursesw/curses.h>
0041 #include <ncursesw/eti.h>
0042
0043 #ifdef __cplusplus
0044 extern "C" {
0045 #endif
0046
0047 #if defined(BUILDING_FORM)
0048 # define FORM_IMPEXP NCURSES_EXPORT_GENERAL_EXPORT
0049 #else
0050 # define FORM_IMPEXP NCURSES_EXPORT_GENERAL_IMPORT
0051 #endif
0052
0053 #define FORM_WRAPPED_VAR(type,name) extern FORM_IMPEXP type NCURSES_PUBLIC_VAR(name)(void)
0054
0055 #define FORM_EXPORT(type) FORM_IMPEXP type NCURSES_API
0056 #define FORM_EXPORT_VAR(type) FORM_IMPEXP type
0057
0058 #ifndef FORM_PRIV_H
0059 typedef void *FIELD_CELL;
0060 #endif
0061
0062 #ifndef NCURSES_FIELD_INTERNALS
0063 #define NCURSES_FIELD_INTERNALS
0064 #endif
0065
0066 typedef int Form_Options;
0067 typedef int Field_Options;
0068
0069
0070
0071
0072
0073 typedef struct pagenode
0074 #if !NCURSES_OPAQUE_FORM
0075 {
0076 short pmin;
0077 short pmax;
0078 short smin;
0079 short smax;
0080 }
0081 #endif
0082 _PAGE;
0083
0084
0085
0086
0087
0088 typedef struct fieldnode
0089 #if 1
0090 {
0091 unsigned short status;
0092 short rows;
0093 short cols;
0094 short frow;
0095 short fcol;
0096 int drows;
0097 int dcols;
0098 int maxgrow;
0099 int nrow;
0100 short nbuf;
0101 short just;
0102 short page;
0103 short index;
0104 int pad;
0105 chtype fore;
0106 chtype back;
0107 Field_Options opts;
0108 struct fieldnode * snext;
0109 struct fieldnode * sprev;
0110 struct fieldnode * link;
0111 struct formnode * form;
0112 struct typenode * type;
0113 void * arg;
0114 FIELD_CELL * buf;
0115 void * usrptr;
0116
0117
0118
0119
0120
0121
0122
0123
0124 NCURSES_FIELD_INTERNALS
0125 }
0126 #endif
0127 FIELD;
0128
0129
0130
0131
0132
0133
0134 typedef struct formnode
0135 #if 1
0136 {
0137 unsigned short status;
0138 short rows;
0139 short cols;
0140 int currow;
0141 int curcol;
0142 int toprow;
0143 int begincol;
0144 short maxfield;
0145 short maxpage;
0146 short curpage;
0147 Form_Options opts;
0148 WINDOW * win;
0149 WINDOW * sub;
0150 WINDOW * w;
0151 FIELD ** field;
0152 FIELD * current;
0153 _PAGE * page;
0154 void * usrptr;
0155
0156 void (*forminit)(struct formnode *);
0157 void (*formterm)(struct formnode *);
0158 void (*fieldinit)(struct formnode *);
0159 void (*fieldterm)(struct formnode *);
0160
0161 }
0162 #endif
0163 FORM;
0164
0165
0166
0167
0168
0169
0170 typedef struct typenode
0171 #if !NCURSES_OPAQUE_FORM
0172 {
0173 unsigned short status;
0174 long ref;
0175 struct typenode * left;
0176 struct typenode * right;
0177
0178 void* (*makearg)(va_list *);
0179 void* (*copyarg)(const void *);
0180 void (*freearg)(void *);
0181
0182 #if NCURSES_INTEROP_FUNCS
0183 union {
0184 bool (*ofcheck)(FIELD *,const void *);
0185 bool (*gfcheck)(FORM*,FIELD *,const void*);
0186 } fieldcheck;
0187 union {
0188 bool (*occheck)(int,const void *);
0189 bool (*gccheck)(int,FORM*,
0190 FIELD*,const void*);
0191 } charcheck;
0192 union {
0193 bool (*onext)(FIELD *,const void *);
0194 bool (*gnext)(FORM*,FIELD*,const void*);
0195 } enum_next;
0196 union {
0197 bool (*oprev)(FIELD *,const void *);
0198 bool (*gprev)(FORM*,FIELD*,const void*);
0199 } enum_prev;
0200 void* (*genericarg)(void*);
0201 #else
0202 bool (*fcheck)(FIELD *,const void *);
0203 bool (*ccheck)(int,const void *);
0204
0205 bool (*next)(FIELD *,const void *);
0206 bool (*prev)(FIELD *,const void *);
0207 #endif
0208 }
0209 #endif
0210 FIELDTYPE;
0211
0212 typedef void (*Form_Hook)(FORM *);
0213
0214
0215
0216
0217
0218
0219 #define NO_JUSTIFICATION (0)
0220 #define JUSTIFY_LEFT (1)
0221 #define JUSTIFY_CENTER (2)
0222 #define JUSTIFY_RIGHT (3)
0223
0224
0225 #define O_VISIBLE (0x0001U)
0226 #define O_ACTIVE (0x0002U)
0227 #define O_PUBLIC (0x0004U)
0228 #define O_EDIT (0x0008U)
0229 #define O_WRAP (0x0010U)
0230 #define O_BLANK (0x0020U)
0231 #define O_AUTOSKIP (0x0040U)
0232 #define O_NULLOK (0x0080U)
0233 #define O_PASSOK (0x0100U)
0234 #define O_STATIC (0x0200U)
0235 #define O_DYNAMIC_JUSTIFY (0x0400U)
0236 #define O_NO_LEFT_STRIP (0x0800U)
0237 #define O_EDGE_INSERT_STAY (0x1000U)
0238 #define O_INPUT_LIMIT (0x2000U)
0239
0240
0241 #define O_NL_OVERLOAD (0x0001U)
0242 #define O_BS_OVERLOAD (0x0002U)
0243
0244
0245 #define REQ_NEXT_PAGE (KEY_MAX + 1)
0246 #define REQ_PREV_PAGE (KEY_MAX + 2)
0247 #define REQ_FIRST_PAGE (KEY_MAX + 3)
0248 #define REQ_LAST_PAGE (KEY_MAX + 4)
0249
0250 #define REQ_NEXT_FIELD (KEY_MAX + 5)
0251 #define REQ_PREV_FIELD (KEY_MAX + 6)
0252 #define REQ_FIRST_FIELD (KEY_MAX + 7)
0253 #define REQ_LAST_FIELD (KEY_MAX + 8)
0254 #define REQ_SNEXT_FIELD (KEY_MAX + 9)
0255 #define REQ_SPREV_FIELD (KEY_MAX + 10)
0256 #define REQ_SFIRST_FIELD (KEY_MAX + 11)
0257 #define REQ_SLAST_FIELD (KEY_MAX + 12)
0258 #define REQ_LEFT_FIELD (KEY_MAX + 13)
0259 #define REQ_RIGHT_FIELD (KEY_MAX + 14)
0260 #define REQ_UP_FIELD (KEY_MAX + 15)
0261 #define REQ_DOWN_FIELD (KEY_MAX + 16)
0262
0263 #define REQ_NEXT_CHAR (KEY_MAX + 17)
0264 #define REQ_PREV_CHAR (KEY_MAX + 18)
0265 #define REQ_NEXT_LINE (KEY_MAX + 19)
0266 #define REQ_PREV_LINE (KEY_MAX + 20)
0267 #define REQ_NEXT_WORD (KEY_MAX + 21)
0268 #define REQ_PREV_WORD (KEY_MAX + 22)
0269 #define REQ_BEG_FIELD (KEY_MAX + 23)
0270 #define REQ_END_FIELD (KEY_MAX + 24)
0271 #define REQ_BEG_LINE (KEY_MAX + 25)
0272 #define REQ_END_LINE (KEY_MAX + 26)
0273 #define REQ_LEFT_CHAR (KEY_MAX + 27)
0274 #define REQ_RIGHT_CHAR (KEY_MAX + 28)
0275 #define REQ_UP_CHAR (KEY_MAX + 29)
0276 #define REQ_DOWN_CHAR (KEY_MAX + 30)
0277
0278 #define REQ_NEW_LINE (KEY_MAX + 31)
0279 #define REQ_INS_CHAR (KEY_MAX + 32)
0280 #define REQ_INS_LINE (KEY_MAX + 33)
0281 #define REQ_DEL_CHAR (KEY_MAX + 34)
0282 #define REQ_DEL_PREV (KEY_MAX + 35)
0283 #define REQ_DEL_LINE (KEY_MAX + 36)
0284 #define REQ_DEL_WORD (KEY_MAX + 37)
0285 #define REQ_CLR_EOL (KEY_MAX + 38)
0286 #define REQ_CLR_EOF (KEY_MAX + 39)
0287 #define REQ_CLR_FIELD (KEY_MAX + 40)
0288 #define REQ_OVL_MODE (KEY_MAX + 41)
0289 #define REQ_INS_MODE (KEY_MAX + 42)
0290 #define REQ_SCR_FLINE (KEY_MAX + 43)
0291 #define REQ_SCR_BLINE (KEY_MAX + 44)
0292 #define REQ_SCR_FPAGE (KEY_MAX + 45)
0293 #define REQ_SCR_BPAGE (KEY_MAX + 46)
0294 #define REQ_SCR_FHPAGE (KEY_MAX + 47)
0295 #define REQ_SCR_BHPAGE (KEY_MAX + 48)
0296 #define REQ_SCR_FCHAR (KEY_MAX + 49)
0297 #define REQ_SCR_BCHAR (KEY_MAX + 50)
0298 #define REQ_SCR_HFLINE (KEY_MAX + 51)
0299 #define REQ_SCR_HBLINE (KEY_MAX + 52)
0300 #define REQ_SCR_HFHALF (KEY_MAX + 53)
0301 #define REQ_SCR_HBHALF (KEY_MAX + 54)
0302
0303 #define REQ_VALIDATION (KEY_MAX + 55)
0304 #define REQ_NEXT_CHOICE (KEY_MAX + 56)
0305 #define REQ_PREV_CHOICE (KEY_MAX + 57)
0306
0307 #define MIN_FORM_COMMAND (KEY_MAX + 1)
0308 #define MAX_FORM_COMMAND (KEY_MAX + 57)
0309
0310 #if defined(MAX_COMMAND)
0311 # if (MAX_FORM_COMMAND > MAX_COMMAND)
0312 # error Something is wrong -- MAX_FORM_COMMAND is greater than MAX_COMMAND
0313 # elif (MAX_COMMAND != (KEY_MAX + 128))
0314 # error Something is wrong -- MAX_COMMAND is already inconsistently defined.
0315 # endif
0316 #else
0317 # define MAX_COMMAND (KEY_MAX + 128)
0318 #endif
0319
0320
0321
0322
0323 extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_ALPHA;
0324 extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_ALNUM;
0325 extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_ENUM;
0326 extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_INTEGER;
0327 extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_NUMERIC;
0328 extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_REGEXP;
0329
0330
0331
0332
0333
0334 extern FORM_EXPORT_VAR(FIELDTYPE *) TYPE_IPV4;
0335
0336
0337
0338
0339 extern FORM_EXPORT(FIELDTYPE *) new_fieldtype (
0340 bool (* const field_check)(FIELD *,const void *),
0341 bool (* const char_check)(int,const void *));
0342 extern FORM_EXPORT(FIELDTYPE *) link_fieldtype(
0343 FIELDTYPE *, FIELDTYPE *);
0344
0345 extern FORM_EXPORT(int) free_fieldtype (FIELDTYPE *);
0346 extern FORM_EXPORT(int) set_fieldtype_arg (FIELDTYPE *,
0347 void * (* const make_arg)(va_list *),
0348 void * (* const copy_arg)(const void *),
0349 void (* const free_arg)(void *));
0350 extern FORM_EXPORT(int) set_fieldtype_choice (FIELDTYPE *,
0351 bool (* const next_choice)(FIELD *,const void *),
0352 bool (* const prev_choice)(FIELD *,const void *));
0353
0354
0355
0356
0357 extern FORM_EXPORT(FIELD *) new_field (int,int,int,int,int,int);
0358 extern FORM_EXPORT(FIELD *) dup_field (FIELD *,int,int);
0359 extern FORM_EXPORT(FIELD *) link_field (FIELD *,int,int);
0360
0361 extern FORM_EXPORT(int) free_field (FIELD *);
0362 extern FORM_EXPORT(int) field_info (const FIELD *,int *,int *,int *,int *,int *,int *);
0363 extern FORM_EXPORT(int) dynamic_field_info (const FIELD *,int *,int *,int *);
0364 extern FORM_EXPORT(int) set_max_field ( FIELD *,int);
0365 extern FORM_EXPORT(int) move_field (FIELD *,int,int);
0366 extern FORM_EXPORT(int) set_field_type (FIELD *,FIELDTYPE *,...);
0367 extern FORM_EXPORT(int) set_new_page (FIELD *,bool);
0368 extern FORM_EXPORT(int) set_field_just (FIELD *,int);
0369 extern FORM_EXPORT(int) field_just (const FIELD *);
0370 extern FORM_EXPORT(int) set_field_fore (FIELD *,chtype);
0371 extern FORM_EXPORT(int) set_field_back (FIELD *,chtype);
0372 extern FORM_EXPORT(int) set_field_pad (FIELD *,int);
0373 extern FORM_EXPORT(int) field_pad (const FIELD *);
0374 extern FORM_EXPORT(int) set_field_buffer (FIELD *,int,const char *);
0375 extern FORM_EXPORT(int) set_field_status (FIELD *,bool);
0376 extern FORM_EXPORT(int) set_field_userptr (FIELD *, void *);
0377 extern FORM_EXPORT(int) set_field_opts (FIELD *,Field_Options);
0378 extern FORM_EXPORT(int) field_opts_on (FIELD *,Field_Options);
0379 extern FORM_EXPORT(int) field_opts_off (FIELD *,Field_Options);
0380
0381 extern FORM_EXPORT(chtype) field_fore (const FIELD *);
0382 extern FORM_EXPORT(chtype) field_back (const FIELD *);
0383
0384 extern FORM_EXPORT(bool) new_page (const FIELD *);
0385 extern FORM_EXPORT(bool) field_status (const FIELD *);
0386
0387 extern FORM_EXPORT(void *) field_arg (const FIELD *);
0388
0389 extern FORM_EXPORT(void *) field_userptr (const FIELD *);
0390
0391 extern FORM_EXPORT(FIELDTYPE *) field_type (const FIELD *);
0392
0393 extern FORM_EXPORT(char *) field_buffer (const FIELD *,int);
0394
0395 extern FORM_EXPORT(Field_Options) field_opts (const FIELD *);
0396
0397
0398
0399
0400
0401 extern FORM_EXPORT(FORM *) new_form (FIELD **);
0402
0403 extern FORM_EXPORT(FIELD **) form_fields (const FORM *);
0404 extern FORM_EXPORT(FIELD *) current_field (const FORM *);
0405
0406 extern FORM_EXPORT(WINDOW *) form_win (const FORM *);
0407 extern FORM_EXPORT(WINDOW *) form_sub (const FORM *);
0408
0409 extern FORM_EXPORT(Form_Hook) form_init (const FORM *);
0410 extern FORM_EXPORT(Form_Hook) form_term (const FORM *);
0411 extern FORM_EXPORT(Form_Hook) field_init (const FORM *);
0412 extern FORM_EXPORT(Form_Hook) field_term (const FORM *);
0413
0414 extern FORM_EXPORT(int) free_form (FORM *);
0415 extern FORM_EXPORT(int) set_form_fields (FORM *,FIELD **);
0416 extern FORM_EXPORT(int) field_count (const FORM *);
0417 extern FORM_EXPORT(int) set_form_win (FORM *,WINDOW *);
0418 extern FORM_EXPORT(int) set_form_sub (FORM *,WINDOW *);
0419 extern FORM_EXPORT(int) set_current_field (FORM *,FIELD *);
0420 extern FORM_EXPORT(int) unfocus_current_field (FORM *);
0421 extern FORM_EXPORT(int) field_index (const FIELD *);
0422 extern FORM_EXPORT(int) set_form_page (FORM *,int);
0423 extern FORM_EXPORT(int) form_page (const FORM *);
0424 extern FORM_EXPORT(int) scale_form (const FORM *,int *,int *);
0425 extern FORM_EXPORT(int) set_form_init (FORM *,Form_Hook);
0426 extern FORM_EXPORT(int) set_form_term (FORM *,Form_Hook);
0427 extern FORM_EXPORT(int) set_field_init (FORM *,Form_Hook);
0428 extern FORM_EXPORT(int) set_field_term (FORM *,Form_Hook);
0429 extern FORM_EXPORT(int) post_form (FORM *);
0430 extern FORM_EXPORT(int) unpost_form (FORM *);
0431 extern FORM_EXPORT(int) pos_form_cursor (FORM *);
0432 extern FORM_EXPORT(int) form_driver (FORM *,int);
0433 # if NCURSES_WIDECHAR
0434 extern FORM_EXPORT(int) form_driver_w (FORM *,int,wchar_t);
0435 # endif
0436 extern FORM_EXPORT(int) set_form_userptr (FORM *,void *);
0437 extern FORM_EXPORT(int) set_form_opts (FORM *,Form_Options);
0438 extern FORM_EXPORT(int) form_opts_on (FORM *,Form_Options);
0439 extern FORM_EXPORT(int) form_opts_off (FORM *,Form_Options);
0440 extern FORM_EXPORT(int) form_request_by_name (const char *);
0441
0442 extern FORM_EXPORT(const char *) form_request_name (int);
0443
0444 extern FORM_EXPORT(void *) form_userptr (const FORM *);
0445
0446 extern FORM_EXPORT(Form_Options) form_opts (const FORM *);
0447
0448 extern FORM_EXPORT(bool) data_ahead (const FORM *);
0449 extern FORM_EXPORT(bool) data_behind (const FORM *);
0450
0451 #if NCURSES_SP_FUNCS
0452 extern FORM_EXPORT(FORM *) NCURSES_SP_NAME(new_form) (SCREEN*, FIELD **);
0453 #endif
0454
0455 #ifdef __cplusplus
0456 }
0457 #endif
0458
0459
0460 #endif