https://invisible-island.net/cdk/manpage/


cdk_dialog 3 2024-03-28 Library calls

cdk_dialog(3)                   Library calls                  cdk_dialog(3)

NAME

       cdk_dialog - Cdk dialog widget

SYNOPSIS

       cc [ flag ... ] file ...  -lcdk [ library ... ]

       #include <cdk.h>

       int activateCDKDialog (
                      CDKDIALOG *dialog,
                      chtype * actions);

       void destroyCDKDialog (
                      CDKDIALOG *dialog);

       void drawCDKDialog (
                      CDKDIALOG *dialog,
                      boolean box);

       void drawCDKDialogButtons (
                      CDKDIALOG *dialog);

       void eraseCDKDialog (
                      CDKDIALOG *dialog);

       boolean getCDKDialog (
                      CDKDIALOG *dialog);

       boolean getCDKDialogBox (
                      CDKDIALOG *dialog);

       chtype getCDKDialogHighlight (
                      CDKDIALOG *dialog);

       boolean getCDKDialogSeparator (
                      CDKDIALOG *dialog);

       int injectCDKDialog (
                      CDKDIALOG *dialog,
                      chtype input);

       void moveCDKDialog (
                      CDKDIALOG *dialog,
                      int xpos,
                      int ypos,
                      boolean relative,
                      boolean refresh);

       CDKDIALOG *newCDKDialog (
                      CDKSCREEN *cdkscreen,
                      int xpos,
                      int ypos,
                      CDK_CONST char ** message,
                      int rows,
                      CDK_CONST char ** buttons,
                      int buttonCount,
                      chtype highlight,
                      boolean separator,
                      boolean box,
                      boolean shadow);

       void positionCDKDialog (
                      CDKDIALOG *dialog);

       void setCDKDialogBox (
                      CDKDIALOG *dialog,
                      boolean boxWidget);

       void setCDKDialog (
                      CDKDIALOG *dialog,
                      chtype highlight,
                      boolean separator,
                      boolean box);

       void setCDKDialogBackgroundAttrib (
                      CDKDIALOG *dialog,
                      chtype attribute);

       void setCDKDialogBackgroundColor (
                      CDKDIALOG *dialog,
                      const char * color);

       void setCDKDialogBox (
                      CDKDIALOG *dialog,
                      boolean box);

       void setCDKDialogBoxAttribute (
                      CDKDIALOG *dialog,
                      chtype character);

       void setCDKDialogHighlight (
                      CDKDIALOG *dialog,
                      chtype highlight);

       void setCDKDialogHorizontalChar (
                      CDKDIALOG *dialog,
                      chtype character);

       void setCDKDialogLLChar (
                      CDKDIALOG *dialog,
                      chtype character);

       void setCDKDialogLRChar (
                      CDKDIALOG *dialog,
                      chtype character);

       void setCDKDialogPostProcess (
                      CDKDIALOG *dialog,
                      PROCESSFN callback,
                      void * data);

       void setCDKDialogPreProcess (
                      CDKDIALOG *dialog,
                      PROCESSFN callback,
                      void * data);

       void setCDKDialogSeparator (
                      CDKDIALOG *dialog,
                      boolean separator);

       void setCDKDialogULChar (
                      CDKDIALOG *dialog,
                      chtype character);

       void setCDKDialogURChar (
                      CDKDIALOG *dialog,
                      chtype character);

       void setCDKDialogVerticalChar (
                      CDKDIALOG *dialog,
                      chtype character);

DESCRIPTION

       The  Cdk dialog widget creates a dialog box with a message and a var-
       ied number of buttons to choose from.  The following functions create
       or manipulate the Cdk dialog box widget.

AVAILABLE FUNCTIONS

       activateCDKDialog
            activates  the dialog widget and lets the user interact with the
            widget.

            o   The parameter dialog is a pointer to a non-NULL dialog  wid-
                get.

            o   If  the  actions  parameter is passed with a non-NULL value,
                the characters in the array will be injected into  the  wid-
                get.

                To  activate the widget interactively pass in a NULL pointer
                for actions.

            If the character entered into this widget is RETURN or TAB  then
            this  function  will return a value from 0 to the number of but-
            tons -1, representing the button selected.   It  also  sets  the
            widget data exitType to vNORMAL.

            If  the  character entered into this widget was ESCAPE, then the
            widget returns a value of -1 and the widget data  exitType  will
            be set to vESCAPE_HIT.

       destroyCDKDialog
            removes  the  widget from the screen and frees memory the object
            used.

       drawCDKDialog
            draws the dialog widget on the screen.

            If the box parameter is true, the widget is drawn with a box.

       drawCDKDialogButtons
            draws the dialog buttons and the separation line.

       eraseCDKDialog
            removes the widget from the screen.  This does NOT  destroy  the
            widget.

       getCDKDialog
            returns true if the list will be drawn with a box around it.

       getCDKDialogBox
            returns true if the dialog will be drawn with a box around it.

       getCDKDialogHighlight
            returns the highlight attribute of the widget.

       getCDKDialogSeparator
            returns the state of the separator flag.

       injectCDKDialog
            injects a single character into the widget.

            o   The  parameter dialog is a pointer to a non-NULL dialog wid-
                get.

            o   The parameter character is the character to inject into  the
                widget.

            The  return value and side-effect (setting the widget data exit-
            Type) depend upon the injected character:

            RETURN or TAB
                   the function returns a value from zero to one  less  than
                   the  number of buttons, representing the button selected.
                   The widget data exitType is set to vNORMAL.

            ESCAPE the function returns -1.  The widget data exitType is set
                   to vESCAPE_HIT.

            Otherwise
                   unless  modified  by preprocessing, postprocessing or key
                   bindings, the function returns -1.  The widget data exit-
                   Type is set to vEARLY_EXIT.

       moveCDKDialog
            moves the given widget to the given position.

            o   The  parameters  xpos  and  ypos are the new position of the
                widget.

                The parameter xpos may be an integer or one of  the  pre-de-
                fined values TOP, BOTTOM, and CENTER.

                The  parameter  ypos may be an integer or one of the pre-de-
                fined values LEFT, RIGHT, and CENTER.

                The parameter relative states whether the xpos/ypos pair  is
                a relative move or an absolute move.

                For  example,  if xpos = 1 and ypos = 2 and relative = TRUE,
                then the widget would move one  row  down  and  two  columns
                right.   If the value of relative was FALSE, then the widget
                would move to the position (1,2).

                Do not use the values TOP, BOTTOM, LEFT,  RIGHT,  or  CENTER
                when relative = TRUE.  (weird things may happen).

            o   The  final parameter refresh is a boolean value which states
                whether the widget will get refreshed after the move.

       newCDKDialog
            creates a dialog widget and returns a pointer  to  it.   Parame-
            ters:

            screen
                 is the screen you wish this widget to be placed in.

            xpos controls  the  placement of the object along the horizontal
                 axis.  It may be integer or one of the  pre-defined  values
                 LEFT, RIGHT, and CENTER.

            ypos controls  the  placement  of  the object along the vertical
                 axis.  It may be an integer or one of the pre-defined  val-
                 ues TOP, BOTTOM, and CENTER.

            message
                 is  the  text  to be displayed in the message region of the
                 dialog box.

            rows is the number of elements in the message list.

            buttons
                 is an array containing the button labels to be displayed on
                 the bottom of the dialog box.

            buttonCount
                 is the number of elements in the buttons array.

            highlight
                 is the attribute of the currently highlighted button.

            box  is true if the widget should be drawn with a box around it.

            separator
                 is  true  if  a  separator line should be drawn between the
                 message region and the buttons.

            shadow
                 turns the shadow on or off around this widget.

            If the widget could not be created then a NULL  pointer  is  re-
            turned.

       positionCDKDialog
            allows  the  user  to  move the widget around the screen via the
            cursor/keypad keys.  See cdk_position(3) for key bindings.

       setCDKDialogBox
            sets whether the widget will be drawn with a box around it.

       setCDKDialog
            lets the programmer modify certain elements of an existing  dia-
            log widget.

            The  parameter  names  correspond  to  the  same parameter names
            listed in the newCDKDialog function.

       setCDKDialogBackgroundAttrib
            sets the background attribute of the widget.

            The parameter attribute is a curses attribute, e.g., A_BOLD.

       setCDKDialogBackgroundColor
            sets the background color of the widget.

            The parameter color is in the format of the Cdk format strings.

            See cdk_display(3).  setCDKDialogBox sets the box  attribute  of
            the dialog widget.

       setCDKDialogBoxAttribute
            function sets the attribute of the box.

       setCDKDialogHighlight
            sets the highlight attribute of the selected button.

       setCDKDialogHorizontalChar
            sets  the  horizontal drawing character for the box to the given
            character.

       setCDKDialogLLChar
            sets the lower left hand corner of the widget's box to the given
            character.

       setCDKDialogLRChar
            sets  the  lower  right  hand  corner of the widget's box to the
            given character.

       setCDKDialogPreProcess
            allows the user to have the widget call a function after  a  key
            is hit and before the key is applied to the widget.

            o   The parameter function is the callback function.

            o   The parameter data is a pointer to void.

            To learn more about pre-processing see cdk_process(3).

       setCDKDialogPostProcess
            allows the user to have the widget call a function after the key
            has been applied to the widget.

            o   The parameter function is the callback function.

            o   The parameter data points to data  passed  to  the  callback
                function.

            To learn more about post-processing see cdk_process(3).

       setCDKDialogSeparator
            sets  the boolean flag whether the widget will be drawn with the
            separator bar between the buttons and the message area.

       setCDKDialogULChar
            function sets the upper left hand corner of the widget's box  to
            the given character.

       setCDKDialogURChar
            sets  the  upper  right  hand  corner of the widget's box to the
            given character.

       setCDKDialogVerticalChar
            sets the vertical drawing character for the  box  to  the  given
            character.

KEY BINDINGS

       When  the  widget is activated there are several default key bindings
       which will help the user enter or manipulate the information quickly.
       The following table outlines the keys and their actions for this wid-
       get.

              +----------------+-------------------------------------+
              |Key             | Action                              |
              +----------------+-------------------------------------+
              +----------------+-------------------------------------+
              |Left Arrow      | Selects the button to the  left  of |
              |                | the current button.                 |
              +----------------+-------------------------------------+
              |Right Arrow     | Selects  the button to the right of |
              |                | the current button.                 |
              +----------------+-------------------------------------+
              |Tab             | Selects the button to the right  of |
              |                | the current button.                 |
              +----------------+-------------------------------------+
              |Space           | Selects  the button to the right of |
              |                | the current button.                 |
              +----------------+-------------------------------------+
              |Return          | Exits the widget  and  returns  the |
              |                | index of the selected button.  This |
              |                | also sets the widget data  exitType |
              |                | to vNORMAL.                         |
              +----------------+-------------------------------------+
              |Tab             | Exits  the  widget  and returns the |
              |                | index of the selected button.  This |
              |                | also  sets the widget data exitType |
              |                | to vNORMAL.                         |
              +----------------+-------------------------------------+
              |Escape          | Exits the widget  and  returns  -1. |
              |                | This  also  sets  the  widget  data |
              |                | exitType to vESCAPE_HIT.            |
              +----------------+-------------------------------------+
              |Ctrl-L          | Refreshes the screen.               |
              +----------------+-------------------------------------+

SEE ALSO

       cdk(3),     cdk_binding(3),     cdk_display(3),      cdk_position(3),
       cdk_process(3), cdk_screen(3)

                                 2024-03-28                    cdk_dialog(3)