1 /*-----------------------------------------------------------------------------+
2 | The ncurses form library is Copyright (C) 1995-1997 |
3 | by Juergen Pfeifer <Juergen.Pfeifer@T-Online.de> |
4 | All Rights Reserved. |
6 | Permission to use, copy, modify, and distribute this software and its |
7 | documentation for any purpose and without fee is hereby granted, provided |
8 | that the above copyright notice appear in all copies and that both that |
9 | copyright notice and this permission notice appear in supporting |
10 | documentation, and that the name of the above listed copyright holder(s) not |
11 | be used in advertising or publicity pertaining to distribution of the |
12 | software without specific, written prior permission. |
14 | THE ABOVE LISTED COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO |
15 | THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT- |
16 | NESS, IN NO EVENT SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR |
17 | ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RE- |
18 | SULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, |
19 | NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH |
20 | THE USE OR PERFORMANCE OF THIS SOFTWARE. |
21 +-----------------------------------------------------------------------------*/
23 #include "mf_common.h"
26 /* form status values */
27 #define _OVLMODE (0x04) /* Form is in overlay mode */
28 #define _WINDOW_MODIFIED (0x10) /* Current field window has been modified */
29 #define _FCHECK_REQUIRED (0x20) /* Current field needs validation */
31 /* field status values */
32 #define _CHANGED (0x01) /* Field has been changed */
33 #define _NEWTOP (0x02) /* Vertical scrolling occured */
34 #define _NEWPAGE (0x04) /* field begins new page of form */
35 #define _MAY_GROW (0x08) /* dynamic field may still grow */
37 /* fieldtype status values */
38 #define _LINKED_TYPE (0x01) /* Type is a linked type */
39 #define _HAS_ARGS (0x02) /* Type has arguments */
40 #define _HAS_CHOICE (0x04) /* Type has choice methods */
41 #define _RESIDENT (0x08) /* Type is builtin */
43 /* If form is NULL replace form argument by default-form */
44 #define Normalize_Form(form) ((form)=(form)?(form):_nc_Default_Form)
46 /* If field is NULL replace field argument by default-field */
47 #define Normalize_Field(field) ((field)=(field)?(field):_nc_Default_Field)
49 /* Retrieve forms window */
50 #define Get_Form_Window(form) \
51 ((form)->sub?(form)->sub:((form)->win?(form)->win:stdscr))
53 /* Calculate the size for a single buffer for this field */
54 #define Buffer_Length(field) ((field)->drows * (field)->dcols)
56 /* Calculate the total size of all buffers for this field */
57 #define Total_Buffer_Size(field) \
58 ( (Buffer_Length(field) + 1) * (1+(field)->nbuf) )
60 /* Logic to determine whether or not a field is single lined */
61 #define Single_Line_Field(field) \
62 (((field)->rows + (field)->nrow) == 1)
65 typedef struct typearg {
67 struct typearg *right;
70 /* This is a dummy request code (normally invalid) to be used internally
71 with the form_driver() routine to position to the first active field
74 #define FIRST_ACTIVE_MAGIC (-291056)
76 #define ALL_FORM_OPTS ( \
80 #define ALL_FIELD_OPTS ( \
94 #define is_blank(c) ((c)==C_BLANK)