Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1 | .\"*************************************************************************** |
| 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 |
| 36 | int form_driver(FORM *form, int c); |
| 37 | .br |
| 38 | .SH DESCRIPTION |
| 39 | Once a form has been posted (displayed), you should funnel input events to it |
| 40 | through \fBform_driver\fR. This routine has three major input cases: |
| 41 | .TP 3 |
| 42 | - |
| 43 | The input is a form navigation request. |
| 44 | Navigation request codes are constants defined in \fB<form.h>\fP, |
| 45 | which are distinct from the key- and character codes returned by \fBwgetch\fP. |
| 46 | .TP 3 |
| 47 | - |
| 48 | The input is a printable character. |
| 49 | Printable characters (which must be positive, less than 256) are |
| 50 | checked according to the program's locale settings. |
| 51 | .TP 3 |
| 52 | - |
| 53 | The input is the KEY_MOUSE special key associated with an mouse event. |
| 54 | .PP |
| 55 | The form driver requests are as follows: |
| 56 | .TP 5 |
| 57 | REQ_NEXT_PAGE |
| 58 | Move to the next page. |
| 59 | .TP 5 |
| 60 | REQ_PREV_PAGE |
| 61 | Move to the previous page. |
| 62 | .TP 5 |
| 63 | REQ_FIRST_PAGE |
| 64 | Move to the first page. |
| 65 | .TP 5 |
| 66 | REQ_LAST_PAGE |
| 67 | Move to the last field. |
| 68 | .sp |
| 69 | .TP 5 |
| 70 | REQ_NEXT_FIELD |
| 71 | Move to the next field. |
| 72 | .TP 5 |
| 73 | REQ_PREV_FIELD |
| 74 | Move to the previous field. |
| 75 | .TP 5 |
| 76 | REQ_FIRST_FIELD |
| 77 | Move to the first field. |
| 78 | .TP 5 |
| 79 | REQ_LAST_FIELD |
| 80 | Move to the last field. |
| 81 | .TP 5 |
| 82 | REQ_SNEXT_FIELD |
| 83 | Move to the sorted next field. |
| 84 | .TP 5 |
| 85 | REQ_SPREV_FIELD |
| 86 | Move to the sorted previous field. |
| 87 | .TP 5 |
| 88 | REQ_SFIRST_FIELD |
| 89 | Move to the sorted first field. |
| 90 | .TP 5 |
| 91 | REQ_SLAST_FIELD |
| 92 | Move to the sorted last field. |
| 93 | .TP 5 |
| 94 | REQ_LEFT_FIELD |
| 95 | Move left to a field. |
| 96 | .TP 5 |
| 97 | REQ_RIGHT_FIELD |
| 98 | Move right to a field. |
| 99 | .TP 5 |
| 100 | REQ_UP_FIELD |
| 101 | Move up to a field. |
| 102 | .TP 5 |
| 103 | REQ_DOWN_FIELD |
| 104 | Move down to a field. |
| 105 | .sp |
| 106 | .TP 5 |
| 107 | REQ_NEXT_CHAR |
| 108 | Move to the next char. |
| 109 | .TP 5 |
| 110 | REQ_PREV_CHAR |
| 111 | Move to the previous char. |
| 112 | .TP 5 |
| 113 | REQ_NEXT_LINE |
| 114 | Move to the next line. |
| 115 | .TP 5 |
| 116 | REQ_PREV_LINE |
| 117 | Move to the previous line. |
| 118 | .TP 5 |
| 119 | REQ_NEXT_WORD |
| 120 | Move to the next word. |
| 121 | .TP 5 |
| 122 | REQ_PREV_WORD |
| 123 | Move to the previous word. |
| 124 | .TP 5 |
| 125 | REQ_BEG_FIELD |
| 126 | Move to the beginning of the field. |
| 127 | .TP 5 |
| 128 | REQ_END_FIELD |
| 129 | Move to the end of the field. |
| 130 | .TP 5 |
| 131 | REQ_BEG_LINE |
| 132 | Move to the beginning of the line. |
| 133 | .TP 5 |
| 134 | REQ_END_LINE |
| 135 | Move to the end of the line. |
| 136 | .TP 5 |
| 137 | REQ_LEFT_CHAR |
| 138 | Move left in the field. |
| 139 | .TP 5 |
| 140 | REQ_RIGHT_CHAR |
| 141 | Move right in the field. |
| 142 | .TP 5 |
| 143 | REQ_UP_CHAR |
| 144 | Move up in the field. |
| 145 | .TP 5 |
| 146 | REQ_DOWN_CHAR |
| 147 | Move down in the field. |
| 148 | .sp |
| 149 | .TP 5 |
| 150 | REQ_NEW_LINE |
| 151 | Insert or overlay a new line. |
| 152 | .TP 5 |
| 153 | REQ_INS_CHAR |
| 154 | Insert a blank at the cursor. |
| 155 | .TP 5 |
| 156 | REQ_INS_LINE |
| 157 | Insert a blank line at the cursor. |
| 158 | .TP 5 |
| 159 | REQ_DEL_CHAR |
| 160 | Delete character at the cursor. |
| 161 | .TP 5 |
| 162 | REQ_DEL_PREV |
| 163 | Delete character before the cursor. |
| 164 | .TP 5 |
| 165 | REQ_DEL_LINE |
| 166 | Delete line at the cursor. |
| 167 | .TP 5 |
| 168 | REQ_DEL_WORD |
| 169 | Delete blank-delimited word at the cursor. |
| 170 | .TP 5 |
| 171 | REQ_CLR_EOL |
| 172 | Clear to end of line from cursor. |
| 173 | .TP 5 |
| 174 | REQ_CLR_EOF |
| 175 | Clear to end of field from cursor. |
| 176 | .TP 5 |
| 177 | REQ_CLR_FIELD |
| 178 | Clear the entire field. |
| 179 | .TP 5 |
| 180 | REQ_OVL_MODE |
| 181 | Enter overlay mode. |
| 182 | .TP 5 |
| 183 | REQ_INS_MODE |
| 184 | Enter insert mode. |
| 185 | .sp |
| 186 | .TP 5 |
| 187 | REQ_SCR_FLINE |
| 188 | Scroll the field forward a line. |
| 189 | .TP 5 |
| 190 | REQ_SCR_BLINE |
| 191 | Scroll the field backward a line. |
| 192 | .TP 5 |
| 193 | REQ_SCR_FPAGE |
| 194 | Scroll the field forward a page. |
| 195 | .TP 5 |
| 196 | REQ_SCR_BPAGE |
| 197 | Scroll the field backward a page. |
| 198 | .TP 5 |
| 199 | REQ_SCR_FHPAGE |
| 200 | Scroll the field forward half a page. |
| 201 | .TP 5 |
| 202 | REQ_SCR_BHPAGE |
| 203 | Scroll the field backward half a page. |
| 204 | .sp |
| 205 | .TP 5 |
| 206 | REQ_SCR_FCHAR |
| 207 | Scroll the field forward a character. |
| 208 | .TP 5 |
| 209 | REQ_SCR_BCHAR |
| 210 | Scroll the field backward a character. |
| 211 | .TP 5 |
| 212 | REQ_SCR_HFLINE |
| 213 | Horizontal scroll the field forward a line. |
| 214 | .TP 5 |
| 215 | REQ_SCR_HBLINE |
| 216 | Horizontal scroll the field backward a line. |
| 217 | .TP 5 |
| 218 | REQ_SCR_HFHALF |
| 219 | Horizontal scroll the field forward half a line. |
| 220 | .TP 5 |
| 221 | REQ_SCR_HBHALF |
| 222 | Horizontal scroll the field backward half a line. |
| 223 | .sp |
| 224 | .TP |
| 225 | REQ_VALIDATION |
| 226 | Validate field. |
| 227 | .TP |
| 228 | REQ_NEXT_CHOICE |
| 229 | Display next field choice. |
| 230 | .TP |
| 231 | REQ_PREV_CHOICE |
| 232 | Display previous field choice. |
| 233 | .PP |
| 234 | If the second argument is a printable character, the driver places it |
| 235 | in the current position in the current field. If it is one of the forms |
| 236 | requests listed above, that request is executed. |
| 237 | .SS MOUSE HANDLING |
| 238 | .PP |
| 239 | If the second argument is the KEY_MOUSE special key, the associated |
| 240 | mouse event is translated into one of the above pre-defined requests. |
| 241 | Currently only clicks in the user window (e.g. inside the form display |
| 242 | area or the decoration window) are handled. |
| 243 | .PP |
| 244 | If you click above the display region of the form: |
| 245 | .RS |
| 246 | .TP |
| 247 | a REQ_PREV_FIELD is generated for a single click, |
| 248 | .TP |
| 249 | a REQ_PREV_PAGE is generated for a double-click and |
| 250 | .TP |
| 251 | a REQ_FIRST_FIELD is generated for a triple-click. |
| 252 | .RE |
| 253 | .PP |
| 254 | If you click below the display region of the form: |
| 255 | .RS |
| 256 | .TP |
| 257 | a REQ_NEXT_FIELD is generated for a single click, |
| 258 | .TP |
| 259 | a REQ_NEXT_PAGE is generated for a double-click and |
| 260 | .TP |
| 261 | a REQ_LAST_FIELD is generated for a triple-click. |
| 262 | .RE |
| 263 | .PP |
| 264 | If you click at an field inside the display area of the form: |
| 265 | .RS |
| 266 | .TP 3 |
| 267 | - |
| 268 | the form cursor is positioned to that field. |
| 269 | .TP 3 |
| 270 | - |
| 271 | If you double-click a field, |
| 272 | the form cursor is positioned to that field |
| 273 | and \fBE_UNKNOWN_COMMAND\fR is returned. |
| 274 | This return value makes sense, |
| 275 | because a double click usually means that an field-specific action should |
| 276 | be returned. |
| 277 | It is exactly the purpose of this return value to signal that an |
| 278 | application specific command should be executed. |
| 279 | .TP 3 |
| 280 | - |
| 281 | If a translation |
| 282 | into a request was done, \fBform_driver\fR returns the result of this request. |
| 283 | .RE |
| 284 | .PP |
| 285 | If you clicked outside the user window or the mouse event could not be translated |
| 286 | into a form request an \fBE_REQUEST_DENIED\fR is returned. |
| 287 | .SS APPLICATION-DEFINED COMMANDS |
| 288 | .PP |
| 289 | If the second argument is neither printable nor one of the above |
| 290 | pre-defined form requests, the driver assumes it is an application-specific |
| 291 | command and returns \fBE_UNKNOWN_COMMAND\fR. Application-defined commands |
| 292 | should be defined relative to \fBMAX_COMMAND\fR, the maximum value of these |
| 293 | pre-defined requests. |
| 294 | .SH RETURN VALUE |
| 295 | \fBform_driver\fR returns one of the following error codes: |
| 296 | .TP 5 |
| 297 | .B E_OK |
| 298 | The routine succeeded. |
| 299 | .TP 5 |
| 300 | .B E_BAD_ARGUMENT |
| 301 | Routine detected an incorrect or out-of-range argument. |
| 302 | .TP 5 |
| 303 | .B E_BAD_STATE |
| 304 | Routine was called from an initialization or termination function. |
| 305 | .TP 5 |
| 306 | .B E_NOT_POSTED |
| 307 | The form has not been posted. |
| 308 | .TP 5 |
| 309 | .B E_INVALID_FIELD |
| 310 | Contents of field is invalid. |
| 311 | .TP 5 |
| 312 | .B E_REQUEST_DENIED |
| 313 | The form driver could not process the request. |
| 314 | .TP 5 |
| 315 | .B E_SYSTEM_ERROR |
| 316 | System error occurred (see \fBerrno\fR). |
| 317 | .TP 5 |
| 318 | .B E_UNKNOWN_COMMAND |
| 319 | The 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 |
| 326 | The header file \fB<form.h>\fR automatically includes the header files |
| 327 | \fB<curses.h>\fR. |
| 328 | .SH PORTABILITY |
| 329 | These routines emulate the System V forms library. They were not supported on |
| 330 | Version 7 or BSD versions. |
| 331 | .SH AUTHORS |
| 332 | Juergen Pfeifer. Manual pages and adaptation for new curses by Eric |
| 333 | S. Raymond. |
| 334 | .\"# |
| 335 | .\"# The following sets edit modes for GNU EMACS |
| 336 | .\"# Local Variables: |
| 337 | .\"# mode:nroff |
| 338 | .\"# fill-column:79 |
| 339 | .\"# End: |