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