Gtk.Scrollable

g GObject.GInterface GObject.GInterface Gtk.Scrollable Gtk.Scrollable GObject.GInterface->Gtk.Scrollable

Implementations:

Gtk.ColumnView, Gtk.IconView, Gtk.ListBase, Gtk.TextView, Gtk.TreeView, Gtk.Viewport

Methods

get_border ()

get_hadjustment ()

get_hscroll_policy ()

get_vadjustment ()

get_vscroll_policy ()

set_hadjustment (hadjustment)

set_hscroll_policy (policy)

set_vadjustment (vadjustment)

set_vscroll_policy (policy)

Virtual Methods

do_get_border ()

Properties

Name

Type

Flags

Short Description

hadjustment

Gtk.Adjustment

r/w/c

hscroll-policy

Gtk.ScrollablePolicy

r/w/en

vadjustment

Gtk.Adjustment

r/w/c

vscroll-policy

Gtk.ScrollablePolicy

r/w/en

Signals

None

Fields

None

Class Details

class Gtk.Scrollable
Bases:

GObject.GInterface

Structure:

Gtk.ScrollableInterface

GtkScrollable is an interface for widgets with native scrolling ability.

To implement this interface you should override the [property`Gtk`.Scrollable:hadjustment] and [property`Gtk`.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 [signal`Gtk`.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 [vfunc`Gtk`.Widget.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 [vfunc`Gtk`.Widget.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 [method`Gtk`.Adjustment.configure].

  • When any of the adjustments emits the [signal`Gtk`.Adjustment::value-changed] signal, the scrollable widget should scroll its contents.

get_border()[source]
Returns:

True if border has been set

border:

return location for the results

Return type:

(bool, border: Gtk.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.

get_hadjustment()[source]
Returns:

horizontal GtkAdjustment.

Return type:

Gtk.Adjustment or None

Retrieves the GtkAdjustment used for horizontal scrolling.

get_hscroll_policy()[source]
Returns:

The horizontal GtkScrollablePolicy.

Return type:

Gtk.ScrollablePolicy

Gets the horizontal GtkScrollablePolicy.

get_vadjustment()[source]
Returns:

vertical GtkAdjustment.

Return type:

Gtk.Adjustment or None

Retrieves the GtkAdjustment used for vertical scrolling.

get_vscroll_policy()[source]
Returns:

The vertical GtkScrollablePolicy.

Return type:

Gtk.ScrollablePolicy

Gets the vertical GtkScrollablePolicy.

set_hadjustment(hadjustment)[source]
Parameters:

hadjustment (Gtk.Adjustment or None) – a GtkAdjustment

Sets the horizontal adjustment of the GtkScrollable.

set_hscroll_policy(policy)[source]
Parameters:

policy (Gtk.ScrollablePolicy) – the horizontal GtkScrollablePolicy

Sets the GtkScrollablePolicy.

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

set_vadjustment(vadjustment)[source]
Parameters:

vadjustment (Gtk.Adjustment or None) – a GtkAdjustment

Sets the vertical adjustment of the GtkScrollable.

set_vscroll_policy(policy)[source]
Parameters:

policy (Gtk.ScrollablePolicy) – the vertical GtkScrollablePolicy

Sets the GtkScrollablePolicy.

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

do_get_border() virtual
Returns:

True if border has been set

border:

return location for the results

Return type:

(bool, border: Gtk.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.

Property Details

Gtk.Scrollable.props.hadjustment
Name:

hadjustment

Type:

Gtk.Adjustment

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT

Horizontal GtkAdjustment of the scrollable widget.

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

Gtk.Scrollable.props.hscroll_policy
Name:

hscroll-policy

Type:

Gtk.ScrollablePolicy

Default Value:

Gtk.ScrollablePolicy.MINIMUM

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Determines when horizontal scrolling should start.

Gtk.Scrollable.props.vadjustment
Name:

vadjustment

Type:

Gtk.Adjustment

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT

Vertical GtkAdjustment of the scrollable widget.

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

Gtk.Scrollable.props.vscroll_policy
Name:

vscroll-policy

Type:

Gtk.ScrollablePolicy

Default Value:

Gtk.ScrollablePolicy.MINIMUM

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Determines when vertical scrolling should start.