Handy.Deck

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 Handy.Swipeable Handy.Swipeable GObject.GInterface->Handy.Swipeable 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.Deck Handy.Deck Gtk.Container->Handy.Deck Gtk.Orientable->Handy.Deck Gtk.Widget->Gtk.Container Handy.Swipeable->Handy.Deck

Subclasses:

None

Methods

Inherited:

Gtk.Container (35), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10), Gtk.Orientable (2), Handy.Swipeable (8)

Structs:

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

class

new ()

get_adjacent_child (direction)

get_can_swipe_back ()

get_can_swipe_forward ()

get_child_by_name (name)

get_homogeneous (orientation)

get_interpolate_size ()

get_transition_duration ()

get_transition_running ()

get_transition_type ()

get_visible_child ()

get_visible_child_name ()

insert_child_after (child, sibling)

navigate (direction)

prepend (child)

reorder_child_after (child, sibling)

set_can_swipe_back (can_swipe_back)

set_can_swipe_forward (can_swipe_forward)

set_homogeneous (orientation, homogeneous)

set_interpolate_size (interpolate_size)

set_transition_duration (duration)

set_transition_type (transition)

set_visible_child (visible_child)

set_visible_child_name (name)

Virtual Methods

Inherited:

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

Properties

Inherited:

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

Name

Type

Flags

Short Description

can-swipe-back

bool

r/w/en

Whether or not swipe gesture can be used to switch to the previous child

can-swipe-forward

bool

r/w/en

Whether or not swipe gesture can be used to switch to the next child

hhomogeneous

bool

r/w/en

Horizontally 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 transition animation duration, in milliseconds

transition-running

bool

r

Whether or not the transition is currently running

transition-type

Handy.DeckTransitionType

r/w/en

The type of animation used to transition between children

vhomogeneous

bool

r/w/en

Vertically homogeneous sizing

visible-child

Gtk.Widget

r/w/en

The widget currently visible

visible-child-name

str

r/w/en

The name of the widget currently visible

Child Properties

Name

Type

Default

Flags

Short Description

name

str

None

r/w

The name of the child page

Style Properties

Inherited:

Gtk.Widget (17)

Signals

Inherited:

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

Fields

Inherited:

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

Name

Type

Access

Description

parent_instance

Gtk.Container

r

Class Details

class Handy.Deck(**kwargs)
Bases:

Gtk.Container, Gtk.Orientable, Handy.Swipeable

Abstract:

No

Structure:

Handy.DeckClass

A swipeable widget showing one of the visible children at a time.

The HdyDeck widget displays one of the visible children, similar to a [class`Gtk`.Stack]. The children are strictly ordered and can be navigated using swipe gestures.

The “over” and “under” stack the children one on top of the other, while the “slide” transition puts the children side by side. While navigating to a child on the side or below can be performed by swiping the current child away, navigating to an upper child requires dragging it from the edge where it resides. This doesn’t affect non-dragging swipes.

The “over” and “under” transitions can draw their shadow on top of the window’s transparent areas, like the rounded corners. This is a side-effect of allowing shadows to be drawn on top of OpenGL areas. It can be mitigated by using [class`Window`] or [class`ApplicationWindow`] as they will crop anything drawn beyond the rounded corners.

CSS nodes

HdyDeck has a single CSS node with name deck.

New in version 1.0.

classmethod new()
Returns:

the newly created HdyDeck

Return type:

Gtk.Widget

Creates a new HdyDeck.

New in version 1.0.

get_adjacent_child(direction)
Parameters:

direction (Handy.NavigationDirection) – the direction

Returns:

the previous or next child

Return type:

Gtk.Widget or None

Finds the previous or next navigatable child.

Gets the previous or next child. This will be the same widget [method`Deck`.navigate] will navigate to.

If there’s no child to navigate to, NULL will be returned instead.

New in version 1.0.

get_can_swipe_back()
Returns:

Whether swipe gestures are enabled.

Return type:

bool

Gets whether swipe gestures for navigating backward are enabled.

New in version 1.0.

get_can_swipe_forward()
Returns:

Whether swipe gestures are enabled.

Return type:

bool

Gets whether swipe gestures for navigating forward enabled.

New in version 1.0.

get_child_by_name(name)
Parameters:

name (str) – the name of the child to find

Returns:

the requested child of self

Return type:

Gtk.Widget or None

Finds the child of self with name.

Returns NULL if there is no child with this name.

New in version 1.0.

get_homogeneous(orientation)
Parameters:

orientation (Gtk.Orientation) – the orientation

Returns:

whether self is homogeneous for the given orientation

Return type:

bool

Gets whether self is homogeneous for the given orientation.

New in version 1.0.

get_interpolate_size()
Returns:

whether child sizes are interpolated

Return type:

bool

Gets whether self will interpolate its size when changing the visible child.

New in version 1.0.

get_transition_duration()
Returns:

the mode transition duration, in milliseconds.

Return type:

int

Gets the mode transition animation duration for self.

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.DeckTransitionType

Gets the type of animation used for transitions between children.

New in version 1.0.

get_visible_child()
Returns:

the visible child widget

Return type:

Gtk.Widget

Gets the visible child widget.

New in version 1.0.

get_visible_child_name()
Returns:

the name of the visible child

Return type:

str

Gets the name of the currently visible child widget.

New in version 1.0.

insert_child_after(child, sibling)
Parameters:

Inserts child in the position after sibling in the list of children.

If sibling is NULL, inserts child at the first position.

New in version 1.2.

navigate(direction)
Parameters:

direction (Handy.NavigationDirection) – the direction

Returns:

whether the visible child was changed

Return type:

bool

Navigates to the previous or next child.

The switch is similar to performing a swipe gesture to go in direction.

New in version 1.0.

prepend(child)
Parameters:

child (Gtk.Widget) – the widget to prepend

Inserts child at the first position in self.

New in version 1.2.

reorder_child_after(child, sibling)
Parameters:
  • child (Gtk.Widget) – the widget to move, must be a child of self

  • sibling (Gtk.Widget or None) – the sibling to move child after

Moves child to the position after sibling in the list of children.

If sibling is NULL, move child to the first position.

New in version 1.2.

set_can_swipe_back(can_swipe_back)
Parameters:

can_swipe_back (bool) – the new value

Sets whether swipe gestures for navigating backward are enabled.

New in version 1.0.

set_can_swipe_forward(can_swipe_forward)
Parameters:

can_swipe_forward (bool) – the new value

Sets whether swipe gestures for navigating forward are enabled.

New in version 1.0.

set_homogeneous(orientation, homogeneous)
Parameters:
  • orientation (Gtk.Orientation) – the orientation

  • homogeneous (bool) – TRUE to make self homogeneous

Sets whether self is homogeneous for a given orientation.

If set to FALSE, different children can have different size along the opposite orientation.

New in version 1.0.

set_interpolate_size(interpolate_size)
Parameters:

interpolate_size (bool) – the new value

Sets whether self will interpolate its size when changing the visible child.

self will interpolate its size between the current one and the one it’ll take after changing the visible child, according to the set transition duration.

New in version 1.0.

set_transition_duration(duration)
Parameters:

duration (int) – the new duration, in milliseconds

Sets the mode transition animation duration for self.

New in version 1.0.

set_transition_type(transition)
Parameters:

transition (Handy.DeckTransitionType) – the new transition type

Sets the type of animation used for transitions between children.

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.

set_visible_child(visible_child)
Parameters:

visible_child (Gtk.Widget) – the new child

Sets the currently visible widget.

New in version 1.0.

set_visible_child_name(name)
Parameters:

name (str) – the name of a child

Makes the child with the name name visible.

See [method`Deck`.set_visible_child] for more details.

New in version 1.0.

Property Details

Handy.Deck.props.can_swipe_back
Name:

can-swipe-back

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether swipe gestures allow switching to the previous child.

New in version 1.0.

Handy.Deck.props.can_swipe_forward
Name:

can-swipe-forward

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether swipe gestures allow switching to the next child.

New in version 1.0.

Handy.Deck.props.hhomogeneous
Name:

hhomogeneous

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Horizontally homogeneous sizing.

New in version 1.0.

Handy.Deck.props.interpolate_size
Name:

interpolate-size

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

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

New in version 1.0.

Handy.Deck.props.transition_duration
Name:

transition-duration

Type:

int

Default Value:

200

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The transition animation duration, in milliseconds.

New in version 1.0.

Handy.Deck.props.transition_running
Name:

transition-running

Type:

bool

Default Value:

False

Flags:

READABLE

Whether or not the transition is currently running.

New in version 1.0.

Handy.Deck.props.transition_type
Name:

transition-type

Type:

Handy.DeckTransitionType

Default Value:

Handy.DeckTransitionType.OVER

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The type of animation that will be used for transitions between children.

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.Deck.props.vhomogeneous
Name:

vhomogeneous

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Vertically homogeneous sizing.

New in version 1.0.

Handy.Deck.props.visible_child
Name:

visible-child

Type:

Gtk.Widget

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The widget currently visible.

The transition is determined by [property`Deck`:py:data::transition-type<Handy.Deck.props.transition_type>] and [property`Deck`:py:data::transition-duration<Handy.Deck.props.transition_duration>]. The transition can be cancelled by the user, in which case visible child will change back to the previously visible child.

New in version 1.0.

Handy.Deck.props.visible_child_name
Name:

visible-child-name

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The name of the widget currently visible.

New in version 1.0.