1.166 <GtkScrollbar>

Class: <GtkScrollbar>

It derives from <GtkWidget>.

Shows a horizontal or vertical scrollbar.

Its position and movement are controlled by the adjustment that is passed to or created by scrollbar:new. See <GtkAdjustment> for more details. The adjustment:value field sets the position of the thumb and must be between adjustment:lower and adjustment:upper - adjustment:page-size. The adjustment:page-size represents the size of the visible scrollable area.

The fields adjustment:step-increment and adjustment:page-increment fields are added to or subtracted from the adjustment:value when the user asks to move by a step (using e.g. the cursor arrow keys) or by a page (using e.g. the Page Down/Up keys).

CSS nodes

scrollbar
╰── range[.fine-tune]
    ╰── trough
        ╰── slider

<GtkScrollbar> has a main CSS node with name scrollbar and a subnode for its contents. The main node gets the .horizontal or .vertical style classes applied, depending on the scrollbar’s orientation.

The range node gets the style class .fine-tune added when the scrollbar is in ’fine-tuning’ mode.

Other style classes that may be added to scrollbars inside <GtkScrolledWindow> include the positional classes (.left, .right, .top, .bottom) and style classes related to overlay scrolling (.overlay-indicator, .dragging, .hovering).

Accessibility

<GtkScrollbar> uses the Gtk.AccessibleRole.scrollbar role.

Properties

Property: scrollbar:adjustment self

The <GtkAdjustment> controlled by this scrollbar.

Its value is a <GtkAdjustment>, or #f.

Set it with (set! (scrollbar:adjustment self) value).

Procedures

Method: scrollbar:get-adjustment self ⇒ %return
Method: get-adjustment self ⇒ %return

Returns the scrollbar’s adjustment.

self

Passed: a <GtkScrollbar>.

a <GtkScrollbar>

%return

Returned: a <GtkAdjustment>.

the scrollbar’s adjustment

Procedure: scrollbar:new orientation [adjustment] ⇒ %return

Creates a new scrollbar with the given orientation.

orientation

Passed: a <GtkOrientation>, or one of its symbols.

the scrollbar’s orientation.

adjustment

Passed, or left out: a <GtkAdjustment>, or #f.

the <GtkAdjustment> to use, or #f to create a new adjustment.

%return

Returned: a <GtkWidget>.

the new <GtkScrollbar>.

Method: scrollbar:set-adjustment self [adjustment]
Method: set-adjustment self [adjustment]

Makes the scrollbar use the given adjustment.

self

Passed: a <GtkScrollbar>.

a <GtkScrollbar>

adjustment

Passed, or left out: a <GtkAdjustment>, or #f.

the adjustment to set