blob: 4b0576f042e0948b2a0a7dc130fa345f99592f29 [file] [log] [blame]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301.\"***************************************************************************
2.\" Copyright (c) 1998-2007,2008 Free Software Foundation, Inc. *
3.\" *
4.\" Permission is hereby granted, free of charge, to any person obtaining a *
5.\" copy of this software and associated documentation files (the *
6.\" "Software"), to deal in the Software without restriction, including *
7.\" without limitation the rights to use, copy, modify, merge, publish, *
8.\" distribute, distribute with modifications, sublicense, and/or sell *
9.\" copies of the Software, and to permit persons to whom the Software is *
10.\" furnished to do so, subject to the following conditions: *
11.\" *
12.\" The above copyright notice and this permission notice shall be included *
13.\" in all copies or substantial portions of the Software. *
14.\" *
15.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS *
16.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF *
17.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. *
18.\" IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, *
19.\" DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR *
20.\" OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR *
21.\" THE USE OR OTHER DEALINGS IN THE SOFTWARE. *
22.\" *
23.\" Except as contained in this notice, the name(s) of the above copyright *
24.\" holders shall not be used in advertising or otherwise to promote the *
25.\" sale, use or other dealings in this Software without prior written *
26.\" authorization. *
27.\"***************************************************************************
28.\"
29.\" $Id: form_driver.3x,v 1.16 2008/06/21 21:55:39 tom Exp $
30.TH form_driver 3X ""
31.SH NAME
32\fBform_driver\fR - command-processing loop of the form system
33.SH SYNOPSIS
34\fB#include <form.h>\fR
35.br
36int form_driver(FORM *form, int c);
37.br
38.SH DESCRIPTION
39Once a form has been posted (displayed), you should funnel input events to it
40through \fBform_driver\fR. This routine has three major input cases:
41.TP 3
42-
43The input is a form navigation request.
44Navigation request codes are constants defined in \fB<form.h>\fP,
45which are distinct from the key- and character codes returned by \fBwgetch\fP.
46.TP 3
47-
48The input is a printable character.
49Printable characters (which must be positive, less than 256) are
50checked according to the program's locale settings.
51.TP 3
52-
53The input is the KEY_MOUSE special key associated with an mouse event.
54.PP
55The form driver requests are as follows:
56.TP 5
57REQ_NEXT_PAGE
58Move to the next page.
59.TP 5
60REQ_PREV_PAGE
61Move to the previous page.
62.TP 5
63REQ_FIRST_PAGE
64Move to the first page.
65.TP 5
66REQ_LAST_PAGE
67Move to the last field.
68.sp
69.TP 5
70REQ_NEXT_FIELD
71Move to the next field.
72.TP 5
73REQ_PREV_FIELD
74Move to the previous field.
75.TP 5
76REQ_FIRST_FIELD
77Move to the first field.
78.TP 5
79REQ_LAST_FIELD
80Move to the last field.
81.TP 5
82REQ_SNEXT_FIELD
83Move to the sorted next field.
84.TP 5
85REQ_SPREV_FIELD
86Move to the sorted previous field.
87.TP 5
88REQ_SFIRST_FIELD
89Move to the sorted first field.
90.TP 5
91REQ_SLAST_FIELD
92Move to the sorted last field.
93.TP 5
94REQ_LEFT_FIELD
95Move left to a field.
96.TP 5
97REQ_RIGHT_FIELD
98Move right to a field.
99.TP 5
100REQ_UP_FIELD
101Move up to a field.
102.TP 5
103REQ_DOWN_FIELD
104Move down to a field.
105.sp
106.TP 5
107REQ_NEXT_CHAR
108Move to the next char.
109.TP 5
110REQ_PREV_CHAR
111Move to the previous char.
112.TP 5
113REQ_NEXT_LINE
114Move to the next line.
115.TP 5
116REQ_PREV_LINE
117Move to the previous line.
118.TP 5
119REQ_NEXT_WORD
120Move to the next word.
121.TP 5
122REQ_PREV_WORD
123Move to the previous word.
124.TP 5
125REQ_BEG_FIELD
126Move to the beginning of the field.
127.TP 5
128REQ_END_FIELD
129Move to the end of the field.
130.TP 5
131REQ_BEG_LINE
132Move to the beginning of the line.
133.TP 5
134REQ_END_LINE
135Move to the end of the line.
136.TP 5
137REQ_LEFT_CHAR
138Move left in the field.
139.TP 5
140REQ_RIGHT_CHAR
141Move right in the field.
142.TP 5
143REQ_UP_CHAR
144Move up in the field.
145.TP 5
146REQ_DOWN_CHAR
147Move down in the field.
148.sp
149.TP 5
150REQ_NEW_LINE
151Insert or overlay a new line.
152.TP 5
153REQ_INS_CHAR
154Insert a blank at the cursor.
155.TP 5
156REQ_INS_LINE
157Insert a blank line at the cursor.
158.TP 5
159REQ_DEL_CHAR
160Delete character at the cursor.
161.TP 5
162REQ_DEL_PREV
163Delete character before the cursor.
164.TP 5
165REQ_DEL_LINE
166Delete line at the cursor.
167.TP 5
168REQ_DEL_WORD
169Delete blank-delimited word at the cursor.
170.TP 5
171REQ_CLR_EOL
172Clear to end of line from cursor.
173.TP 5
174REQ_CLR_EOF
175Clear to end of field from cursor.
176.TP 5
177REQ_CLR_FIELD
178Clear the entire field.
179.TP 5
180REQ_OVL_MODE
181Enter overlay mode.
182.TP 5
183REQ_INS_MODE
184Enter insert mode.
185.sp
186.TP 5
187REQ_SCR_FLINE
188Scroll the field forward a line.
189.TP 5
190REQ_SCR_BLINE
191Scroll the field backward a line.
192.TP 5
193REQ_SCR_FPAGE
194Scroll the field forward a page.
195.TP 5
196REQ_SCR_BPAGE
197Scroll the field backward a page.
198.TP 5
199REQ_SCR_FHPAGE
200Scroll the field forward half a page.
201.TP 5
202REQ_SCR_BHPAGE
203Scroll the field backward half a page.
204.sp
205.TP 5
206REQ_SCR_FCHAR
207Scroll the field forward a character.
208.TP 5
209REQ_SCR_BCHAR
210Scroll the field backward a character.
211.TP 5
212REQ_SCR_HFLINE
213Horizontal scroll the field forward a line.
214.TP 5
215REQ_SCR_HBLINE
216Horizontal scroll the field backward a line.
217.TP 5
218REQ_SCR_HFHALF
219Horizontal scroll the field forward half a line.
220.TP 5
221REQ_SCR_HBHALF
222Horizontal scroll the field backward half a line.
223.sp
224.TP
225REQ_VALIDATION
226Validate field.
227.TP
228REQ_NEXT_CHOICE
229Display next field choice.
230.TP
231REQ_PREV_CHOICE
232Display previous field choice.
233.PP
234If the second argument is a printable character, the driver places it
235in the current position in the current field. If it is one of the forms
236requests listed above, that request is executed.
237.SS MOUSE HANDLING
238.PP
239If the second argument is the KEY_MOUSE special key, the associated
240mouse event is translated into one of the above pre-defined requests.
241Currently only clicks in the user window (e.g. inside the form display
242area or the decoration window) are handled.
243.PP
244If you click above the display region of the form:
245.RS
246.TP
247a REQ_PREV_FIELD is generated for a single click,
248.TP
249a REQ_PREV_PAGE is generated for a double-click and
250.TP
251a REQ_FIRST_FIELD is generated for a triple-click.
252.RE
253.PP
254If you click below the display region of the form:
255.RS
256.TP
257a REQ_NEXT_FIELD is generated for a single click,
258.TP
259a REQ_NEXT_PAGE is generated for a double-click and
260.TP
261a REQ_LAST_FIELD is generated for a triple-click.
262.RE
263.PP
264If you click at an field inside the display area of the form:
265.RS
266.TP 3
267-
268the form cursor is positioned to that field.
269.TP 3
270-
271If you double-click a field,
272the form cursor is positioned to that field
273and \fBE_UNKNOWN_COMMAND\fR is returned.
274This return value makes sense,
275because a double click usually means that an field-specific action should
276be returned.
277It is exactly the purpose of this return value to signal that an
278application specific command should be executed.
279.TP 3
280-
281If a translation
282into a request was done, \fBform_driver\fR returns the result of this request.
283.RE
284.PP
285If you clicked outside the user window or the mouse event could not be translated
286into a form request an \fBE_REQUEST_DENIED\fR is returned.
287.SS APPLICATION-DEFINED COMMANDS
288.PP
289If the second argument is neither printable nor one of the above
290pre-defined form requests, the driver assumes it is an application-specific
291command and returns \fBE_UNKNOWN_COMMAND\fR. Application-defined commands
292should be defined relative to \fBMAX_COMMAND\fR, the maximum value of these
293pre-defined requests.
294.SH RETURN VALUE
295\fBform_driver\fR returns one of the following error codes:
296.TP 5
297.B E_OK
298The routine succeeded.
299.TP 5
300.B E_BAD_ARGUMENT
301Routine detected an incorrect or out-of-range argument.
302.TP 5
303.B E_BAD_STATE
304Routine was called from an initialization or termination function.
305.TP 5
306.B E_NOT_POSTED
307The form has not been posted.
308.TP 5
309.B E_INVALID_FIELD
310Contents of field is invalid.
311.TP 5
312.B E_REQUEST_DENIED
313The form driver could not process the request.
314.TP 5
315.B E_SYSTEM_ERROR
316System error occurred (see \fBerrno\fR).
317.TP 5
318.B E_UNKNOWN_COMMAND
319The form driver code saw an unknown request code.
320.
321.SH SEE ALSO
322\fBcurses\fR(3X),
323\fBform\fR(3X),
324\fBwgetch\fR(3X).
325.SH NOTES
326The header file \fB<form.h>\fR automatically includes the header files
327\fB<curses.h>\fR.
328.SH PORTABILITY
329These routines emulate the System V forms library. They were not supported on
330Version 7 or BSD versions.
331.SH AUTHORS
332Juergen Pfeifer. Manual pages and adaptation for new curses by Eric
333S. Raymond.
334.\"#
335.\"# The following sets edit modes for GNU EMACS
336.\"# Local Variables:
337.\"# mode:nroff
338.\"# fill-column:79
339.\"# End: