unixdev.net


Switch to SpeakEasy.net DSL

The Modular Manual Browser

Home Page
Manual: (NetBSD-2.0)
Page:
Section:
Apropos / Subsearch:
optional field

cdk_slider(3)              Library Functions Manual              cdk_slider(3)



NAME
       newCDKSlider,  activateCDKSlider, injectCDKSlider, setCDKSlider, setCD-
       KSliderLowHigh,  getCDKSliderLowValue,  getCDKSliderHighValue,   setCD-
       KSliderBox,  getCDKSliderBox,  setCDKSliderULChar,  setCDKSliderURChar,
       setCDKSliderLLChar,    setCDKSliderLRChar,    setCDKSliderVerticalChar,
       setCDKSliderHorizontalChar, setCDKSliderBoxAttribute, setCDKSliderBack-
       groundColor, drawCDKSlider,  eraseCDKSlider,  destroyCDKSlider,  setCD-
       KSliderPreProcess, setCDKSliderPostProcess
        - Creates a managed curses slider widget.

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

       #include <cdk.h>

       CDKSLIDER *newCDKSlider (CDKSCREEN *cdkscreen, int xpos, int ypos, char
       *title, char *label, chtype fillerCharacter, int fieldWidth,  int  cur-
       rentValue,  int  lowValue, int highValue, int increment, int fastIncre-
       ment, boolean box, boolean shadow);

       int activateCDKSlider (CDKSLIDER *slider, chtype *actions);

       int injectCDKSlider (CDKSLIDER *slider, chtype input);

       void setCDKSlider (CDKSLIDER *slider, int lowValue, int highValue,  int
       currentValue, boolean box);

       void  setCDKSliderLowHigh  (CDKSLIDER  *slider, int lowValue, int high-
       Value);

       int getCDKSliderLowValue ((CDKSLIDER *slider);

       int getCDKSliderHighValue ((CDKSLIDER *slider);

       void setCDKSliderValue ((CDKSLIDER *slider, int value);

       int getCDKSliderValue ((CDKSLIDER *slider);

       void setCDKSliderULChar (CDKSLIDER *,slider, chtype character);

       void setCDKSliderURChar (CDKSLIDER *,slider, chtype character);

       void setCDKSliderLLChar (CDKSLIDER *,slider, chtype character);

       void setCDKSliderLRChar (CDKSLIDER *,slider, chtype character);

       void setCDKSliderVerticalChar (CDKSLIDER *,slider, chtype character);

       void setCDKSliderHorizontalChar (CDKSLIDER *,slider, chtype character);

       void setCDKSliderBoxAttribute (CDKSLIDER *,slider, chtype character);

       void setCDKSliderBackgroundColor (CDKSLIDER *,slider, char * color);

       void moveCDKSlider (CDKSLIDER *slider, int box, int box, boolean  rela-
       tive, boolean refresh);

       void positionCDKSlider (CDKSLIDER *slider);

       void drawCDKSlider (CDKSLIDER *slider, boolean box);

       void eraseCDKSlider (CDKSLIDER *slider);

       void destroyCDKSlider (CDKSLIDER *slider);

       void  setCDKSliderPreProcess  (CDKSLIDER  *slider,  PROCESSFN callback,
       void * data);

       void setCDKSliderPostProcess (CDKSLIDER  *slider,  PROCESSFN  callback,
       void * data);

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

DESCRIPTION
       The Cdk slider widget creates a visual slider box with a  label  and  a
       slider  field.  The  following are functions which create or manipulate
       the Cdk slider box widget.


AVAILABLE FUNCTIONS
       CDKSLIDER *newCDKSlider (CDKSCREEN *screen, int xpos,  int  ypos,  char
       *title,  char  *label,  chtype fillerCharacter, chtype fillerCharacter,
       EDisplayType displayType, int fieldWidth, int minimumLength, int  maxi-
       mumLength, boolean box, boolean shadow);
          This  function  creates  a  pointer  to  a slider 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 hori-
          zontal 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  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 label parameter is the string which will be
          displayed in the label of the slider field. The  fillerCharacter  is
          the  character  to  be used to draw the slider bar in the field. The
          parameter fieldWidth controls the width of the widget. If  you  pro-
          vide  a value of zero the widget will be created with the full width
          of the screen. If you provide a negative value, the widget  will  be
          created the full width minus the value provided.  The parameter cur-
          rentValue is the value of the slider field when the widget is  acti-
          vated.  The  parameters  lowValue and highValue are the low and high
          values of the widget respectively. The parameter  increment  is  the
          regular  increment  value  while  fastIncrement  is  the accelerated
          increment value. 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 activateCDKSlider (CDKSLIDER *slider, chtype *actions);
          This function activates the slider widget and lets the user interact
          with the widget. The parameter slider is a  pointer  to  a  non-NULL
          slider  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 a value from the low value to the
          high value. It will also set the structure member exitType to  vNOR-
          MAL.  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.

       int injectCDKSlider (CDKSLIDER *slider, chtype character);
          This function injects a single character into the widget. The param-
          eter slider is a pointer to a non-NULL slider widget. The  parameter
          character is the character to inject into the widget. If the charac-
          ter injected into this widget was RETURN then the character injected
          into  this  widget is RETURN or TAB then this function will return a
          value from the low value to the high value. 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 setCDKSlider (CDKSLIDER *slider, int value, int minimumLength, int
       maximumLength, boolean box);
          This function lets the programmer  modify  certain  elements  of  an
          already defined slider widget. The parameter names correspond to the
          same parameter names listed in the newCDKSlider function.

       void setCDKSliderLowHigh (CDKSLIDER *slider, int  lowValue,  int  high-
       Value);
          This sets the low and high values of the widget.

       int getCDKSliderLowValue (CDKSLIDER *slider);
          This returns the low value of the slider widget.

       int getCDKSliderHighValue (CDKSLIDER *slider);
          This returns the high value of the slider widget.

       void setCDKSliderValue (CDKSLIDER *slider, int value);
          This sets the current value of the widget.

       int getCDKSliderValue (CDKSLIDER *slider);
          This returns the current value of the widget.

       void setCDKSliderBox (CDKSLIDER *slider, boolean boxWidget);
          This  sets  whether or not the widget will be draw with a box around
          it.

       boolean getCDKSliderBox (CDKSLIDER *slider);
          This returns whether or not the widget will  be  drawn  with  a  box
          around it.

       void setCDKSliderULChar (CDKSLIDER *slider, chtype character);
          This  function sets the upper left hand corner of the widgets box to
          the given character.

       void setCDKSliderURChar (CDKSLIDER *slider, chtype character);
          This function sets the upper right hand corner of the widgets box to
          the given character.

       void setCDKSliderLLChar (CDKSLIDER *slider, chtype character);
          This  function sets the lower left hand corner of the widgets box to
          the given character.

       void setCDKSliderLRChar (CDKSLIDER *slider, chtype character);
          This function sets the lower right hand corner of the widgets box to
          the given character.

       void setCDKSliderVerticalChar (CDKSLIDER *slider, chtype character);
          This function sets the vertical drawing character for the box to the
          given character.

       void setCDKSliderHorizontalChar (CDKSLIDER *slider, chtype character);
          This function sets the horizontal drawing character for the  box  to
          the given character.

       void setCDKSliderBoxAttribute (CDKSLIDER *slider, chtype attribute);
          This function sets the attribute of the box.

       void setCDKSliderBackgroundColor (CDKSLIDER *slider, 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 moveCDKSlider (CDKSLIDER *slider, int xpos, int ypos, boolean rel-
       ative, 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.  (weird
          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 positionCDKSlider (CDKSLIDER *slider);
          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 its 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 drawCDKSlider (CDKSLIDER *slider, boolean box);
                This function draws the slider widget on the screen.  The  box
                option draws the widget with or without a box.

             void eraseCDKSlider (CDKSLIDER *slider);
                This  function  removes  the widget from the screen. This does
                NOT destroy the widget.

             void destroyCDKSlider (CDKSLIDER *slider);
                This function removes the widget from the screen and frees  up
                any memory the object may be using.

             void  setCDKSliderPreProcess  (CDKSLIDER *slider, PROCESSFN func-
             tion, void *data);
                This function allows the user to have the widget call a  func-
                tion  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 setCDKSliderPostProcess (CDKSLIDER *slider, PROCESSFN  func-
             tion, void *data);
                This  function allows the user to have the widget call a func-
                tion after the key has been applied to the widget.  The param-
                eter  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  wid-
       get.

          Key         Action
          Left Arrow  Decrements the value in the field
                      by the normal decrement value.
          Down Arrow  Decrements the value in the field
                      by the normal decrement value.
          d           Decrements the value in the field
                      by the normal decrement value.
          -           Decrements the value in the field
                      by the normal decrement value.
          Right Arrow Increments the value in the field
                      by the normal increment value.
          Up Arrow    Increments the value in the field
                      by the normal increment value.
          u           Increments the value in the field
                      by the normal increment value.
          +           Increments the value in the field
                      by the normal increment value.
          Prev Page   Decrements the value in the field
                      by the accelerated decrement value.
          U           Decrements the value in the field
                      by the accelerated decrement value.
          Ctrl-B      Decrements the value in the field
                      by the accelerated decrement value.
          Next Page   Increments the value in the field
                      by the accelerated increment value.
          D           Increments the value in the field
                      by the accelerated increment value.
          Ctrl-F      Increments the value in the field
                      by the accelerated increment value.
          Home        Sets the value to the low value.
          g           Sets the value to the low value.
          0           Sets the value to the low value.
          End         Sets the value to the high value.
          G           Sets the value to the high value.
          $           Sets the value to the high value.
          Return      Exits the widget and returns an
                      integer value representing the
                      current value. This also sets the
                      structure member exitType in
                      the widget pointer to the value of
                      vNORMAL.
          Tab         Exits the widget and returns an
                      integer value representing the
                      current value. 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-R      Refreshes the screen.

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

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

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



                                 18 March 1997                   cdk_slider(3)