The Cdk histogram widget creates a histogram widget. This widget can draw a
vertical or horizontal histogram. The following are functions which create or
manipulate the Cdk histogram box widget.
AVAILABLE FUNCTIONS
CDKHISTOGRAM *newCDKHistogram (CDKSCREEN *screen, int xpos, int ypos, char *title, int height, int width, int orient, char *label, boolean box, boolean shadow);
This function creates a pointer to a histogram 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 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 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 orient
parameter specifies the orientation of the histogram. This parameter accepts
two values: VERTICAL and HORIZONTAL. The label parameter
specifies the contents of the label of the histogram. 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.
void setCDKHistogram (CDKHISTOGRAM *histogram, EHistogramDisplayType viewType, int statsPosition, chtype statsAttribute, int lowValue, int highValue, int currentValue, chtype fillerCharacter, boolean box);
This function lets the programmer set the specific values of the histogram
widget. The parameter viewType specifies the type of histogram to draw.
The following table lists the valid values and the results.
Display_Type Result
vNONE Displays no information
about the current values.
vPERCENT Displays the current
value as a percentage.
vFRACTION Displays the current
value as a fraction.
vREAL Displays the current value.
The statsPosition parameter states where the statistics will be
displayed. It accepts TOP, BOTTOM, and CENTER. The parameter
statsAttribute sets the attributes of the statistics. The parameters
lowValue, highValue, and currentValue are the low, high,
and current values respectively. The filler character is the character
to use in the unused space in the histogram. The box option draws
the widget with or without a box.
void setCDKHistogramValue (CDKHISTOGRAM *histogram, int low, int high, int value);
This sets the low, high, and current value of the histogram.
int getCDKHistogramLowValue (CDKHISTOGRAM *histogram);
This returns the low value of the histogram.
int getCDKHistogramHighValue (CDKHISTOGRAM *histogram);
This returns the high value of the histogram.
int getCDKHistogramValue (CDKHISTOGRAM *histogram);
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 moveCDKHistogram (CDKHISTOGRAM *histogram, 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.
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.)