cdk_swindow(3)

NAME
newCDKSwindow, activateCDKSwindow, injectCDKSwindow, setCDKSwindow, setCDKSwindowContents, getCDKSwindowContents, setCDKSwindowBox, getCDKSwindowBox, setCDKSwindowULChar, setCDKSwindowURChar, setCDKSwindowLLChar, setCDKSwindowLRChar, setCDKSwindowVerticalChar, setCDKSwindowHorizontalChar, setCDKSwindowBoxAttribute, setCDKSwindowBackgroundColor, drawCDKSwindow, eraseCDKSwindow, cleanCDKSwindow, addCDKSwindow, execCDKSwindow, trimCDKSwindow, saveCDKSwindowInformation, jumpToLineCDKSwindow, loadCDKSwindowInformation, dumpCDKSwindow, destroyCDKSwindow, setCDKSwindowPreProcess, setCDKSwindowPostProcess - Creates a managed curses swindow widget.

SYNOPSIS

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

#include <cdk.h>

CDKSWINDOW *newCDKSwindow (CDKSCREEN *cdkscreen, int xpos, int ypos, int height, int width, char *title, int saveLines, boolean box, boolean shadow);

void activateCDKSwindow (CDKSWINDOW *swindow, chtype * actions);

int injectCDKSwindow (CDKSWINDOW *swindow, chtype input);

void setCDKSwindow (CDKSWINDOW *swindow, char **info, int lines, boolean box);

void setCDKSwindowContents (CDKSWINDOW *swindow, char **info, int lines);

char **getCDKSwindowContents (CDKSWINDOW *swindow);

void setCDKSwindowULChar (CDKSWINDOW *,swindow, chtype character);

void setCDKSwindowURChar (CDKSWINDOW *,swindow, chtype character);

void setCDKSwindowLLChar (CDKSWINDOW *,swindow, chtype character);

void setCDKSwindowLRChar (CDKSWINDOW *,swindow, chtype character);

void setCDKSwindowVerticalChar (CDKSWINDOW *,swindow, chtype character);

void setCDKSwindowHorizontalChar (CDKSWINDOW *,swindow, chtype character);

void setCDKSwindowBoxAttribute (CDKSWINDOW *,swindow, chtype character);

void setCDKSwindowBackgroundColor (CDKSWINDOW *,swindow, char * color);

void moveCDKSwindow (CDKSWINDOW *swindow, int box, int box, boolean relative, boolean refresh);

void positionCDKSwindow (CDKSWINDOW *swindow);

void drawCDKSwindow (CDKSWINDOW *swindow, boolean box);

void eraseCDKSwindow (CDKSWINDOW *swindow);

void cleanCDKSwindow (CDKSWINDOW *swindow);

void addCDKSwindow (CDKSWINDOW *swindow, char *info, int insertPosition);

int execCDKSwindow (CDKSWINDOW *swindow, char * command, int insertPosition);

void trimCDKSwindow (CDKSWINDOW *swindow, int start, int finish);

void saveCDKSwindowInformation (CDKSWINDOW *swindow);

void jumpToLineCDKSwindow (CDKSWINDOW *swindow, int line);

void loadCDKSwindowInformation (CDKSWINDOW *swindow);

void dumpCDKSwindow (CDKSWINDOW *swindow, char *filename);

void destroyCDKSwindow (CDKSWINDOW *swindow);

void setCDKSwindowPreProcess (CDKSWINDOW *swindow, PROCESSFN callback, void * data);

void setCDKSwindowPostProcess (CDKSWINDOW *swindow, PROCESSFN callback, void * data);

void bindCDKObject (EObjectType widgetType, void *object, chtype key, BINDFN function, void *data);

DESCRIPTION
The Cdk scrolling window widget creates a widget which can be used to display messages. The following are functions which create or manipulate the Cdk swindow box widget.

AVAILABLE FUNCTIONS
CDKSWINDOW *newCDKSwindow (CDKSCREEN *screen, int xpos, int ypos, int height, int width, char *title, int saveLines, boolean box);
    This function creates a pointer to a swindow widget. The screen parameter is the screen you wish this widget to be placed in. The parameter xpos controls the placement of the object along the horizontal axis. This parameter can accept an integer value or one of the pre-defined values of LEFT, RIGHT, and CENTER. The parameter ypos controls the placement of the object along the vertical axis. This parameter can accept an integer value or one of the pre-defined values of TOP, BOTTOM, and CENTER. The parameters height and width control the height and width of the widget. If you provide a value of zero for either of the height or the width, the widget will be created with the full width and height of the screen. If you provide a negative value, the widget will be created the full height or width minus the value provided. The title parameter is the string which will be displayed at the top of the widget. The title can be more than one line; just provide a carriage return character at the line break. The parameter saveLines is the number of lines to save before throwing information away. The box parameter states whether the widget will be drawn with a box around it or not. The shadow parameter accepts a boolean value to turn the shadow on or off around this widget. If the widget could not be created then a NULL pointer is returned.
int activateCDKSwindow (CDKSWINDOW *swindow, chtype *actions);
    This function activates the swindow widget and lets the user interact with the widget. The parameter swindow is a pointer to a non-NULL swindow widget. If the actions parameter is passed with a non-NULL value, the characters in the array will be injected into the widget. 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 1. It will also set the structure member exitType to vNORMAL. If the character entered into this widget was ESCAPE then the widget will return a value of -1 and the structure member exitType will be set to vESCAPE_HIT.
void injectCDKSwindow (CDKSWINDOW *swindow, chtype character);
    This function injects a single character into the widget. The parameter swindow is a pointer to a non-NULL swindow widget. The parameter character is the character to inject into the widget. If the character injected into this widget was RETURN then the character injected into this widget is RETURN or TAB then this function will return 1. It will also set the structure member exitType to vNORMAL. If the character entered into this widget was ESCAPE then the widget will return a value of -1 and the structure member exitType will be set to vESCAPE_HIT. Any other character injected into the widget will set the structure member exitType to vEARLY_EXIT and the function will return -1.
void setCDKSwindow (CDKSWINDOW *swindow, char **info, int lines, boolean box);
    This function lets the programmer modify certain elements of an already defined swindow widget. The parameter info is a char ** of the information to set in the scrolling window; lines is the number of lines being added. The other parameter names correspond to the same parameter names listed in the newCDKSwindow function.
void setCDKSwindowContents (CDKSWINDOW *swindow, char **info, int lines);
    This function lets the programmer modify certain elements of an already defined swindow widget. The parameter info is a char ** of the information to set in the scrolling window; lines is the number of lines being added.
char **getCDKSwindowContents (CDKSWINDOW *swindow, int *lines);
    This returns the contents of the scrolling window. The parameter lines will be set to the number of lines returned.
void setCDKSwindowBox (CDKSWINDOW *swindow, boolean boxWidget);
    This sets whether or not the widget will be draw with a box around it.
boolean getCDKSwindowBox (CDKSWINDOW *swindow);
    This returns whether or not the widget will be drawn with a box around it.
void setCDKSwindowULChar (CDKSWINDOW *swindow, chtype character);
    This function sets the upper left hand corner of the widgets box to the given character.
void setCDKSwindowURChar (CDKSWINDOW *swindow, chtype character);
    This function sets the upper right hand corner of the widgets box to the given character.
void setCDKSwindowLLChar (CDKSWINDOW *swindow, chtype character);
    This function sets the lower left hand corner of the widgets box to the given character.
void setCDKSwindowLRChar (CDKSWINDOW *swindow, chtype character);
    This function sets the lower right hand corner of the widgets box to the given character.
void setCDKSwindowVerticalChar (CDKSWINDOW *swindow, chtype character);
    This function sets the vertical drawing character for the box to the given character.
void setCDKSwindowHorizontalChar (CDKSWINDOW *swindow, chtype character);
    This function sets the horizontal drawing character for the box to the given character.
void setCDKSwindowBoxAttribute (CDKSWINDOW *swindow, chtype attribute);
    This function sets the attribute of the box.
void setCDKSwindowBackgroundColor (CDKSWINDOW *swindow, char *color);
    This sets the background color of the widget. The parameter color is in the format of the Cdk format strings. To get more information look at the cdk_display manual page.
void moveCDKSwindow (CDKSWINDOW *swindow, int xpos, int ypos, boolean relative, boolean refresh);
    This function moves the given widget to the given position. The parameters xpos and ypos is the new position of the widget. The parameter xpos can accept an integer value or one of the pre-defined values of TOP, BOTTOM, and CENTER. The parameter ypos can accept an integer value or one of the pre-defined values of 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 of TOP, BOTTOM, LEFT, RIGHT, or CENTER when relative = TRUE. (wierd things may happen). The final parameter refresh is a boolean value which states whether the widget will get refreshed after the move or not.
void positionCDKSwindow (CDKSWINDOW *swindow);
    This function allows the user to move the widget around the screen via the cursor/keypad keys. The following key bindings can be used to move the widget around the screen.

    Key Bindings
        Key          Action
        Up Arrow     Moves the widget up one line.
        Down Arrow   Moves the widget down one line.
        Left Arrow   Moves the widget left one column
        Right Arrow  Moves the widget right one column
        Keypad-1     Moves the widget down one line
                     and left one column.
        Keypad-2     Moves the widget down one line.
        Keypad-3     Moves the widget down one line
                     and right one column.
        Keypad-4     Moves the widget left one column
        Keypad-5     Centers the widget both vertically
                     and horizontally.
        Keypad-6     Moves the widget right one column
        Keypad-7     Moves the widget up one line
                     and left one column.
        Keypad-8     Moves the widget up one line.
        Keypad-9     Moves the widget up one line
                     and right one column.
        t            Moves the widget to the top of the screen.
        b            Moves the widget to the bottom of the screen.
        l            Moves the widget to the left of the screen.
        r            Moves the widget to the right of the screen.
        c            Centers the widget between the left and
                     right of the window.
        C            Centers the widget between the top and
                     bottom of the window.
        Escape       Returns the widget to it's original position.
        Return       Exits the function and leaves the widget
                     where it was.

        Keypad means that if the keyboard you are using has a keypad, then the Num-Lock light has to be on in order to use the keys as listed. (The numeric keys at the top of the keyboard will work as well.)

        void drawCDKSwindow (CDKSWINDOW *swindow, boolean box);
            This function draws the swindow widget on the screen. The box option draws the widget with or without a box.
        void eraseCDKSwindow (CDKSWINDOW *swindow);
            This function removes the widget from the screen. This does NOT destroy the widget.
        void cleanCDKSwindow (CDKSWINDOW *swindow);
            This function clears the information from the window.
        void addCDKSwindow (CDKSWINDOW *swindow, char *info, int insertPosition);
            This function adds information to a defined scrolling window. The information is supplied by the info parameter. The information is immediately added to the scrolling window. The position of the new information is governed by the value of the parameter insertPosition. This parameter can accept two values: TOP or BOTTOM.
        void execCDKSwindow (CDKSWINDOW *swindow, char *command, int insertPosition);
            This function allows the user to execute a shell command and have the output of the shell command direct itself to the scrolling window. The command parameter is the command to execute while insertPosition is where the output is to insert itself within the scrolling window.
        void trimCDKSwindow (CDKSWINDOW *swindow, int start, int end);
            This function removes information from the scrolling window. The parameters start and end state where to start cutting from and where to stop. The first element in the scrolling window starts at index 0.
        void saveCDKSwindowInformation (CDKSWINDOW *swindow)
            This function allows the user to save the contents of the scrolling window into a file. This function is interactive, and will ask for a filename.
        void jumpToLineCDKSwindow (CDKSWINDOW *swindow, int line);
            This function moves the scrolling window to the given line. The parameter line can accept and integer or one of the two predefined values of TOP and BOTTOM.
        void loadCDKSwindowInformation (CDKSWINDOW *swindow)
            This function allows the user to load the contents of a file into the scrolling window. This function is interactive, and will ask for a filename.
        int dumpCDKSwindowInformation (CDKSWINDOW *swindow, char *filename)
            This function saves the contents of the scrolling window into the file specified by the filename parameter. It returns -1 on failure, and the number of lines saved if the dump was successful.
        void destroyCDKSwindow (CDKSWINDOW *swindow);
            This function removes the widget from the screen and frees up any memory the object may be using.
        void setCDKSwindowPreProcess (CDKSWINDOW *swindow, PROCESSFN function, void *data);
            This function allows the user to have the widget call a function after a key is hit and before the key is applied to the widget. The parameter function if of type PROCESSFN. The parameter data is a pointer to void. To learn more about pre-processing read the cdk_process manual page.

        void setCDKSwindowPostProcess (CDKSWINDOW *swindow, PROCESSFN function, void *data);
            This function allows the user to have the widget call a function after the key has been applied to the widget. The parameter function if of type PROCESSFN. The parameter data is a pointer to void. To learn more about post-processing read the cdk_process manual page.
        void bindCDKObject (EObjectType widgetType, void *object, char key, BINDFN function, void *data);
            This function allows the user to create special key bindings. The widgetType parameter is a defined type which states what Cdk object type is being used. To learn more about the type EObjectType read the cdk_binding manual page. The object parameter is the pointer to the widget object. The key is the character to bind. The function is the function type. To learn more about the key binding callback function types read the cdk_binding manual page. The last parameter data is a pointer to any data that needs to get passed to the callback function.

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 widget.

    Key          Action
    Left Arrow  Scrolls the window left one character.
    Right Arrow Scrolls the window right one character.
    Up Arrow    Scrolls the window up one line.
    Down Arrow  Scrolls the window up down line.
    Prev Page   Scrolls the window backwards one page.
    Ctrl-B      Scrolls the window backwards one page.
    b           Scrolls the window backwards one page.
    B           Scrolls the window backwards one page.
    Next Page   Scrolls the window forwards one page.
    Ctrl-F      Scrolls the window forwards one page.
    Space       Scrolls the window forwards one page.
    f           Scrolls the window forwards one page.
    F           Scrolls the window forwards one page.
    Home        Moves the whole list to the far left character.
    |           Moves the whole list to the far left character.
    End         Moves the whole list to the far right character.
    $           Moves the whole list to the far right character.
    g           Moves to the top of the scrolling window.
    1           Moves to the top of the scrolling window.
    G           Moves to the bottom of the scrolling window.
    l           Loads a file into the scrolling window.
    L           Loads a file into the scrolling window.
    s           Saves the contents of the scrolling window into a file.
    S           Saves the contents of the scrolling window into a file.
    Return      Exits the widget and returns 1. This also sets
                the structure member exitType in the widget
                pointer to the value of vNORMAL.
    Tab         Exits the widget and returns 1. This also sets
                the structure member exitType in the widget
                pointer to the value of vNORMAL.
    Escape      Exits the widget and returns -1. This also sets
                the structure member exitType in the widget
                pointer to the value of vESCAPE_HIT.
    Ctrl-L      Refreshes the screen.

SEE ALSO
cdk(3), cdk_binding(3), cdk_display(3), cdk_screen(3)

NOTES

The header file <cdk.h> automatically includes the header files <curses.h>, <stdlib.h>, <string.h>, <ctype.h>, <unistd.h>, <dirent.h>, <time.h>, <errno.h>, <pwd.h>, <grp.h>, <sys/stat.h>, and <sys/types.h>. The <curses.h> header file includes <stdio.h> and <unctrl.h>.

If you have Ncurses installed on your machine add -DNCURSES to the compile line to include the Ncurses header files instead.