Contents
1. Overview
Scrollbars are used whenever some contents needs to be scrolled around. They will often be part of a ../GtkScrolledWindow, but do not need to.
The ../GtkScrollbar class has two subclasses. GtkHScrollbar is a horizontal scrollbar, and GtkVScrollbar is a vertical one. I will only discuss the horizontal scrollbar here, but vertical ones are exactly the same.
2. Style Properties
Name |
Type |
Default |
Nick |
Description |
misc |
fixed-slider-length |
boolean |
FALSE |
Fixed slider size |
Don't change slider size, just lock it to the minimum length |
|
has-backward-stepper |
boolean |
TRUE |
Backward stepper |
Display the standard backward arrow button |
|
has-forward-stepper |
boolean |
TRUE |
Forward stepper |
Display the standard forward arrow button |
|
has-secondary-backward-stepper |
boolean |
FALSE |
Secondary backward stepper |
Display a second backward arrow button on the opposite end of the scrollbar |
|
has-secondary-forward-stepper |
boolean |
FALSE |
Secondary forward stepper |
Display a second forward arrow button on the opposite end of the scrollbar |
|
min-slider-length |
int |
21 |
Minimum Slider Length |
Minimum length of scrollbar slider |
Min: 0; Max: G_MAXINT |
Also relevant are the GtkRange style properties:
Name |
Type |
Default |
Nick |
Description |
misc |
activate-slider |
boolean |
FALSE |
Draw slider ACTIVE during drag |
With this option set to TRUE, sliders will be drawn ACTIVE and with shadow IN while they are dragged |
|
arrow-displacement-x |
int |
0 |
Arrow X Displacement |
How far in the x direction to move the arrow when the button is depressed |
Min: G_MININT; Max: G_MAXINT |
arrow-displacement-y |
int |
0 |
Arrow Y Displacement |
How far in the y direction to move the arrow when the button is depressed |
Min: G_MININT; Max: G_MAXINT |
slider-width |
int |
14 |
Slider Width |
Width of scrollbar or scale thumb |
Min: 0; Max: G_MAXINT |
stepper-size |
int |
14 |
Stepper Size |
Length of step buttons at ends |
Min: 0; Max: G_MAXINT |
stepper-spacing |
int |
0 |
Stepper Spacing |
Spacing between step buttons and thumb |
Min: 0; Max: G_MAXINT |
trough-border |
int |
1 |
Trough Border |
Spacing between thumb/steppers and outer trough bevel |
Min: 0; Max: G_MAXINT |
trough-side-details |
boolean |
FALSE |
Trough Side Details |
When TRUE, the parts of the trough on the two sides of the slider are drawn with different details |
|
trough-under-steppers |
boolean |
TRUE |
Trough Under Steppers |
Whether to draw trough for full length of range or exclude the steppers and spacing |
|
An exception here is probably trough-side-details which will not be interesting for scrollbars, but is very usefull for the ../GtkScale.
If stepper-spacing is non-zero, then trough-under-steppers is automatically disabled.
3. Geometry
3.1. trough under steppers
3.2. trough not under steppers
4. Drawing
The drawing is basically the same thing as the one from ../GtkScale, with the difference that a scrollbar has stepper buttons.
4.1. Trough
The trough is a box with a detail of "trough" and a shadow of IN. The state is ACTIVE for normal scrollbars, and INSENSITIVE if the scrollbar is insensitive. For scrollbars trough-side-details and fill level drawing can also be set. They work in exactly the same way as the one from ../GtkScale.
4.2. Slider
The slider is drawn with the slider function in GTK+ (so SLIDER in eg. the pixmap/pixbuf engine). The detail is just "slider". The state and shadow also depend on the value of the activate-slider style property. If the activate-slider style property is not set, then the slider that is dragged looks like it is in the prelight state. On the other hand, if activate-slider is set, then the slider looks differently if it is dragged.
A slider that is neither pressed, nor prelit, has a state of NORMAL and a shadow of OUT. If the mouse hovers over the slider, then the state becomes PRELIGHT, the shadow stays OUT. Then, as the slider is pressed, the state becomes ACTIVE and the shadow will be IN.
If the scrollbar is insensitive, then the slider will be drawn with a state of INSENSITIVE.
4.3. Stepper Button and Arrow
The stepper buttons have a detail of hscrollbar or vscrollbar depening on the orientation. Other than that it is drawn similar to any other button. The main thing to note is that a stepper button will be drawn insenstive if the slider is at the top or bottom. The arrows drawn with the same detail string, state and shadow, and fill_arrow is set to TRUE. It will be displaced by the number of pixels specified in the arrow-displacement-? style properties if the stepper button is pressed.