You may return to the Cvo Object Documenation Index from this document. This document contains the following sections describing the Cvo_ScrollBar object:
Cvo_ScrollBar
Cvo_Window
#include
<Cvo/ScrollBar.h++>
new
Cvo_ScrollBar ( char *resource_name,
{ Cvo_Object *parent | Display *display },
{ Cvo_HORIZONTAL | Cvo_VERTICAL } )
Cvo_HORIZONTAL
or Cvo_VERTICAL
.
This object defines the following member functions in addition to those defined by its parent and ancestor objects.
SetValues (
int min,
int max,
int current,
int visible )
SetMinimum (
int min )
SetMaximum (
int max )
SetCurrent (
int current )
SetVisible (
int visible )
There are four values associated with a scroll bar. The minimum, maximum, and current values, as well as the amount of visible space on the screen. The current value is constrained between (minimum) and (maximum - visible). The ratio of between (visible) and (maximum - minimum) determines the size of the thumb.
The above functions are used to set the values, either individually or at once.
int GetMinimum (
)
int GetMaximum (
)
int GetCurrent (
)
int GetVisible (
)
Return the minimum, maximum, current or visible value.
SetJump (
unsigned delta )
Normally pressing an arrow will move the scroll bar one unit. If delta is specified it changes the amount to move the scroll bar. This is useful when the units represent pixels.
CompressEvents (
[ BOOL value ] )
By default the Cvo_ScrollBar object returns events as the thumb is
being dragged. Calling this function with no argument, or a True
value, will cause an event only to be sent when the thumb is
released after having been depressed and dragged.
This object defines the following Cvo Events in addition to those defined by its parent and ancestor objects.
CvoScrollBarEvent
struct
Cvo_ScrollBarEvent
int value,
BOOL scrolling:1
A CvoScrollBarEvent
event is generated when the current value of
the scroll bar is changed by the user. The value element contains the
new value of current. The scrolling element is set if this event
is one of several due to either the thumb being dragged, or the user
holding down an arrow.
This object defines the following event translations in addition to those defined by its parent and ancestor objects.
<Button2Press>
:
Move()
The Move translation moves the thumb to the location on the scroll bar pointed to by the mouse and then allows the user to move the thumb prior to releasing the button.
<Button1Press>
:
MotifMove()
The MotifMove translation moves the thumb up or down one screenfull of data (1/10 the amount of data if the visible size is 0) depending whether the mouse was pressed above or below the thumb.
The PageUp and PageDown translations move the thumb a percentage of visible size dependent on the location of the button press (or simply by the visible amount if this was not a button press). For instance, if the button was pressed a quarter of the way down the scroll bar, the thumb would page 25% of the visible size.
By default these translations are not used.
<ButtonPress>
:
MoveThumb
Only available for the thumb, this translation allows the user to grab the thumb with the mouse and move it.
<ButtonPress>
:
Scroll(1)
This translation is only available for the arrows. It causes the scroll bar to be moved by a multiple of the jump size (defaults to 1). For instance, the translation:
<ButtonPress>: Scroll(5)
would cause the thumb to be moved by five times the jump size each time the arrow was pressed.
This object is composed of the following Cvo objects. Each object has the shown resource name. This link displays the composition of the parent object.
Cvo_SBAccessory
:
*CvoScrollBar.down
Cvo_SBAccessory
:
*CvoScrollBar.left
Cvo_SBAccessory
:
*CvoScrollBar.right
Cvo_SBAccessory
:
*CvoScrollBar.up
Cvo_SBThumb
:
*CvoScrollBar.horzThumb
Cvo_SBThumb
:
*CvoScrollBar.vertThumb
This object modifies the following X resources which are used by its parent or other ancestors.
*CvoScrollBar.Cursor
(new value:
SB Right Arrow
)
*CvoScrollBar.up.Cursor
(new value:
Based Arrow Up
)
*CvoScrollBar.down.Cursor
(new value:
Based Arrow Down
)
*CvoScrollBar.left.Cursor
(new value:
SB Left Arrow
)
*CvoScrollBar.right.Cursor
(new value:
SB Right Arrow
)
*CvoScrollBar.vertThumb.Cursor
(new value:
SB V Double Arrow
)
*CvoScrollBar.horzThumb.Cursor
(new value:
SB H Double Arrow
)
*CvoScrollBar.Pad
(new value:
0
)
*CvoScrollBar.CvoAccessory.Chamfer
(new value:
0
)
*CvoScrollBar.CvoAccessory.Pad
(new value:
0
)
*CvoScrollBar.CvoAccessory.LayoutPad
(new value:
0
)
*CvoScrollBar.CvoThumb.LayoutPad
(new value:
0
)
*CvoScrollBar.CvoAccessory.InteralPad
(new value:
0
)
*CvoScrollBar.CvoThumb.InteralPad
(new value:
0
)
*CvoScrollBar.Sunken
(new value:
True
)
*CvoScrollBar.CvoAccessory.Sunken
(new value:
True
)
*CvoScrollBar.CvoAccessory.BorderWidth
(new value:
0
)
See the example source code for an example of how to use this object.
See the legend for information about the conventions used in this documentation.