Handy.Leaflet
Description: Reference for Handy.Leaflet

### Class

# HandyLeaflet

#### Description [src]

    class Handy.Leaflet : Gtk.Container {
      parent_instance: GtkContainer
    }

An adaptive container acting like a box or a stack.

The `HdyLeaflet` widget can display its children like a `GtkBox` does or like a `GtkStack` does, adapting to size changes by switching between the two modes.

When there is enough space the children are displayed side by side, otherwise only one is displayed and the leaflet is said to be “folded”. The threshold is dictated by the preferred minimum sizes of the children. When a leaflet is folded, the children can be navigated using swipe gestures.

The “over” and “under” transition types 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 `HdyWindow` or `HdyApplicationWindow` as they will crop anything drawn beyond the rounded corners.

The child property `navigatable` can be set on `HdyLeaflet` children to determine whether they can be navigated to when folded. If `FALSE`, the child will be ignored by `hdy_leaflet_get_adjacent_child()`, `hdy_leaflet_navigate()`, and swipe gestures. This can be used used to prevent switching to widgets like separators.

## CSS nodes

`HdyLeaflet` has a single CSS node with name `leaflet`. The node will get the style classes `.folded` when it is folded, `.unfolded` when it’s not, or none if it didn’t compute its fold yet.

Available since: | 1.0

#### Ancestors

- GtkContainer
- GtkWidget
- GInitiallyUnowned
- GObject

#### Implements

- AtkImplementorIface
- GtkBuildable
- GtkOrientable
- HdySwipeable

#### Constructors

###### hdy_leaflet_new

Creates a new `HdyLeaflet`.

Available since: 1.0

#### Instance methods

###### hdy_leaflet_get_adjacent_child

Finds the previous or next navigatable child.

Available since: 1.0

###### hdy_leaflet_get_can_swipe_back

Gets whether swipe gestures switch to the previous navigatable child.

Available since: 1.0

###### hdy_leaflet_get_can_swipe_forward

Gets whether swipe gestures switch to the next navigatable child.

Available since: 1.0

###### hdy_leaflet_get_child_by_name

Finds the child of `self` with the name given as the argument.

Available since: 1.0

###### hdy_leaflet_get_child_transition_duration

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

Available since: 1.0

###### hdy_leaflet_get_child_transition_running

Returns whether `self` is currently in a transition from one page to another.

Available since: 1.0

###### hdy_leaflet_get_folded

Gets whether `self` is folded.

Available since: 1.0

###### hdy_leaflet_get_homogeneous

Gets whether `self` is homogeneous for the given fold and orientation.

Available since: 1.0

###### hdy_leaflet_get_interpolate_size

Gets whether to interpolate between the sizes of children on page switches.

Available since: 1.0

###### hdy_leaflet_get_mode_transition_duration

Gets the amount of time that transitions between modes in `self` will take.

Available since: 1.0

###### hdy_leaflet_get_transition_type

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

Available since: 1.0

###### hdy_leaflet_get_visible_child

Gets the visible child widget.

Available since: 1.0

###### hdy_leaflet_get_visible_child_name

Gets the name of the currently visible child widget.

Available since: 1.0

###### hdy_leaflet_insert_child_after

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

Available since: 1.2

###### hdy_leaflet_navigate

Navigates to the previous or next navigatable child.

Available since: 1.0

###### hdy_leaflet_prepend

Inserts `child` at the first position in `self`.

Available since: 1.2

###### hdy_leaflet_reorder_child_after

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

Available since: 1.2

###### hdy_leaflet_set_can_swipe_back

Sets whether swipe gestures switch to the previous navigatable child.

Available since: 1.0

###### hdy_leaflet_set_can_swipe_forward

Sets whether swipe gestures switch to the next navigatable child.

Available since: 1.0

###### hdy_leaflet_set_child_transition_duration

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

Available since: 1.0

###### hdy_leaflet_set_homogeneous

Sets whether to be homogeneous for the given fold and orientation.

Available since: 1.0

###### hdy_leaflet_set_interpolate_size

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

Available since: 1.0

###### hdy_leaflet_set_mode_transition_duration

Sets the duration that transitions between modes in `self` will take.

Available since: 1.0

###### hdy_leaflet_set_transition_type

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

Available since: 1.0

###### hdy_leaflet_set_visible_child

Sets the currently visible widget when the leaflet is folded.

Available since: 1.0

###### hdy_leaflet_set_visible_child_name

Makes the child with the name `name` visible.

Available since: 1.0

##### Methods inherited from HdySwipeable (8)

###### hdy_swipeable_emit_child_switched

Emits `HdySwipeable::child-switched` signal.

Available since: 1.0

###### hdy_swipeable_get_cancel_progress

Gets the progress `self` will snap back to after the gesture is canceled.

Available since: 1.0

###### hdy_swipeable_get_distance

Gets the swipe distance of `self`.

Available since: 1.0

###### hdy_swipeable_get_progress

Gets the current progress of `self`.

Available since: 1.0

###### hdy_swipeable_get_snap_points

Gets the snap points of `self`.

Available since: 1.0

###### hdy_swipeable_get_swipe_area

Gets the area `self` can start a swipe from for the given direction and gesture type.

Available since: 1.0

###### hdy_swipeable_get_swipe_tracker

Gets the `HdySwipeTracker` used by this swipeable widget.

Available since: 1.0

###### hdy_swipeable_switch_child

Switches to child with index `index`.

Available since: 1.0

#### Properties

###### Handy.Leaflet:can-swipe-back

Whether swipe gestures allow switching to the previous navigatable child.

Available since: 1.0

###### Handy.Leaflet:can-swipe-forward

Whether swipe gestures allow switching to the next navigatable child.

Available since: 1.0

###### Handy.Leaflet:child-transition-duration

The child transition animation duration, in milliseconds.

Available since: 1.0

###### Handy.Leaflet:child-transition-running

Whether a child transition is currently running.

Available since: 1.0

###### Handy.Leaflet:folded

Whether the leaflet is folded.

Available since: 1.0

###### Handy.Leaflet:hhomogeneous-folded

Whether to allocate the same width for all children when folded.

Available since: 1.0

###### Handy.Leaflet:hhomogeneous-unfolded

Whether to allocate the same width for all children when unfolded.

Available since: 1.0

###### Handy.Leaflet:interpolate-size

Whether the size should smoothly change when changing between children.

Available since: 1.0

###### Handy.Leaflet:mode-transition-duration

The mode transition animation duration, in milliseconds.

Available since: 1.0

###### Handy.Leaflet:transition-type

The animation type used for transitions between modes and children.

Available since: 1.0

###### Handy.Leaflet:vhomogeneous-folded

Whether to allocates the same height for all children when folded.

Available since: 1.0

###### Handy.Leaflet:vhomogeneous-unfolded

Whether to allocate the same height for all children when unfolded.

Available since: 1.0

###### Handy.Leaflet:visible-child

The widget currently visible when the leaflet is folded.

Available since: 1.0

###### Handy.Leaflet:visible-child-name

The name of the widget currently visible when the leaflet is folded.

Available since: 1.0

#### Class structure

    struct HandyLeafletClass {
      GtkContainerClass parent_class;

    }

###### Class members

`parent_class` |
    GtkContainerClass
| The parent class.