ClampScrollable

class ClampScrollable(**properties: Any)

Superclasses: Widget, InitiallyUnowned, Object

Implemented Interfaces: Accessible, Buildable, ConstraintTarget, Orientable, Scrollable

A scrollable Clamp.

AdwClampScrollable is a variant of Clamp that implements the Scrollable interface.

The primary use case for AdwClampScrollable is clamping ListView.

Constructors

class ClampScrollable
classmethod new() Widget

Creates a new AdwClampScrollable.

Methods

class ClampScrollable
get_child() Widget | None

Gets the child widget of self.

get_maximum_size() int

Gets the maximum size allocated to the child.

get_tightening_threshold() int

Gets the size above which the child is clamped.

get_unit() LengthUnit

Gets the length unit for maximum size and tightening threshold.

Added in version 1.4.

set_child(child: Widget | None = None) None

Sets the child widget of self.

Parameters:

child – the child widget

set_maximum_size(maximum_size: int) None

Sets the maximum size allocated to the child.

It is the width if the clamp is horizontal, or the height if it is vertical.

Parameters:

maximum_size – the maximum size

set_tightening_threshold(tightening_threshold: int) None

Sets the size above which the child is clamped.

Starting from this size, the clamp will tighten its grip on the child, slowly allocating less and less of the available size up to the maximum allocated size. Below that threshold and below the maximum width, the child will be allocated all the available size.

If the threshold is greater than the maximum size to allocate to the child, the child will be allocated all the width up to the maximum. If the threshold is lower than the minimum size to allocate to the child, that size will be used as the tightening threshold.

Effectively, tightening the grip on the child before it reaches its maximum size makes transitions to and from the maximum size smoother when resizing.

Parameters:

tightening_threshold – the tightening threshold

set_unit(unit: LengthUnit) None

Sets the length unit for maximum size and tightening threshold.

Allows the sizes to vary depending on the text scale factor.

Added in version 1.4.

Parameters:

unit – the length unit

Properties

class ClampScrollable
props.child: Widget

The child widget of the AdwClampScrollable.

props.maximum_size: int

The maximum size allocated to the child.

It is the width if the clamp is horizontal, or the height if it is vertical.

props.tightening_threshold: int

The size above which the child is clamped.

Starting from this size, the clamp will tighten its grip on the child, slowly allocating less and less of the available size up to the maximum allocated size. Below that threshold and below the maximum width, the child will be allocated all the available size.

If the threshold is greater than the maximum size to allocate to the child, the child will be allocated all the width up to the maximum. If the threshold is lower than the minimum size to allocate to the child, that size will be used as the tightening threshold.

Effectively, tightening the grip on the child before it reaches its maximum size makes transitions to and from the maximum size smoother when resizing.

props.unit: LengthUnit

The length unit for maximum size and tightening threshold.

Allows the sizes to vary depending on the text scale factor.

Added in version 1.4.