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