HdyLeaflet: Handy Reference Manual

## HdyLeaflet HdyLeaflet — An adaptive container acting like a box or a stack. |

## Functions

GtkWidget * | hdy_leaflet_new ()
HdyFold | hdy_leaflet_get_fold ()
GtkWidget * | hdy_leaflet_get_visible_child ()
void | hdy_leaflet_set_visible_child ()
const gchar * | hdy_leaflet_get_visible_child_name ()
void | hdy_leaflet_set_visible_child_name ()
gboolean | hdy_leaflet_get_homogeneous ()
void | hdy_leaflet_set_homogeneous ()
HdyLeafletTransitionType | hdy_leaflet_get_transition_type ()
void | hdy_leaflet_set_transition_type ()
HdyLeafletModeTransitionType | hdy_leaflet_get_mode_transition_type ()
void | hdy_leaflet_set_mode_transition_type ()
guint | hdy_leaflet_get_mode_transition_duration ()
void | hdy_leaflet_set_mode_transition_duration ()
HdyLeafletChildTransitionType | hdy_leaflet_get_child_transition_type ()
void | hdy_leaflet_set_child_transition_type ()
guint | hdy_leaflet_get_child_transition_duration ()
void | hdy_leaflet_set_child_transition_duration ()
gboolean | hdy_leaflet_get_child_transition_running ()
gboolean | hdy_leaflet_get_interpolate_size ()
void | hdy_leaflet_set_interpolate_size ()
gboolean | hdy_leaflet_get_can_swipe_back ()
void | hdy_leaflet_set_can_swipe_back ()
gboolean | hdy_leaflet_get_can_swipe_forward ()
void | hdy_leaflet_set_can_swipe_forward ()

## Properties

gboolean | can-swipe-back | Read / Write
gboolean | can-swipe-forward | Read / Write
guint | child-transition-duration | Read / Write
gboolean | child-transition-running | Read
HdyLeafletChildTransitionType | child-transition-type | Read / Write
HdyFold | fold | Read
gboolean | folded | Read
gboolean | hhomogeneous-folded | Read / Write
gboolean | hhomogeneous-unfolded | Read / Write
gboolean | interpolate-size | Read / Write
guint | mode-transition-duration | Read / Write
HdyLeafletModeTransitionType | mode-transition-type | Read / Write
HdyLeafletTransitionType | transition-type | Read / Write
gboolean | vhomogeneous-folded | Read / Write
gboolean | vhomogeneous-unfolded | Read / Write
GtkWidget * | visible-child | Read / Write
char * | visible-child-name | Read / Write

## Types and Values

#define | HDY_TYPE_LEAFLET
enum | HdyLeafletTransitionType
enum | HdyLeafletModeTransitionType
enum | HdyLeafletChildTransitionType
struct | HdyLeafletClass
| HdyLeaflet

## Object Hierarchy

        GEnum
        ├── HdyLeafletChildTransitionType
        ├── HdyLeafletModeTransitionType
        ╰── HdyLeafletTransitionType
        GObject
        ╰── GInitiallyUnowned
            ╰── GtkWidget
                ╰── GtkContainer
                    ╰── HdyLeaflet

## Implemented Interfaces

HdyLeaflet implements AtkImplementorIface, GtkBuildable, GtkOrientable and HdySwipeable.

## Description

The HdyLeaflet widget can display its children like a GtkBox does or like a HdyLeaflet 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. The threshold is dictated by the preferred minimum sizes of the children.

## Functions

### hdy_leaflet_new ()

    GtkWidget *
    hdy_leaflet_new (void);

### hdy_leaflet_get_fold ()

    HdyFold
    hdy_leaflet_get_fold (HdyLeaflet *self);

Gets the fold of `self` .

#### Parameters

self | a HdyLeaflet |

#### Returns

the fold of `self` .

### hdy_leaflet_get_visible_child ()

    GtkWidget *
    hdy_leaflet_get_visible_child (HdyLeaflet *self);

Get the visible child widget.

#### Parameters

self | a HdyLeaflet |

#### Returns

the visible child widget.

[transfer none]

### hdy_leaflet_set_visible_child ()

    void
    hdy_leaflet_set_visible_child (HdyLeaflet *self,
                                   GtkWidget *visible_child);

### hdy_leaflet_get_visible_child_name ()

    const gchar *
    hdy_leaflet_get_visible_child_name (HdyLeaflet *self);

### hdy_leaflet_set_visible_child_name ()

    void
    hdy_leaflet_set_visible_child_name (HdyLeaflet *self,
                                        const gchar *name);

### hdy_leaflet_get_homogeneous ()

    gboolean
    hdy_leaflet_get_homogeneous (HdyLeaflet *self,
                                 HdyFold fold,
                                 GtkOrientation orientation);

Gets whether `self` is homogeneous for the given fold and orientation. See `hdy_leaflet_set_homogeneous()`.

#### Parameters

self | a HdyLeaflet |
fold | the fold |
orientation | the orientation |

#### Returns

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

### hdy_leaflet_set_homogeneous ()

    void
    hdy_leaflet_set_homogeneous (HdyLeaflet *self,
                                 HdyFold fold,
                                 GtkOrientation orientation,
                                 gboolean homogeneous);

Sets the HdyLeaflet to be homogeneous or not for the given fold and orientation. If it is homogeneous, the HdyLeaflet will request the same width or height for all its children depending on the orientation. If it isn't and it is folded, the leaflet may change width or height when a different child becomes visible.

#### Parameters

self | a HdyLeaflet |
fold | the fold |
orientation | the orientation |
homogeneous | `TRUE` to make `self` homogeneous |

### hdy_leaflet_get_transition_type ()

    HdyLeafletTransitionType
    hdy_leaflet_get_transition_type (HdyLeaflet *self);

Gets the type of animation that will be used for transitions between modes and children in `self` .

#### Parameters

self | a HdyLeaflet |

#### Returns

the current transition type of `self`

Since: 0.0.12

### hdy_leaflet_set_transition_type ()

    void
    hdy_leaflet_set_transition_type (HdyLeaflet *self,
                                     HdyLeafletTransitionType transition);

Sets the type of animation that will be used for transitions between modes and children in `self` .

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

#### Parameters

self | a HdyLeaflet |
transition | the new transition type |

Since: 0.0.12

### hdy_leaflet_get_mode_transition_type ()

    HdyLeafletModeTransitionType
    hdy_leaflet_get_mode_transition_type (HdyLeaflet *self);

`hdy_leaflet_get_mode_transition_type` has been deprecated since version 0.0.12 and should not be used in newly-written code.

Use `hdy_leaflet_get_transition_type()`

Gets the type of animation that will be used for transitions between modes in `self` .

#### Parameters

self | a HdyLeaflet |

#### Returns

the current mode transition type of `self`

### hdy_leaflet_set_mode_transition_type ()

    void
    hdy_leaflet_set_mode_transition_type (HdyLeaflet *self,
                                          HdyLeafletModeTransitionType transition);

`hdy_leaflet_set_mode_transition_type` has been deprecated since version 0.0.12 and should not be used in newly-written code.

Use `hdy_leaflet_set_transition_type()`

Sets the type of animation that will be used for transitions between modes in `self` .

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

#### Parameters

self | a HdyLeaflet |
transition | the new transition type |

### hdy_leaflet_get_mode_transition_duration ()

    guint
    hdy_leaflet_get_mode_transition_duration
                                   (HdyLeaflet *self);

Returns the amount of time (in milliseconds) that transitions between modes in `self` will take.

#### Parameters

self | a HdyLeaflet |

#### Returns

the mode transition duration

### hdy_leaflet_set_mode_transition_duration ()

    void
    hdy_leaflet_set_mode_transition_duration
                                   (HdyLeaflet *self,
                                    guint duration);

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

#### Parameters

self | a HdyLeaflet |
duration | the new duration, in milliseconds |

### hdy_leaflet_get_child_transition_type ()

    HdyLeafletChildTransitionType
    hdy_leaflet_get_child_transition_type (HdyLeaflet *self);

`hdy_leaflet_get_child_transition_type` has been deprecated since version 0.0.12 and should not be used in newly-written code.

Use `hdy_leaflet_get_transition_type()`

Gets the type of animation that will be used for transitions between children in `self` .

#### Parameters

self | a HdyLeaflet |

#### Returns

the current mode transition type of `self`

### hdy_leaflet_set_child_transition_type ()

    void
    hdy_leaflet_set_child_transition_type (HdyLeaflet *self,
                                           HdyLeafletChildTransitionType transition);

`hdy_leaflet_set_child_transition_type` has been deprecated since version 0.0.12 and should not be used in newly-written code.

Use `hdy_leaflet_set_transition_type()`

Sets the type of animation that will be used for transitions between children in `self` .

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.

#### Parameters

self | a HdyLeaflet |
transition | the new transition type |

### hdy_leaflet_get_child_transition_duration ()

    guint
    hdy_leaflet_get_child_transition_duration
                                   (HdyLeaflet *self);

Returns the amount of time (in milliseconds) that transitions between children in `self` will take.

#### Parameters

self | a HdyLeaflet |

#### Returns

the mode transition duration

### hdy_leaflet_set_child_transition_duration ()

    void
    hdy_leaflet_set_child_transition_duration
                                   (HdyLeaflet *self,
                                    guint duration);

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

#### Parameters

self | a HdyLeaflet |
duration | the new duration, in milliseconds |

### hdy_leaflet_get_child_transition_running ()

    gboolean
    hdy_leaflet_get_child_transition_running
                                   (HdyLeaflet *self);

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

#### Parameters

self | a HdyLeaflet |

#### Returns

`TRUE` if the transition is currently running, `FALSE` otherwise.

### hdy_leaflet_get_interpolate_size ()

    gboolean
    hdy_leaflet_get_interpolate_size (HdyLeaflet *self);

Returns wether the HdyLeaflet is set up to interpolate between the sizes of children on page switch.

#### Parameters

self | a HdyLeaflet |

#### Returns

`TRUE` if child sizes are interpolated

### hdy_leaflet_set_interpolate_size ()

    void
    hdy_leaflet_set_interpolate_size (HdyLeaflet *self,
                                      gboolean interpolate_size);

Sets whether or not `self` will interpolate its size when changing the visible child. If the “interpolate-size” property is set to `TRUE`, `stack` 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.

#### Parameters

self | a HdyLeaflet |
interpolate_size | the new value |

### hdy_leaflet_get_can_swipe_back ()

    gboolean
    hdy_leaflet_get_can_swipe_back (HdyLeaflet *self);

Returns whether the HdyLeaflet allows swiping to the previous child.

#### Parameters

self | a HdyLeaflet |

#### Returns

`TRUE` if back swipe is enabled.

Since: 0.0.12

### hdy_leaflet_set_can_swipe_back ()

    void
    hdy_leaflet_set_can_swipe_back (HdyLeaflet *self,
                                    gboolean can_swipe_back);

Sets whether or not `self` allows switching to the previous child that has 'allow-visible' child property set to `TRUE` via a swipe gesture

#### Parameters

self | a HdyLeaflet |
can_swipe_back | the new value |

Since: 0.0.12

### hdy_leaflet_get_can_swipe_forward ()

    gboolean
    hdy_leaflet_get_can_swipe_forward (HdyLeaflet *self);

Returns whether the HdyLeaflet allows swiping to the next child.

#### Parameters

self | a HdyLeaflet |

#### Returns

`TRUE` if back swipe is enabled.

Since: 0.0.12

### hdy_leaflet_set_can_swipe_forward ()

    void
    hdy_leaflet_set_can_swipe_forward (HdyLeaflet *self,
                                       gboolean can_swipe_forward);

Sets whether or not `self` allows switching to the next child that has 'allow-visible' child property set to `TRUE` via a swipe gesture.

#### Parameters

self | a HdyLeaflet |
can_swipe_forward | the new value |

Since: 0.0.12

## Types and Values

### HDY_TYPE_LEAFLET

    #define HDY_TYPE_LEAFLET (hdy_leaflet_get_type())

### enum HdyLeafletTransitionType

This enumeration value describes the possible transitions between modes and children in a HdyLeaflet widget.

New values may be added to this enumeration over time.

#### Members

HDY_LEAFLET_TRANSITION_TYPE_NONE | No transition |
HDY_LEAFLET_TRANSITION_TYPE_SLIDE | Slide from left, right, up or down according to the orientation, text direction and the children order |
HDY_LEAFLET_TRANSITION_TYPE_OVER | Cover the old page or uncover the new page, sliding from or towards the end according to orientation, text direction and children order |
HDY_LEAFLET_TRANSITION_TYPE_UNDER | Uncover the new page or cover the old page, sliding from or towards the start according to orientation, text direction and children order |

Since: 0.0.12

### enum HdyLeafletModeTransitionType

`HdyLeafletModeTransitionType` has been deprecated since version 0.0.12 and should not be used in newly-written code.

Use HdyLeafletTransitionType

These enumeration values describe the possible transitions between pages in a HdyLeaflet widget.

#### Members

HDY_LEAFLET_MODE_TRANSITION_TYPE_NONE | No transition |
HDY_LEAFLET_MODE_TRANSITION_TYPE_SLIDE | Slide from left, right, up or down according to the orientation, text direction and the children order |

### enum HdyLeafletChildTransitionType

`HdyLeafletChildTransitionType` has been deprecated since version 0.0.12 and should not be used in newly-written code.

Use HdyLeafletTransitionType

These enumeration values describe the possible transitions between pages in a HdyLeaflet widget.

#### Members

HDY_LEAFLET_CHILD_TRANSITION_TYPE_NONE | No transition |
HDY_LEAFLET_CHILD_TRANSITION_TYPE_CROSSFADE | A cross-fade |
HDY_LEAFLET_CHILD_TRANSITION_TYPE_SLIDE | Slide from left, right, up or down according to the orientation, text direction and the children order |
HDY_LEAFLET_CHILD_TRANSITION_TYPE_OVER | Cover the old page or uncover the new page, sliding from or towards the end according to orientation, text direction and children order |
HDY_LEAFLET_CHILD_TRANSITION_TYPE_UNDER | Uncover the new page or cover the old page, sliding from or towards the start according to orientation, text direction and children order |

### struct HdyLeafletClass

    struct HdyLeafletClass {
      GtkContainerClass parent_class;
    };

#### Members

### HdyLeaflet

    typedef struct _HdyLeaflet HdyLeaflet;

## Property Details

### The `“can-swipe-back”` property

      “can-swipe-back”           gboolean

Whether or not `self` allows switching to the previous child that has 'allow-visible' child property set to `TRUE` via a swipe gesture.

Owner: HdyLeaflet

Flags: Read / Write

Default value: FALSE

Since: 0.0.12

### The `“can-swipe-forward”` property

      “can-swipe-forward”        gboolean

Whether or not `self` allows switching to the next child that has 'allow-visible' child property set to `TRUE` via a swipe gesture.

Owner: HdyLeaflet

Flags: Read / Write

Default value: FALSE

Since: 0.0.12

### The `“child-transition-duration”` property

      “child-transition-duration” guint

The child transition animation duration, in milliseconds.

Owner: HdyLeaflet

Flags: Read / Write

Default value: 200

### The `“child-transition-running”` property

      “child-transition-running” gboolean

Whether or not the child transition is currently running.

Owner: HdyLeaflet

Flags: Read

Default value: FALSE

### The `“child-transition-type”` property

      “child-transition-type”    HdyLeafletChildTransitionType

The type of animation used to transition between children

`HdyLeaflet:child-transition-type` has been deprecated since version 0.0.12 and should not be used in newly-written code.

Use “transition-type” instead

Owner: HdyLeaflet

Flags: Read / Write

Default value: HDY_LEAFLET_CHILD_TRANSITION_TYPE_NONE

### The `“fold”` property

      “fold”                     HdyFold

The fold of the leaflet.

The leaflet will be folded if the size allocated to it is smaller than the sum of the natural size of its children, it will be unfolded otherwise.

See also: “folded”.

Owner: HdyLeaflet

Flags: Read

Default value: HDY_FOLD_UNFOLDED

### The `“folded”` property

      “folded”                   gboolean

`TRUE` if the leaflet is folded.

This is similar to the “fold” property but expressed as a gboolean rather than a GEnum. This makes it convenient to bind the “fold” of a leaflet to any other gboolean property of other GObject's using ``g_object_bind_property()``.

Owner: HdyLeaflet

Flags: Read

Default value: FALSE

### The `“hhomogeneous-folded”` property

      “hhomogeneous-folded”      gboolean

Horizontally homogeneous sizing when the leaflet is folded.

Owner: HdyLeaflet

Flags: Read / Write

Default value: TRUE

### The `“hhomogeneous-unfolded”` property

      “hhomogeneous-unfolded”    gboolean

Horizontally homogeneous sizing when the leaflet is unfolded.

Owner: HdyLeaflet

Flags: Read / Write

Default value: FALSE

### The `“interpolate-size”` property

      “interpolate-size”         gboolean

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

Owner: HdyLeaflet

Flags: Read / Write

Default value: FALSE

### The `“mode-transition-duration”` property

      “mode-transition-duration” guint

The mode transition animation duration, in milliseconds.

Owner: HdyLeaflet

Flags: Read / Write

Default value: 250

### The `“mode-transition-type”` property

      “mode-transition-type”     HdyLeafletModeTransitionType

The type of animation used to transition between mode

`HdyLeaflet:mode-transition-type` has been deprecated since version 0.0.12 and should not be used in newly-written code.

Use “transition-type” instead

Owner: HdyLeaflet

Flags: Read / Write

Default value: HDY_LEAFLET_MODE_TRANSITION_TYPE_NONE

### The `“transition-type”` property

      “transition-type”          HdyLeafletTransitionType

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

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

Owner: HdyLeaflet

Flags: Read / Write

Default value: HDY_LEAFLET_TRANSITION_TYPE_NONE

Since: 0.0.12

### The `“vhomogeneous-folded”` property

      “vhomogeneous-folded”      gboolean

Vertically homogeneous sizing when the leaflet is folded.

Owner: HdyLeaflet

Flags: Read / Write

Default value: TRUE

### The `“vhomogeneous-unfolded”` property

      “vhomogeneous-unfolded”    gboolean

Vertically homogeneous sizing when the leaflet is unfolded.

Owner: HdyLeaflet

Flags: Read / Write

Default value: FALSE

### The `“visible-child”` property

      “visible-child”            GtkWidget *

The widget currently visible when the leaflet is folded.

Owner: HdyLeaflet

Flags: Read / Write

### The `“visible-child-name”` property

      “visible-child-name”       char *

The name of the widget currently visible when the children are stacked.

Owner: HdyLeaflet

Flags: Read / Write

Default value: NULL