4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
22 /* Copyright (c) 1988 AT&T */
23 /* All Rights Reserved */
27 * Copyright (c) 1997, by Sun Microsystems, Inc.
28 * All rights reserved.
31 #pragma ident "%Z%%M% %I% %E% SMI"
35 #include <sys/types.h>
44 return (E_BAD_ARGUMENT
);
46 if (Status(f
, POSTED
))
50 return (E_NOT_CONNECTED
);
52 getmaxyx(Sub(f
), y
, x
);
54 if (f
->rows
> y
|| f
->cols
> x
)
57 v
= _set_form_page(f
, P(f
), C(f
));
65 (void) _update_current(f
);
73 return (E_BAD_ARGUMENT
);
75 if (!Status(f
, POSTED
))
76 return (E_NOT_POSTED
);
78 if (Status(f
, DRIVER
))
83 (void) werase(Sub(f
));
90 /* pos_form_cursor - move to cursor position and sync up */
92 pos_form_cursor(FORM
*f
)
95 return (E_BAD_ARGUMENT
);
97 if (!Status(f
, POSTED
))
98 return (E_NOT_POSTED
);
100 return (_pos_form_cursor(f
));
104 set_current_field(FORM
*f
, FIELD
*c
)
106 if (!f
|| !c
|| c
->form
!= f
)
107 return (E_BAD_ARGUMENT
);
109 if (!Opt(c
, O_ACTIVE
) || !Opt(c
, O_VISIBLE
))
110 return (E_REQUEST_DENIED
);
112 if (!Status(f
, POSTED
)) {
117 if (Status(f
, DRIVER
))
118 return (E_BAD_STATE
);
126 if (c
-> page
!= P(f
)) { /* page change */
128 v
= _set_form_page(f
, c
->page
, c
);
131 v
= _set_current_field(f
, c
);
134 (void) _update_current(f
);
137 return (E_INVALID_FIELD
);
143 current_field(FORM
*f
)
149 field_index(FIELD
*f
)
158 set_form_page(FORM
*f
, int page
)
160 if (!f
|| !ValidPage(f
, page
))
161 return (E_BAD_ARGUMENT
);
163 if (!Status(f
, POSTED
)) {
165 C(f
) = _first_active(f
);
168 if (Status(f
, DRIVER
))
169 return (E_BAD_STATE
);
177 v
= _set_form_page(f
, page
, (FIELD
*) 0);
180 (void) _update_current(f
);
183 return (E_INVALID_FIELD
);