2.14 <GtkScrollable>

Interface: <GtkScrollable>

An interface for widgets with native scrolling ability.

To implement this interface you should override the scrollable:hadjustment and scrollable:vadjustment properties.

Creating a scrollable widget

All scrollable widgets should do the following.

  • When a parent widget sets the scrollable child widget’s adjustments, the widget should connect to the adjustment:value-changed signal. The child widget should then populate the adjustments’ properties as soon as possible, which usually means queueing an allocation right away and populating the properties in the widget:do-size-allocate implementation.
  • Because its preferred size is the size for a fully expanded widget, the scrollable widget must be able to cope with underallocations. This means that it must accept any value passed to its widget:do-size-allocate implementation.
  • When the parent allocates space to the scrollable child widget, the widget must ensure the adjustments’ property values are correct and up to date, for example using adjustment:configure.
  • When any of the adjustments emits the adjustment:value-changed signal, the scrollable widget should scroll its contents.

Properties

Property: scrollable:hadjustment self

Horizontal <GtkAdjustment> of the scrollable widget.

This adjustment is shared between the scrollable widget and its parent.

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

Set it with (set! (scrollable:hadjustment self) value).

Property: scrollable:hscroll-policy self

Determines when horizontal scrolling should start.

Its value is a <GtkScrollablePolicy> (or, to set it, one of its symbols).

Set it with (set! (scrollable:hscroll-policy self) value).

Property: scrollable:vadjustment self

Vertical <GtkAdjustment> of the scrollable widget.

This adjustment is shared between the scrollable widget and its parent.

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

Set it with (set! (scrollable:vadjustment self) value).

Property: scrollable:vscroll-policy self

Determines when vertical scrolling should start.

Its value is a <GtkScrollablePolicy> (or, to set it, one of its symbols).

Set it with (set! (scrollable:vscroll-policy self) value).

Procedures

Method: scrollable:get-border! self border ⇒ %return border
Method: get-border! self border ⇒ %return border

Returns the size of a non-scrolling border around the outside of the scrollable.

An example for this would be treeview headers. GTK can use this information to display overlaid graphics, like the overshoot indication, at the right position.

self

Passed: a <GtkScrollable>.

a <GtkScrollable>

border

Passed, filled in, and returned: a <GtkBorder>.

return location for the results

%return

Returned: a boolean.

#t if border has been set

Method: scrollable:get-hadjustment self ⇒ %return
Method: get-hadjustment self ⇒ %return

Retrieves the <GtkAdjustment> used for horizontal scrolling.

self

Passed: a <GtkScrollable>.

a <GtkScrollable>

%return

Returned: a <GtkAdjustment>, or #f.

horizontal <GtkAdjustment>.

Method: scrollable:get-hscroll-policy self ⇒ %return
Method: get-hscroll-policy self ⇒ %return

Gets the horizontal <GtkScrollablePolicy>.

self

Passed: a <GtkScrollable>.

a <GtkScrollable>

%return

Returned: a <GtkScrollablePolicy>.

The horizontal <GtkScrollablePolicy>.

Method: scrollable:get-vadjustment self ⇒ %return
Method: get-vadjustment self ⇒ %return

Retrieves the <GtkAdjustment> used for vertical scrolling.

self

Passed: a <GtkScrollable>.

a <GtkScrollable>

%return

Returned: a <GtkAdjustment>, or #f.

vertical <GtkAdjustment>.

Method: scrollable:get-vscroll-policy self ⇒ %return
Method: get-vscroll-policy self ⇒ %return

Gets the vertical <GtkScrollablePolicy>.

self

Passed: a <GtkScrollable>.

a <GtkScrollable>

%return

Returned: a <GtkScrollablePolicy>.

The vertical <GtkScrollablePolicy>.

Method: scrollable:set-hadjustment self [hadjustment]
Method: set-hadjustment self [hadjustment]

Sets the horizontal adjustment of the <GtkScrollable>.

self

Passed: a <GtkScrollable>.

a <GtkScrollable>

hadjustment

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

a <GtkAdjustment>

Method: scrollable:set-hscroll-policy self policy
Method: set-hscroll-policy self policy

Sets the <GtkScrollablePolicy>.

The policy determines whether horizontal scrolling should start below the minimum width or below the natural width.

self

Passed: a <GtkScrollable>.

a <GtkScrollable>

policy

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

the horizontal <GtkScrollablePolicy>

Method: scrollable:set-vadjustment self [vadjustment]
Method: set-vadjustment self [vadjustment]

Sets the vertical adjustment of the <GtkScrollable>.

self

Passed: a <GtkScrollable>.

a <GtkScrollable>

vadjustment

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

a <GtkAdjustment>

Method: scrollable:set-vscroll-policy self policy
Method: set-vscroll-policy self policy

Sets the <GtkScrollablePolicy>.

The policy determines whether vertical scrolling should start below the minimum height or below the natural height.

self

Passed: a <GtkScrollable>.

a <GtkScrollable>

policy

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

the vertical <GtkScrollablePolicy>

Virtual methods

Virtual method: scrollable:do-get-border implementor self border ⇒ %return border

Returns the size of a non-scrolling border around the outside of the scrollable.

An example for this would be treeview headers. GTK can use this information to display overlaid graphics, like the overshoot indication, at the right position.

To override it in a new class, give register-type #:vfuncs `((get-border . ,procedure)). The procedure is called as (procedure self border) ⇒ %return.

implementor

Passed: the class whose implementation to call: a class that implements <GtkScrollable>, or its GType number.

self

Passed: a <GtkScrollable>.

a <GtkScrollable>

border

Passed, filled in, and returned: a <GtkBorder>.

return location for the results

%return

Returned: a boolean.

#t if border has been set