Handy.Squeezer

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.Buildable->Gtk.Widget Gtk.Container Gtk.Container Handy.Squeezer Handy.Squeezer Gtk.Container->Handy.Squeezer Gtk.Orientable->Handy.Squeezer Gtk.Widget->Gtk.Container

Subclasses:

None

Methods

Inherited:

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_child_enabled (child)

get_homogeneous ()

get_interpolate_size ()

get_transition_duration ()

get_transition_running ()

get_transition_type ()

get_visible_child ()

get_xalign ()

get_yalign ()

set_child_enabled (child, enabled)

set_homogeneous (homogeneous)

set_interpolate_size (interpolate_size)

set_transition_duration (duration)

set_transition_type (transition)

set_xalign (xalign)

set_yalign (yalign)

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

homogeneous

bool

r/w/en

Homogeneous sizing

interpolate-size

bool

r/w/en

Whether or not the size should smoothly change when changing between differently sized children

transition-duration

int

r/w/en

The animation duration, in milliseconds

transition-running

bool

r

Whether or not the transition is currently running

transition-type

Handy.SqueezerTransitionType

r/w/en

The type of animation used to transition

visible-child

Gtk.Widget

r/en

The widget currently visible in the squeezer

xalign

float

r/w/en

The horizontal alignment, from 0 (start) to 1 (end)

yalign

float

r/w/en

The vertical alignment, from 0 (top) to 1 (bottom)

Child Properties

Name

Type

Default

Flags

Short Description

enabled

bool

True

r/w

Whether the child can be picked or should be ignored when looking for the child fitting the available size best

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.Squeezer(**kwargs)
Bases:

Gtk.Container, Gtk.Orientable

Abstract:

No

Structure:

Handy.SqueezerClass

A best fit container.

The HdySqueezer widget is a container which only shows the first of its children that fits in the available size. It is convenient to offer different widgets to represent the same data with different levels of detail, making the widget seem to squeeze itself to fit in the available space.

Transitions between children can be animated as fades. This can be controlled with [method`Squeezer`.set_transition_type].

CSS nodes

HdySqueezer has a single CSS node with name squeezer.

New in version 1.0.

classmethod new()
Returns:

the newly created HdySqueezer

Return type:

Gtk.Widget

Creates a new HdySqueezer.

New in version 1.0.

get_child_enabled(child)
Parameters:

child (Gtk.Widget) – a child of self

Returns:

whether child is enabled

Return type:

bool

Gets whether child is enabled.

See [method`Squeezer`.set_child_enabled].

New in version 1.0.

get_homogeneous()
Returns:

whether self is homogeneous

Return type:

bool

Gets whether self is homogeneous.

New in version 1.0.

get_interpolate_size()
Returns:

whether self interpolates its size on visible child change

Return type:

bool

Gets whether self should interpolate its size on visible child change.

New in version 1.0.

get_transition_duration()
Returns:

the transition duration, in milliseconds

Return type:

int

Gets the amount of time that transitions between children will take.

New in version 1.0.

get_transition_running()
Returns:

whether a transition is currently running

Return type:

bool

Gets whether a transition is currently running for self.

New in version 1.0.

get_transition_type()
Returns:

the current transition type of self

Return type:

Handy.SqueezerTransitionType

Gets the animation type that will be used for transitions between children.

New in version 1.0.

get_visible_child()
Returns:

the visible child

Return type:

Gtk.Widget or None

Gets the currently visible child of self.

New in version 1.0.

get_xalign()
Returns:

the xalign property

Return type:

float

Gets the horizontal alignment.

New in version 1.0.

get_yalign()
Returns:

the yalign property

Return type:

float

Gets the vertical alignment.

New in version 1.0.

set_child_enabled(child, enabled)
Parameters:
  • child (Gtk.Widget) – a child of self

  • enabled (bool) – whether to enable the child

Sets whether child is enabled.

If a child is disabled, it will be ignored when looking for the child fitting the available size best. This allows to programmatically and prematurely hide a child of self even if it fits in the available space.

This can be used e.g. to ensure a certain child is hidden below a certain window width, or any other constraint you find suitable.

New in version 1.0.

set_homogeneous(homogeneous)
Parameters:

homogeneous (bool) – TRUE to make self homogeneous

Sets whether all children have the same size for the opposite orientation.

New in version 1.0.

set_interpolate_size(interpolate_size)
Parameters:

interpolate_size (bool) – TRUE to interpolate the size

Sets whether self should interpolate its size on visible child change.

New in version 1.0.

set_transition_duration(duration)
Parameters:

duration (int) – the new duration, in milliseconds

Sets the duration that transitions between children in self will take.

New in version 1.0.

set_transition_type(transition)
Parameters:

transition (Handy.SqueezerTransitionType) – the new transition type

Sets the animation type that will be used for transitions between children.

New in version 1.0.

set_xalign(xalign)
Parameters:

xalign (float) – the new xalign value, between 0 and 1

Sets the horizontal alignment.

New in version 1.0.

set_yalign(yalign)
Parameters:

yalign (float) – the new yalign value, between 0 and 1

Sets the vertical alignment.

New in version 1.0.

Property Details

Handy.Squeezer.props.homogeneous
Name:

homogeneous

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether all children have the same size for the opposite orientation.

For example, if a squeezer is horizontal and is homogeneous, it will request the same height for all its children. If it isn’t, the squeezer may change size when a different child becomes visible.

New in version 1.0.

Handy.Squeezer.props.interpolate_size
Name:

interpolate-size

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the squeezer interpolates its size when changing the visible child.

If TRUE, the squeezer will interpolate its size between the one of the previous visible child and the one of the new visible child, according to the set transition duration and the orientation, e.g. if the squeezer is horizontal, it will interpolate the its height.

New in version 1.0.

Handy.Squeezer.props.transition_duration
Name:

transition-duration

Type:

int

Default Value:

200

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The animation duration, in milliseconds.

New in version 1.0.

Handy.Squeezer.props.transition_running
Name:

transition-running

Type:

bool

Default Value:

False

Flags:

READABLE

Whether a transition is currently running.

New in version 1.0.

Handy.Squeezer.props.transition_type
Name:

transition-type

Type:

Handy.SqueezerTransitionType

Default Value:

Handy.SqueezerTransitionType.NONE

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The type of animation used for transitions between children.

Available types include various kinds of fades and slides.

The transition type can be changed without problems at runtime, so it is possible to change the animation based on the child that is about to become current.

New in version 1.0.

Handy.Squeezer.props.visible_child
Name:

visible-child

Type:

Gtk.Widget

Default Value:

None

Flags:

READABLE, EXPLICIT_NOTIFY

The currently visible child.

New in version 1.0.

Handy.Squeezer.props.xalign
Name:

xalign

Type:

float

Default Value:

0.5

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The horizontal alignment, from 0 (start) to 1 (end).

The xalign property determines the horizontal alignment of the children inside the squeezer’s size allocation. Compare this to [property`Gtk`.Widget:halign], which determines how the squeezer’s size allocation is positioned in the space available for the squeezer.

This will affect the position of children too wide to fit in the squeezer as they are fading out.

New in version 1.0.

Handy.Squeezer.props.yalign
Name:

yalign

Type:

float

Default Value:

0.5

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The vertical alignment, from 0 (start) to 1 (end).

The yalign property determines the vertical alignment of the children inside the squeezer’s size allocation. Compare this to [property`Gtk`.Widget:valign], which determines how the squeezer’s size allocation is positioned in the space available for the squeezer.

This will affect the position of children too tall to fit in the squeezer as they are fading out.

New in version 1.0.