HdyLeaflet

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

Functions

Properties

Types and Values

Object Hierarchy

    GEnum
    ╰── 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 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. The threshold is dictated by the preferred minimum sizes of the children.

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.

Functions

hdy_leaflet_new ()

GtkWidget *
hdy_leaflet_new (void);

hdy_leaflet_get_folded ()

gboolean
hdy_leaflet_get_folded (HdyLeaflet *self);

Gets whether self is folded.

Parameters

self

a HdyLeaflet

 

Returns

whether self is folded.


hdy_leaflet_get_visible_child ()

GtkWidget *
hdy_leaflet_get_visible_child (HdyLeaflet *self);

Gets 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);

Makes visible_child visible using a transition determined by HdyLeaflet:transition-type and HdyLeaflet:child-transition-duration. The transition can be cancelled by the user, in which case visible child will change back to the previously visible child.

Parameters

self

a HdyLeaflet

 

visible_child

the new child

 

hdy_leaflet_get_visible_child_name ()

const gchar *
hdy_leaflet_get_visible_child_name (HdyLeaflet *self);

Gets the name of the currently visible child widget.

Parameters

self

a HdyLeaflet

 

Returns

the name of the visible child.

[transfer none]


hdy_leaflet_set_visible_child_name ()

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

Makes the child with the name name visible.

See hdy_leaflet_set_visible_child() for more details.

Parameters

self

a HdyLeaflet

 

name

the name of a child

 

hdy_leaflet_get_homogeneous ()

gboolean
hdy_leaflet_get_homogeneous (HdyLeaflet *self,
                             gboolean folded,
                             GtkOrientation orientation);

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

Parameters

self

a HdyLeaflet

 

folded

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,
                             gboolean folded,
                             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

 

folded

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_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_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 child 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, 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.

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 forward 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


hdy_leaflet_navigate ()

gboolean
hdy_leaflet_navigate (HdyLeaflet *self,
                      HdyNavigationDirection direction);

Switches to the previous or next child that doesn't have 'allow-visible' child property set to FALSE, similar to performing a swipe gesture to go in direction .

Parameters

self

a HdyLeaflet

 

direction

the direction

 

Returns

TRUE if visible child was changed, FALSE otherwise.

Since: 1.0

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


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.

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.

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.

Flags: Read / Write

Default value: 200


The “child-transition-running” property

  “child-transition-running” gboolean

Whether or not the child transition is currently running.

Flags: Read

Default value: FALSE


The “folded” property

  “folded”                   gboolean

TRUE if the leaflet is folded.

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.

Flags: Read

Default value: FALSE


The “hhomogeneous-folded” property

  “hhomogeneous-folded”      gboolean

Horizontally homogeneous sizing when the leaflet is folded.

Flags: Read / Write

Default value: TRUE


The “hhomogeneous-unfolded” property

  “hhomogeneous-unfolded”    gboolean

Horizontally homogeneous sizing when the leaflet is unfolded.

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.

Flags: Read / Write

Default value: FALSE


The “mode-transition-duration” property

  “mode-transition-duration” guint

The mode transition animation duration, in milliseconds.

Flags: Read / Write

Default value: 250


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.

Flags: Read / Write

Default value: HDY_LEAFLET_TRANSITION_TYPE_OVER

Since: 0.0.12


The “vhomogeneous-folded” property

  “vhomogeneous-folded”      gboolean

Vertically homogeneous sizing when the leaflet is folded.

Flags: Read / Write

Default value: TRUE


The “vhomogeneous-unfolded” property

  “vhomogeneous-unfolded”    gboolean

Vertically homogeneous sizing when the leaflet is unfolded.

Flags: Read / Write

Default value: FALSE


The “visible-child” property

  “visible-child”            GtkWidget *

The widget currently visible when the leaflet is folded.

Flags: Read / Write


The “visible-child-name” property

  “visible-child-name”       gchar *

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

Flags: Read / Write

Default value: NULL