]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/dialog/dialog.3
login(1): when exporting variables check the result of setenv(3)
[FreeBSD/FreeBSD.git] / contrib / dialog / dialog.3
1 '\" t
2 .\" $Id: dialog.3,v 1.121 2018/06/20 01:21:53 tom Exp $
3 .\" Copyright 2005-2017,2018  Thomas E. Dickey
4 .\"
5 .\" This program is free software; you can redistribute it and/or modify
6 .\" it under the terms of the GNU Lesser General Public License, version 2.1
7 .\" as published by the Free Software Foundation.
8 .\"
9 .\" This program is distributed in the hope that it will be useful, but
10 .\" WITHOUT ANY WARRANTY; without even the implied warranty of
11 .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12 .\" Lesser General Public License for more details.
13 .\"
14 .\" You should have received a copy of the GNU Lesser General Public
15 .\" License along with this program; if not, write to
16 .\"     Free Software Foundation, Inc.
17 .\"     51 Franklin St., Fifth Floor
18 .\"     Boston, MA 02110, USA.
19 .\"
20 .\" definitions for renaming
21 .ds p dialog
22 .ds l dialog
23 .ds L Dialog
24 .ds D DIALOG
25 .
26 .de ES
27 .ne 8
28 .IP
29 ..
30 .de Ex
31 .RS +7
32 .PP
33 .nf
34 .ft CW
35 ..
36 .de Ee
37 .fi
38 .ft R
39 .RE
40 ..
41 .\" Bulleted paragraph
42 .de bP
43 .ie n  .IP \(bu 4
44 .el    .IP \(bu 2
45 ..
46 .ie \n(.g .ds `` \(lq
47 .el       .ds `` ``
48 .ie \n(.g .ds '' \(rq
49 .el       .ds '' ''
50 .TH \*D 3 "" "$Date: 2018/06/20 01:21:53 $"
51 .SH NAME
52 dialog \- widgets and utilities for the \*p program
53 .SH SYNOPSIS
54 .B cc [ flag ... ] file ...  -l\*l [ library ... ]
55 .br
56 \ \ \ or
57 .br
58 .B cc $(\*p-config --cflags) file ... $(\*p-config --libs) ]
59 .sp
60 .B #include <\*l.h>
61 .PP
62 \fB\*L\fP
63 is a program that will let you present a variety of questions or
64 display messages using dialog boxes from a shell script.
65 It is built from the \fB\*l\fP library,
66 which consists of several widgets
67 as well as utility functions that are used by the widgets
68 or the main program.
69 .
70 .SH DESCRIPTION
71 This manpage documents the features from \fI<\*l.h>\fP which
72 are likely to be important to developers using the widgets directly.
73 Some hints are also given for developing new widgets.
74 .PP
75 Here is a \fB\*l\fP version of \fIHello World\/\fP:
76 .RS
77 .nf
78 int main(void)
79 {
80         int status;
81         init_dialog(stdin, stdout);
82         status = dialog_yesno(
83                         "Hello, in dialog-format",
84                         "Hello World!",
85                         0, 0);
86         end_dialog();
87         return status;
88 }
89 .fi
90 .RE
91 .
92 .\" ************************************************************************
93 .SH DEFINITIONS
94 Exit codes (passed back to the main program for its use)
95 are defined with a "\fIDLG_EXIT_\fP prefix.
96 The efined constants can be mapped using environment variables
97 as described in \fB\*p\fP(1),
98 e.g., \fIDLG_EXIT_OK\fP corresponds to \fI$DIALOG_OK\fP.
99 .PP
100 Useful character constants which correspond to user input
101 are named with the "\fICHR_\fP" prefix, e.g.,
102 \fICHR_BACKSPACE\fP.
103 .PP
104 Colors and video attributes are categorized and associated with
105 settings in the configuration file
106 (see the discussion of \fI$DIALOGRC\fP in \fB\*p\/\fP(1)).
107 The \fIDIALOG_ATR(n)\fP macro is used for defining the references
108 to the combined color and attribute table \fBdlg_color_table[]\fP.
109 .PP
110 The \fB\*p\fP application passes its command-line parameters
111 to the widget functions.
112 Some of those parameters are single values,
113 but some of the widgets accept data as an array of values.
114 Those include checklist/radiobox, menubox and formbox.
115 When the \fB--item-help\fP option is given, an extra column
116 of data is expected.
117 The USE_ITEM_HELP(), CHECKBOX_TAGS, MENUBOX_TAGS and FORMBOX_TAGS
118 macros are used to hide this difference from the calling application.
119 .PP
120 Most of the other definitions found in \fI<\*l.h>\fP
121 are used for convenience in building the library or main program.
122 These include definitions based on the generated \fI<dlg_config.h>\fP header.
123 .
124 .\" ************************************************************************
125 .SH DATA STRUCTURES
126 All of the global data for the \fB\*l\fP library is stored in
127 a few structures:
128 \fIDIALOG_STATE\fP, \fIDIALOG_VARS\fP and \fIDIALOG_COLORS\fP.
129 The corresponding
130 \fBdialog_state\fP, \fBdialog_vars\fP and \fBdlg_color_table\fP
131 global variables should be initialized to zeros,
132 and then populated with the data to use.
133 A few of these must be nonzero for the corresponding widgets to function.
134 As as the case with function names,
135 variables beginning with "\fIdialog_\fP"
136 are designed for use by the calling application
137 while variables beginning with "\fIdlg_\fP"
138 are intended for lower levels, e.g., by the \fB\*l\fP library.
139 .\" ---------------------------------------------------------------------------
140 .SH DIALOG_STATE
141 The \fIstate\fP variables are \fB\*l\fP's working variables.
142 It initializes those, uses them to manage the widgets.
143 .\" ---------------------------------------------------------------------------
144 .SS .all_subwindows
145 This is a linked list of all subwindows created by the library.
146 The \fBdlg_del_window\fP function uses this
147 to free storage for subwindows when deleting a window.
148 .\" ---------------------------------------------------------------------------
149 .SS .all_windows
150 This is a linked list of all windows created by the library.
151 The \fBdlg_del_window\fP function uses this to locate windows which
152 may be redrawn after deleting a window.
153 .\" ---------------------------------------------------------------------------
154 .SS .aspect_ratio
155 This corresponds to the command-line option "\fB--aspect-ratio\fP".
156 The value gives the application
157 some control over the box dimensions when using auto
158 sizing (specifying 0 for height and width).
159 It represents width / height.
160 The default is 9, which means 9 characters wide to every 1 line high.
161 .\" ---------------------------------------------------------------------------
162 .SS .finish_string
163 When set to true, this allows calls to \fBdlg_finish_string\fP to discard the
164 corresponding data which is created to speed up layout computations for the
165 given string parameter.
166 The \fBgauge\fP widget uses this feature.
167 .\" ---------------------------------------------------------------------------
168 .SS .getc_callbacks
169 This is set up in \fIui_getc.c\fP to record windows which must be polled
170 for input, e.g., to handle the background tailbox widget.
171 One window is designated as the foreground or control window.
172 .\" ---------------------------------------------------------------------------
173 .SS .getc_redirect
174 If the control window for \fIDIALOG_STATE.getc_callbacks\fP is
175 closed, the list is transferred to this variable.
176 Closing all windows causes the application to exit.
177 .\" ---------------------------------------------------------------------------
178 .SS .no_mouse
179 This corresponds to the command-line option "\fB--no-mouse\fP".
180 If true, \fB\*p\fP will not initialize (and enable) the mouse in
181 \fIinit_dialog\fP.
182 .\" ---------------------------------------------------------------------------
183 .SS .output
184 This is set in the \fB\*p\fP application to the stream on
185 which the application and library functions may write text results.
186 Normally that is the standard error,
187 since the curses library prefers to write its data to the standard output.
188 Some scripts, trading portability for convenience,
189 prefer to write results to the standard output,
190 e.g., by using the "\fB--stdout\fP" option.
191 .\" ---------------------------------------------------------------------------
192 .SS .output_count
193 This is incremented by \fBdlg_does_output\fP,
194 which is called by each widget that writes text to the output.
195 The \fB\*p\fP application uses that to decide if it should
196 also write a separator, i.e.,
197 \fIDIALOG_STATE.separate_str\fP,
198 between calls to each widget.
199 .\" ---------------------------------------------------------------------------
200 .SS .pipe_input
201 This is set in \fIinit_dialog\fP to a stream which can be used by the
202 \fBgauge\fP widget, which must be the application's standard input.
203 The \fB\*p\fP application calls \fIinit_dialog\fP normally with
204 \fIinput\fP set to the standard input, but optionally based on the
205 "\fB--input-fd\fP" option.
206 Since the application cannot read from
207 a pipe (standard input) and at the same time read
208 the curses input from the standard input,
209 it must allow for reopening the latter from either
210 a specific file descriptor,
211 or directly from the terminal.
212 The adjusted pipe stream value is stored in this variable.
213 .\" ---------------------------------------------------------------------------
214 .SS .screen_initialized
215 This is set in \fIinit_dialog\fP and
216 reset in \fIend_dialog\fP.
217 It is used to check if curses has been initialized,
218 and if the \fIendwin\fP function must be called on exit.
219 .\" ---------------------------------------------------------------------------
220 .SS .screen_output
221 This is set in \fIinit_dialog\fP to the output stream used
222 by the curses library.
223 Normally that is the standard output,
224 unless that happens to not be a terminal (and if \fIinit_dialog\fP can
225 successfully open the terminal directly).
226 .\" ---------------------------------------------------------------------------
227 .SS .separate_str
228 This corresponds to the command-line option "\fB--separate-widget\fP".
229 The given string
230 specifies a string that will separate the output on \fB\*p\fP's output from
231 each widget.
232 This is used to simplify parsing the result of a dialog with several widgets.
233 If this option is not given,
234 the default separator string is a tab character.
235 .\" ---------------------------------------------------------------------------
236 .SS .tab_len
237 This corresponds to the command-line option "\fB--tab-len\fP \fInumber\/\fP".
238 Specify the number of spaces that a tab character occupies if the
239 "\fB--tab-correct\fP"
240 option is given.
241 The default is 8.
242 .\" ---------------------------------------------------------------------------
243 .SS .text_height
244 This text-formatting functions set this to the number of lines used for
245 formatting a string.
246 .LP
247 It is used by \fB\*l\fP for the command-line options
248 "\fB--print-text-size\fP" and
249 "\fB--print-text-only\fP".
250 .\" ---------------------------------------------------------------------------
251 .SS .text_only
252 \fB\*L\fP uses this in the command-line option "\fB--print-text-only\fP".
253 .LP
254 The text-formatting functions
255 (\fBdlg_print_text\fP,
256 \fBdlg_print_line\fP, and
257 \fBdlg_print_autowrap\fP)
258 check this to decide whether to print the formatted text to
259 \fB\*p\fP's output or to the curses-display.
260 .LP
261 Also,
262 \fBdlg_auto_size\fP checks the flag, allowing it to be used before
263 \fBinit_dialog\fP is called.
264 .\" ---------------------------------------------------------------------------
265 .SS .text_width
266 This text-formatting functions set this to the number of columns used for
267 formatting a string.
268 .LP
269 It is used by \fB\*l\fP for the command-line options
270 "\fB--print-text-size\fP" and
271 "\fB--print-text-only\fP".
272 .\" ---------------------------------------------------------------------------
273 .SS .trace_output
274 This corresponds to the command-line option "\fB--trace\fP \fIfile\fP".
275 It is the file pointer to which trace messages are written.
276 .\" ---------------------------------------------------------------------------
277 .SS .use_colors
278 This is set in \fIinit_dialog\fP if the curses implementation supports color.
279 .\" ---------------------------------------------------------------------------
280 .SS .use_scrollbar
281 This corresponds to the command-line option "\fB--scrollbar\fP".
282 If true,
283 draw a scrollbar to make windows holding scrolled data more readable.
284 .\" ---------------------------------------------------------------------------
285 .SS .use_shadow
286 This corresponds to the command-line option "\fB--no-shadow\fP".
287 This is set in \fIinit_dialog\fP if the curses implementation supports color.
288 If true,
289 suppress shadows that would be drawn to the right and bottom of each dialog box.
290 .\" ---------------------------------------------------------------------------
291 .SS .visit_items
292 This corresponds to the command-line option "\fB--visit-items\fP".
293 Modify the tab-traversal of the list-oriented widgets
294 (buildlist, checklist, radiobox, menubox, inputmenu, and treeview)
295 to include the list of items as one of the states.
296 This is useful as a visual aid,
297 i.e., the cursor position helps some users.
298 .\" ---------------------------------------------------------------------------
299 .PP
300 The \fB\*p\fP application resets the \fBdialog_vars\fP data before
301 accepting options to invoke each widget.
302 Most of the \fIDIALOG_VARS\fP members are set directly from \fB\*p\fP's
303 command-line options:
304 .\" ---------------------------------------------------------------------------
305 .SH
306 DIALOG_VARS
307 .PP
308 In contrast to \fBDIALOG_STATE\fP, the members of \fBDIALOG_VARS\fP
309 are set by command-line options in \fB\*p\fP.
310 .\" ---------------------------------------------------------------------------
311 .SS .ascii_lines
312 This corresponds to the command-line option "\fB--ascii-lines\fP.
313 It causes line-drawing to be done with ASCII characters, e.g., "+" and "-".
314 See \fIDIALOG_VARS.no_lines\fP.
315 .\" ---------------------------------------------------------------------------
316 .SS .backtitle
317 This corresponds to the command-line option
318 "\fB--backtitle\fP \fIbacktitle\/\fP".
319 It specifies a
320 \fIbacktitle\fP
321 string to be displayed on the backdrop, at the top of the screen.
322 .\" ---------------------------------------------------------------------------
323 .SS .beep_after_signal
324 This corresponds to the command-line option "\fB--beep-after\fP".
325 If true, beep after a user has completed a widget
326 by pressing one of the buttons.
327 .\" ---------------------------------------------------------------------------
328 .SS .beep_signal
329 This corresponds to the command-line option "\fB--beep\fP".
330 It is obsolete.
331 .\" ---------------------------------------------------------------------------
332 .SS .begin_set
333 This is true if the command-line option "\fB--begin\fP \fIy x\/\fP" was used.
334 It specifies the position of the upper left corner
335 of a dialog box on the screen.
336 .\" ---------------------------------------------------------------------------
337 .SS .begin_x
338 This corresponds to the \fIx\fP value from
339 the command-line option "\fB--begin\fP \fIy x\/\fP" (second value).
340 .\" ---------------------------------------------------------------------------
341 .SS .begin_y
342 This corresponds to the \fIy\fP value from
343 the command-line option "\fB--begin\fP \fIy x\/\fP" (first value).
344 .\" ---------------------------------------------------------------------------
345 .SS .cancel_label
346 This corresponds to the command-line option
347 "\fB--cancel-label\fP \fIstring\/\fP".
348 The given \fIstring\fP overrides the label used for \*(``Cancel\*('' buttons.
349 .\" ---------------------------------------------------------------------------
350 .SS .cant_kill
351 This corresponds to the command-line option "\fB--no-kill\fP".
352 If true, this tells
353 \fB\*p\fP
354 to put the
355 \fBtailboxbg\fP
356 box in the background,
357 printing its process id to \fB\*p\fP's output.
358 SIGHUP is disabled for the background process.
359 .\" ---------------------------------------------------------------------------
360 .SS .colors
361 This corresponds to the command-line option "\fB--colors\fP".
362 If true, interpret embedded "\eZ" sequences in the dialog text
363 by the following character,
364 which tells \fB\*p\fP to set colors or video attributes:
365 0 through 7 are the ANSI codes used in curses:
366 black,
367 red,
368 green,
369 yellow,
370 blue,
371 magenta,
372 cyan and
373 white respectively.
374 Bold is set by 'b', reset by 'B'.
375 Reverse is set by 'r', reset by 'R'.
376 Underline is set by 'u', reset by 'U'.
377 The settings are cumulative, e.g., "\eZb\eZ1" makes the following text
378 bright red.
379 Restore normal settings with "\eZn".
380 .\" ---------------------------------------------------------------------------
381 .SS .column_separator
382 This corresponds to the command-line option "\fB--column-separator\fP".
383 \fB\*L\fP splits data for radio/checkboxes and menus on the
384 occurrences of the given string, and aligns the split data into columns.
385 .\" ---------------------------------------------------------------------------
386 .SS .cr_wrap
387 This corresponds to the command-line option "\fB--cr-wrap\fP".
388 If true,
389 interpret embedded newlines in the dialog text as a newline on the screen.
390 Otherwise, \fB\*p\fR will only wrap lines where needed
391 to fit inside the text box.
392 Even though you can control line breaks with this,
393 \fB\*p\fR will still wrap any lines that are too long for the width of the box.
394 Without cr-wrap, the layout of your text may be formatted to look nice
395 in the source code of your script without affecting the way it will
396 look in the dialog.
397 .\" ---------------------------------------------------------------------------
398 .SS .date_format
399 This corresponds to the command-line option
400 "\fB--date-format\fP \fIstring\/\fP".
401 If the host provides \fBstrftime\fP, and the value is nonnull,
402 the calendar widget uses this to format its output.
403 .\" ---------------------------------------------------------------------------
404 .SS .default_button
405 This is set by the command-line option "\fB--default-button\fP.
406 It is used by \fBdlg_default_button\fP.
407 .\" ---------------------------------------------------------------------------
408 .SS .default_item
409 This corresponds to the command-line option
410 "\fB--default-item\fP \fIstring\/\fP".
411 The given string is used as
412 the default item in a checklist, form or menu box.
413 Normally the first item in the box is the default.
414 .\" ---------------------------------------------------------------------------
415 .SS .defaultno
416 This corresponds to the command-line option "\fB--defaultno\fP".
417 If true,
418 make the default value of the
419 \fByes/no\fP
420 box a
421 .BR No .
422 Likewise, treat the default button of widgets that provide
423 \*(``OK\*('' and \*(``Cancel\*(''
424 as a \fICancel\fP.
425 If \fB--nocancel\fP was given that option overrides this,
426 making the default button always \*(``Yes\*(''
427 (internally the same as \*(``OK\*('').
428 .\" ---------------------------------------------------------------------------
429 .SS .dlg_clear_screen
430 This corresponds to the command-line option "\fB--clear\fP".
431 This option is implemented in the main program, not the library.
432 If true,
433 the screen will be cleared on exit.
434 This may be used alone, without other options.
435 .\" ---------------------------------------------------------------------------
436 .SS .exit_label
437 This corresponds to the command-line option "\fB--exit-label string\fP".
438 The given string overrides the label used for \*(``EXIT\*('' buttons.
439 .\" ---------------------------------------------------------------------------
440 .SS .extra_button
441 This corresponds to the command-line option "\fB--extra-button\fP".
442 If true, some widgets show an extra button,
443 between \*(``OK\*('' and \*(``Cancel\*('' buttons.
444 .\" ---------------------------------------------------------------------------
445 .SS .extra_label
446 This corresponds to the command-line option
447 "\fB--extra-label\fP \fIstring\/\fP".
448 The given string overrides the label used for \*(``Extra\*('' buttons.
449 Note: for inputmenu widgets, this defaults to \*(``Rename\*(''.
450 .\" ---------------------------------------------------------------------------
451 .SS .formitem_type
452 This is set by the command-line option "\fB--passwordform\fP"
453 to tell the form widget that its text fields should be treated like
454 password widgets.
455 .\" ---------------------------------------------------------------------------
456 .SS .help_button
457 This corresponds to the command-line option "\fB--help-button\fP".
458 If true, some widgets show a help-button after
459 \*(``OK\*('' and \*(``Cancel\*('' buttons,
460 i.e., in checklist, radiolist and menu boxes.
461 If \fB--item-help\fR is also given, on exit
462 the return status will be the same as for the \*(``OK\*('' button,
463 and the item-help text will be written to \fB\*p\fP's output
464 after the token \*(``HELP\*(''.
465 Otherwise, the return status will indicate that the Help button was pressed,
466 and no message printed.
467 .\" ---------------------------------------------------------------------------
468 .SS .help_file
469 This corresponds to the command-line option "\fB--hfile\fP \fIstring\/\fP".
470 The given filename is passed to \fBdialog_helpfile\fP when the user
471 presses F1.
472 .\" ---------------------------------------------------------------------------
473 .SS .help_label
474 This corresponds to the command-line option "\fB--help-label\fP \fIstring\/\fP".
475 The given string overrides the label used for \*(``Help\*('' buttons.
476 .\" ---------------------------------------------------------------------------
477 .SS .help_line
478 This corresponds to the command-line option "\fB--hline\fP \fIstring\/\fP".
479 The given string is displayed in the bottom of dialog windows,
480 like a subtitle.
481 .\" ---------------------------------------------------------------------------
482 .SS .help_status
483 This corresponds to the command-line option "\fB--help-status\fP".
484 If true, and the the help-button is selected,
485 writes the checklist or radiolist information
486 after the item-help \*(``HELP\*('' information.
487 This can be used to reconstruct the state of a checklist after processing
488 the help request.
489 .\" ---------------------------------------------------------------------------
490 .SS .help_tags
491 This corresponds to the command-line option "\fB--help-tags\fP".
492 If true,
493 \fBdlg_add_help_formitem\fP and
494 \fBdlg_add_help_listitem\fP use the item's tag value consistently
495 rather than using the tag's help-text value
496 when \fIDIALOG_VARS.item_help\fP is set.
497 .\" ---------------------------------------------------------------------------
498 .SS .input_length
499 This is nonzero if \fIDIALOG_VARS.input_result\fP is allocated,
500 versus being a pointer to the user's local variables.
501 .\" ---------------------------------------------------------------------------
502 .SS .input_menu
503 This flag is set to denote whether the menubox widget
504 implements a menu versus a inputmenu widget.
505 .\" ---------------------------------------------------------------------------
506 .SS .input_result
507 This may be either a user-supplied buffer,
508 or a buffer dynamically allocated by the library,
509 depending on \fIDIALOG_VARS.input_length\fP:
510 .bP
511 If \fIDIALOG_VARS.input_length\fP is zero,
512 this is a pointer to user buffer (on the stack, or static).
513 The buffer size is assumed to be \fBMAX_LEN\fP,
514 which is defined in \fI<\*l.h>\fP.
515 .bP
516 When \fIDIALOG_VARS.input_length\fP is nonzero,
517 this is a dynamically-allocated buffer used by the widgets to return
518 printable results to the calling application.
519 .LP
520 Certain widgets copy a result to this buffer.
521 If the pointer is NULL, or if the length is insufficient for
522 the result, then the \fB\*l\fP library allocates a buffer which is large enough,
523 and sets \fIDIALOG_VARS.input_length\fP.
524 Callers should check for this case if they have supplied their own buffer.
525 .\" ---------------------------------------------------------------------------
526 .SS .insecure
527 This corresponds to the command-line option "\fB--insecure\fP".
528 If true, make the password widget friendlier but less secure,
529 by echoing asterisks for each character.
530 .\" ---------------------------------------------------------------------------
531 .SS .in_helpfile
532 This variable is used to prevent \fBdialog_helpfile\fP from showing
533 anything, e.g., if F1 were pressed within a help-file display.
534 .\" ---------------------------------------------------------------------------
535 .SS .iso_week
536 This corresponds to the command-line option "\fB--iso-week\fP".
537 It is used in the calendar widget to tell how
538 to compute the starting week for the year:
539 .bP
540 by default, the calendar treats January 1 as the first week of the year.
541 .bP
542 If this variable is true, the calendar uses ISO 8601's convention.
543 ISO 8601 numbers weeks starting with the first week in January with
544 a Thursday in the current year.
545 January 1 may be in the \fIprevious\fP year.
546 .\" ---------------------------------------------------------------------------
547 .SS .item_help
548 This corresponds to the command-line option "\fB--item-help\fP".
549 If true,
550 interpret the tags data for checklist, radiolist and menu boxes
551 adding a column whose text is displayed in the bottom line of the
552 screen, for the currently selected item.
553 .\" ---------------------------------------------------------------------------
554 .SS .keep_tite
555 This is set by the command-line option "\fB--keep-tite\fP"
556 to tell \fB\*p\fP to not attempt to cancel the terminal initialization
557 (termcap \fIti\/\fP/\,\fIte\/\fP) sequences
558 which correspond to xterm's alternate-screen switching.
559 Normally \fB\*p\fP does this to avoid flickering when run several times
560 in a script.
561 .\" ---------------------------------------------------------------------------
562 .SS .keep_window
563 This corresponds to the command-line option "\fB--keep-window\fP".
564 If true, do not remove/repaint the window on exit.
565 This is useful for keeping the window contents visible when several
566 widgets are run in the same process.
567 Note that curses will clear the screen when starting a new process.
568 .\" ---------------------------------------------------------------------------
569 .SS .last_key
570 This corresponds to the command-line option "\fB--last-key\fP".
571 .\" ---------------------------------------------------------------------------
572 .SS .max_input
573 This corresponds to the command-line option "\fB--max-input\fP \fIsize\/\fP".
574 Limit input strings to the given size.
575 If not specified, the limit is 2048.
576 .\" ---------------------------------------------------------------------------
577 .SS .no_items
578 This corresponds to the command-line option "\fB--no-items\fP".
579 Some widgets (checklist, inputmenu, radiolist, menu) display a list
580 with two columns (a \*(``tag\*('' and \*(``item\*('',
581 i.e., \*(``description\*('').
582 This tells \fB\*p\fP to read shorter rows from data,
583 omitting the \*(``list\*(''.
584 .\" ---------------------------------------------------------------------------
585 .SS .no_label
586 This corresponds to the command-line option "\fB--no-label\fP \fIstring\/\fP".
587 The given string overrides the label used for \*(``No\*('' buttons.
588 .\" ---------------------------------------------------------------------------
589 .SS .no_lines
590 This corresponds to the command-line option "\fB--no-lines\fP.
591 It suppresses line-drawing.
592 See \fIDIALOG_VARS.ascii_lines\fP.
593 .\" ---------------------------------------------------------------------------
594 .SS .no_nl_expand
595 This corresponds to the command-line option "\fB--no-nl-expand\fP".
596 If false, \fBdlg_trim_string\fP converts literal "\en" substrings
597 in a message into newlines.
598 .\" ---------------------------------------------------------------------------
599 .SS .no_tags
600 This corresponds to the command-line option "\fB--no-tags\fP".
601 Some widgets (checklist, inputmenu, radiolist, menu) display a list
602 with two columns (a \*(``tag\*('' and \*(``item\*('',
603 also known as \*(``description\*('').
604 The tag is useful for scripting, but may not help the user.
605 The \fB--no-tags\fP option (from Xdialog) may be used to suppress the
606 column of tags from the display.
607 .LP
608 Normally \fB\*p\fP allows you to quickly move to entries on the displayed list,
609 by matching a single character to the first character of the tag.
610 When the \fB--no-tags\fP option is given, \fB\*p\fP matches against
611 the first character of the description.
612 In either case, the matchable character is highlighted.
613 .LP
614 Here is a table showing how the no_tags and no_items values interact:
615 .TS
616 tab(/);
617 l l l l l
618 l l l n n.
619 Widget/Fields Shown/Fields Read/.no_items/.no_tags
620 _
621 buildlist/item/tag,item/0/0*
622 buildlist/item/tag,item/0/1
623 buildlist/tag/tag/1/0*
624 buildlist/tag/tag/1/1
625 checklist/tag,item/tag,item/0/0
626 checklist/item/tag,item/0/1
627 checklist/tag/tag/1/0
628 checklist/tag/tag/1/1
629 inputmenu/tag,item/tag,item/0/0
630 inputmenu/item/tag,item/0/1
631 inputmenu/tag/tag/1/0
632 inputmenu/tag/tag/1/1
633 menu/tag,item/tag,item/0/0
634 menu/item/tag,item/0/1
635 menu/tag/tag/1/0
636 menu/tag/tag/1/1
637 radiolist/tag,item/tag,item/0/0
638 radiolist/item/tag,item/0/1
639 radiolist/tag/tag/1/0
640 radiolist/tag/tag/1/1
641 treeview/item/tag,item/0/0*
642 treeview/item/tag,item/0/1
643 treeview/tag/tag/1/0*
644 treeview/tag/tag/1/1
645 _
646 .TE
647 .TP 2
648 *
649 Xdialog does not display the tag column for the analogous buildlist
650 and treeview widgets.
651 \fB\*L\fP does the same on the command-line.
652 However the library interface defaults to displaying the tag column.
653 Your application can enable or disable the tag column as needed for each widget.
654 .\" ---------------------------------------------------------------------------
655 .SS .nocancel
656 This corresponds to the command-line option "\fB--no-cancel\fP".
657 If true,
658 suppress the \*(``Cancel\*('' button in checklist, inputbox and menu box modes.
659 A script can still test if the user pressed the ESC key to cancel to quit.
660 .\" ---------------------------------------------------------------------------
661 .SS .nocollapse
662 This corresponds to the command-line option "\fB--no-collapse\fP".
663 Normally \fB\*p\fR converts tabs to spaces and reduces multiple
664 spaces to a single space for text which is displayed in a message boxes, etc.
665 It true, that feature is disabled.
666 Note that \fB\*p\fR will still wrap text, subject to the \fB--cr-wrap\fR
667 option.
668 .\" ---------------------------------------------------------------------------
669 .SS .nook
670 This corresponds to the command-line option "\fB--nook\fP.
671 \fB\*L\fP will suppress the \*(``ok\*('' (or \*(``yes\*('') button
672 from the widget.
673 .\" ---------------------------------------------------------------------------
674 .SS .ok_label
675 This corresponds to the command-line option "\fB--ok-label\fP \fIstring\/\fP".
676 The given string overrides the label used for \*(``OK\*('' buttons.
677 .\" ---------------------------------------------------------------------------
678 .SS .print_siz
679 This corresponds to the command-line option "\fB--print-size\fP".
680 If true,
681 each widget prints its size to \fB\*p\fP's output when it is invoked.
682 .\" ---------------------------------------------------------------------------
683 .SS .quoted
684 This corresponds to the command-line option "\fB--quoted\fP.
685 Normally \fB\*p\fP quotes the strings returned by checklist's
686 as well as the item-help text.
687 If true, \fB\*p\fP will quote all string results.
688 .\" ---------------------------------------------------------------------------
689 .SS .reorder
690 This corresponds to the command-line option "\fB--reorder\fP.
691 By default, the buildlist widget uses the same order for the output (right)
692 list as for the input (left).
693 If true, \fB\*p\fP will use the order in which a user adds selections
694 to the output list.
695 .\" ---------------------------------------------------------------------------
696 .SS .separate_output
697 This corresponds to the command-line option "\fB--separate-output\fP".
698 If true,
699 checklist widgets output result one line at a time, with no quoting.
700 This facilitates parsing by another program.
701 .\" ---------------------------------------------------------------------------
702 .SS .single_quoted
703 This corresponds to the command-line option "\fB--single-quoted\fP".
704 If true,
705 use single-quoting as needed (and no quotes if unneeded) for the
706 output of checklist's as well as the item-help text.
707 If this option is not set, \fB\*p\fP uses double quotes around each item.
708 The latter requires occasional use of backslashes to make the output useful in
709 shell scripts.
710 .\" ---------------------------------------------------------------------------
711 .SS .size_err
712 This corresponds to the command-line option "\fB--size-err\fP".
713 If true,
714 check the resulting size of a dialog box before trying to use it,
715 printing the resulting size if it is larger than the screen.
716 (This option is obsolete, since all new-window calls are checked).
717 .\" ---------------------------------------------------------------------------
718 .SS .sleep_secs
719 This corresponds to the command-line option "\fB--sleep\fP \fIsecs\/\fP".
720 This option is implemented in the main program, not the library.
721 If nonzero, this is the number of seconds after to delay
722 after processing a dialog box.
723 .\" ---------------------------------------------------------------------------
724 .SS .tab_correct
725 This corresponds to the command-line option "\fB--tab-correct\fP".
726 If true, convert each tab character of the text to one or more spaces.
727 Otherwise, tabs are rendered according to the curses library's interpretation.
728 .\" ---------------------------------------------------------------------------
729 .SS .time_format
730 This corresponds to the command-line option
731 "\fB--time-format\fP \fIstring\/\fP".
732 If the host provides \fBstrftime\fP, and the value is nonnull,
733 the timebox widget uses this to format its output.
734 .\" ---------------------------------------------------------------------------
735 .SS .timeout_secs
736 This corresponds to the command-line option "\fB--timeout\fP \fIsecs\/\fP".
737 If nonzero, timeout input requests (exit with error code)
738 if no user response within the given number of seconds.
739 .\" ---------------------------------------------------------------------------
740 .SS .title
741 This corresponds to the command-line option "\fB--title\fP \fItitle\/\fP".
742 Specifies a
743 \fItitle\fP
744 string to be displayed at the top of the dialog box.
745 .\" ---------------------------------------------------------------------------
746 .SS .trim_whitespace
747 This corresponds to the command-line option "\fB--trim\fP".
748 If true, eliminate leading blanks,
749 trim literal newlines and repeated blanks from message text.
750 .\" ---------------------------------------------------------------------------
751 .SS .week_start
752 This corresponds to the command-line option "\fB--week-start\fP".
753 It is used in the calendar widget to set the starting day for the week.
754 The string value can be
755 .bP
756 a number (0 to 6, Sunday through Saturday using POSIX) or
757 .bP
758 the special value \*(``locale\*('' (this works with systems using glibc,
759 providing an extension to the \fBlocale\fP command,
760 the \fBfirst_weekday\fP value).
761 .bP
762 a string matching one of the abbreviations for the day of the week
763 shown in the \fBcalendar\fP widget, e.g., \*(``Mo\*('' for \*(``Monday\*(''.
764 .\" ---------------------------------------------------------------------------
765 .SS .yes_label
766 This corresponds to the command-line option "\fB--yes-label\fP \fIstring\/\fP".
767 The given string overrides the label used for \*(``Yes\*('' buttons.
768 .
769 .\" ************************************************************************
770 .\" ************************************************************************
771 .SH WIDGETS
772 Functions that implement major functionality for the command-line \fB\*p\fP
773 program, e.g., widgets, have names beginning "\fIdialog_\fP".
774 .PP
775 All dialog boxes have at least three parameters:
776 .RS 3
777 .TP 5
778 \fItitle\fP
779 the caption for the box, shown on its top border.
780 .TP 5
781 \fIheight\fP
782 the height of the dialog box.
783 .TP 5
784 \fIwidth\fP
785 the width of the dialog box.
786 .RE
787 .PP
788 Other parameters depend on the box type.
789 .
790 .\" ************************************************************************
791 .SS dialog_buildlist
792 implements the "\fB--buildlist\fP" option.
793 .TP 5
794 .B const char * \fItitle
795 is the title on the top of the widget.
796 .TP 5
797 .B const char * \fIcprompt
798 is the prompt text shown within the widget.
799 .TP 5
800 .B int \fIheight
801 is the desired height of the box.
802 If zero, the height is adjusted to use the available screen size.
803 .TP 5
804 .B int \fIwidth
805 is the desired width of the box.
806 If zero, the height is adjusted to use the available screen size.
807 .TP 5
808 .B int \fIlist_height
809 is the minimum height to reserve for displaying the list.
810 If zero, it is computed based on the given \fIheight\fP and \fIwidth\fP.
811 .TP 5
812 .B int \fIitem_no
813 is the number of rows in \fIitems\fP.
814 .TP 5
815 .B char ** \fIitems
816 is an array of strings which is viewed either as a list of rows
817 .RS
818 \fItag item status\fR
819 .RE
820 .IP
821 or
822 .RS
823 \fItag item status help\fR
824 .RE
825 .IP
826 depending on whether \fBdialog_vars.item_help\fP is set.
827 .TP 5
828 .B int \fIorder_mode
829 is reserved for future enhancements
830 .
831 .\" ************************************************************************
832 .SS dialog_calendar
833 implements the "\fB--calendar\fP" option.
834 .TP 5
835 .B const char * \fItitle
836 is the title on the top of the widget.
837 .TP 5
838 .B const char * \fIsubtitle
839 is the prompt text shown within the widget.
840 .TP 5
841 .B int \fIheight
842 is the height excluding the fixed-height calendar grid.
843 .TP 5
844 .B int \fIwidth
845 is the overall width of the box,
846 which is adjusted up to the calendar grid's minimum width if needed.
847 .TP 5
848 .B int \fIday
849 is the initial day of the week shown,
850 counting zero as Sunday.
851 If the value is negative, the current day of the week is used.
852 .TP 5
853 .B int \fImonth
854 is the initial month of the year shown,
855 counting one as January.
856 If the value is negative, the current month of the year is used.
857 .TP 5
858 .B int \fIyear
859 is the initial year shown.
860 If the value is negative, the current year is used.
861 .\" ************************************************************************
862 .SS dialog_checklist
863 implements the "\fB--checklist\fP" and "\fB--radiolist\fP" options
864 depending on the \fIflag\fP parameter.
865 .TP 5
866 .B const char * \fItitle
867 is the title on the top of the widget.
868 .TP 5
869 .B const char * \fIcprompt
870 is the prompt text shown within the widget.
871 .TP 5
872 .B int \fIheight
873 is the desired height of the box.
874 If zero, the height is adjusted to use the available screen size.
875 .TP 5
876 .B int \fIwidth
877 is the desired width of the box.
878 If zero, the height is adjusted to use the available screen size.
879 .TP 5
880 .B int \fIlist_height
881 is the minimum height to reserve for displaying the list.
882 If zero, it is computed based on the given \fIheight\fP and \fIwidth\fP.
883 .TP 5
884 .B int \fIitem_no
885 is the number of rows in \fIitems\fP.
886 .TP 5
887 .B int \fIitems
888 is an array of strings which is viewed either as a list of rows
889 .RS
890 \fItag item status\fR
891 .RE
892 .IP
893 or
894 .RS
895 \fItag item status help\fR
896 .RE
897 .IP
898 depending on whether \fBdialog_vars.item_help\fP is set.
899 .IP flag
900 is either \fIFLAG_CHECK\fP, for checklists,
901 or \fIFLAG_RADIO\fP for radiolists.
902 .\" ************************************************************************
903 .SS dialog_dselect
904 implements the "\fB--dselect\fP" option.
905 .TP 5
906 .B const char * \fItitle
907 is the title on the top of the widget.
908 .TP 5
909 .B const char * \fIpath
910 is the preselected value to show in the input-box,
911 which is used also to set the directory- and file-windows.
912 .TP 5
913 .B int \fIheight
914 is the height excluding the minimum needed to show the dialog box framework.
915 If zero, the height is based on the screen size.
916 .TP 5
917 .B int \fIwidth
918 is the desired width of the box.
919 If zero, the height is based on the screen size.
920 .\" ************************************************************************
921 .SS dialog_editbox
922 implements the "\fB--editbox\fP" option.
923 .TP 5
924 .B const char * \fItitle
925 is the title on the top of the widget.
926 .TP 5
927 .B const char * \fIfile
928 is the name of the file from which to read.
929 .TP 5
930 .B int \fIheight
931 is the desired height of the box.
932 If zero, the height is adjusted to use the available screen size.
933 .TP 5
934 .B int \fIwidth
935 is the desired width of the box.
936 If zero, the height is adjusted to use the available screen size.
937 .\" ************************************************************************
938 .SS dialog_form
939 implements the "\fB--form\fP" option.
940 .TP 5
941 .B const char * \fItitle
942 is the title on the top of the widget.
943 .TP 5
944 .B const char * \fIcprompt
945 is the prompt text shown within the widget.
946 .TP 5
947 .B int \fIheight
948 is the desired height of the box.
949 If zero, the height is adjusted to use the available screen size.
950 .TP 5
951 .B int \fIwidth
952 is the desired width of the box.
953 If zero, the height is adjusted to use the available screen size.
954 .TP 5
955 .B int \fIform_height
956 is the minimum height to reserve for displaying the list.
957 If zero, it is computed based on the given \fIheight\fP and \fIwidth\fP.
958 .TP 5
959 .B int \fIitem_no
960 is the number of rows in \fIitems\fP.
961 .TP 5
962 .B int \fIitems
963 is an array of strings which is viewed either as a list of rows
964 .RS
965 \fIName NameY NameX Text TextY TextX FLen ILen\fR
966 .RE
967 .IP
968 or
969 .RS
970 \fIName NameY NameX Text TextY TextX FLen ILen Help\fR
971 .RE
972 .IP
973 depending on whether \fBdialog_vars.item_help\fP is set.
974 .\" ************************************************************************
975 .SS dialog_fselect
976 implements the "\fB--fselect\fP" option.
977 .TP 5
978 .B const char * \fItitle
979 is the title on the top of the widget.
980 .TP 5
981 .B const char * \fIpath
982 is the preselected value to show in the input-box,
983 which is used also to set the directory- and file-windows.
984 .TP 5
985 .B int \fIheight
986 is the height excluding the minimum needed to show the dialog box framework.
987 If zero, the height is based on the screen size.
988 .TP 5
989 .B int \fIwidth
990 is the desired width of the box.
991 If zero, the height is based on the screen size.
992 .\" ************************************************************************
993 .SS dialog_gauge
994 implements the "\fB--gauge\fP" option.
995 Alternatively, a simpler or customized gauge widget can be
996 set up using
997 \fBdlg_allocate_gauge\fP,
998 \fBdlg_reallocate_gauge\fP,
999 \fBdlg_update_gauge\fP and
1000 \fBdlg_free_gauge\fP.
1001 .TP 5
1002 .B const char * \fItitle
1003 is the title on the top of the widget.
1004 .TP 5
1005 .B const char * \fIcprompt
1006 is the prompt text shown within the widget.
1007 .TP 5
1008 .B int \fIheight
1009 is the desired height of the box.
1010 If zero, the height is based on the screen size.
1011 .TP 5
1012 .B int \fIwidth
1013 is the desired width of the box.
1014 If zero, the height is based on the screen size.
1015 .TP 5
1016 .B int \fIpercent
1017 is the percentage to show in the progress bar.
1018 .\" ************************************************************************
1019 .SS dialog_inputbox
1020 implements the "\fB--inputbox\fP" or
1021 "\fB--password\fP" option, depending on the value of \fIpassword\fP.
1022 .TP 5
1023 .B const char * \fItitle
1024 is the title on the top of the widget.
1025 .TP 5
1026 .B const char * \fIcprompt
1027 is the prompt text shown within the widget.
1028 .TP 5
1029 .B int \fIheight
1030 is the desired height of the box.
1031 If zero, the height is based on the screen size.
1032 .TP 5
1033 .B int \fIwidth
1034 is the desired width of the box.
1035 If zero, the height is based on the screen size.
1036 .TP 5
1037 .B const char * \fIinit
1038 is the initial value of the input box, whose length is taken into account
1039 when auto-sizing the width of the dialog box.
1040 .TP 5
1041 .B int \fIpassword
1042 if true, causes typed input to be echoed as asterisks.
1043 .\" ************************************************************************
1044 .SS dialog_helpfile
1045 implements the "\fB--hfile\fP" option.
1046 .TP 5
1047 .B const char * \fItitle
1048 is the title on the top of the widget.
1049 .TP 5
1050 .B const char * \fIfile
1051 is the name of a file containing the text to display.
1052 This function is internally bound to F1 (function key \*(``1\*(''),
1053 passing \fBdialog_vars.help_file\fP as a parameter.
1054 The \fBdialog\fP program sets that variable when the \fB--hfile\fP option
1055 is given.
1056 .TP 5
1057 .B int \fIheight
1058 is the desired height of the box.
1059 If zero, the height is based on the screen size.
1060 .TP 5
1061 .B int \fIwidth
1062 is the desired width of the box.
1063 If zero, the height is based on the screen size.
1064 .\" ************************************************************************
1065 .SS dialog_menu
1066 implements the "\fB--menu\fP" or "\fB--inputmenu\fP" option
1067 depending on whether \fBdialog_vars.input_menu\fP is set.
1068 .TP 5
1069 .B const char * \fItitle
1070 is the title on the top of the widget.
1071 .TP 5
1072 .B const char * \fIcprompt
1073 is the prompt text shown within the widget.
1074 .TP 5
1075 .B int \fIheight
1076 is the desired height of the box.
1077 If zero, the height is based on the screen size.
1078 .TP 5
1079 .B int \fIwidth
1080 is the desired width of the box.
1081 If zero, the height is based on the screen size.
1082 .TP 5
1083 .B int \fImenu_height
1084 is the minimum height to reserve for displaying the list.
1085 If zero, it is computed based on the given \fIheight\fP and \fIwidth\fP.
1086 .TP 5
1087 .B int \fIitem_no
1088 is the number of rows in \fIitems\fP.
1089 .TP 5
1090 .B int \fIitems
1091 is an array of strings which is viewed either as a list of rows
1092 .RS
1093 \fItag item\fR
1094 .RE
1095 .IP
1096 or
1097 .RS
1098 \fItag item help\fR
1099 .RE
1100 .IP
1101 depending on whether \fBdialog_vars.item_help\fP is set.
1102 .\" ************************************************************************
1103 .SS dialog_mixedform
1104 implements the "\fB--mixedform\fP" option.
1105 .TP 5
1106 .B const char * \fItitle
1107 is the title on the top of the widget.
1108 .TP 5
1109 .B const char * \fIcprompt
1110 is the prompt text shown within the widget.
1111 .TP 5
1112 .B int \fIheight
1113 is the desired height of the box.
1114 If zero, the height is adjusted to use the available screen size.
1115 .TP 5
1116 .B int \fIwidth
1117 is the desired width of the box.
1118 If zero, the height is adjusted to use the available screen size.
1119 .TP 5
1120 .B int \fIform_height
1121 is the minimum height to reserve for displaying the list.
1122 If zero, it is computed based on the given \fIheight\fP and \fIwidth\fP.
1123 .TP 5
1124 .B int \fIitem_no
1125 is the number of rows in \fIitems\fP.
1126 .TP 5
1127 .B int \fIitems
1128 is an array of strings which is viewed either as a list of rows
1129 .RS
1130 \fIName NameY NameX Text TextY TextX FLen ILen Ityp\fR
1131 .RE
1132 .IP
1133 or
1134 .RS
1135 \fIName NameY NameX Text TextY TextX FLen ILen Ityp Help\fR
1136 .RE
1137 .IP
1138 depending on whether \fBdialog_vars.item_help\fP is set.
1139 .\" ************************************************************************
1140 .SS dialog_mixedgauge
1141 implements the "\fB--mixedgauge\fP" option
1142 .TP 5
1143 .B const char * \fItitle
1144 is the title on the top of the widget.
1145 .TP 5
1146 .B const char * \fIcprompt
1147 is the caption text shown within the widget.
1148 .TP 5
1149 .B int \fIheight
1150 is the desired height of the box.
1151 If zero, the height is based on the screen size.
1152 .TP 5
1153 .B int \fIwidth
1154 is the desired width of the box.
1155 If zero, the height is based on the screen size.
1156 .TP 5
1157 .B int \fIpercent
1158 is the percentage to show in the progress bar.
1159 .TP 5
1160 .B int \fIitem_no
1161 is the number of rows in \fIitems\fP.
1162 .TP 5
1163 .B int \fIitems
1164 is an array of strings which is viewed as a list
1165 of \fItag\fP and \fIitem\fP values.
1166 The \fItag\fP values are listed,
1167 one per row, in the list at the top of the widget.
1168 .IP
1169 The \fIitem\fP values are decoded:
1170 digits 0 through 9 are the following strings
1171 .RS
1172 .IP 0
1173 Succeeded
1174 .IP 1
1175 Failed
1176 .IP 2
1177 Passed
1178 .IP 3
1179 Completed
1180 .IP 4
1181 Checked
1182 .IP 5
1183 Done
1184 .IP 6
1185 Skipped
1186 .IP 7
1187 In Progress
1188 .IP 8
1189 (blank)
1190 .IP 9
1191 N/A
1192 .RE
1193 .IP
1194 A string with a leading "-" character is centered, marked with "%".
1195 For example, "-75" is displayed as "75%".
1196 Other strings are displayed as is.
1197 .\" ************************************************************************
1198 .SS dialog_msgbox
1199 implements the "\fB--msgbox\fP" or "\fB--infobox\fP" option
1200 depending on whether \fIpauseopt\fP is set.
1201 .TP 5
1202 .B const char * \fItitle
1203 is the title on the top of the widget.
1204 .TP 5
1205 .B const char * \fIcprompt
1206 is the prompt text shown within the widget.
1207 .TP 5
1208 .B int \fIheight
1209 is the desired height of the box.
1210 If zero, the height is based on the screen size.
1211 .TP 5
1212 .B int \fIwidth
1213 is the desired width of the box.
1214 If zero, the height is based on the screen size.
1215 .TP 5
1216 .B int \fIpauseopt
1217 if true, an \*(``OK\*('' button will be shown,
1218 and the dialog will wait for it to complete.
1219 With an \*(``OK\*('' button, it is denoted a \*(``msgbox\*('',
1220 without an \*(``OK\*('' button, it is denoted an \*(``infobox\*(''.
1221 .\" ************************************************************************
1222 .SS dialog_pause
1223 implements the "\fB--pause\fP" option.
1224 .TP 5
1225 .B const char * \fItitle
1226 is the title on the top of the widget.
1227 .TP 5
1228 .B int \fIheight
1229 is the desired height of the box.
1230 If zero, the height is based on the screen size.
1231 .TP 5
1232 .B int \fIwidth
1233 is the desired width of the box.
1234 If zero, the height is based on the screen size.
1235 .TP 5
1236 .B int \fIseconds
1237 is the timeout to use for the progress bar.
1238 .\" ************************************************************************
1239 .SS dialog_prgbox
1240 implements the "\fB--prgbox\fP" option.
1241 .TP 5
1242 .B const char * \fItitle
1243 is the title on the top of the widget.
1244 .TP 5
1245 .B const char * \fIcprompt
1246 is the prompt text shown within the widget.
1247 If empty or null, no prompt is shown.
1248 .TP 5
1249 .B const char * \fIcommand
1250 is the name of the command to execute.
1251 .TP 5
1252 .B int \fIheight
1253 is the desired height of the box.
1254 If zero, the height is based on the screen size.
1255 .TP 5
1256 .B int \fIwidth
1257 is the desired width of the box.
1258 If zero, the height is based on the screen size.
1259 .TP 5
1260 .B int \fIpauseopt
1261 if true, an \*(``OK\*('' button will be shown,
1262 and the dialog will wait for it to complete.
1263 .\" ************************************************************************
1264 .SS dialog_progressbox
1265 implements the "\fB--progressbox\fP" option.
1266 .TP 5
1267 .B const char * \fItitle
1268 is the title on the top of the widget.
1269 .TP 5
1270 .B const char * \fIcprompt
1271 is the prompt text shown within the widget.
1272 If empty or null, no prompt is shown.
1273 .TP 5
1274 .B int \fIheight
1275 is the desired height of the box.
1276 If zero, the height is based on the screen size.
1277 .TP 5
1278 .B int \fIwidth
1279 is the desired width of the box.
1280 If zero, the height is based on the screen size.
1281 .\" ************************************************************************
1282 .SS dialog_rangebox
1283 implements the "\fB--rangebox\fP" option.
1284 .TP 5
1285 .B const char * \fItitle
1286 is the title on the top of the widget.
1287 .TP 5
1288 .B const char * \fIcprompt
1289 is the prompt text shown within the widget.
1290 If empty or null, no prompt is shown.
1291 .TP 5
1292 .B int \fIheight
1293 is the desired height of the widget.
1294 If zero, the height is based on the screen size.
1295 .TP 5
1296 .B int \fIwidth
1297 is the desired width of the widget.
1298 If zero, the height is based on the screen size.
1299 .TP 5
1300 .B int \fImin_value
1301 is the minimum value to allow.
1302 .TP 5
1303 .B int \fImax_value
1304 is the maximum value to allow.
1305 .TP 5
1306 .B int \fIdefault_value
1307 is the default value, if no change is made.
1308 .\" ************************************************************************
1309 .SS dialog_tailbox
1310 implements the "\fB--tailbox\fP" or "\fB--tailboxbg\fP" option
1311 depending on whether \fIbg_task\fP is set.
1312 .TP 5
1313 .B const char * \fItitle
1314 is the title on the top of the widget.
1315 .TP 5
1316 .B const char * \fIfile
1317 is the name of the file to display in the dialog.
1318 .TP 5
1319 .B int \fIheight
1320 is the desired height of the box.
1321 If zero, the height is based on the screen size.
1322 .TP 5
1323 .B int \fIwidth
1324 is the desired width of the box.
1325 If zero, the height is based on the screen size.
1326 .TP 5
1327 .B int \fIbg_task
1328 if true,
1329 the window is added to the callback list in \fBdialog_state\fP,
1330 and the application will poll for the window to be updated.
1331 Otherwise an \*(``OK\*('' button is added to the window,
1332 and it will be closed when the button is activated.
1333 .\" ************************************************************************
1334 .SS dialog_textbox
1335 implements the "\fB--textbox\fP" option.
1336 .TP 5
1337 .B const char * \fItitle
1338 is the title on the top of the widget.
1339 .TP 5
1340 .B const char * \fIfile
1341 is the name of the file to display in the dialog.
1342 .TP 5
1343 .B int \fIheight
1344 is the desired height of the box.
1345 If zero, the height is based on the screen size.
1346 .TP 5
1347 .B int \fIwidth
1348 is the desired width of the box.
1349 If zero, the height is based on the screen size.
1350 .\" ************************************************************************
1351 .SS dialog_timebox
1352 implements the "\fB--timebox\fP" option.
1353 .TP 5
1354 .B const char * \fItitle
1355 is the title on the top of the widget.
1356 .TP 5
1357 .B const char * \fIsubtitle
1358 is the prompt text shown within the widget.
1359 .TP 5
1360 .B int \fIheight
1361 is the desired height of the box.
1362 If zero, the height is based on the screen size.
1363 .TP 5
1364 .B int \fIwidth
1365 is the desired width of the box.
1366 If zero, the height is based on the screen size.
1367 .TP 5
1368 .B int \fIhour
1369 is the initial hour shown.
1370 If the value is negative, the current hour is used.
1371 Returns DLG_EXIT_ERROR if the value specified is greater than or equal to 24.
1372 .TP 5
1373 .B int \fIminute
1374 is the initial minute shown.
1375 If the value is negative, the current minute is used.
1376 Returns DLG_EXIT_ERROR if the value specified is greater than or equal to 60.
1377 .TP 5
1378 .B int \fIsecond
1379 is the initial second shown.
1380 If the value is negative, the current second is used.
1381 Returns DLG_EXIT_ERROR if the value specified is greater than or equal to 60.
1382 .\" ************************************************************************
1383 .SS dialog_treeview
1384 implements the "\fB--treeview\fP" option.
1385 .TP 5
1386 .B const char * \fItitle
1387 is the title on the top of the widget.
1388 .TP 5
1389 .B const char * \fIcprompt
1390 is the prompt text shown within the widget.
1391 .TP 5
1392 .B int \fIheight
1393 is the desired height of the box.
1394 If zero, the height is based on the screen size.
1395 .TP 5
1396 .B int \fIwidth
1397 is the desired width of the box.
1398 If zero, the height is based on the screen size.
1399 .TP 5
1400 .B int \fIlist_height
1401 is the minimum height to reserve for displaying the list.
1402 If zero, it is computed based on the given \fIheight\fP and \fIwidth\fP.
1403 .TP 5
1404 .B int \fIitem_no
1405 is the number of rows in \fIitems\fP.
1406 .TP 5
1407 .B char ** \fIitems
1408 is the list of items, contain tag, name, and optionally help strings
1409 (if \fBdialog_vars.item_help\fP is set).
1410 The initial selection state for each item is also in this list.
1411 .TP 5
1412 .B int \fIflag
1413 .IP flag
1414 is either \fIFLAG_CHECK\fP, for checklists (multiple selections),
1415 or \fIFLAG_RADIO\fP for radiolists (a single selection).
1416 .\" ************************************************************************
1417 .SS dialog_yesno
1418 implements the "\fB--yesno\fP" option.
1419 .TP 5
1420 .B const char * \fItitle
1421 is the title on the top of the widget.
1422 .TP 5
1423 .B const char * \fIcprompt
1424 is the prompt text shown within the widget.
1425 .TP 5
1426 .B int \fIheight
1427 is the desired height of the box.
1428 If zero, the height is based on the screen size.
1429 .TP 5
1430 .B int \fIwidth
1431 is the desired width of the box.
1432 If zero, the height is based on the screen size.
1433 .
1434 .\" ************************************************************************
1435 .SH UTILITY FUNCTIONS
1436 Most functions that implement lower-level
1437 functionality for the command-line \fB\*p\fP
1438 program or widgets, have names beginning "\fIdlg_\fP".
1439 Bowing to longstanding usage, the functions that initialize the
1440 display and end it are named \fIinit_dialog\fP and \fIend_dialog\fP.
1441 .PP
1442 The only non-widget function whose name begins with "\fIdialog_\fP"
1443 is \fBdialog_version\fP, which returns the version number of the
1444 library as a string.
1445 .
1446 .PP
1447 Here is a brief summary of the utility functions and their parameters:
1448 .\" ---------------------------------------------------------------------------
1449 .SS dlg_add_callback
1450 Add a callback, used to allow polling input from multiple tailbox
1451 widgets.
1452 .TP 5
1453 .B DIALOG_CALLBACK *\fIp\fP
1454 contains the callback information.
1455 .\" ---------------------------------------------------------------------------
1456 .SS dlg_add_callback_ref
1457 Like \fBdlg_add_callback\fP, but passes a reference to the \fBDIALOG_CALLBACK\fP
1458 as well as a pointer to a cleanup function which will be called when the
1459 associated input ends.
1460 .TP 5
1461 .B DIALOG_CALLBACK **\fIp\fP
1462 points to the callback information.
1463 This is a reference to the pointer so that the caller's pointer can be
1464 zeroed when input ends.
1465 .TP 5
1466 .B DIALOG_FREEBACK \fIfunc\fP
1467 function to call when input ends, e.g., to free caller's additional data.
1468 .\" ---------------------------------------------------------------------------
1469 .SS dlg_add_help_formitem
1470 This is a utility function used enforce consistent behavior for
1471 the \fIDIALOG_VARS.help_tags\fP and \fIDIALOG_VARS.item_help\fP variables.
1472 .TP 5
1473 .B int *\fIresult\fP
1474 this is updated to DLG_EXIT_ITEM_HELP if \fIDIALOG_VARS.item_help\fP is set.
1475 .TP 5
1476 .B char **\fItag\fP
1477 the tag- or help-text is stored here.
1478 .TP 5
1479 .B DIALOG_FORMITEM *\fIitem\fP
1480 contains the list item to use for tag- or help-text.
1481 .\" ---------------------------------------------------------------------------
1482 .SS dlg_add_help_listitem
1483 This is a utility function used enforce consistent behavior for
1484 the \fIDIALOG_VARS.help_tags\fP and \fIDIALOG_VARS.item_help\fP variables.
1485 .TP 5
1486 .B int *\fIresult\fP
1487 this is updated to DLG_EXIT_ITEM_HELP if \fIDIALOG_VARS.item_help\fP is set.
1488 .TP 5
1489 .B char **\fItag\fP
1490 the tag- or help-text is stored here.
1491 .TP 5
1492 .B DIALOG_LISTITEM *\fIitem\fP
1493 contains the list item to use for tag- or help-text.
1494 .\" ---------------------------------------------------------------------------
1495 .SS dlg_add_last_key
1496 Report the last key entered by the user.
1497 This implements the \fB--last-key\fP command-line option,
1498 using \fBdialog_vars.last_key\fP.
1499 .TP 5
1500 .B int \fImode
1501 controls the way the last key report is separated from other results:
1502 .RS
1503 .TP 5
1504 -2
1505 (no separator)
1506 .TP 5
1507 -1
1508 (separator after the key name)
1509 .TP 5
1510 0
1511 (separator is optionally before the key name)
1512 .TP 5
1513 1
1514 (same as -1)
1515 .RE
1516 .\" ---------------------------------------------------------------------------
1517 .SS dlg_add_quoted
1518 Add a quoted string to the result buffer (see \fBdlg_add_result\fP).
1519 If no quotes are necessary, none are used.
1520 If \fBdialog_vars.single_quoted\fR is set, single-quotes are used.
1521 Otherwise, double-quotes are used.
1522 .TP 5
1523 .B char * \fIstring
1524 is the string to add.
1525 .\" ---------------------------------------------------------------------------
1526 .SS dlg_add_result
1527 Add a string to the result buffer \fBdialog_vars.input_result\fP.
1528 .TP 5
1529 .B char * \fIstring
1530 is the string to add.
1531 .\" ---------------------------------------------------------------------------
1532 .SS dlg_add_separator
1533 Add an output-separator to the result buffer \fBdialog_vars.input_result\fP.
1534 If \fBdialog_vars.output_separator\fP is set, use that.
1535 Otherwise, if \fBdialog_vars.separate_output\fP is set, use newline.
1536 If neither is set, use a space.
1537 .\" ---------------------------------------------------------------------------
1538 .SS dlg_add_string
1539 Add a quoted or unquoted string to the result buffer
1540 (see \fBdlg_add_quoted\fP) and \fBdlg_add_result\fP),
1541 according to whether \fBdialog_vars.quoted\fP is true.
1542 .TP 5
1543 .B char * \fIstring
1544 is the string to add.
1545 .\" ---------------------------------------------------------------------------
1546 .SS dlg_align_columns
1547 Copy and reformat an array of pointers to strings, aligning according to
1548 the column separator \fBdialog_vars.column_separator\fP.
1549 If no column separator is set, the array will be unmodified;
1550 otherwise it is copied and reformatted.
1551 .IP
1552 Caveat: This function is only implemented for 8-bit characters.
1553 .TP 5
1554 .B char **\fItarget
1555 This is the array to reformat.
1556 It points to the first string to modify.
1557 .TP 5
1558 .B int \fIper_row
1559 This is the size of the struct for each row of the array.
1560 .TP 5
1561 .B int \fInum_rows
1562 This is the number of rows in the array.
1563 .\" ---------------------------------------------------------------------------
1564 .SS dlg_allocate_gauge
1565 Allocates a gauge widget.
1566 Use \fBdlg_update_gauge\fP to display the result.
1567 .TP 5
1568 .B const char * \fItitle
1569 is the title string to display at the top of the widget.
1570 .TP 5
1571 .B const char * \fIcprompt
1572 is the prompt text shown within the widget.
1573 .TP 5
1574 .B int \fIheight
1575 is the desired height of the box.
1576 If zero, the height is adjusted to use the available screen size.
1577 .TP 5
1578 .B int \fIwidth
1579 is the desired width of the box.
1580 If zero, the height is adjusted to use the available screen size.
1581 .TP 5
1582 .B int \fIpercent
1583 is the percentage to show in the progress bar.
1584 .\" ---------------------------------------------------------------------------
1585 .SS dlg_asciibox
1586 returns its parameter transformed to the
1587 corresponding "+" or "-", etc.,
1588 for the line-drawing characters used in \fB\*p\fP.
1589 If the parameter is not a line-drawing or other special character
1590 such as ACS_DARROW, it returns 0.
1591 .TP 5
1592 .B chtype \fIch
1593 is the parameter, usually one of the \fBACS_\fP\fIxxx\fP constants.
1594 .\" ---------------------------------------------------------------------------
1595 .SS dlg_attr_clear
1596 Set window to the given attribute.
1597 .TP 5
1598 .B WINDOW * \fIwin
1599 is the window to update.
1600 .TP 5
1601 .B int \fIheight
1602 is the number of rows to update.
1603 .TP 5
1604 .B int \fIwidth
1605 is the number of columns to update.
1606 .TP 5
1607 .B chtype \fIattr
1608 is the attribute, e.g., \fBA_BOLD\fP.
1609 .\" ---------------------------------------------------------------------------
1610 .SS dlg_auto_size
1611 Compute window size based on the size of the formatted \fIprompt\fP and
1612 minimum dimensions for a given widget.
1613 .PP
1614 \fB\*L\fP sets
1615 \fBdialog_state.text_height\fP and
1616 \fBdialog_state.text_width\fP for
1617 the formatted \fIprompt\fP
1618 as a side-effect.
1619 .PP
1620 Normally \fB\*l\fP writes the formatted \fIprompt\fP to the curses
1621 window,
1622 but it will write the formatted \fIprompt\fP to the output stream
1623 if \fBdialog_state.text_only\fP is set.
1624 .TP 5
1625 .B const char * \fItitle
1626 is the title string to display at the top of the widget.
1627 .TP 5
1628 .B const char * \fIprompt
1629 is the message text which will be displayed in the widget,
1630 used here to determine how large the widget should be.
1631 .IP
1632 If the value is \fINULL\fP,
1633 \fB\*l\fP allows the widget to use the whole screen,
1634 i.e., if the values referenced by \fIheight\fP and/or \fIwidth\fP are zero.
1635 .TP 5
1636 .B int * \fIheight
1637 is the nominal height.
1638 \fB\*L\fP checks the referenced value and may update it:
1639 .RS
1640 .bP
1641 if the value is negative,
1642 \fB\*l\fP updates it to the available height of the screen,
1643 after reserving rows for the window border and shadow,
1644 as well as taking into account
1645 \fBdialog_vars.begin_y\fP and
1646 \fBdialog_vars.begin_set\fP.
1647 .bP
1648 if the value is zero,
1649 \fB\*l\fP updates it to the required height of the window,
1650 taking into account a (possibly) multi-line \fIprompt\fP.
1651 .bP
1652 if the value is greater than zero, 
1653 \fB\*l\fP uses it internally, but restores the value on return.
1654 .RE
1655 .TP 5
1656 .B int * \fIwidth
1657 is the nominal width.
1658 \fB\*L\fP checks the referenced value and may update it:
1659 .RS
1660 .bP
1661 if the value is negative,
1662 \fB\*l\fP updates it to the available width of the screen,
1663 after reserving rows for the window border and shadow,
1664 as well as taking into account
1665 \fBdialog_vars.begin_x\fP and
1666 \fBdialog_vars.begin_set\fP.
1667 .bP
1668 if the value is zero,
1669 \fB\*l\fP updates it to the required width of the window,
1670 taking into account a (possibly) multi-line \fIprompt\fP.
1671 .bP
1672 if the value is greater than zero, 
1673 \fB\*l\fP uses it internally, but restores the value on return.
1674 .RE
1675 .TP 5
1676 .B int \fIboxlines
1677 is the number of lines to reserve in the vertical direction.
1678 .TP 5
1679 .B int \fImincols
1680 is the minimum number of columns to use.
1681 .\" ---------------------------------------------------------------------------
1682 .SS dlg_auto_sizefile
1683 Like \fBdlg_auto_size\fP, but use a file contents to decide how large
1684 the widget should be.
1685 .TP 5
1686 .B const char * \fItitle
1687 is the title string to display at the top of the widget.
1688 .TP 5
1689 .B const char * \fIfile
1690 is the name of the file.
1691 .TP 5
1692 .B int * \fIheight
1693 is the nominal height.
1694 .IP
1695 If it is -1, use the screen's height
1696 (after subtracting \fBdialog_vars.begin_y\fP
1697 if \fBdialog_vars.begin_set\fP is true).
1698 .IP
1699 If it is greater than zero,
1700 limit the referenced value to the screen-height
1701 after verifying that the file exists.
1702 .TP 5
1703 .B int * \fIwidth
1704 is the nominal width.
1705 .IP
1706 If it is -1, use the screen's width (after subtracting \fBdialog_vars.begin_x\fP
1707 if \fBdialog_vars.begin_set\fP is true).
1708 .IP
1709 If it is greater than zero,
1710 limit the referenced value to the screen-width
1711 after verifying that the file exists.
1712 .TP 5
1713 .B int \fIboxlines
1714 is the number of lines to reserve on the screen for drawing boxes.
1715 .TP 5
1716 .B int \fImincols
1717 is the number of columns to reserve on the screen for drawing boxes.
1718 .\" ---------------------------------------------------------------------------
1719 .SS dlg_beeping
1720 If \fBdialog_vars.beep_signal\fP is nonzero,
1721 this calls \fBbeep\fP once and sets
1722 \fBdialog_vars.beep_signal\fP to zero.
1723 .\" ---------------------------------------------------------------------------
1724 .SS dlg_boxchar
1725 returns its \fBchtype\fP parameter transformed as follows:
1726 .bP
1727 if neither \fBdialog_vars.ascii_lines\fP nor \fBdialog_vars.no_lines\fP is set.
1728 .bP
1729 if \fBdialog_vars.ascii_lines\fP is set,
1730 returns the corresponding "+" or "-", etc.,
1731 for the line-drawing characters used in \fB\*p\fP.
1732 .bP
1733 otherwise, if \fBdialog_vars.no_lines\fP is set,
1734 returns a space for the line-drawing characters.
1735 .bP
1736 if the parameter is not a line-drawing or other special character
1737 such as ACS_DARROW,
1738 it returns the parameter unchanged.
1739 .\" ---------------------------------------------------------------------------
1740 .SS dlg_box_x_ordinate
1741 returns a suitable x-ordinate (column) for a new widget.
1742 If \fBdialog_vars.begin_set\fP is 1,
1743 use \fBdialog_vars.begin_x\fP;
1744 otherwise center the widget on the screen (using the \fIwidth\fP parameter).
1745 .TP 5
1746 .B int \fIwidth
1747 is the width of the widget.
1748 .\" ---------------------------------------------------------------------------
1749 .SS dlg_box_y_ordinate
1750 returns a suitable y-ordinate (row) for a new widget.
1751 If \fBdialog_vars.begin_set\fP is 1,
1752 use \fBdialog_vars.begin_y\fP;
1753 otherwise center the widget on the screen (using the \fIheight\fP parameter).
1754 .TP 5
1755 .B int \fIheight
1756 is the height of the widget.
1757 .\" ---------------------------------------------------------------------------
1758 .SS dlg_buildlist
1759 This is an alternate interface to the \fBbuildlist\fP widget
1760 which allows the application to read the list item states back
1761 directly without putting them in the output buffer.
1762 .TP 5
1763 .B const char * \fItitle
1764 is the title string to display at the top of the widget.
1765 .TP 5
1766 .B const char * \fIcprompt
1767 is the prompt text shown within the widget.
1768 .TP 5
1769 .B int \fIheight
1770 is the desired height of the box.
1771 If zero, the height is adjusted to use the available screen size.
1772 .TP 5
1773 .B int \fIwidth
1774 is the desired width of the box.
1775 If zero, the height is adjusted to use the available screen size.
1776 .TP 5
1777 .B int \fIlist_height
1778 is the minimum height to reserve for displaying the list.
1779 If zero, it is computed based on the given \fIheight\fP and \fIwidth\fP.
1780 .TP 5
1781 .B int \fIitem_no
1782 is the number of rows in \fIitems\fP.
1783 .TP 5
1784 .B DIALOG_LISTITEM * \fIitems
1785 is the list of items, contain tag, name, and optionally help strings
1786 (if \fBdialog_vars.item_help\fP is set).
1787 The initial selection state for each item is also in this list.
1788 .TP 5
1789 .B const char * \fIstates
1790 This is a list of characters to display for the given states.
1791 Normally a buildlist provides true (1) and false (0) values,
1792 which the widget displays as "*" and space, respectively.
1793 An application may set this parameter to an arbitrary null-terminated string.
1794 The widget determines the number of states from the length of this string,
1795 and will cycle through the corresponding display characters as the user
1796 presses the space-bar.
1797 .TP 5
1798 .B int \fIorder_mode
1799 is reserved for future enhancements
1800 .TP 5
1801 .B int * \fIcurrent_item
1802 The widget sets the referenced location to the index of the current display
1803 item (cursor) when it returns.
1804 .\" ---------------------------------------------------------------------------
1805 .SS dlg_button_count
1806 Count the buttons in the list.
1807 .TP 5
1808 .B const char ** \fIlabels
1809 is a list of (pointers to) button labels terminated by a null pointer.
1810 .\" ---------------------------------------------------------------------------
1811 .SS dlg_button_layout
1812 Make sure there is enough space for the buttons by
1813 computing the width required for their labels,
1814 adding margins and limiting based on the screen size.
1815 .TP 5
1816 .B const char ** \fIlabels
1817 is a list of (pointers to) button labels terminated by a null pointer.
1818 .TP 5
1819 .B int * \fIlimit
1820 the function sets the referenced \fIlimit\fP to the width required for
1821 the buttons (limited by the screen size)
1822 if that is wider than the passed-in limit.
1823 .\" ---------------------------------------------------------------------------
1824 .SS dlg_button_sizes
1825 Compute the size of the button array in columns.
1826 .TP 5
1827 .B const char ** \fIlabels
1828 is a list of (pointers to) button labels terminated by a null pointer.
1829 .TP 5
1830 .B int \fIvertical
1831 is true if the buttons are arranged in a column rather than a row.
1832 .TP 5
1833 .B int * \fIlongest
1834 Return the total number of columns in the referenced location.
1835 .TP 5
1836 .B int * \fIlength
1837 Return the longest button's columns in the referenced location.
1838 .\" ---------------------------------------------------------------------------
1839 .SS dlg_button_to_char
1840 Find the first uppercase character in the label, which we may use for an
1841 abbreviation.
1842 If the label is empty, return -1.
1843 If no uppercase character is found, return 0.
1844 Otherwise return the uppercase character.
1845 .LP
1846 Normally
1847 .B dlg_draw_buttons
1848 and
1849 .B dlg_char_to_button
1850 use the first uppercase character.
1851 However, they keep track of all of the labels and
1852 if the first has already been used in another label,
1853 they will continue looking for another uppercase character.
1854 This function does not have enough information to make that check.
1855 .TP 5
1856 .B const char * \fIlabel
1857 is the label to test.
1858 .\" ---------------------------------------------------------------------------
1859 .SS dlg_button_x_step
1860 Compute the step-size needed between elements of the button array.
1861 .TP 5
1862 .B const char ** \fIlabels
1863 is a list of (pointers to) button labels terminated by a null pointer.
1864 .TP 5
1865 .B int \fIlimit
1866 is the maximum number of columns to allow for the buttons.
1867 .TP 5
1868 .B int * \fIgap
1869 store the nominal gap between buttons in the referenced location.
1870 This is constrained to be at least one.
1871 .TP 5
1872 .B int * \fImargin
1873 store the left+right total margins (for the list of buttons) in the referenced
1874 location.
1875 .TP 5
1876 .B int * \fIstep
1877 store the step-size in the referenced location.
1878 .\" ---------------------------------------------------------------------------
1879 .SS dlg_calc_list_width
1880 Calculate the minimum width for the list,
1881 assuming none of the items are truncated.
1882 .TP 5
1883 .B int \fIitem_no
1884 is the number of \fIitems\fP.
1885 .TP 5
1886 .B DIALOG_LISTITEM * \fIitems
1887 contains a \fIname\fP and \fItext\fP field,
1888 e.g., for checklists or radiobox lists.
1889 The function returns the sum of the widest columns
1890 needed for of each of these fields.
1891 .IP
1892 If \fBdialog_vars.no_items\fP is set,
1893 the \fItext\fP fields in the list are ignored.
1894 .\" ---------------------------------------------------------------------------
1895 .SS dlg_calc_listh
1896 Calculate new height and list_height values.
1897 .TP 5
1898 .B int * \fIheight
1899 on input, is the height without adding the list-height.
1900 On return, this contains the total list-height and is the
1901 actual widget's height.
1902 .TP 5
1903 .B int * \fIlist_height
1904 on input, is the requested list-height.
1905 On return, this contains the number of rows available for displaying
1906 the list after taking into account the screen size and
1907 the \fBdialog_vars.begin_set\fP and \fBdialog_vars.begin_y\fP variables.
1908 .TP 5
1909 .B int \fIitem_no
1910 is the number of \fIitems\fP in the list.
1911 .\" ---------------------------------------------------------------------------
1912 .SS dlg_calc_listw
1913 This function is obsolete, provided for library-compatibility.
1914 It is replaced by \fBdlg_calc_list_width\fP.
1915 .TP 5
1916 .B int \fIitem_no
1917 is the number of \fIitems\fP.
1918 .TP 5
1919 .B char ** \fIitems
1920 is a list of character pointers.
1921 .TP 5
1922 .B int \fIgroup
1923 is the number of items in each group, e.g., the second array index.
1924 .\" ---------------------------------------------------------------------------
1925 .SS dlg_char_to_button
1926 Given a list of button labels,
1927 and a character which may be the abbreviation for one, find it, if it exists.
1928 An abbreviation will be the first character
1929 which happens to be capitalized in the label.
1930 If the character is found, return its index within the list of \fIlabels\fP.
1931 Otherwise, return \fBDLG_EXIT_UNKNOWN\fP.
1932 .TP 5
1933 .B int \fIch
1934 is the character to find.
1935 .TP 5
1936 .B const char ** \fIlabels
1937 is a list of (pointers to) button labels terminated by a null pointer.
1938 .\" ---------------------------------------------------------------------------
1939 .SS dlg_checklist
1940 This entrypoint provides the \fB--checklist\fP or \fB--radiolist\fP
1941 functionality without the limitations of \fB\*p\fP's command-line syntax
1942 (compare to \fBdialog_checklist\fP).
1943 .TP 5
1944 .B const char * \fItitle
1945 is the title string to display at the top of the widget.
1946 .TP 5
1947 .B const char * \fIcprompt
1948 is the prompt text shown within the widget.
1949 .TP 5
1950 .B int \fIheight
1951 is the desired height of the box.
1952 If zero, the height is adjusted to use the available screen size.
1953 .TP 5
1954 .B int \fIwidth
1955 is the desired width of the box.
1956 If zero, the height is adjusted to use the available screen size.
1957 .TP 5
1958 .B int \fIlist_height
1959 is the minimum height to reserve for displaying the list.
1960 If zero, it is computed based on the given \fIheight\fP and \fIwidth\fP.
1961 .TP 5
1962 .B int \fIitem_no
1963 is the number of \fIitems\fP.
1964 .TP 5
1965 .B DIALOG_LISTITEM * \fIitems
1966 This is a list of the items to display in the checklist.
1967 .TP 5
1968 .B const char * \fIstates
1969 This is a list of characters to display for the given states.
1970 Normally a checklist provides true (1) and false (0) values,
1971 which the widget displays as "*" and space, respectively.
1972 An application may set this parameter to an arbitrary null-terminated string.
1973 The widget determines the number of states from the length of this string,
1974 and will cycle through the corresponding display characters as the user
1975 presses the space-bar.
1976 .TP 5
1977 .B int \fIflag
1978 This is should be one of \fBFLAG_CHECK\fP or \fPFLAG_RADIO\fP,
1979 depending on whether the widget should act as a checklist or radiobox.
1980 .TP 5
1981 .B int * \fIcurrent_item
1982 The widget sets the referenced location to the index of the current display
1983 item (cursor) when it returns.
1984 .\" ---------------------------------------------------------------------------
1985 .SS dlg_check_scrolled
1986 given a function key (or other key that was mapped to a function key),
1987 check if it is one of the up/down scrolling functions:
1988 .sp
1989 .RS
1990 DLGK_PAGE_FIRST,
1991 .br
1992 DLGK_PAGE_LAST,
1993 .br
1994 DLGK_GRID_UP,
1995 .br
1996 DLGK_GRID_DOWN,
1997 .br
1998 DLGK_PAGE_PREV or
1999 .br
2000 DLGK_PAGE_NEXT.
2001 .RE
2002 .fi
2003 .LP
2004 Some widgets use these key bindings for scrolling the prompt-text up and
2005 down, to allow for display in very small windows.
2006 .LP
2007 The function returns 0 (zero) if it finds one of these keys,
2008 and -1 if not.
2009 .TP 5
2010 .B int \fIkey
2011 is the function-key to check
2012 .TP 5
2013 .B int \fIlast
2014 is the number of lines
2015 which would be used to display the scrolled prompt in
2016 an arbitrarily tall window.
2017 It is used here to check limits for the \fIoffset\fP value.
2018 .TP 5
2019 .B int \fIpage
2020 this is the available height for writing scrolled text,
2021 which is smaller than the window if it contains buttons.
2022 .TP 5
2023 .B bool * \fIshow
2024 on return, holds TRUE if \fBdlg_print_scrolled\fP should be used to redisplay
2025 the prompt text.
2026 .TP 5
2027 .B int * \fIoffset
2028 on entry, holds the starting line number (counting from zero)
2029 last used for \fBdlg_print_scrolled\fP.
2030 On return, holds the updated starting line number.
2031 .\" ---------------------------------------------------------------------------
2032 .SS dlg_clear
2033 Set window to the default \fB\*p\fP screen attribute.
2034 This is set in the rc-file with \fBscreen_color\fP.
2035 .\" ---------------------------------------------------------------------------
2036 .SS dlg_clr_result
2037 Free storage used for the result buffer (\fBdialog_vars.input_result\fP).
2038 The corresponding pointer is set to NULL.
2039 .\" ---------------------------------------------------------------------------
2040 .SS dlg_color_count
2041 Return the number of colors that can be configured in \fB\*p\fP.
2042 .\" ---------------------------------------------------------------------------
2043 .SS dlg_color_setup
2044 Initialize the color pairs used in \fB\*p\fP.
2045 .\" ---------------------------------------------------------------------------
2046 .SS dlg_count_argv
2047 Count the entries in an argument vector.
2048 .TP 5
2049 .B argv
2050 Points to the argument vector.
2051 .\" ---------------------------------------------------------------------------
2052 .SS dlg_count_columns
2053 Returns the number of columns used for a string.
2054 This is not necessarily the number of bytes in a string.
2055 .TP 5
2056 .B const char * \fIstring
2057 is the string to measure.
2058 .\" ---------------------------------------------------------------------------
2059 .SS dlg_count_real_columns
2060 Returns the number of columns used for a string,
2061 accounting for "\eZ" sequences which can be used for
2062 coloring the text if \fBdialog_vars.colors\fP is set.
2063 This is not necessarily the number of bytes in a string.
2064 .TP 5
2065 .B const char * \fIstring
2066 is the string to measure.
2067 .\" ---------------------------------------------------------------------------
2068 .SS dlg_count_wchars
2069 Returns the number of wide-characters in the string.
2070 .TP 5
2071 .B const char * \fIstring
2072 is the string to measure.
2073 .\" ---------------------------------------------------------------------------
2074 .SS dlg_create_rc
2075 Create a configuration file,
2076 i.e., write internal tables to a file which can be read back by \fB\*p\fP
2077 as an rc-file.
2078 .TP 5
2079 .B const char * \fIfilename
2080 is the name of the file to write to.
2081 .\" ---------------------------------------------------------------------------
2082 .SS dlg_ctl_size
2083 If \fBdialog_vars.size_err\fP is true,
2084 check if the given window size is too large to fit on the screen.
2085 If so, exit with an error reporting the size of the window.
2086 .TP 5
2087 .B int \fIheight
2088 is the window's height
2089 .TP 5
2090 .B int \fIwidth
2091 is the window's width
2092 .\" ---------------------------------------------------------------------------
2093 .SS dlg_default_button
2094 If \fBdialog_vars.default_button\fP is positive,
2095 return the button-index for that button code,
2096 using \fBdlg_ok_buttoncode\fP to test indices starting with zero.
2097 Otherwise (or if no match was found for the button code), return zero.
2098 .\" ---------------------------------------------------------------------------
2099 .SS dlg_default_formitem
2100 If \fBdialog_vars.default_item\fP is not null,
2101 find that name by matching the \fIname\fP field in the list of form \fIitems\fP.
2102 If found, return the index of that item in the list.
2103 Otherwise, return zero.
2104 .TP 5
2105 .B DIALOG_FORMITEM * \fIitems
2106 is the list of items to search.
2107 It is terminated by an entry with a null \fIname\fP field.
2108 .\" ---------------------------------------------------------------------------
2109 .SS dlg_default_item
2110 This function is obsolete, provided for library-compatibility.
2111 It is replaced by \fBdlg_default_formitem\fP and \fBdlg_default_listitem\fP.
2112 .TP 5
2113 .B char ** \fIitems
2114 is the list of items to search.
2115 .TP 5
2116 .B int \fIllen
2117 is the number of items in each group, e.g., the second array index.
2118 .\" ---------------------------------------------------------------------------
2119 .SS dlg_defaultno_button
2120 If \fBdialog_vars.defaultno\fP is true, and \fBdialog_vars.nocancel\fP is not,
2121 find the button-index for the \*(``Cancel\*('' button.
2122 Otherwise, return the index for \*(``OK\*('' (always zero).
2123 .\" ---------------------------------------------------------------------------
2124 .SS dlg_del_window
2125 Remove a window, repainting everything else.
2126 .TP 5
2127 .B WINDOW * \fIwin
2128 is the window to remove.
2129 .\" ---------------------------------------------------------------------------
2130 .SS dlg_does_output
2131 This is called each time a widget is invoked which may do output.
2132 It increments \fBdialog_state.output_count\fP,
2133 so the output function in \fB\*p\fP can test this and add a separator.
2134 .\" ---------------------------------------------------------------------------
2135 .SS dlg_draw_arrows
2136 Draw up/down arrows on a window, e.g., for scrollable lists.
2137 It calls \fBdlg_draw_arrows2\fP using the
2138 \fImenubox_color\fP and \fImenubox_border_color\fP attributes.
2139 .TP 5
2140 .B WINDOW * \fIdialog
2141 is the window on which to draw an arrow.
2142 .TP 5
2143 .B int \fItop_arrow
2144 is true if an up-arrow should be drawn at the top of the window.
2145 .TP 5
2146 .B int \fIbottom_arrow
2147 is true if an down-arrow should be drawn at the bottom of the window.
2148 .TP 5
2149 .B int \fIx
2150 is the zero-based column within the window on which to draw arrows.
2151 .TP 5
2152 .B int \fItop
2153 is the zero-based row within the window on which to draw up-arrows
2154 as well as a horizontal line to show the window's top.
2155 .TP 5
2156 .B int \fIbottom
2157 is the zero-based row within the window on which to draw down-arrows
2158 as well as a horizontal line to show the window's bottom.
2159 .\" ---------------------------------------------------------------------------
2160 .SS dlg_draw_arrows2
2161 Draw up/down arrows on a window, e.g., for scrollable lists.
2162 .TP 5
2163 .B WINDOW * \fIdialog
2164 is the window on which to draw an arrow.
2165 .TP 5
2166 .B int \fItop_arrow
2167 is true if an up-arrow should be drawn at the top of the window.
2168 .TP 5
2169 .B int \fIbottom_arrow
2170 is true if an down-arrow should be drawn at the bottom of the window.
2171 .TP 5
2172 .B int \fIx
2173 is the zero-based column within the window on which to draw arrows.
2174 .TP 5
2175 .B int \fItop
2176 is the zero-based row within the window on which to draw up-arrows
2177 as well as a horizontal line to show the window's top.
2178 .TP 5
2179 .B int \fIbottom
2180 is the zero-based row within the window on which to draw down-arrows
2181 as well as a horizontal line to show the window's bottom.
2182 .TP 5
2183 .B chtype \fIattr
2184 is the window's background attribute.
2185 .TP 5
2186 .B chtype \fIborderattr
2187 is the window's border attribute.
2188 .\" ---------------------------------------------------------------------------
2189 .SS dlg_draw_bottom_box
2190 Draw a partial box at the bottom of a window,
2191 e.g., to surround a row of buttons.
2192 It is designed to merge with an existing box around
2193 the whole window (see \fBdlg_draw_box\fP),
2194 so it uses tee-elements rather than corner-elements
2195 on the top corners of this box.
2196 .TP 5
2197 .B WINDOW * \fIwin
2198 is the window to update.
2199 .\" ---------------------------------------------------------------------------
2200 .SS dlg_draw_bottom_box2
2201 Draw a partial box at the bottom of a window,
2202 e.g., to surround a row of buttons.
2203 It is designed to merge with an existing box around
2204 the whole window (see \fBdlg_draw_box2\fP),
2205 so it uses tee-elements rather than corner-elements
2206 on the top corners of this box.
2207 .TP 5
2208 .B WINDOW * \fIwin
2209 is the window to update.
2210 .TP 5
2211 .B chtype \fIon_left
2212 is used to color the upper/left edges of the box, i.e., the tee-element and
2213 horizontal line
2214 .TP 5
2215 .B chtype \fIon_right
2216 is used to color the right edge of the box, i.e., the tee-element
2217 .TP 5
2218 .B chtype \fIon_inside
2219 is used to fill-color the inside of the box
2220 .\" ---------------------------------------------------------------------------
2221 .SS dlg_draw_box
2222 Draw a rectangular box with line drawing characters.
2223 .TP 5
2224 .B WINDOW * \fIwin
2225 is the window to update.
2226 .TP 5
2227 .B int \fIy
2228 is the top row of the box.
2229 .TP 5
2230 .B int \fIx
2231 is the left column of the box.
2232 .TP 5
2233 .B int \fIheight
2234 is the height of the box.
2235 .TP 5
2236 .B int \fIwidth
2237 is the width of the box.
2238 .TP 5
2239 .B chtype \fIboxchar
2240 is used to color the right/lower edges.
2241 It also is fill-color used for the box contents.
2242 .TP 5
2243 .B chtype \fIborderchar
2244 is used to color the upper/left edges.
2245 .\" ---------------------------------------------------------------------------
2246 .SS dlg_draw_box2
2247 Draw a rectangular box with line drawing characters.
2248 .TP 5
2249 .B WINDOW * \fIwin
2250 is the window to update.
2251 .TP 5
2252 .B int \fIy
2253 is the top row of the box.
2254 .TP 5
2255 .B int \fIx
2256 is the left column of the box.
2257 .TP 5
2258 .B int \fIheight
2259 is the height of the box.
2260 .TP 5
2261 .B int \fIwidth
2262 is the width of the box.
2263 .TP 5
2264 .B chtype \fIboxchar
2265 is used to fill-color for the box contents.
2266 .TP 5
2267 .B chtype \fIborderchar
2268 is used to color the upper/left edges.
2269 .TP 5
2270 .B chtype \fIborderchar2
2271 is used to color the right/lower edges.
2272 .\" ---------------------------------------------------------------------------
2273 .SS dlg_draw_buttons
2274 Print a list of buttons at the given position.
2275 .TP 5
2276 .B WINDOW * \fIwin
2277 is the window to update.
2278 .TP 5
2279 .B int \fIy
2280 is the starting row.
2281 .TP 5
2282 .B int \fIx
2283 is the starting column.
2284 .TP 5
2285 .B const char ** \fIlabels
2286 is a list of (pointers to) button labels terminated by a null pointer.
2287 .TP 5
2288 .B int \fIselected
2289 is the index within the list of the selected button.
2290 .TP 5
2291 .B int \fIvertical
2292 is true if the buttons are arranged in a column rather than a row.
2293 .TP 5
2294 .B int \fIlimit
2295 is the number of columns (or rows if \fIvertical\/\fP) allowed for the display.
2296 .\" ---------------------------------------------------------------------------
2297 .SS dlg_draw_helpline
2298 draw the text in \fBdialog_vars.help_line\fP at the bottom of the given window.
2299 .TP 5
2300 .B WINDOW * \fIdialog
2301 is the window to modify.
2302 .TP 5
2303 .B bool \fIdecorations
2304 if true, allow room for the scrolling arrows.
2305 .\" ---------------------------------------------------------------------------
2306 .SS dlg_draw_scrollbar
2307 If \fBdialog_state.use_scrollbar\fP is set,
2308 draw a scrollbar on the right margin of windows holding scrollable data.
2309 Also (whether or not the scrollbar is drawn),
2310 annotate the bottom margin of the window with the percentage of data
2311 by the bottom of that window,
2312 and call \fBdlg_draw_arrows2\fP to put markers on the window showing
2313 when more data is available.
2314 .TP 5
2315 .B WINDOW * \fIwin
2316 is the window in which the data is scrolled.
2317 Because \fIleft\fP, \fIright\fP, \fItop\fP, \fIbottom\fP
2318 are passed as parameters, this window can contain additional data.
2319 .TP 5
2320 .B long \fIfirst_data
2321 is the zero-based index to the first row of data in the current window.
2322 .TP 5
2323 .B long \fIthis_data
2324 is the zero-based index to the current row of data.
2325 .TP 5
2326 .B long \fInext_data
2327 is the zero-based index to the next data after the current row.
2328 .TP 5
2329 .B long \fItotal_data
2330 is the total number of rows of data.
2331 .TP 5
2332 .B int \fIleft
2333 is the zero-based left margin/column of the window.
2334 The up/down arrows are draw inset by 5 columns from this point.
2335 .TP 5
2336 .B int \fIright
2337 is the zero-based right margin/column of the window.
2338 The scrollbar is drawn flush against this column.
2339 .TP 5
2340 .B int \fItop
2341 is the zero-based row within the window on which to draw up-arrows
2342 as well as a horizontal line to show the window's top.
2343 .TP 5
2344 .B int \fIbottom
2345 is the zero-based row within the window on which to draw down-arrows
2346 as well as a horizontal line to show the window's bottom.
2347 .TP 5
2348 .B chtype \fIattr
2349 is the window's background attribute.
2350 .TP 5
2351 .B chtype \fIborderattr
2352 is the window's border attribute.
2353 .\" ---------------------------------------------------------------------------
2354 .SS dlg_draw_shadow
2355 Draw shadows along the right and bottom edge of a window to give it
2356 a 3-dimensional look.
2357 (The height, etc., may not be the same as the window's actual values).
2358 .TP 5
2359 .B WINDOW * \fIwin
2360 is the window to update.
2361 .TP 5
2362 .B int \fIheight
2363 is the height of the window.
2364 .TP 5
2365 .B int \fIwidth
2366 is the width of the window.
2367 .TP 5
2368 .B int \fIy
2369 is the top row of the window.
2370 .TP 5
2371 .B int \fIx
2372 is the left column of the window.
2373 .\" ---------------------------------------------------------------------------
2374 .SS dlg_draw_title
2375 Draw a title centered at the top of the window.
2376 .TP 5
2377 .B WINDOW * \fIwin
2378 is the window to update.
2379 .TP 5
2380 .B const char * \fItitle
2381 is the title string to display at the top of the widget.
2382 .\" ---------------------------------------------------------------------------
2383 .SS dlg_dummy_menutext
2384 This is a utility function which supports the \fB--inputmenu\fP option of
2385 the \fB\*p\fP program.
2386 If \fBdialog_vars.input_menu\fP is set, \fBdialog_menu\fP passes this
2387 pointer to \fBdlg_menu\fP as the \fIrename_menutext\fP parameter.
2388 Otherwise, it passes \fBdlg_dummy_menutext\fP.
2389 .LP
2390 The function should only return \fBDLG_EXIT_ERROR\fP.
2391 .TP 5
2392 .B DIALOG_LISTITEM * \fIitems
2393 is the list of menu items
2394 .TP 5
2395 .B int \fIcurrent
2396 is the index of the currently-selected item
2397 .TP 5
2398 .B char * \fInewtext
2399 is the updated text for the menu item
2400 .\" ---------------------------------------------------------------------------
2401 .SS dlg_dump_keys
2402 Write all user-defined key-bindings to the given stream,
2403 e.g., as part of \fBdlg_create_rc\fP.
2404 .TP 5
2405 .B FILE * \fIfp
2406 is the stream on which to write the bindings.
2407 .\" ---------------------------------------------------------------------------
2408 .SS dlg_dump_window_keys
2409 Write all user-defined key-bindings to the given stream,
2410 e.g., as part of \fBdlg_create_rc\fP.
2411 .TP 5
2412 .B FILE * \fIfp
2413 is the stream on which to write the bindings.
2414 .TP 5
2415 .B WINDOW * \fIwin
2416 is the window for which bindings should be dumped.
2417 If it is null, then only built-in bindings are dumped.
2418 .\" ---------------------------------------------------------------------------
2419 .SS dlg_eat_argv
2420 Remove one or more items from an argument vector.
2421 .TP 5
2422 .B int * \fIargcp
2423 in/out parameter giving the length of the argument vector.
2424 .B char *** \fIargvp
2425 in/out parameter pointing to the argument vector.
2426 .B int \fIstart
2427 starting index.
2428 .B int \fIcount
2429 number of arguments to remove.
2430 .\" ---------------------------------------------------------------------------
2431 .SS dlg_edit_offset
2432 Given the character-offset in the string,
2433 returns the display-offset where
2434 \fB\*p\fP should position the cursor.
2435 In this context, \*(``characters\*('' may be multicolumn,
2436 since the string can be a multibyte character string.
2437 .TP 5
2438 .B char * \fIstring
2439 is the string to analyze
2440 .TP 5
2441 .B int \fIoffset
2442 is the character-offset
2443 .TP 5
2444 .B int \fIx_last
2445 is a limit on the column positions that can be used,
2446 e.g., the window's size.
2447 .\" ---------------------------------------------------------------------------
2448 .SS dlg_edit_string
2449 Updates the string and character-offset, given various editing characters
2450 or literal characters which are inserted at the character-offset.
2451 Returns true if an editing change was made (and the display should
2452 be updated), and false if the key was something like KEY_ENTER,
2453 which is a non-editing action outside this function.
2454 .TP 5
2455 .B char * \fIstring
2456 is the (multibyte) string to update
2457 .TP 5
2458 .B int * \fIoffset
2459 is the character-offset
2460 .TP 5
2461 .B int \fIkey
2462 is the editing key
2463 .TP 5
2464 .B int \fIfkey
2465 is true if the editing key is a function-key
2466 .TP 5
2467 .B bool \fIforce
2468 is used in a special loop case by calling code to force the return
2469 value of this function when a function-key code 0 is passed in.
2470 .\" ---------------------------------------------------------------------------
2471 .SS dlg_exit
2472 Given an internal exit code,
2473 check if the corresponding environment variable is set.
2474 If so, remap the exit code to match the environment variable.
2475 Finally call \fBexit\fP with the resulting exit code.
2476 .TP 5
2477 .B int \fIcode
2478 is the internal exit code, e.g., \fBDLG_EXIT_OK\fP,
2479 which may be remapped.
2480 .LP
2481 The \fB\*p\fP program uses this function
2482 to allow shell scripts to remap the exit codes so they can distinguish ESC
2483 from ERROR.
2484 .\" ---------------------------------------------------------------------------
2485 .SS dlg_exit_buttoncode
2486 Map the given button index for \fBdlg_exit_label\fP into \fB\*p\fP's exit-code.
2487 .TP 5
2488 .B int \fIbutton
2489 is the button index
2490 .\" ---------------------------------------------------------------------------
2491 .SS dlg_exit_label
2492 Return a list of button labels.
2493 If \fBdialog_vars.extra_button\fP is true,
2494 return the result of \fBdlg_ok_labels\fP.
2495 Otherwise, return a list with the \*(``Exit\*('' label
2496 and (if \fBdialog_vars.help_button\fP is set)
2497 the \*(``Help\*('' button as well.
2498 .\" ---------------------------------------------------------------------------
2499 .SS dlg_exiterr
2500 Quit program killing all \fBtailboxbg\fP widgets.
2501 .TP 5
2502 .B const char * \fIfmt
2503 is the format of the \fBprintf\fP-like message to write.
2504 .TP 5
2505 .B ...
2506 .br
2507 are the variables to apply to the \fIfmt\fP format.
2508 .\" ---------------------------------------------------------------------------
2509 .SS dlg_find_index
2510 Given the character-offset to find in the list, return the corresponding
2511 array index.
2512 .TP 5
2513 .B const int *\fIlist
2514 contains a list of character-offsets,
2515 i.e., indices into a string that denote the beginning of multibyte characters.
2516 .TP 5
2517 .B int \fIlimit
2518 is the last index into \fBlist\fP to search.
2519 .TP 5
2520 .B int \fIto_find
2521 is the character-offset to find.
2522 .\" ---------------------------------------------------------------------------
2523 .SS dlg_finish_string
2524 If \fIDIALOG_STATE.finish_string\fP is true,
2525 this function discards data used to speed up layout computations.
2526 .TP 5
2527 .B const char * \fIstring
2528 is the address of the string whose data should be discarded.
2529 The address rather than contents is used as the unique identifier because
2530 some of the caching is used for editable input-fields.
2531 .\" ---------------------------------------------------------------------------
2532 .SS dlg_flush_getc
2533 Cancel the local data saved by \fBdlg_last_getc\fP.
2534 .\" ---------------------------------------------------------------------------
2535 .SS dlg_editbox
2536 This entrypoint provides the \fB--editbox\fP
2537 functionality without the limitations of \fB\*p\fP's command-line syntax
2538 (compare to \fBdialog_editbox\fP).
2539 .TP 5
2540 .B const char * \fItitle
2541 is the title string to display at the top of the widget.
2542 .TP 5
2543 .B char *** \fIlist
2544 is a pointer to an array of \fBchar\ *\fP pointers.
2545 The array is allocated by the caller,
2546 and so are the strings to which it points.
2547 The \fBdlg_editbox\fP function may reallocate the
2548 array and the strings.
2549 .TP 5
2550 .B int * \fIrows
2551 points to the nominal length of \fIlist\fP.
2552 The referenced value is updated if\fIlist\fP is reallocated.
2553 .TP 5
2554 .B int \fIheight
2555 is the desired height of the box.
2556 If zero, the height is adjusted to use the available screen size.
2557 .TP 5
2558 .B int \fIwidth
2559 is the desired width of the box.
2560 If zero, the height is adjusted to use the available screen size.
2561 .\" ---------------------------------------------------------------------------
2562 .SS dlg_form
2563 This entrypoint provides the \fB--form\fP
2564 functionality without the limitations of \fB\*p\fP's command-line syntax
2565 (compare to \fBdialog_form\fP).
2566 .TP 5
2567 .B const char * \fItitle
2568 is the title string to display at the top of the widget.
2569 .TP 5
2570 .B const char * \fIcprompt
2571 is the prompt text shown within the widget.
2572 .TP 5
2573 .B int \fIheight
2574 is the desired height of the box.
2575 If zero, the height is adjusted to use the available screen size.
2576 .TP 5
2577 .B int \fIwidth
2578 is the desired width of the box.
2579 If zero, the height is adjusted to use the available screen size.
2580 .TP 5
2581 .B int \fIform_height
2582 is the minimum height to reserve for displaying the list.
2583 If zero, it is computed based on the given \fIheight\fP and \fIwidth\fP.
2584 .TP 5
2585 .B int \fIitem_no
2586 is the number of \fIitems\fP.
2587 .TP 5
2588 .B DIALOG_FORMITEM * \fIitems
2589 This is a list of the items to display in the form.
2590 .TP 5
2591 .B int * \fIcurrent_item
2592 The widget sets the referenced location to the index of the current display
2593 item (cursor) when it returns.
2594 .\" ---------------------------------------------------------------------------
2595 .SS dlg_free_columns
2596 Free data allocated by \fBdlg_align_columns\fP.
2597 .TP 5
2598 .B char **\fItarget
2599 This is the array which was reformatted.
2600 It points to the first string to free.
2601 .TP 5
2602 .B int \fIper_row
2603 This is the size of the struct for each row of the array.
2604 .TP 5
2605 .B int \fInum_rows
2606 This is the number of rows in the array.
2607 .\" ---------------------------------------------------------------------------
2608 .SS dlg_free_formitems
2609 Free memory owned by a list of DIALOG_FORMITEM's.
2610 .TP 5
2611 .B DIALOG_FORMITEM * \fIitems
2612 is the list to free.
2613 .\" ---------------------------------------------------------------------------
2614 .SS dlg_free_gauge
2615 Remove the gauge widget from the screen and free its associated memory.
2616 .TP 5
2617 .B void *\fIobjptr
2618 points to the gauge widget.
2619 .\" ---------------------------------------------------------------------------
2620 .SS dlg_getc
2621 Read a character from the given window.
2622 Handle repainting here (to simplify
2623 things in the calling application).
2624 Also, if input-callback(s) are set up,
2625 poll the corresponding files and handle the updates,
2626 e.g., for displaying a tailbox.
2627 Returns the key-code.
2628 .TP 5
2629 .B WINDOW * \fIwin
2630 is the window within which to read.
2631 .TP 5
2632 .B int * \fIfkey
2633 as a side-effect, set this to true if the key-code is really a function-key.
2634 .\" ---------------------------------------------------------------------------
2635 .SS dlg_get_attrs
2636 extract the video attributes from the given window.
2637 .TP 5
2638 .B WINDOW * \fIwin
2639 is the window from which to get attributes.
2640 .\" ---------------------------------------------------------------------------
2641 .SS dlg_getc_callbacks
2642 passes the given key-code \fIch\fP to the current window that
2643 has established a callback.
2644 If the callback returns zero, remove it and try the next window.
2645 If no more callbacks remain, return.
2646 If any callbacks were found, return true, otherwise false.
2647 .TP 5
2648 .B int \fIch
2649 is the key-code
2650 .TP 5
2651 .B int \fIfkey
2652 is true if the key is a function-key
2653 .TP 5
2654 .B int * \fIresult
2655 is used to pass an exit-code to the caller,
2656 which should pass that via \fBdlg_exit\fP.
2657 .\" ---------------------------------------------------------------------------
2658 .SS dlg_index_columns
2659 Build a list of the display-columns for the given multibyte string's characters.
2660 .TP 5
2661 .B const char * \fIstring
2662 is the string to analyze
2663 .\" ---------------------------------------------------------------------------
2664 .SS dlg_index_wchars
2665 Build an index of the wide-characters in the string,
2666 so the caller can easily tell
2667 which byte-offset begins a given wide-character.
2668 .TP 5
2669 .B const char * \fIstring
2670 is the string to analyze
2671 .\" ---------------------------------------------------------------------------
2672 .SS dlg_item_help
2673 Draw the string for the \fBdialog_vars.item_help\fP feature.
2674 .TP 5
2675 .B const char * \fItxt
2676 is the help-message
2677 .\" ---------------------------------------------------------------------------
2678 .SS dlg_killall_bg
2679 If \fB\*p\fP has callbacks active,
2680 purge the list of all that are not marked
2681 to keep in the background.
2682 If any remain, run those in a background process.
2683 .TP 5
2684 .B int * \fIretval
2685 stores the exit-code to pass back to the caller.
2686 .\" ---------------------------------------------------------------------------
2687 .SS dlg_last_getc
2688 returns the most recent character that was read via \fBdlg_getc\fP.
2689 .\" ---------------------------------------------------------------------------
2690 .SS dlg_limit_columns
2691 Given a column limit,
2692 count the number of wide characters that can fit into that limit.
2693 The offset is used to skip over a leading character
2694 that was already written.
2695 .TP 5
2696 .B const char * \fIstring
2697 is the string to analyze
2698 .TP 5
2699 .B int \fIlimit
2700 is the column limit
2701 .TP 5
2702 .B int \fIoffset
2703 is the starting offset from which analysis should continue
2704 .\" ---------------------------------------------------------------------------
2705 .SS dlg_lookup_key
2706 Check for a key-binding.
2707 If there is no binding associated with the widget, it simply returns
2708 the given curses-key.
2709 Otherwise, it returns the result of the binding
2710 .TP 5
2711 .B WINDOW * \fIwin
2712 is the window on which the binding is checked
2713 .TP 5
2714 .B int \fIcurses_key
2715 is the curses key-code
2716 .TP 5
2717 .B int * \fIdialog_key
2718 is the corresponding \fB\*p\fP internal code
2719 (see \fBDLG_KEYS_ENUM\fP in dlg_key.h).
2720 .\" ---------------------------------------------------------------------------
2721 .SS dlg_max_input
2722 Limit the parameter according to \fBdialog_vars.max_input\fP
2723 .TP 5
2724 .B int \fImax_len
2725 is the value to limit
2726 .\" ---------------------------------------------------------------------------
2727 .SS dlg_match_char
2728 Match a given character against the beginning of the string,
2729 ignoring case of the given character.
2730 The matching string must begin with an uppercase character.
2731 .TP 5
2732 .B int \fIch
2733 is the character to check
2734 .TP 5
2735 .B const char * \fIstring
2736 is the string to search
2737 .\" ---------------------------------------------------------------------------
2738 .SS dlg_menu
2739 This entrypoint provides the \fB--menu\fP
2740 functionality without the limitations of \fB\*p\fP's command-line syntax
2741 (compare to \fBdialog_menu\fP).
2742 .TP 5
2743 .B const char * \fItitle
2744 is the title string to display at the top of the widget.
2745 .TP 5
2746 .B const char * \fIcprompt
2747 is the prompt text shown within the widget.
2748 .TP 5
2749 .B int \fIheight
2750 is the desired height of the box.
2751 If zero, the height is adjusted to use the available screen size.
2752 .TP 5
2753 .B int \fIwidth
2754 is the desired width of the box.
2755 If zero, the height is adjusted to use the available screen size.
2756 .TP 5
2757 .B int \fImenu_height
2758 is the minimum height to reserve for displaying the list.
2759 If zero, it is computed based on the given \fIheight\fP and \fIwidth\fP.
2760 .TP 5
2761 .B int \fIitem_no
2762 is the number of \fIitems\fP.
2763 .TP 5
2764 .B DIALOG_LISTITEM * \fIitems
2765 This is a list of the items to display in the form.
2766 .TP 5
2767 .B int * \fIcurrent_item
2768 The widget sets the referenced location to the index of the current display
2769 item (cursor) when it returns.
2770 .TP 5
2771 .B DIALOG_INPUTMENU \fIrename_menutext
2772 If this is not \fBdlg_dummy_menutext\fP,
2773 the widget acts like an \fIinputmenu\fP widget,
2774 providing an extra \*(``Rename\*('' button,
2775 which activates an edit feature on the selected menu item.
2776 .\" ---------------------------------------------------------------------------
2777 .SS dlg_move_window
2778 Moves/resizes the given window to the given position and size.
2779 .TP 5
2780 .B WINDOW *\fIwin
2781 is the window to move/resize.
2782 .TP 5
2783 .B WINDOW *\fIheight
2784 is the height of the resized window.
2785 .TP 5
2786 .B WINDOW *\fIwidth
2787 is the width of the resized window.
2788 .TP 5
2789 .B WINDOW *\fIy
2790 y-ordinate to use for the repositioned window.
2791 .TP 5
2792 .B WINDOW *\fIx
2793 x-ordinate to use for the repositioned window.
2794 .\" ---------------------------------------------------------------------------
2795 .SS dlg_mouse_bigregion
2796 Retrieve the big-region under the pointer.
2797 .TP 5
2798 .B int \fIy
2799 is the row on which the mouse click occurred
2800 .TP 5
2801 .B int \fIx
2802 is the column on which the mouse click occurred
2803 .\" ---------------------------------------------------------------------------
2804 .SS dlg_mouse_free_regions
2805 Free the memory associated with mouse regions.
2806 .\" ---------------------------------------------------------------------------
2807 .SS dlg_mouse_mkbigregion
2808 Creates a region on which the mouse-clicks will return a specified code.
2809 .TP 5
2810 .B int \fIy
2811 is the top-row of the region.
2812 .TP 5
2813 .B int \fIx
2814 is the left-column of the region.
2815 .TP 5
2816 .B int \fIheight
2817 is the height of the region.
2818 .TP 5
2819 .B int \fIwidth
2820 is the width of the region.
2821 .TP 5
2822 .B int \fIcode
2823 is a code used to make the region unique within a widget
2824 .TP 5
2825 .B int \fIstep_x
2826 is used in modes 2 (columns) and 3 (cells) to determine the width
2827 of a column/cell.
2828 .TP 5
2829 .B int \fIstep_y
2830 is currently unused
2831 .TP 5
2832 .B int \fImode
2833 is used to determine how the mouse position is translated into
2834 a code (like a function-key):
2835 .RS 5
2836 .TP 3
2837 1
2838 index by lines
2839 .TP
2840 2
2841 index by columns
2842 .TP
2843 3
2844 index by cells
2845 .RE
2846 .\" ---------------------------------------------------------------------------
2847 .SS dlg_mouse_mkregion
2848 .TP 5
2849 .B int \fIy
2850 is the top-row of the region.
2851 .TP 5
2852 .B int \fIx
2853 is the left-column of the region.
2854 .TP 5
2855 .B int \fIheight
2856 is the height of the region.
2857 .TP 5
2858 .B int \fIwidth
2859 is the width of the region.
2860 .TP 5
2861 .B int \fIcode
2862 is a code used to make the region unique within a widget
2863 .\" ---------------------------------------------------------------------------
2864 .SS dlg_mouse_region
2865 Retrieve the frame under the mouse pointer
2866 .TP 5
2867 .B int \fIy
2868 is the row of the mouse-click
2869 .TP 5
2870 .B int \fIx
2871 is the column of the mouse-click
2872 .\" ---------------------------------------------------------------------------
2873 .SS dlg_mouse_setbase
2874 Sets a base for subsequent calls to \fBdlg_mouse_mkregion\fP,
2875 so they can make regions relative to the start of a given window.
2876 .TP 5
2877 .B int \fIx
2878 is the left-column for the base
2879 .TP 5
2880 .B int \fIy
2881 is the top-row for the base
2882 .\" ---------------------------------------------------------------------------
2883 .SS dlg_mouse_setcode
2884 Sets a value used internally by \fBdlg_mouse_mkregion\fP
2885 which is added to the \fIcode\fP parameter.
2886 By providing different values,
2887 e.g., multiples of \fBKEY_MAX\fP,
2888 it is possible to support multiple \*(``big\*('' regions in a widget.
2889 The \fIbuildlist\fP widget uses this feature to recognize mouse-clicks
2890 in the left/right panes.
2891 .TP 5
2892 .B int \fIcode
2893 is the value to add to \fBdlg_mouse_mkregion\fP's \fIcode\fP parameter.
2894 .\" ---------------------------------------------------------------------------
2895 .SS dlg_mouse_wgetch
2896 is a wrapper for \fBdlg_getc\fP which additionally maps mouse-clicks
2897 (if the curses library supports those) into extended function-keys
2898 which encode the position according to the \fImode\fP in
2899 \fBdlg_mouse_mkbigregion\fP.
2900 Returns the corresponding key-code.
2901 .TP 5
2902 .B WINDOW * \fIwin
2903 is the window on which to perform the input
2904 .TP 5
2905 .B int * \fIfkey
2906 the referenced location is set to true if the key-code is an actual
2907 or extended (mouse) function-key.
2908 .\" ---------------------------------------------------------------------------
2909 .SS dlg_mouse_wgetch_nowait
2910 This is a non-blocking variant of \fBdlg_mouse_wgetch\fP.
2911 .TP 5
2912 .B WINDOW * \fIwin
2913 is the window on which to perform the input
2914 .TP 5
2915 .B int * \fIfkey
2916 the referenced location is set to true if the key-code is an actual
2917 or extended (mouse) function-key.
2918 .\" ---------------------------------------------------------------------------
2919 .SS dlg_need_separator
2920 Check if an output-separator is needed.
2921 If \fBdialog_vars.output_separator\fP is set, return true.
2922 Otherwise, if \fBdialog_vars.input_result\fP is nonempty, return true.
2923 If neither, return false.
2924 .\" ---------------------------------------------------------------------------
2925 .SS dlg_new_modal_window
2926 Create a modal window, optionally with a shadow.
2927 The shadow is created if \fBdialog_state.use_shadow\fP is true.
2928 .TP 5
2929 .B WINDOW * \fIparent
2930 is the parent window (usually the top-level window of a widget)
2931 .TP 5
2932 .B int \fIheight
2933 is the window's height
2934 .TP 5
2935 .B int \fIwidth
2936 is the window's width
2937 .TP 5
2938 .B int \fIy
2939 is the window's top-row
2940 .TP 5
2941 .B int \fIx
2942 is the window's left-column
2943 .\" ---------------------------------------------------------------------------
2944 .SS dlg_new_window
2945 Create a window, optionally with a shadow.
2946 The shadow is created if \fBdialog_state.use_shadow\fP is true.
2947 .TP 5
2948 .B int \fIheight
2949 is the window's height
2950 .TP 5
2951 .B int \fIwidth
2952 is the window's width
2953 .TP 5
2954 .B int \fIy
2955 is the window's top-row
2956 .TP 5
2957 .B int \fIx
2958 is the window's left-column
2959 .\" ---------------------------------------------------------------------------
2960 .SS dlg_next_button
2961 Return the next index in the list of labels.
2962 .TP 5
2963 .B const char ** \fIlabels
2964 is a list of (pointers to) button labels terminated by a null pointer.
2965 .TP 5
2966 .B int \fIbutton
2967 is the current button-index.
2968 .\" ---------------------------------------------------------------------------
2969 .SS dlg_next_ok_buttonindex
2970 Assuming that the caller is using \fBdlg_ok_labels\fP to list buttons,
2971 find the next index in the list of buttons.
2972 .TP 5
2973 .B int \fIcurrent
2974 is the current index in the list of buttons
2975 .TP 5
2976 .B int \fIextra
2977 if negative, provides a way to enumerate extra active areas on the widget.
2978 .\" ---------------------------------------------------------------------------
2979 .SS dlg_ok_buttoncode
2980 Map the given button index for \fBdlg_ok_labels\fP
2981 into \fB\*p\fP's exit-code.
2982 .TP 5
2983 .B int \fIbutton
2984 is the button-index (which is not necessarily the same as the index
2985 in the list of labels).
2986 .\" ---------------------------------------------------------------------------
2987 .SS dlg_ok_label
2988 Returns a list with the \*(``Ok\*('' label,
2989 and if \fBdialog_vars.help_button\fP is true, the \*(``Help\*('' label as well.
2990 .\" ---------------------------------------------------------------------------
2991 .SS dlg_ok_labels
2992 Return a list of button labels for the OK/Cancel group of widgets.
2993 .\" ---------------------------------------------------------------------------
2994 .SS dlg_ordinate
2995 Decode the string as an integer, decrement if greater than zero to make
2996 a curses-ordinate from a dialog-ordinate.
2997 .\" ---------------------------------------------------------------------------
2998 .SS dlg_parse_bindkey
2999 Parse the parameters of the \*(``bindkeys\*('' configuration-file entry.
3000 This expects widget name which may be "*", followed by curses key definition and
3001 then \fB\*p\fP key definition.
3002 .TP 5
3003 .B char * \fIparams
3004 is the parameter string to parse.
3005 .\" ---------------------------------------------------------------------------
3006 .SS dlg_parse_rc
3007 Parse the configuration file and set up variables.
3008 .\" ---------------------------------------------------------------------------
3009 .SS dlg_popen
3010 Open a pipe which ties the standard error and output together.
3011 The \fBpopen\fP function captures only the standard output of a command.
3012 .TP 5
3013 .B const char *\fIcommand
3014 The shell command to run.
3015 .TP 5
3016 .B const char *\fItype
3017 Like \fBpopen\fP, "r" is used to read, and "w" is used to write.
3018 .\" ---------------------------------------------------------------------------
3019 .SS dlg_prev_button
3020 Return the previous index in the list of labels.
3021 .TP 5
3022 .B const char ** \fIlabels
3023 is a list of (pointers to) button labels terminated by a null pointer.
3024 .TP 5
3025 .B int \fIbutton
3026 is the current button index
3027 .\" ---------------------------------------------------------------------------
3028 .SS dlg_print_listitem
3029 This is a helper function used for the various \*(``list\*('' widgets,
3030 e.g., checklist, menu, buildlist, treeview.
3031 Each list-widget has \*(``tag\*('' and \*(``description\*('' values
3032 for each item which can be displayed.
3033 If \fBdialog_vars.no_tags\fP is true,
3034 the \*(``tag\*('' value is not shown.
3035 The first character of the first value shown (tag or description)
3036 is highlighted to indicate that the widget will match it for quick navigation.
3037 .TP 5
3038 .B WINDOW *\fIwin
3039 the window in which to display the text
3040 .TP 5
3041 .B const char *\fItext
3042 the value to display
3043 .TP 5
3044 .B int \fIclimit
3045 the number of columns available for printing the text
3046 .TP 5
3047 .B bool \fIfirst
3048 true if this is the first call (for \*(``tag\*('' and \*(``description\*(''),
3049 and the first character of the value should be highlighted.
3050 .TP 5
3051 .B int \fIselected
3052 nonzero if the text should be displayed using the \*(``selected\*('' colors
3053 .\" ---------------------------------------------------------------------------
3054 .SS dlg_print_scrolled
3055 This is a wrapper for \fBdlg_print_autowrap\fP which allows the user
3056 to scroll too-long prompt text up/down.
3057 .LP
3058 See \fBdlg_check_scrolled\fP for a function which updates the \fIoffset\fP
3059 variable used as a parameter here.
3060 It complements this function; you need both.
3061 If \fIpauseopt\fP is set, this function returns an updated \fIlast\fP
3062 parameter, needed for \fBdlg_check_scrolled\fP calls.
3063 .TP 5
3064 .B WINDOW * \fIwin
3065 is the window to update.
3066 .TP 5
3067 .B const char * \fIprompt
3068 is the string to print
3069 .TP 5
3070 .B int \fIoffset
3071 is the starting line-number to write wrapped text.
3072 .TP 5
3073 .B int \fIheight
3074 is the available height for writing the wrapped text
3075 .TP 5
3076 .B int \fIwidth
3077 is the width that the wrapping should occur in
3078 .TP 5
3079 .B int \fIpauseopt
3080 is true if the extra functionality for scrolling should be enabled.
3081 If false, this calls \fBdlg_print_autowrap\fP without doing any scrolling.
3082 .\" ---------------------------------------------------------------------------
3083 .SS dlg_print_line
3084 Print one line of the prompt in the window within the limits of the
3085 specified right margin.
3086 The line will end on a word boundary and a pointer
3087 to the start of the next line is returned, or a NULL pointer if the end of
3088 *prompt is reached.
3089 .TP 5
3090 .B WINDOW *\fIwin
3091 is the window to update.
3092 .TP 5
3093 .B chtype *\fIattr
3094 holds the starting attributes, and is updated to reflect the final attributes
3095 applied to the string.
3096 .TP 5
3097 .B const char *\fIprompt
3098 is the string to print
3099 .TP 5
3100 .B int \fIlm
3101 is the left margin.
3102 .TP 5
3103 .B int \fIrm
3104 is the right margin
3105 .TP 5
3106 .B int *\fIx
3107 returns the ending x-ordinate.
3108 .\" ---------------------------------------------------------------------------
3109 .SS dlg_prev_ok_buttonindex
3110 Find the previous button index in the list from \fBdlg_ok_labels\fP.
3111 .TP 5
3112 .B int \fIcurrent
3113 is the current index
3114 .TP 5
3115 .B int \fIextra
3116 if negative provides a way to enumerate extra active areas on the widget.
3117 .\" ---------------------------------------------------------------------------
3118 .SS dlg_print_autowrap
3119 Print a string of text in a window, automatically wrap around to the next
3120 line if the string is too long to fit on one line.
3121 Note that the string may contain embedded newlines.
3122 The text is written starting at the top of the window.
3123 .TP 5
3124 .B WINDOW * \fIwin
3125 is the window to update.
3126 .TP 5
3127 .B const char * \fIprompt
3128 is the string to print
3129 .TP 5
3130 .B int \fIheight
3131 is the nominal height the wrapped string is limited to
3132 .TP 5
3133 .B int \fIwidth
3134 is the width that the wrapping should occur in
3135 .\" ---------------------------------------------------------------------------
3136 .SS dlg_print_size
3137 If \fBdialog_vars.print_siz\fP is true,
3138 print the given height/width (from a widget)
3139 to \fBdialog_state.output\fP, e.g.,
3140 \fBSize: height, width\fP.
3141 .TP 5
3142 .B int \fIheight
3143 is the window's height
3144 .TP 5
3145 .B int \fIwidth
3146 is the window's width
3147 .\" ---------------------------------------------------------------------------
3148 .SS dlg_print_text
3149 Print up to \fIcols\fP columns from \fBtext\fP,
3150 optionally rendering \fB\*p\fP's escape sequences for attributes and color.
3151 .TP 5
3152 .B WINDOW * \fIwin
3153 is the window to update.
3154 .TP 5
3155 .B const char * \fItxt
3156 is the string to print
3157 .TP 5
3158 .B int \fIcol
3159 is the column limit
3160 .TP 5
3161 .B chtype * \fIattr
3162 holds the starting attributes, and is updated to reflect the final attributes
3163 applied to the string.
3164 .\" ---------------------------------------------------------------------------
3165 .SS dlg_progressbox
3166 implements the "\fB--prgbox\fP" and "\fB--progressbox\fP" options.
3167 .TP 5
3168 .B const char * \fItitle
3169 is the title on the top of the widget.
3170 .TP 5
3171 .B const char * \fIcprompt
3172 is the prompt text shown within the widget.
3173 If empty or null, no prompt is shown.
3174 .TP 5
3175 .B int \fIheight
3176 is the desired height of the box.
3177 If zero, the height is based on the screen size.
3178 .TP 5
3179 .B int \fIwidth
3180 is the desired width of the box.
3181 If zero, the height is based on the screen size.
3182 .TP 5
3183 .B int \fIpauseopt
3184 if true, an \*(``OK\*('' button will be shown,
3185 and the dialog will wait for it to complete.
3186 With an \*(``OK\*('' button, it is denoted a \*(``programbox\*('',
3187 without an \*(``OK\*('' button, it is denoted a \*(``progressbox\*(''.
3188 .TP 5
3189 .B FILE * \fIfp
3190 is the file pointer, which may be a pipe or a regular file.
3191 .\" ---------------------------------------------------------------------------
3192 .SS dlg_put_backtitle
3193 Display the background title if \fBdialog_vars.backtitle\fP is non-null.
3194 The background title is shown at the top of the screen.
3195 .\" ---------------------------------------------------------------------------
3196 .SS dlg_reallocate_gauge
3197 Allocates or reallocates a gauge widget (see \fBdlg_allocate_gauge\fP).
3198 Use \fBdlg_update_gauge\fP to display the result.
3199 .TP 5
3200 .B void ** \fIobjptr
3201 If the pointer referenced by this parameter is null, the function creates
3202 a new gauge widget using \fBdlg_allocate_gauge\fP.
3203 Otherwise, it updates the title and cprompt values, reusing the window
3204 from the previous call on this function.
3205 As a side-effect, the function stores the updated object-pointer via
3206 the \fIobjptr\fP parameter.
3207 .TP 5
3208 .B const char * \fItitle
3209 is the title string to display at the top of the widget.
3210 .TP 5
3211 .B const char * \fIcprompt
3212 is the prompt text shown within the widget.
3213 .TP 5
3214 .B int \fIheight
3215 is the desired height of the box.
3216 If zero, the height is adjusted to use the available screen size.
3217 .TP 5
3218 .B int \fIwidth
3219 is the desired width of the box.
3220 If zero, the height is adjusted to use the available screen size.
3221 .TP 5
3222 .B int \fIpercent
3223 is the percentage to show in the progress bar.
3224 .\" ---------------------------------------------------------------------------
3225 .SS dlg_register_buttons
3226 The widget developer should call this function after \fBdlg_register_window\fP,
3227 for the list of button labels associated with the widget.
3228 One may bind a key to a button, e.g., \*(``OK\*('' for \fBDLGK_OK\fP,
3229 .TP 5
3230 .B WINDOW * \fIwin
3231 is the window with which to associate the buttons
3232 .TP 5
3233 .B const char * \fIname
3234 is the widget's binding name (usually the name of the widget).
3235 .TP 5
3236 .B const char ** \fIbuttons
3237 is the list of buttons
3238 .\" ---------------------------------------------------------------------------
3239 .SS dlg_register_window
3240 For a given named widget's window, associate a binding table.
3241 .TP 5
3242 .B WINDOW * \fIwin
3243 is the window with which to associate the buttons
3244 .TP 5
3245 .B const char * \fIname
3246 is the widget's binding name (usually the name of the widget).
3247 .TP 5
3248 .B DLG_KEYS_BINDING * \fIbinding
3249 is the binding table
3250 .\" ---------------------------------------------------------------------------
3251 .SS dlg_remove_callback
3252 Remove a callback.
3253 .TP 5
3254 .B DIALOG_CALLBACK * \fIp
3255 contains the callback information.
3256 .\" ---------------------------------------------------------------------------
3257 .SS dlg_renamed_menutext
3258 This is a utility function which supports the \fB--inputmenu\fP option of
3259 the \fB\*p\fP program.
3260 If \fBdialog_vars.input_menu\fP is set, \fBdialog_menu\fP passes this
3261 pointer to \fBdlg_menu\fP as the \fIrename_menutext\fP parameter.
3262 Otherwise, it passes \fBdlg_dummy_menutext\fP.
3263 .LP
3264 The function should add \*(``RENAMED\*('' to \fBdialog_vars.input_result\fP ,
3265 followed by the menu item's name and the \fInewtext\fP value
3266 (with a space separating the three items),
3267 and return \fBDLG_EXIT_EXTRA\fP.
3268 .TP 5
3269 .B DIALOG_LISTITEM * \fIitems
3270 is the list of menu items
3271 .TP 5
3272 .B int \fIcurrent
3273 is the index of the currently-selected item
3274 .TP 5
3275 .B char * \fInewtext
3276 is the updated text for the menu item
3277 .\" ---------------------------------------------------------------------------
3278 .SS dlg_restore_vars
3279 Restore \fB\*p\fP's variables from the given variable
3280 (see \fBdialog_save_vars\fP).
3281 .TP 5
3282 .B DIALOG_VARS * \fIsave
3283 is the variable from which to restore.
3284 .LP
3285 The
3286 \fIDIALOG_VARS.input_length\fP and
3287 \fIDIALOG_VARS.input_result\fP members are treated specially,
3288 since these are used by a widget to pass data to the caller.
3289 They are not modified by this function.
3290 .\" ---------------------------------------------------------------------------
3291 .SS dlg_result_key
3292 Test a \fB\*p\fP internal keycode to see if it corresponds to one of the push
3293 buttons on the widget such as \*(``OK\*(''.
3294 This is only useful if there are user-defined key bindings, since there are
3295 no built-in bindings that map directly to \fBDLGK_OK\fP, etc.
3296 Return true if a mapping was done.
3297 .TP 5
3298 .B int \fIdialog_key
3299 is the \fB\*p\fP key to test
3300 .TP 5
3301 .B int \fIfkey
3302 is true if this is a function key
3303 .TP 5
3304 .B int * \fIresultp
3305 store the result of the mapping in the referenced location.
3306 .\" ---------------------------------------------------------------------------
3307 .SS dlg_save_vars
3308 Save \fB\*p\fP's variables into the given variable (see \fBdlg_restore_vars\fP).
3309 .TP 5
3310 .B DIALOG_VARS * \fIsave
3311 is the variable into which to save.
3312 .\" ---------------------------------------------------------------------------
3313 .SS dlg_set_focus
3314 Set focus on the given window,
3315 making it display above other windows on the screen.
3316 .TP 5
3317 .B WINDOW * \fIparent
3318 is the parent window (usually the top-level window of a widget)
3319 .TP 5
3320 .B WINDOW * \fIwin
3321 is the window on which to place focus (usually a subwindow of a widget)
3322 .\" ---------------------------------------------------------------------------
3323 .SS dlg_set_result
3324 Setup a fixed-buffer for the result in \fBdialog_vars.input_result\fP
3325 .TP 5
3326 .B const char * \fIstring
3327 is the new contents for the result
3328 .\" ---------------------------------------------------------------------------
3329 .SS dlg_show_string
3330 Displays the string, shifted as necessary, to fit within the box and show
3331 the current character-offset.
3332 .TP 5
3333 .B WINDOW * \fIwin
3334 is the window within which to display
3335 .TP 5
3336 .B const char * \fIstring
3337 is the string to display
3338 .TP 5
3339 .B int \fIoffset
3340 is the starting (character, not bytes) offset
3341 .TP 5
3342 .B chtype \fIattr
3343 is the window attribute to use for the string
3344 .TP 5
3345 .B int \fIy_base
3346 beginning row on screen
3347 .TP 5
3348 .B int \fIx_base
3349 beginning column on screen
3350 .TP 5
3351 .B int \fIx_last
3352 number of columns on screen
3353 .TP 5
3354 .B bool \fIhidden
3355 if true, do not echo input
3356 .TP 5
3357 .B bool \fIforce
3358 if true, force repaint
3359 .\" ---------------------------------------------------------------------------
3360 .SS dlg_strclone
3361 duplicate the string, like \fBstrdup\fP.
3362 .TP 5
3363 .B const char * \fIcprompt
3364 is the string to duplicate
3365 .\" ---------------------------------------------------------------------------
3366 .SS dlg_strcmp
3367 compare two strings, ignoring case.
3368 .TP 5
3369 .B const char * \fIa
3370 is one string
3371 .TP 5
3372 .B const char * \fIb
3373 is the other string
3374 .\" ---------------------------------------------------------------------------
3375 .SS dlg_string_to_argv
3376 Convert a string to an argument vector
3377 returning an index (which must be freed by the caller).
3378 The string is modified:
3379 .bP
3380 Blanks between arguments are replaced by nulls.
3381 .bP
3382 Normally arguments are separated by blanks;
3383 however you can double-quote an argument to enclose blanks.
3384 The surrounding double-quotes are removed from the string.
3385 .bP
3386 A backslash preceding a double-quote within double-quotes is removed.
3387 .bP
3388 A backslash preceding a newline outside double-quotes is removed.
3389 .bP
3390 Except for special cases, backslashes are preserved in the strings,
3391 since other \fB\*l\fP functions interpret backslashes, e.g., for colors.
3392 .TP 5
3393 .B char *\fIblob
3394 is the string to convert.
3395 .\" ---------------------------------------------------------------------------
3396 .SS dlg_sub_window
3397 create a subwindow, e.g., for an input area of a widget
3398 .TP 5
3399 .B WINDOW * \fIwin
3400 is the parent window
3401 .TP 5
3402 .B int \fIheight
3403 is the subwindow's height
3404 .TP 5
3405 .B int \fIwidth
3406 is the subwindow's width
3407 .TP 5
3408 .B int \fIy
3409 is the subwindow's top-row
3410 .TP 5
3411 .B int \fIx
3412 is the subwindow's left-column
3413 .\" ---------------------------------------------------------------------------
3414 .SS dlg_tab_correct_str
3415 If the \fBdialog_vars.tab_correct\fP is true, convert tabs to single spaces.
3416 Return the converted result.
3417 The caller is responsible for freeing the string.
3418 .TP 5
3419 .B char * \fIprompt
3420 is the string to convert
3421 .\" ---------------------------------------------------------------------------
3422 .SS dlg_trace
3423 If the parameter is non-null, opens a trace file with that
3424 name and stores the file pointer in \fBdialog_state.trace\fP.
3425 .\" ---------------------------------------------------------------------------
3426 .SS dlg_trace_2n
3427 logs a numeric value as a comment.
3428 .TP 5
3429 .B char * \fIname
3430 is the name to log in the comment.
3431 .TP 5
3432 .B int \fIvalue
3433 is the value to log in the comment.
3434 .\" ---------------------------------------------------------------------------
3435 .SS dlg_trace_2n
3436 logs a string value as a comment.
3437 If the value contains embedded newlines,
3438 the comment is continued with \*(``#+\*('' markers.
3439 .TP 5
3440 .B char * \fIname
3441 is the name to log in the comment.
3442 .TP 5
3443 .B int \fIvalue
3444 is the value to log in the comment.
3445 .\" ---------------------------------------------------------------------------
3446 .SS dlg_trace_chr
3447 If \fBdialog_state.trace\fP is set,
3448 translate the parameters into a printable representation,
3449 log it on a \*(``chr\*('' line.
3450 .TP 5
3451 .B int \fIch
3452 is the nominal keycode value.
3453 .TP 5
3454 .B int \fIfkey
3455 is nonzero if the value is really a function key.
3456 Some of these may be values declared in the DLG_KEYS_ENUM.
3457 .\" ---------------------------------------------------------------------------
3458 .SS dlg_trace_msg
3459 Write a formatted message to the trace file.
3460 .TP 5
3461 .B const char * \fIfmt
3462 is the format of the \fBprintf\fP-like message to write.
3463 .TP 5
3464 .B ...
3465 .br
3466 are the variables to apply to the \fIfmt\fP format.
3467 .LP
3468 Use the DLG_TRACE macro for portability, in case the trace
3469 feature is not compiled into the library.
3470 It uses an extra level of parentheses to work with a variable number of
3471 parameters, e.g.,
3472 .Ex
3473 DLG_TRACE(("this is dialog version %s\en", dialog_version()));
3474 .Ee
3475 .\" ---------------------------------------------------------------------------
3476 .SS dlg_ttysize
3477 Returns the screensize without using curses.
3478 That allows the function to be used before initializing the screen.
3479 .\" ---------------------------------------------------------------------------
3480 .SS dlg_trace_win
3481 If \fBdialog_state.trace\fP is set,
3482 log a printable picture of the given window.
3483 .\" ---------------------------------------------------------------------------
3484 .SS dlg_treeview
3485 This is an alternate interface to 'treeview' which allows the application
3486 to read the list item states back directly without putting them in the
3487 output buffer.
3488 .TP 5
3489 .B const char * \fItitle
3490 is the title on the top of the widget.
3491 .TP 5
3492 .B const char * \fIcprompt
3493 is the prompt text shown within the widget.
3494 .TP 5
3495 .B int \fIheight
3496 is the desired height of the box.
3497 If zero, the height is based on the screen size.
3498 .TP 5
3499 .B int \fIwidth
3500 is the desired width of the box.
3501 If zero, the height is based on the screen size.
3502 .TP 5
3503 .B int \fIlist_height
3504 is the minimum height to reserve for displaying the list.
3505 If zero, it is computed based on the given \fIheight\fP and \fIwidth\fP.
3506 .TP 5
3507 .B int \fIitem_no
3508 is the number of rows in \fIitems\fP.
3509 .TP 5
3510 .B DIALOG_LISTITEM * \fIitems
3511 is the list of items, contain tag, name, and optionally help strings
3512 (if \fBdialog_vars.item_help\fP is set).
3513 The initial selection state for each item is also in this list.
3514 .TP 5
3515 .B const char * \fIstates
3516 This is a list of characters to display for the given states.
3517 Normally a buildlist provides true (1) and false (0) values,
3518 which the widget displays as "*" and space, respectively.
3519 An application may set this parameter to an arbitrary null-terminated string.
3520 The widget determines the number of states from the length of this string,
3521 and will cycle through the corresponding display characters as the user
3522 presses the space-bar.
3523 .TP 5
3524 .B int * \fIdepths
3525 This is a list of depths of each item in the tree.
3526 It is a separate parameter from \fIitems\fP to allow reuse of
3527 the existing functions.
3528 .TP 5
3529 .B int \fIflag
3530 is either \fIFLAG_CHECK\fP, for checklists (multiple selections),
3531 or \fIFLAG_RADIO\fP for radiolists (a single selection).
3532 .TP 5
3533 .B int * \fIcurrent_item
3534 The widget sets the referenced location to the index of the current display
3535 item (cursor) when it returns.
3536 .\" ---------------------------------------------------------------------------
3537 .SS dlg_trim_string
3538 The \fBdialog\fP program uses this in each widget to adjust the
3539 message string,
3540 which may contain the newline character (referred to as '\en')
3541 and/or the special substring "\en"
3542 (which can be translated into a newline character).
3543 .LP
3544 There are several optional features:
3545 .bP
3546 Unless \fBdialog_vars.nocollapse\fP is set,
3547 each tab is converted to a space before other processing.
3548 .bP
3549 If \fBdialog_vars.no_nl_expand\fP is not set,
3550 and the string has "\en" substrings:
3551 .RS
3552 .bP
3553 The function changes embedded "\en" substrings to '\en' characters.
3554 .IP
3555 The function preserves extra spaces after these substitutions.
3556 For instance, spaces following a newline (substring or character)
3557 are preserved to use as an indentation.
3558 .bP
3559 If \fBdialog_vars.cr_wrap\fP is set,
3560 the function preserves '\en' newline characters.
3561 Otherwise, each '\en' newline character is converted to a space.
3562 .RE
3563 .bP
3564 Otherwise, if \fBdialog_vars.trim_whitespace\fP is set:
3565 .RS
3566 .bP
3567 This function strips all extra spaces to simplify justification.
3568 .bP
3569 If \fBdialog_vars.cr_wrap\fP is set,
3570 the function preserves '\en' newline characters.
3571 Otherwise, each '\en' newline character is converted to a space.
3572 .RE
3573 .bP
3574 Finally
3575 (if \fBdialog_vars.no_nl_expand\fP is set,
3576 or the string does not contain "\en" substrings,
3577 and \fBdialog_vars.trim_whitespace\fP is not set):
3578 .RS
3579 .bP
3580 Unless \fBdialog_vars.nocollapse\fP is set,
3581 sequences of spaces are reduced to a single space.
3582 .RE
3583 .TP 5
3584 .B char * \fIsrc
3585 is the string to trim
3586 .\" ---------------------------------------------------------------------------
3587 .SS dlg_unregister_window
3588 Remove the bindings for a given window.
3589 .TP 5
3590 .B WINDOW * \fIwin
3591 is the window from which to remove bindings
3592 .\" ---------------------------------------------------------------------------
3593 .SS dlg_update_gauge
3594 Update a gauge widget to show a different percentage value.
3595 .TP 5
3596 .B void *\fIobjptr
3597 points to the gauge object to update.
3598 .TP 5
3599 .B int \fIpercent
3600 is the new percentage value to display.
3601 .\" ---------------------------------------------------------------------------
3602 .SS dlg_will_resize
3603 This filters out bursts of \fBKEY_RESIZE\fP values.
3604 Call this after \fBdlg_getc\fP returns \fBKEY_RESIZE\fP,
3605 to improve performance.
3606 .\" ---------------------------------------------------------------------------
3607 .SS dlg_yes_buttoncode
3608 Map the given button index for \fBdlg_yes_labels\fP into \fB\*p\fP's exit-code.
3609 .TP 5
3610 .B int \fIbutton
3611 is the button index
3612 .\" ---------------------------------------------------------------------------
3613 .SS dlg_yes_labels
3614 Return a list of buttons for Yes/No labels.
3615 .\" ---------------------------------------------------------------------------
3616 .SS end_dialog
3617 End use of \fB\*p\fP functions.
3618 .\" ---------------------------------------------------------------------------
3619 .SS init_dialog
3620 Do some initialization for \fB\*p\fP.
3621 .TP 5
3622 .B FILE *\fIinput
3623 is the real tty input of \fB\*p\fP.
3624 Usually it is the standard input, but if
3625 \fB--input-fd\fP option is used, it may be anything.
3626 .TP 5
3627 .B FILE *\fIoutput
3628 is where \fB\*p\fP will send its result.
3629 Usually it is the standard error, but
3630 if \fB--stdout\fP or \fB--output-fd\fP is used, it may be anything.
3631 .
3632 .\" ************************************************************************
3633 .SH SEE ALSO
3634 \fB\*p\fP (1).
3635 .
3636 .\" ************************************************************************
3637 .SH AUTHOR
3638 Thomas E.\& Dickey