Copyright 2005-2010,2011 Thomas E. Dickey
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License, version 2.1
as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this program; if not, write to
Free Software Foundation, Inc.
51 Franklin St., Fifth Floor
Boston, MA 02110, USA.
definitions for renaming
. ..
..
or
cc `\*p-config --cflags` file ... `\*p-config --libs` ] #include <\*l.h>
\*L is a program that will let you to present a variety of questions or display messages using dialog boxes from a shell script. It is built from the \*l library, which consists of several widgets as well as utility functions that are used by the widgets or the main program. .
Useful character constants which correspond to user input are named with the "CHR_" prefix, e.g., CHR_BACKSPACE.
Colors and video attributes are categorized and associated with settings in the configuration file (see the discussion of $DIALOGRC in \*p(1)). The DIALOG_ATR(n) macro is used for defining the references to the combined color and attribute table dlg_color_table[].
The \*p application passes its command-line parameters to the widget functions. Some of those parameters are single values, but some of the widgets accept data as an array of values. Those include checklist/radiobox, menubox and formbox. When the --item-help option is given, an extra column of data is expected. The USE_ITEM_HELP(), CHECKBOX_TAGS, MENUBOX_TAGS and FORMBOX_TAGS macros are used to hide this difference from the calling application.
Most of the other definitions found in <\*l.h>
are used for convenience in building the library or main program.
These include definitions based on the generated <dlg_config.h> header.
************************************************************************
The \*p application resets the dialog_vars data before
accepting options to invoke each widget.
Most of the DIALOG_VARS members are set directly from \*p's
command-line options:
---------------------------------------------------------------------------
.bP If DIALOG_VARS.input_length is zero, this is a pointer to user buffer (on the stack, or static). The buffer size is assumed to be MAX_LEN, which is defined in <\*l.h>. .bP When DIALOG_VARS.input_length is nonzero, this is a dynamically-allocated buffer used by the widgets to return printable results to the calling application.
************************************************************************
5 title the caption for the box, shown on its top border.
5 height the height of the dialog box.
5 width the width of the dialog box.
Other parameters depend on the box type.
.
************************************************************************
5 const char * title is the title on the top of the widget.
5 const char * subtitle is the prompt text shown within the widget.
5 int height is the height excluding the fixed-height calendar grid.
5 int width is the overall width of the box, which is adjusted up to the calendar grid's minimum width if needed.
5 int day is the initial day of the week shown, counting zero as Sunday. If the value is negative, the current day of the week is used.
5 int month is the initial month of the year shown, counting one as January. If the value is negative, the current month of the year is used.
5 int year is the initial year shown. If the value is negative, the current year is used.
5 const char * title is the title on the top of the widget.
5 const char * cprompt is the prompt text shown within the widget.
5 int height is the desired height of the box. If zero, the height is adjusted to use the available screen size.
5 int width is the desired width of the box. If zero, the height is adjusted to use the available screen size.
5 int list_height is the minimum height to reserve for displaying the list. If zero, it is computed based on the given height and width.
5 int item_no is the number of rows in items.
5 int items is an array of strings which is viewed either as a list of rows
tag item status
tag item status help
5 const char * title is the title on the top of the widget.
5 const char * path is the preselected value to show in the input-box, which is used also to set the directory- and file-windows.
5 int height is the height excluding the minimum needed to show the dialog box framework. If zero, the height is based on the screen size.
5 int width is the desired width of the box. If zero, the height is based on the screen size.
5 const char * title is the title on the top of the widget.
5 const char * file is the name of the file from which to read.
5 int height is the desired height of the box. If zero, the height is adjusted to use the available screen size.
5 int width is the desired width of the box. If zero, the height is adjusted to use the available screen size.
5 const char * title is the title on the top of the widget.
5 const char * cprompt is the prompt text shown within the widget.
5 int height is the desired height of the box. If zero, the height is adjusted to use the available screen size.
5 int width is the desired width of the box. If zero, the height is adjusted to use the available screen size.
5 int form_height is the minimum height to reserve for displaying the list. If zero, it is computed based on the given height and width.
5 int item_no is the number of rows in items.
5 int items is an array of strings which is viewed either as a list of rows
Name NameY NameX Text TextY TextX FLen ILen
Name NameY NameX Text TextY TextX FLen ILen Help
5 const char * title is the title on the top of the widget.
5 const char * path is the preselected value to show in the input-box, which is used also to set the directory- and file-windows.
5 int height is the height excluding the minimum needed to show the dialog box framework. If zero, the height is based on the screen size.
5 int width is the desired width of the box. If zero, the height is based on the screen size.
5 const char * title is the title on the top of the widget.
5 const char * cprompt is the prompt text shown within the widget.
5 int height is the desired height of the box. If zero, the height is based on the screen size.
5 int width is the desired width of the box. If zero, the height is based on the screen size.
5 int percent is the percentage to show in the progress bar.
5 const char * title is the title on the top of the widget.
5 const char * cprompt is the prompt text shown within the widget.
5 int height is the desired height of the box. If zero, the height is based on the screen size.
5 int width is the desired width of the box. If zero, the height is based on the screen size.
5 const char * init is the initial value of the input box, whose length is taken into account when auto-sizing the width of the dialog box.
5 int password if true, causes typed input to be echoed as asterisks.
5 const char * title is the title on the top of the widget.
5 const char * file is the name of a file containing the text to display. This function is internally bound to F1 (function key "1"), passing dialog_vars.help_file as a parameter. The dialog program sets that variable when the --hfile option is given.
5 int height is the desired height of the box. If zero, the height is based on the screen size.
5 int width is the desired width of the box. If zero, the height is based on the screen size.
5 const char * title is the title on the top of the widget.
5 const char * cprompt is the prompt text shown within the widget.
5 int height is the desired height of the box. If zero, the height is based on the screen size.
5 int width is the desired width of the box. If zero, the height is based on the screen size.
5 int menu_height is the minimum height to reserve for displaying the list. If zero, it is computed based on the given height and width.
5 int item_no is the number of rows in items.
5 int items is an array of strings which is viewed either as a list of rows
tag item
tag item help
5 const char * title is the title on the top of the widget.
5 const char * cprompt is the prompt text shown within the widget.
5 int height is the desired height of the box. If zero, the height is adjusted to use the available screen size.
5 int width is the desired width of the box. If zero, the height is adjusted to use the available screen size.
5 int form_height is the minimum height to reserve for displaying the list. If zero, it is computed based on the given height and width.
5 int item_no is the number of rows in items.
5 int items is an array of strings which is viewed either as a list of rows
Name NameY NameX Text TextY TextX FLen ILen Ityp
Name NameY NameX Text TextY TextX FLen ILen Ityp Help
5 const char * title is the title on the top of the widget.
5 const char * cprompt is the caption text shown within the widget.
5 int height is the desired height of the box. If zero, the height is based on the screen size.
5 int width is the desired width of the box. If zero, the height is based on the screen size.
5 int item_no is the number of rows in items.
5 int items is an array of strings which is viewed as a list of tag and item values. The tag values are listed, one per row, in the list at the top of the widget.
The item values are decoded: digits 0-9 are the following strings
5 const char * title is the title on the top of the widget.
5 const char * cprompt is the prompt text shown within the widget.
5 int height is the desired height of the box. If zero, the height is based on the screen size.
5 int width is the desired width of the box. If zero, the height is based on the screen size.
5 int pauseopt if true, an "OK" button will be shown, and the dialog will wait for it to complete. With an "OK" button, it is denoted a "msgbox", without an "OK" button, it is denoted an "infobox".
5 const char * title is the title on the top of the widget.
5 int height is the desired height of the box. If zero, the height is based on the screen size.
5 int width is the desired width of the box. If zero, the height is based on the screen size.
5 int seconds is the timeout to use for the progress bar.
5 const char * title is the title on the top of the widget.
5 const char * cprompt is the prompt text shown within the widget. If empty or null, no prompt is shown.
5 const char * command is the name of the command to execute.
5 int height is the desired height of the box. If zero, the height is based on the screen size.
5 int width is the desired width of the box. If zero, the height is based on the screen size.
5 int pauseopt if true, an "OK" button will be shown, and the dialog will wait for it to complete.
5 const char * title is the title on the top of the widget.
5 const char * cprompt is the prompt text shown within the widget. If empty or null, no prompt is shown.
5 int height is the desired height of the box. If zero, the height is based on the screen size.
5 int width is the desired width of the box. If zero, the height is based on the screen size.
5 const char * title is the title on the top of the widget.
5 const char * file is the name of the file to display in the dialog.
5 int height is the desired height of the box. If zero, the height is based on the screen size.
5 int width is the desired width of the box. If zero, the height is based on the screen size.
5 int bg_task if true, the window is added to the callback list in dialog_state, and the application will poll for the window to be updated. Otherwise an "OK" button is added to the window, and it will be closed when the button is activated.
5 const char * title is the title on the top of the widget.
5 const char * file is the name of the file to display in the dialog.
5 int height is the desired height of the box. If zero, the height is based on the screen size.
5 int width is the desired width of the box. If zero, the height is based on the screen size.
5 const char * title is the title on the top of the widget.
5 const char * subtitle is the prompt text shown within the widget.
5 int height is the desired height of the box. If zero, the height is based on the screen size.
5 int width is the desired width of the box. If zero, the height is based on the screen size.
5 int hour is the initial hour shown. If the value is negative, the current hour is used. Returns DLG_EXIT_ERROR if the value specified is greater than or equal to 24.
5 int minute is the initial minute shown. If the value is negative, the current minute is used. Returns DLG_EXIT_ERROR if the value specified is greater than or equal to 60.
5 int second is the initial second shown. If the value is negative, the current second is used. Returns DLG_EXIT_ERROR if the value specified is greater than or equal to 60.
5 const char * title is the title on the top of the widget.
5 const char * cprompt is the prompt text shown within the widget.
5 int height is the desired height of the box. If zero, the height is based on the screen size.
5 int width is the desired width of the box. If zero, the height is based on the screen size.
The only non-widget function whose name begins with "dialog_" is dialog_version, which returns the version number of the library as a string. .
Here is a brief summary of the utility functions and their parameters:
---------------------------------------------------------------------------
5 dlg_add_callback Add a callback, used to allow polling input from multiple tailbox widgets.
5 DIALOG_CALLBACK *p contains the callback information.
5 dlg_add_callback_ref Like dlg_add_callback, but passes a reference to the DIALOG_CALLBACK as well as a pointer to a cleanup function which will be called when the associated input ends.
5 DIALOG_CALLBACK **p points to the callback information. This is a reference to the pointer so that the caller's pointer can be zeroed when input ends.
5 DIALOG_FREEBACK func function to call when input ends, e.g., to free caller's additional data.
5 dlg_add_quoted Add a quoted string to the result buffer (see dlg_add_result).
5 char * string is the string to add.
5 dlg_add_result Add a quoted string to the result buffer dialog_vars.input_result.
5 char * string is the string to add.
5
dlg_add_separator Add an output-separator to the result buffer dialog_vars.input_result.
If dialog_vars.output_separator is set, use that.
Otherwise, if dialog_vars.separate_output is set, use newline.
If neither is set, use a space.
---------------------------------------------------------------------------
5 dlg_add_string Add a quoted or unquoted string to the result buffer (see dlg_add_quoted) and dlg_add_result), according to whether dialog_vars.quoted is true.
5 char * string is the string to add.
5 dlg_align_columns Copy and reformat an array of pointers to strings, aligning according to the column separator dialog_vars.column_separator. If no column separator is set, the array will be unmodified; otherwise it is copied and reformatted.
Caveat: This function is only implemented for 8-bit characters.
5 char **target This is the array to reformat. It points to the first string to modify.
5 int per_row This is the size of the struct for each row of the array.
5 int num_rows This is the number of rows in the array.
5 dlg_allocate_gauge Allocates a gauge widget. Use dlg_update_gauge to display the result.
5 const char * title is the title string to display at the top of the widget.
5 const char * cprompt is the prompt text shown within the widget.
5 int height is the desired height of the box. If zero, the height is adjusted to use the available screen size.
5 int width is the desired width of the box. If zero, the height is adjusted to use the available screen size.
5 int percent is the percentage to show in the progress bar.
5 dlg_asciibox returns its parameter transformed to the corresponding "+" or "-", etc. for the line-drawing characters used in \*p. If the parameter is not a line-drawing or other special character such as ACS_DARROW, it returns 0.
---------------------------------------------------------------------------5 dlg_attr_clear Set window to the given attribute.
5 WINDOW * win is the window to update.
5 int height is the number of rows to update.
5 int width is the number of columns to update.
5 chtype attr is the attribute, e.g., A_BOLD.
5 dlg_auto_size Automatically size the window used for a widget. If the given height or width are zero, justify the prompt text and return the actual limits.
5 const char * title is the title string to display at the top of the widget.
5 const char * prompt is the message text which will be displayed in the widget, used here to determine how large the widget should be.
5 int * height is the nominal height.
5 int * width is the nominal width.
5 int boxlines is the number of lines to reserve in the vertical direction.
5 int mincols is the minimum number of columns to use.
5 dlg_auto_sizefile Like dlg_auto_size, but use a file contents to decide how large the widget should be.
5 const char * title is the title string to display at the top of the widget.
5 const char * file is the name of the file.
5 int * height is the nominal height. If it is -1, use the screen's height after subtracting dialog_vars.begin_y if dialog_vars.begin_set is true.
5 int *width is the nominal width. If it is -1, use the screen's width after subtracting dialog_vars.begin_x if dialog_vars.begin_set is true.
5 int boxlines is the number of lines to reserve on the screen for drawing boxes.
5 int mincols is the number of columns to reserve on the screen for drawing boxes.
5
dlg_beeping If dialog_vars.beep_signal is nonzero,
this calls beep once and sets
dialog_vars.beep_signal to zero.
---------------------------------------------------------------------------
5 dlg_boxchar returns its parameter transformed as follows:
3 - if neither dialog_vars.ascii_lines nor dialog_vars.no_lines is set.
3 - if dialog_vars.ascii_lines is set, returns the corresponding "+" or "-", etc. for the line-drawing characters used in \*p.
3 - otherwise, if dialog_vars.no_lines is set, returns a space for the line-drawing characters.
3 - if the parameter is not a line-drawing or other special character such as ACS_DARROW, it returns the parameter unchanged.
5 dlg_box_x_ordinate returns a suitable x-ordinate (column) for a new widget. If dialog_vars.begin_set is 1, use dialog_vars.begin_x; otherwise center the widget on the screen (using the width parameter).
5 int width is the width of the widget.
5 dlg_box_y_ordinate returns a suitable y-ordinate (row) for a new widget. If dialog_vars.begin_set is 1, use dialog_vars.begin_y; otherwise center the widget on the screen (using the height parameter).
5 int height is the height of the widget.
5 dlg_button_count Count the buttons in the list.
5 const char ** labels is a list of (pointers to) button labels terminated by a null pointer.
5 dlg_button_layout Make sure there is enough space for the buttons by computing the width required for their labels, adding margins and limiting based on the screen size.
5 const char ** labels is a list of (pointers to) button labels terminated by a null pointer.
5 int * limit the function sets the referenced limit to the width required for the buttons (limited by the screen size) if that is wider than the passed-in limit.
5 dlg_button_sizes Compute the size of the button array in columns.
5 const char ** labels is a list of (pointers to) button labels terminated by a null pointer.
5 int vertical is true if the buttons are arranged in a column rather than a row.
5 int * longest Return the total number of columns in the referenced location.
5 int * length Return the longest button's columns in the referenced location.
5 dlg_button_x_step Compute the step-size needed between elements of the button array.
5 const char ** labels is a list of (pointers to) button labels terminated by a null pointer.
5 int limit is the maximum number of columns to allow for the buttons.
5 int * gap store the nominal gap between buttons in the referenced location. This is constrained to be at least one.
5 int * margin store the left+right total margins (for the list of buttons) in the referenced location.
5 int * step store the step-size in the referenced location.
5 dlg_button_to_char Find the first uppercase character in the label, which we may use for an abbreviation. If the label is empty, return -1. If no uppercase character is found, return 0. Otherwise return the uppercase character.
5 const char * label is the label to test.
5 dlg_calc_list_width Calculate the minimum width for the list, assuming none of the items are truncated.
5 int item_no is the number of items.
5 DIALOG_LISTITEM * items contains a name and text field, e.g., for checklists or radiobox lists. The function returns the sum of the widest columns needed for of each of these fields.
5 dlg_calc_listh Calculate new height and list_height values.
5 int * height on input, is the height without adding the list-height. On return, this contains the total list-height and is the actual widget's height.
5 int * list_height on input, is the requested list-height. On return, this contains the number of rows available for displaying the list after taking into account the screen size and the dialog_vars.begin_set and dialog_vars.begin_y variables.
5 int item_no is the number of items in the list.
5 dlg_calc_listw This function is obsolete, provided for library-compatibility. It is replaced by dlg_calc_list_width.
5 int item_no is the number of items.
5 char ** items is a list of character pointers.
5 int group is the number of items in each group, e.g., the second array index.
5 dlg_char_to_button Given a list of button labels, and a character which may be the abbreviation for one, find it, if it exists. An abbreviation will be the first character which happens to be capitalized in the label. If the character is found, return its index within the list of labels. Otherwise, return DLG_EXIT_UNKNOWN.
5 int ch is the character to find.
5 const char ** labels is a list of (pointers to) button labels terminated by a null pointer.
5 dlg_checklist This entrypoint provides the --checklist or --radiolist functionality without the limitations of \*p's command-line syntax (compare to dialog_checklist).
5 const char * title is the title string to display at the top of the widget.
5 const char * cprompt is the prompt text shown within the widget.
5 int height is the desired height of the box. If zero, the height is adjusted to use the available screen size.
5 int width is the desired width of the box. If zero, the height is adjusted to use the available screen size.
5 int list_height is the minimum height to reserve for displaying the list. If zero, it is computed based on the given height and width.
5 int item_no is the number of items.
5 DIALOG_LISTITEM * items This is a list of the items to display in the checklist.
5 const char * states This is a list of characters to display for the given states. Normally a checklist provides true (1) and false (0) values, which the widget displays as "*" and space, respectively. An application may set this parameter to an arbitrary null-terminated string. The widget determines the number of states from the length of this string, and will cycle through the corresponding display characters as the user presses the space-bar.
5 int flag This is should be one of FLAG_CHECK or FLAG_RADIO, depending on whether the widget should act as a checklist or radiobox.
5 int * current_item The widget sets the referenced location to the index of the current display item (cursor) when it returns.
5 dlg_check_scrolled given a function key (or other key that was mapped to a function key), check if it is one of the up/down scrolling functions:
DLGK_PAGE_FIRST,
DLGK_PAGE_LAST,
DLGK_GRID_UP,
DLGK_GRID_DOWN,
DLGK_PAGE_PREV or
DLGK_PAGE_NEXT.
5 int key is the function-key to check
5 int last is the number of lines which would be used to display the scrolled prompt in an arbitrarily tall window. It is used here to check limits for the offset value.
5 int page this is the available height for writing scrolled text, which is smaller than the window if it contains buttons.
5 bool * show on return, holds TRUE if dlg_print_scrolled should be used to redisplay the prompt text.
5 int * offset on entry, holds the starting line number (counting from zero) last used for dlg_print_scrolled. On return, holds the updated starting line number.
5
dlg_clear Set window to the default \*p screen attribute.
This is set in the rc-file with screen_color.
---------------------------------------------------------------------------
5
dlg_clr_result Free storage used for the result buffer (dialog_vars.input_result).
The corresponding pointer is set to NULL.
---------------------------------------------------------------------------
5
dlg_color_count Return the number of colors that can be configured in \*p.
---------------------------------------------------------------------------
5
dlg_color_setup Initialize the color pairs used in \*p.
---------------------------------------------------------------------------
5 dlg_count_argv Count the entries in an argument vector.
5 argv Points to the argument vector.
5 dlg_count_columns Returns the number of columns used for a string. This is not necessarily the number of bytes in a string.
5 const char * string is the string to measure.
5 dlg_count_wchars Returns the number of wide-characters in the string.
5 const char * string is the string to measure.
5 dlg_create_rc Create a configuration file, i.e., write internal tables to a file which can be read back by \*p as an rc-file.
5 const char * filename is the name of the file to write to.
5 dlg_ctl_size If dialog_vars.size_err is true, check if the given window size is too large to fit on the screen. If so, exit with an error reporting the size of the window.
5 int height is the window's height
5 int width is the window's width
5 dlg_default_formitem If dialog_vars.default_item is not null, find that name by matching the name field in the list of form items. If found, return the index of that item in the list. Otherwise, return zero.
5 DIALOG_FORMITEM * items is the list of items to search. It is terminated by an entry with a null name field.
5 dlg_default_item This function is obsolete, provided for library-compatibility. It is replaced by dlg_default_formitem and dlg_default_listitem.
5 char ** items is the list of items to search.
5 int llen is the number of items in each group, e.g., the second array index.
5
dlg_defaultno_button If dialog_vars.defaultno is true, and dialog_vars.nocancel is not,
find the button-index for the "Cancel" button.
Otherwise, return the index for "OK" (always zero).
---------------------------------------------------------------------------
5 dlg_del_window Remove a window, repainting everything else.
5 WINDOW * win is the window to remove.
5
dlg_does_output This is called each time a widget is invoked which may do output.
It increments dialog_state.output_count,
so the output function in \*p can test this and add a separator.
---------------------------------------------------------------------------
5 dlg_draw_arrows Draw up/down arrows on a window, e.g., for scrollable lists. It calls dlg_draw_arrows2 using the menubox_color and menubox_border_color attributes.
5 WINDOW * dialog is the window on which to draw an arrow.
5 int top_arrow is true if an up-arrow should be drawn at the top of the window.
5 int bottom_arrow is true if an down-arrow should be drawn at the bottom of the window.
5 int x is the zero-based column within the window on which to draw arrows.
5 int top is the zero-based row within the window on which to draw up-arrows as well as a horizontal line to show the window's top.
5 int bottom is the zero-based row within the window on which to draw down-arrows as well as a horizontal line to show the window's bottom.
5 dlg_draw_arrows2 Draw up/down arrows on a window, e.g., for scrollable lists.
5 WINDOW * dialog is the window on which to draw an arrow.
5 int top_arrow is true if an up-arrow should be drawn at the top of the window.
5 int bottom_arrow is true if an down-arrow should be drawn at the bottom of the window.
5 int x is the zero-based column within the window on which to draw arrows.
5 int top is the zero-based row within the window on which to draw up-arrows as well as a horizontal line to show the window's top.
5 int bottom is the zero-based row within the window on which to draw down-arrows as well as a horizontal line to show the window's bottom.
5 chtype attr is the window's background attribute.
5 chtype borderattr is the window's border attribute.
5 dlg_draw_bottom_box Draw a partial box at the bottom of a window, e.g., to surround a row of buttons. It is designed to merge with an existing box around the whole window, so it uses tee-elements rather than corner-elements on the top corners of this box.
5 WINDOW * win is the window to update.
5 dlg_draw_box Draw a rectangular box with line drawing characters.
5 WINDOW * win is the window to update.
5 int y is the top row of the box.
5 int x is the left column of the box.
5 int height is the height of the box.
5 int width is the width of the box.
5 chtype boxchar is used to color the right/lower edges. It also is fill-color used for the box contents.
5 dlg_draw_buttons Print a list of buttons at the given position.
5 WINDOW * win is the window to update.
5 int y is the starting row.
5 int x is the starting column.
5 const char ** labels is a list of (pointers to) button labels terminated by a null pointer.
5 int selected is the index within the list of the selected button.
5 int vertical is true if the buttons are arranged in a column rather than a row.
5 int limit is the number of columns (or rows if vertical) allowed for the display.
5 dlg_draw_helpline draw the text in dialog_vars.help_line at the bottom of the given window.
5 WINDOW * dialog is the window to modify.
5 bool decorations if true, allow room for the scrolling arrows.
5 dlg_draw_scrollbar If dialog_state.use_scrollbar is set, draw a scrollbar on the right margin of windows holding scrollable data. Also (whether or not the scrollbar is drawn), annotate the bottom margin of the window with the percentage of data by the bottom of that window, and call dlg_draw_arrows2 to put markers on the window showing when more data is available.
5 WINDOW * win is the window in which the data is scrolled. Because left, right, top, bottom are passed as parameters, this window can contain additional data.
5 long first_data is the zero-based index to the first row of data in the current window.
5 long this_data is the zero-based index to the current row of data.
5 long next_data is the zero-based index to the next data after the current row.
5 long total_data is the total number of rows of data.
5 int left is the zero-based left margin/column of the window. The up/down arrows are draw inset by 5 columns from this point.
5 int right is the zero-based right margin/column of the window. The scrollbar is drawn flush against this column.
5 int top is the zero-based row within the window on which to draw up-arrows as well as a horizontal line to show the window's top.
5 int bottom is the zero-based row within the window on which to draw down-arrows as well as a horizontal line to show the window's bottom.
5 chtype attr is the window's background attribute.
5 chtype borderattr is the window's border attribute.
5 dlg_draw_shadow Draw shadows along the right and bottom edge of a window to give it a 3-dimensional look. (The height, etc., may not be the same as the window's actual values).
5 WINDOW * win is the window to update.
5 int height is the height of the window.
5 int width is the width of the window.
5 int y is the top row of the window.
5 int x is the left column of the window.
5 dlg_draw_title Draw a title centered at the top of the window.
5 WINDOW * win is the window to update.
5 const char * title is the title string to display at the top of the widget.
5 dlg_dump_keys Write all user-defined key-bindings to the given stream, e.g., as part of dlg_create_rc.
5 FILE * fp is the stream on which to write the bindings.
5 dlg_eat_argv Remove one or more items from an argument vector.
5 int *argcp in/out parameter giving the length of the argument vector. char ***argvp in/out parameter pointing to the argument vector. int start starting index. int count number of arguments to remove.
5 dlg_edit_offset Given the character-offset in the string, returns the display-offset where \*p should position the cursor. In this context, "characters" may be multicolumn, since the string can be a multibyte character string.
5 char * string is the string to analyze
5 int offset is the character-offset
5 int x_last is a limit on the column positions that can be used, e.g., the window's size.
5 dlg_edit_string Updates the string and character-offset, given various editing characters or literal characters which are inserted at the character-offset. Returns true if an editing change was made (and the display should be updated), and false if the key was something like KEY_ENTER, which is a non-editing action outside this function.
5 char * string is the (multibyte) string to update
5 int * offset is the character-offset
5 int key is the editing key
5 int fkey is true if the editing key is a function-key
5 bool force is used in a special loop case by calling code to force the return value of this function when a function-key code 0 is passed in.
5 dlg_exit Given an internal exit code, check if the corresponding environment variable is set. If so, remap the exit code to match the environment variable. Finally call exit with the resulting exit code.
5 int code is the internal exit code, e.g., DLG_EXIT_OK, which may be remapped.
5 dlg_exit_buttoncode Map the given button index for dlg_exit_label into \*p's exit-code.
5 int button is the button index
5
dlg_exit_label Return a list of button labels.
If dialog_var.extra_button is true, return the result of dlg_ok_labels.
Otherwise, return a list with the "Exit" label and (if dialog_vars.help_button
is set) the "Help" button as well.
---------------------------------------------------------------------------
5 dlg_exiterr Quit program killing all tailboxbg widgets.
5 const char * fmt is the format of the printf-like message to write.
5 ...
are the variables to apply to the fmt format.
5 dlg_find_index Given the character-offset to find in the list, return the corresponding array index.
5 const int *list contains a list of character-offsets, i.e., indices into a string that denote the beginning of multibyte characters.
5 int limit is the last index into list to search.
5 int to_find is the character-offset to find.
5
dlg_flush_getc Cancel the local data saved by dlg_last_getc.
---------------------------------------------------------------------------
5 const char * title is the title string to display at the top of the widget.
5 char *** list is a pointer to an array of char * pointers. The array is allocated by the caller, and so are the strings to which it points. The dlg_editbox function may reallocate the array and the strings.
5 int * rows points to the nominal length of list. The referenced value is updated iflist is reallocated.
5 int height is the desired height of the box. If zero, the height is adjusted to use the available screen size.
5 int width is the desired width of the box. If zero, the height is adjusted to use the available screen size.
5 dlg_form This entrypoint provides the --form functionality without the limitations of \*p's command-line syntax (compare to dialog_form).
5 const char * title is the title string to display at the top of the widget.
5 const char * cprompt is the prompt text shown within the widget.
5 int height is the desired height of the box. If zero, the height is adjusted to use the available screen size.
5 int width is the desired width of the box. If zero, the height is adjusted to use the available screen size.
5 int form_height is the minimum height to reserve for displaying the list. If zero, it is computed based on the given height and width.
5 int item_no is the number of items.
5 DIALOG_FORMITEM * items This is a list of the items to display in the form.
5 int * current_item The widget sets the referenced location to the index of the current display item (cursor) when it returns.
5 dlg_free_columns Free data allocated by dlg_align_columns.
5 char **target This is the array which was reformatted. It points to the first string to free.
5 int per_row This is the size of the struct for each row of the array.
5 int num_rows This is the number of rows in the array.
5 dlg_free_formitems Free memory owned by a list of DIALOG_FORMITEM's.
5 DIALOG_FORMITEM * items is the list to free.
5 dlg_free_gauge Remove the gauge widget from the screen and free its associated memory.
5 void *objptr points to the gauge widget.
5 dlg_getc Read a character from the given window. Handle repainting here (to simplify things in the calling application). Also, if input-callback(s) are set up, poll the corresponding files and handle the updates, e.g., for displaying a tailbox. Returns the key-code.
5 WINDOW * win is the window within which to read.
5 int * fkey as a side-effect, set this to true if the key-code is really a function-key.
5 dlg_get_attrs extract the video attributes from the given window.
5 WINDOW * win is the window from which to get attributes.
5 dlg_getc_callbacks passes the given key-code ch to the current window that has established a callback. If the callback returns zero, remove it and try the next window. If no more callbacks remain, return. If any callbacks were found, return true, otherwise false.
5 int ch is the key-code
5 int fkey is true if the key is a function-key
5 int * result is used to pass an exit-code to the caller, which should pass that via dlg_exit.
5 dlg_index_columns Build a list of the display-columns for the given multibyte string's characters.
5 const char * string is the string to analyze
5 dlg_index_wchars Build an index of the wide-characters in the string, so the caller can easily tell which byte-offset begins a given wide-character.
5 const char * string is the string to analyze
5 dlg_item_help Draw the string for the dialog_vars.item_help feature.
5 const char * txt is the help-message
5 dlg_killall_bg If \*p has callbacks active, purge the list of all that are not marked to keep in the background. If any remain, run those in a background process.
5 int * retval stores the exit-code to pass back to the caller.
5
dlg_last_getc returns the most recent character that was read via dlg_getc.
---------------------------------------------------------------------------
5 dlg_limit_columns Given a column limit, count the number of wide characters that can fit into that limit. The offset is used to skip over a leading character that was already written.
5 const char * string is the string to analyze
5 int limit is the column limit
5 int offset is the starting offset from which analysis should continue
5 dlg_lookup_key Check for a key-binding. If there is no binding associated with the widget, it simply returns the given curses-key. Otherwise, it returns the result of the binding
5 WINDOW * win is the window on which the binding is checked
5 int curses_key is the curses key-code
5 int * dialog_key is the corresponding \*p internal code (see DLG_KEYS_ENUM in dlg_key.h).
5 dlg_max_input Limit the parameter according to dialog_vars.max_input
5 int max_len is the value to limit
5 dlg_match_char Match a given character against the beginning of the string, ignoring case of the given character. The matching string must begin with an uppercase character.
5 int ch is the character to check
5 const char * string is the string to search
5 dlg_menu This entrypoint provides the --menu functionality without the limitations of \*p's command-line syntax (compare to dialog_menu).
5 const char * title is the title string to display at the top of the widget.
5 const char * cprompt is the prompt text shown within the widget.
5 int height is the desired height of the box. If zero, the height is adjusted to use the available screen size.
5 int width is the desired width of the box. If zero, the height is adjusted to use the available screen size.
5 int menu_height is the minimum height to reserve for displaying the list. If zero, it is computed based on the given height and width.
5 int item_no is the number of items.
5 DIALOG_LISTITEM * items This is a list of the items to display in the form.
5 int * current_item The widget sets the referenced location to the index of the current display item (cursor) when it returns.
5 DIALOG_INPUTMENU rename_menutext
5 dlg_move_window Moves/resizes the given window to the given position and size.
5 WINDOW *win is the window to move/resize.
5 WINDOW *height is the height of the resized window.
5 WINDOW *width is the width of the resized window.
5 WINDOW *y y-ordinate to use for the repositioned window.
5 WINDOW *x x-ordinate to use for the repositioned window.
5 dlg_mouse_bigregion Retrieve the big-region under the pointer.
5 int y is the row on which the mouse click occurred
5 int x is the column on which the mouse click occurred
5
dlg_mouse_free_regions Free the memory associated with mouse regions.
---------------------------------------------------------------------------
5 dlg_mouse_mkbigregion Creates a region on which the mouse-clicks will return a specifed code.
5 int y is the top-row of the region.
5 int x is the left-column of the region.
5 int height is the height of the region.
5 int width is the width of the region.
5 int code is a code used to make the region unique within a widget
5 int step_x is used in modes 2 (columns) and 3 (cells) to determine the width of a column/cell.
5 int step_y is currently unused
5 int mode is used to determine how the mouse position is translated into a code (like a function-key):
1 index by lines
2 index by columns
3 index by cells
5 dlg_mouse_mkregion
5 int y is the top-row of the region.
5 int x is the left-column of the region.
5 int height is the height of the region.
5 int width is the width of the region.
5 int code is a code used to make the region unique within a widget
5 dlg_mouse_region Retrieve the frame under the mouse pointer
5 int y is the row of the mouse-click
5 int x is the column of the mouse-click
5 dlg_mouse_setbase Sets a base for subsequent calls to dlg_mouse_mkregion, so they can make regions relative to the start of a given window.
5 int x is the left-column for the base
5 int y is the top-row for the base
5 dlg_mouse_wgetch is a wrapper for dlg_getc which additionally maps mouse-clicks (if the curses library supports those) into extended function-keys which encode the position according to the mode in dlg_mouse_mkbigregion. Returns the corresponding key-code.
5 WINDOW * win is the window on which to perform the input
5 int * fkey the referenced location is set to true if the key-code is an actual or extended (mouse) function-key.
5 dlg_mouse_wgetch_nowait This is a non-blocking variant of dlg_mouse_wgetch.
5 WINDOW * win is the window on which to perform the input
5 int * fkey the referenced location is set to true if the key-code is an actual or extended (mouse) function-key.
5
dlg_need_separator Check if an output-separator is needed.
If dialog_vars.output_separator is set, return true.
Otherwise, if dialog_vars.input_result is nonempty, return true.
If neither, return false.
---------------------------------------------------------------------------
5 dlg_new_modal_window Create a modal window, optionally with a shadow. The shadow is created if dialog_state.use_shadow is true.
5 WINDOW * parent is the parent window (usually the top-level window of a widget)
5 int height is the window's height
5 int width is the window's width
5 int y is the window's top-row
5 int x is the window's left-column
5 dlg_new_window Create a window, optionally with a shadow. The shadow is created if dialog_state.use_shadow is true.
5 int height is the window's height
5 int width is the window's width
5 int y is the window's top-row
5 int x is the window's left-column
5 dlg_next_button Return the next index in the list of labels.
5 const char ** labels is a list of (pointers to) button labels terminated by a null pointer.
5 int button is the current button-index.
5 dlg_next_ok_buttonindex Assuming that the caller is using dlg_ok_labels to list buttons, find the next index in the list of buttons.
5 int current is the current index in the list of buttons
5 int extra if negative, provides a way to enumerate extra active areas on the widget.
5 dlg_ok_buttoncode Map the given button index for dlg_ok_labels into \*p's exit-code.
5 int button is the button-index (which is not necessarily the same as the index in the list of labels).
5
dlg_ok_label Returns a list with the "Ok" label,
and if dialog_vars.help_button is true, the "Help" label as well.
---------------------------------------------------------------------------
5
dlg_ok_labels Return a list of button labels for the OK/Cancel group of widgets.
---------------------------------------------------------------------------
5
dlg_ordinate Decode the string as an integer, decrement if greater than zero to make
a curses-ordinate from a dialog-ordinate.
---------------------------------------------------------------------------
5 dlg_parse_bindkey Parse the parameters of the "bindkeys" configuration-file entry. This expects widget name which may be "*", followed by curses key definition and then \*p key definition.
5 char * params is the parameter string to parse.
5
dlg_parse_rc Parse the configuration file and set up variables.
---------------------------------------------------------------------------
5 dlg_prev_button Return the previous index in the list of labels.
5 const char ** labels is a list of (pointers to) button labels terminated by a null pointer.
5 int button is the current button index
5 dlg_print_scrolled This is a wrapper for dlg_print_autowrap which allows the user to scroll too-long prompt text up/down.
See dlg_check_scrolled for a function which updates the offset variable used as a parameter here. It complements this function; you need both. If pauseopt is set, this function returns an updated last parameter, needed for dlg_check_scrolled calls.
5 WINDOW * win is the window to update.
5 const char * prompt is the string to print
5 int offset is the starting line-number to write wrapped text.
5 int height is the available height for writing the wrapped text
5 int width is the width that the wrapping should occur in
5 int pauseopt is true if the extra functionality for scrolling should be enabled. If false, this calls dlg_print_autowrap without doing any scrolling.
5 dlg_print_line Print one line of the prompt in the window within the limits of the specified right margin. The line will end on a word boundary and a pointer to the start of the next line is returned, or a NULL pointer if the end of *prompt is reached.
5 WINDOW *win is the window to update.
5 chtype *attr holds the starting attributes, and is updated to reflect the final attributes applied to the string.
5 const char *prompt is the string to print
5 int lm is the left margin.
5 int rm is the right margin
5 int *x returns the ending x-ordinate.
5 dlg_prev_ok_buttonindex Find the previous button index in the list from dlg_ok_labels.
5 int current is the current index
5 int extra if negative provides a way to enumerate extra active areas on the widget.
5 dlg_print_autowrap Print a string of text in a window, automatically wrap around to the next line if the string is too long to fit on one line. Note that the string may contain embedded newlines. The text is written starting at the top of the window.
5 WINDOW * win is the window to update.
5 const char * prompt is the string to print
5 int height is the nominal height the wrapped string is limited to
5 int width is the width that the wrapping should occur in
5 dlg_print_size If dialog_vars.print_siz is true, print the given height/width (from a widget) to dialog_state.output, e.g., Size: height, width.
5 int height is the window's height
5 int width is the window's width
5 dlg_print_text Print up to cols columns from text, optionally rendering \*p's escape sequences for attributes and color.
5 WINDOW * win is the window to update.
5 const char * txt is the string to print
5 int col is the column limit
5 chtype * attr holds the starting attributes, and is updated to reflect the final attributes applied to the string.
dlg_progressbox implements the "--prgbox" and "--progressbox" options.
5 const char * title is the title on the top of the widget.
5 const char * cprompt is the prompt text shown within the widget. If empty or null, no prompt is shown.
5 int height is the desired height of the box. If zero, the height is based on the screen size.
5 int width is the desired width of the box. If zero, the height is based on the screen size.
5 int pauseopt if true, an "OK" button will be shown, and the dialog will wait for it to complete. With an "OK" button, it is denoted a "programbox", without an "OK" button, it is denoted a "progressbox".
5 FILE * fp is the file pointer, which may be a pipe or a regular file.
5
dlg_put_backtitle Display the background title if dialog_vars.backtitle is non-null.
The background title is shown at the top of the screen.
---------------------------------------------------------------------------
5 dlg_register_buttons The widget developer should call this function after dlg_register_window, for the list of button labels associated with the widget. One may bind a key to a button, e.g., "OK" for DLGK_OK,
5 WINDOW * win is the window with which to associate the buttons
5 const char * name is the widget's binding name (usually the name of the widget).
5 const char ** buttons is the list of buttons
5 dlg_register_window For a given named widget's window, associate a binding table.
5 WINDOW * win is the window with which to associate the buttons
5 const char * name is the widget's binding name (usually the name of the widget).
5 DLG_KEYS_BINDING * binding is the binding table
5 dlg_remove_callback Remove a callback.
5 DIALOG_CALLBACK * p contains the callback information.
5 dlg_restore_vars Restore \*p's variables from the given variable (see dialog_save_vars).
5 DIALOG_VARS * save is the variable from which to restore.
5 dlg_result_key Test a \*p internal keycode to see if it corresponds to one of the push buttons on the widget such as "OK". This is only useful if there are user-defined key bindings, since there are no built-in bindings that map directly to DLGK_OK, etc. Return true if a mapping was done.
5 int dialog_key is the \*p key to test
5 int fkey is true if this is a function key
5 int * resultp store the result of the mapping in the referenced location.
5 dlg_save_vars Save \*p's variables into the given variable (see dialog_restore_vars).
5 DIALOG_VARS * save is the variable into which to save.
5 dlg_set_focus Set focus on the given window, making it display above other windows on the screen.
5 WINDOW * parent is the parent window (usually the top-level window of a widget)
5 WINDOW * win is the window on which to place focus (usually a subwindow of a widget)
5 dlg_set_result Setup a fixed-buffer for the result in dialog_vars.input_result
5 const char * string is the new contents for the result
5 dlg_show_string Displays the string, shifted as necessary, to fit within the box and show the current character-offset.
5 WINDOW * win is the window within which to display
5 const char * string is the string to display
5 int offset is the starting (character, not bytes) offset
5 chtype attr is the window attribute to use for the string
5 int y_base beginning row on screen
5 int x_base beginning column on screen
5 int x_last number of columns on screen
5 bool hidden if true, do not echo input
5 bool force if true, force repaint
5 dlg_strclone duplicate the string, like strdup.
5 const char * cprompt is the string to duplicate
5 dlg_strcmp compare two strings, ignoring case.
5 const char * a is one string
5 const char * b is the other string
5 dlg_string_to_argv Convert a string to an argument vector returning an index (which must be freed by the caller). The string is modified (replacing gaps between tokens with nulls).
5 char *blob is the string to convert.
5 dlg_sub_window create a subwindow, e.g., for an input area of a widget
5 WINDOW * win is the parent window
5 int height is the subwindow's height
5 int width is the subwindow's width
5 int y is the subwindow's top-row
5 int x is the subwindow's left-column
5 dlg_tab_correct_str If the dialog_vars.tab_correct is true, convert tabs to single spaces. Return the converted result. The caller is responsible for freeing the string.
5 char * prompt is the string to convert
5
dlg_trace If the parameter is non-null, opens a trace file with that
name and stores the file pointer in dialog_state.trace.
---------------------------------------------------------------------------
5 dlg_trace_chr If dialog_state.trace is set, translate the parameters into a printable representation, log it on a "chr" line.
5 int ch is the nominal keycode value.
5 int fkey is nonzero if the value is really a function key. Some of these may be values declared in the DLG_KEYS_ENUM.
5 dlg_trace_msg Write a formatted message to the trace file.
5 const char * fmt is the format of the printf-like message to write.
5 ...
are the variables to apply to the fmt format.
5
dlg_trace_win If dialog_state.trace is set,
log a printable picture of the given window.
---------------------------------------------------------------------------
5 dlg_trim_string The dialog program uses this in each widget to adjust the message string, which may contain the newline character (referred to as '\\n') and/or the special substring "\\n" (which can be translated into a newline character).
There are several optional features:.bP Unless dialog_vars.no_nl_expand is set,
.bP If it has "\\n" substrings, the function preserves extra spaces. For instance, spaces following a newline (substring or character) are preserved to use as an indentation. .bP The function changes embedded "\\n" substrings to '\\n' characters.
5 char * src is the string to trim
5 dlg_unregister_window Remove the bindings for a given window.
5 WINDOW * win is the window from which to remove bindings
5 dlg_update_gauge Update a gauge widget to show a different percentage value.
5 void *objptr points to the gauge object to update.
5 int percent is the new percentage value to display.
5 dlg_yes_buttoncode Map the given button index for dlg_yes_labels into \*p's exit-code.
5 int button is the button index
5
dlg_yes_labels Return a list of buttons for Yes/No labels.
.
************************************************************************