Handy.Clamp

g Atk.ImplementorIface Atk.ImplementorIface Gtk.Widget Gtk.Widget Atk.ImplementorIface->Gtk.Widget GObject.GInterface GObject.GInterface GObject.GInterface->Atk.ImplementorIface Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.Orientable Gtk.Orientable GObject.GInterface->Gtk.Orientable GObject.InitiallyUnowned GObject.InitiallyUnowned GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Bin Gtk.Bin Handy.Clamp Handy.Clamp Gtk.Bin->Handy.Clamp Gtk.Buildable->Gtk.Widget Gtk.Container Gtk.Container Gtk.Container->Gtk.Bin Gtk.Orientable->Handy.Clamp Gtk.Widget->Gtk.Container

Subclasses:

None

Methods

Inherited:

Gtk.Bin (1), Gtk.Container (35), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10), Gtk.Orientable (2)

Structs:

Gtk.ContainerClass (5), Gtk.WidgetClass (12), GObject.ObjectClass (5)

class

new ()

get_maximum_size ()

get_tightening_threshold ()

set_maximum_size (maximum_size)

set_tightening_threshold (tightening_threshold)

Virtual Methods

Inherited:

Gtk.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10)

Properties

Inherited:

Gtk.Container (3), Gtk.Widget (39), Gtk.Orientable (1)

Name

Type

Flags

Short Description

maximum-size

int

r/w/en

The maximum size allocated to the child

tightening-threshold

int

r/w/en

The size from which the clamp will tighten its grip on the child

Style Properties

Inherited:

Gtk.Widget (17)

Signals

Inherited:

Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Fields

Inherited:

Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Class Details

class Handy.Clamp(**kwargs)
Bases:

Gtk.Bin, Gtk.Orientable

Abstract:

No

Structure:

Handy.ClampClass

A widget constraining its child to a given size.

The HdyClamp widget constrains the size of the widget it contains to a given maximum size. It will constrain the width if it is horizontal, or the height if it is vertical. The expansion of the child from its minimum to its maximum size is eased out for a smooth transition.

If the child requires more than the requested maximum size, it will be allocated the minimum size it can fit in instead.

CSS nodes

HdyClamp has a single CSS node with name clamp.

The node will get the style classes .large when its child reached its maximum size, .small when the clamp allocates its full size to its child, .medium in-between, or none if it didn’t compute its size yet.

New in version 1.0.

classmethod new()
Returns:

the newly created HdyClamp

Return type:

Gtk.Widget

Creates a new HdyClamp.

New in version 1.0.

get_maximum_size()
Returns:

the maximum size to allocate to the children

Return type:

int

Gets the maximum size allocated to the children.

New in version 1.0.

get_tightening_threshold()
Returns:

the size above which the children are clamped

Return type:

int

Gets the size above which the children are clamped.

New in version 1.0.

set_maximum_size(maximum_size)
Parameters:

maximum_size (int) – the maximum size

Sets the maximum size allocated to the children.

New in version 1.0.

set_tightening_threshold(tightening_threshold)
Parameters:

tightening_threshold (int) – the tightening threshold

Sets the size above which the children are clamped.

New in version 1.0.

Property Details

Handy.Clamp.props.maximum_size
Name:

maximum-size

Type:

int

Default Value:

600

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The maximum size to allocate the children.

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

New in version 1.0.

Handy.Clamp.props.tightening_threshold
Name:

tightening-threshold

Type:

int

Default Value:

400

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The size above which the child is clamped.

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

If the threshold is greater than the maximum size to allocate to the children, they will be allocated the whole size up to the maximum. If the threshold is lower than the minimum size to allocate to the children, that size will be used as the tightening threshold.

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

New in version 1.0.