adw-leaflet

adw-leaflet

Functions

GtkWidget * adw_leaflet_page_get_child ()
const char * adw_leaflet_page_get_name ()
void adw_leaflet_page_set_name ()
gboolean adw_leaflet_page_get_navigatable ()
void adw_leaflet_page_set_navigatable ()
GtkWidget * adw_leaflet_new ()
AdwLeafletPage * adw_leaflet_append ()
AdwLeafletPage * adw_leaflet_prepend ()
AdwLeafletPage * adw_leaflet_insert_child_after ()
void adw_leaflet_reorder_child_after ()
void adw_leaflet_remove ()
AdwLeafletPage * adw_leaflet_get_page ()
gboolean adw_leaflet_get_folded ()
GtkWidget * adw_leaflet_get_visible_child ()
void adw_leaflet_set_visible_child ()
const char * adw_leaflet_get_visible_child_name ()
void adw_leaflet_set_visible_child_name ()
gboolean adw_leaflet_get_homogeneous ()
void adw_leaflet_set_homogeneous ()
AdwLeafletTransitionType adw_leaflet_get_transition_type ()
void adw_leaflet_set_transition_type ()
guint adw_leaflet_get_mode_transition_duration ()
void adw_leaflet_set_mode_transition_duration ()
guint adw_leaflet_get_child_transition_duration ()
void adw_leaflet_set_child_transition_duration ()
gboolean adw_leaflet_get_child_transition_running ()
gboolean adw_leaflet_get_interpolate_size ()
void adw_leaflet_set_interpolate_size ()
gboolean adw_leaflet_get_can_swipe_back ()
void adw_leaflet_set_can_swipe_back ()
gboolean adw_leaflet_get_can_swipe_forward ()
void adw_leaflet_set_can_swipe_forward ()
GtkWidget * adw_leaflet_get_adjacent_child ()
gboolean adw_leaflet_navigate ()
GtkWidget * adw_leaflet_get_child_by_name ()
gboolean adw_leaflet_get_can_unfold ()
void adw_leaflet_set_can_unfold ()
GtkSelectionModel * adw_leaflet_get_pages ()

Properties

gboolean can-swipe-back Read / Write
gboolean can-swipe-forward Read / Write
gboolean can-unfold Read / Write
guint child-transition-duration Read / Write
gboolean child-transition-running 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
GtkSelectionModel * pages Read
AdwLeafletTransitionType 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
GtkWidget * child Read / Write / Construct Only
char * name Read / Write
gboolean navigatable Read / Write

Types and Values

Object Hierarchy

    GObject
    ├── AdwLeafletPage
    ╰── GInitiallyUnowned
        ╰── GtkWidget
            ╰── AdwLeaflet

Implemented Interfaces

AdwLeaflet implements GtkAccessible, GtkBuildable, GtkConstraintTarget, GtkOrientable and AdwSwipeable.

Description

Functions

adw_leaflet_page_get_child ()

GtkWidget *
adw_leaflet_page_get_child (AdwLeafletPage *self);

Returns the leaflet child to which self belongs.

Parameters

self

a AdwLeafletPage

 

Returns

the child to which self belongs.

[transfer none]

Since: 1.0


adw_leaflet_page_get_name ()

const char *
adw_leaflet_page_get_name (AdwLeafletPage *self);

Returns the current value of the “name” property.

Parameters

self

a AdwLeafletPage

 

Returns

The value of the “name” property. See adw_leaflet_page_set_name() for details on how to set a new value.

[nullable]

Since: 1.0


adw_leaflet_page_set_name ()

void
adw_leaflet_page_set_name (AdwLeafletPage *self,
                           const char *name);

Sets the new value of the “name” property. See also adw_leaflet_page_get_name()

Parameters

self

a AdwLeafletPage

 

name

the new value to set.

[transfer none][nullable]

Since: 1.0


adw_leaflet_page_get_navigatable ()

gboolean
adw_leaflet_page_get_navigatable (AdwLeafletPage *self);

Gets whether the child can be navigated to when folded.

See adw_leaflet_page_set_navigatable() and “navigatable”.

Parameters

self

a AdwLeafletPage

 

Returns

TRUE if self is enabled, FALSE otherwise

Since: 1.0


adw_leaflet_page_set_navigatable ()

void
adw_leaflet_page_set_navigatable (AdwLeafletPage *self,
                                  gboolean navigatable);

Sets whether the child can be navigated to when folded. If FALSE, the child will be ignored by adw_leaflet_get_adjacent_child(), adw_leaflet_navigate(), and swipe gestures.

This can be used used to prevent switching to widgets like separators.

Sets the new value of the “navigatable” property to navigatable .

Parameters

self

a AdwLeafletPage

 

navigatable

TRUE if the child can be navigated to when folded

 

Since: 1.0


adw_leaflet_new ()

GtkWidget *
adw_leaflet_new (void);

adw_leaflet_append ()

AdwLeafletPage *
adw_leaflet_append (AdwLeaflet *self,
                    GtkWidget *child);

Adds a child to self .

Parameters

self

a AdwLeaflet

 

child

the widget to add

 

Returns

the AdwLeafletPage for child .

[transfer none]

Since: 1.0


adw_leaflet_prepend ()

AdwLeafletPage *
adw_leaflet_prepend (AdwLeaflet *self,
                     GtkWidget *child);

Inserts child at the first position in self .

Parameters

self

a AdwLeaflet

 

child

the GtkWidget to prepend

 

Returns

the AdwLeafletPage for child .

[transfer none]

Since: 1.0


adw_leaflet_insert_child_after ()

AdwLeafletPage *
adw_leaflet_insert_child_after (AdwLeaflet *self,
                                GtkWidget *child,
                                GtkWidget *sibling);

Inserts child in the position after sibling in the list of children. If sibling is NULL, insert child at the first position.

Parameters

self

a AdwLeaflet

 

child

the GtkWidget to insert

 

sibling

the sibling after which to insert child .

[nullable]

Returns

the AdwLeafletPage for child .

[transfer none]

Since: 1.0


adw_leaflet_reorder_child_after ()

void
adw_leaflet_reorder_child_after (AdwLeaflet *self,
                                 GtkWidget *child,
                                 GtkWidget *sibling);

Moves child to the position after sibling in the list of children. If sibling is NULL, move child to the first position.

Parameters

self

a AdwLeaflet

 

child

the GtkWidget to move, must be a child of self

 

sibling

the sibling to move child after, or NULL.

[nullable]

Since: 1.0


adw_leaflet_remove ()

void
adw_leaflet_remove (AdwLeaflet *self,
                    GtkWidget *child);

Removes a child widget from self .

Parameters

self

a AdwLeaflet

 

child

the child to remove

 

Since: 1.0


adw_leaflet_get_page ()

AdwLeafletPage *
adw_leaflet_get_page (AdwLeaflet *self,
                      GtkWidget *child);

Returns the AdwLeafletPage object for child .

Parameters

self

a AdwLeaflet

 

child

a child of self

 

Returns

the AdwLeafletPage for child .

[transfer none]

Since: 1.0


adw_leaflet_get_folded ()

gboolean
adw_leaflet_get_folded (AdwLeaflet *self);

Gets whether self is folded.

Parameters

self

a AdwLeaflet

 

Returns

whether self is folded.

Since: 1.0


adw_leaflet_get_visible_child ()

GtkWidget *
adw_leaflet_get_visible_child (AdwLeaflet *self);

Gets the visible child widget.

Parameters

self

a AdwLeaflet

 

Returns

the visible child widget.

[transfer none]

Since: 1.0


adw_leaflet_set_visible_child ()

void
adw_leaflet_set_visible_child (AdwLeaflet *self,
                               GtkWidget *visible_child);

Makes visible_child visible using a transition determined by AdwLeaflet:transition-type and AdwLeaflet: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 AdwLeaflet

 

visible_child

the new child

 

Since: 1.0


adw_leaflet_get_visible_child_name ()

const char *
adw_leaflet_get_visible_child_name (AdwLeaflet *self);

Gets the name of the currently visible child widget.

Parameters

self

a AdwLeaflet

 

Returns

the name of the visible child.

[transfer none]

Since: 1.0


adw_leaflet_set_visible_child_name ()

void
adw_leaflet_set_visible_child_name (AdwLeaflet *self,
                                    const char *name);

Makes the child with the name name visible.

See adw_leaflet_set_visible_child() for more details.

Parameters

self

a AdwLeaflet

 

name

the name of a child

 

Since: 1.0


adw_leaflet_get_homogeneous ()

gboolean
adw_leaflet_get_homogeneous (AdwLeaflet *self,
                             gboolean folded,
                             GtkOrientation orientation);

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

Parameters

self

a AdwLeaflet

 

folded

the fold

 

orientation

the orientation

 

Returns

whether self is homogeneous for the given fold and orientation.

Since: 1.0


adw_leaflet_set_homogeneous ()

void
adw_leaflet_set_homogeneous (AdwLeaflet *self,
                             gboolean folded,
                             GtkOrientation orientation,
                             gboolean homogeneous);

Sets the AdwLeaflet to be homogeneous or not for the given fold and orientation. If it is homogeneous, the AdwLeaflet 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 AdwLeaflet

 

folded

the fold

 

orientation

the orientation

 

homogeneous

TRUE to make self homogeneous

 

Since: 1.0


adw_leaflet_get_transition_type ()

AdwLeafletTransitionType
adw_leaflet_get_transition_type (AdwLeaflet *self);

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

Parameters

self

a AdwLeaflet

 

Returns

the current transition type of self

Since: 1.0


adw_leaflet_set_transition_type ()

void
adw_leaflet_set_transition_type (AdwLeaflet *self,
                                 AdwLeafletTransitionType 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 AdwLeaflet

 

transition

the new transition type

 

Since: 1.0


adw_leaflet_get_mode_transition_duration ()

guint
adw_leaflet_get_mode_transition_duration
                               (AdwLeaflet *self);

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

Parameters

self

a AdwLeaflet

 

Returns

the mode transition duration

Since: 1.0


adw_leaflet_set_mode_transition_duration ()

void
adw_leaflet_set_mode_transition_duration
                               (AdwLeaflet *self,
                                guint duration);

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

Parameters

self

a AdwLeaflet

 

duration

the new duration, in milliseconds

 

Since: 1.0


adw_leaflet_get_child_transition_duration ()

guint
adw_leaflet_get_child_transition_duration
                               (AdwLeaflet *self);

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

Parameters

self

a AdwLeaflet

 

Returns

the child transition duration

Since: 1.0


adw_leaflet_set_child_transition_duration ()

void
adw_leaflet_set_child_transition_duration
                               (AdwLeaflet *self,
                                guint duration);

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

Parameters

self

a AdwLeaflet

 

duration

the new duration, in milliseconds

 

Since: 1.0


adw_leaflet_get_child_transition_running ()

gboolean
adw_leaflet_get_child_transition_running
                               (AdwLeaflet *self);

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

Parameters

self

a AdwLeaflet

 

Returns

TRUE if the transition is currently running, FALSE otherwise.

Since: 1.0


adw_leaflet_get_interpolate_size ()

gboolean
adw_leaflet_get_interpolate_size (AdwLeaflet *self);

Returns whether the AdwLeaflet is set up to interpolate between the sizes of children on page switch.

Parameters

self

a AdwLeaflet

 

Returns

TRUE if child sizes are interpolated

Since: 1.0


adw_leaflet_set_interpolate_size ()

void
adw_leaflet_set_interpolate_size (AdwLeaflet *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 AdwLeaflet

 

interpolate_size

the new value

 

Since: 1.0


adw_leaflet_get_can_swipe_back ()

gboolean
adw_leaflet_get_can_swipe_back (AdwLeaflet *self);

Returns whether the AdwLeaflet allows swiping to the previous child.

Parameters

self

a AdwLeaflet

 

Returns

TRUE if back swipe is enabled.

Since: 1.0


adw_leaflet_set_can_swipe_back ()

void
adw_leaflet_set_can_swipe_back (AdwLeaflet *self,
                                gboolean can_swipe_back);

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

Parameters

self

a AdwLeaflet

 

can_swipe_back

the new value

 

Since: 1.0


adw_leaflet_get_can_swipe_forward ()

gboolean
adw_leaflet_get_can_swipe_forward (AdwLeaflet *self);

Returns whether the AdwLeaflet allows swiping to the next child.

Parameters

self

a AdwLeaflet

 

Returns

TRUE if forward swipe is enabled.

Since: 1.0


adw_leaflet_set_can_swipe_forward ()

void
adw_leaflet_set_can_swipe_forward (AdwLeaflet *self,
                                   gboolean can_swipe_forward);

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

Parameters

self

a AdwLeaflet

 

can_swipe_forward

the new value

 

Since: 1.0


adw_leaflet_get_adjacent_child ()

GtkWidget *
adw_leaflet_get_adjacent_child (AdwLeaflet *self,
                                AdwNavigationDirection direction);

Gets the previous or next child that doesn't have 'navigatable' child property set to FALSE, or NULL if it doesn't exist. This will be the same widget adw_leaflet_navigate() will navigate to.

Parameters

self

a AdwLeaflet

 

direction

the direction

 

Returns

the previous or next child, or NULL if it doesn't exist.

[nullable][transfer none]

Since: 1.0


adw_leaflet_navigate ()

gboolean
adw_leaflet_navigate (AdwLeaflet *self,
                      AdwNavigationDirection direction);

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

Parameters

self

a AdwLeaflet

 

direction

the direction

 

Returns

TRUE if visible child was changed, FALSE otherwise.

Since: 1.0


adw_leaflet_get_child_by_name ()

GtkWidget *
adw_leaflet_get_child_by_name (AdwLeaflet *self,
                               const char *name);

Finds the child of self with the name given as the argument. Returns NULL if there is no child with this name.

Parameters

self

a AdwLeaflet

 

name

the name of the child to find

 

Returns

the requested child of self .

[transfer none][nullable]

Since: 1.0


adw_leaflet_get_can_unfold ()

gboolean
adw_leaflet_get_can_unfold (AdwLeaflet *self);

adw_leaflet_set_can_unfold ()

void
adw_leaflet_set_can_unfold (AdwLeaflet *self,
                            gboolean can_unfold);

adw_leaflet_get_pages ()

GtkSelectionModel *
adw_leaflet_get_pages (AdwLeaflet *self);

Returns a GListModel that contains the pages of the leaflet, and can be used to keep an up-to-date view. The model also implements GtkSelectionModel and can be used to track the visible page.

Parameters

self

a AdwLeaflet

 

Returns

a GtkSelectionModel for the leaflet's children.

[transfer full]

Since: 1.0

Types and Values

ADW_TYPE_LEAFLET_PAGE

#define ADW_TYPE_LEAFLET_PAGE (adw_leaflet_page_get_type ())

ADW_TYPE_LEAFLET

#define ADW_TYPE_LEAFLET (adw_leaflet_get_type())

enum AdwLeafletTransitionType

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

New values may be added to this enumeration over time.

Members

ADW_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

 

ADW_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

 

ADW_LEAFLET_TRANSITION_TYPE_SLIDE

Slide from left, right, up or down according to the orientation, text direction and the children order

 

Since: 1.0


AdwLeaflet

typedef struct _AdwLeaflet AdwLeaflet;

AdwLeafletPage

typedef struct _AdwLeafletPage AdwLeafletPage;

Property Details

The “can-swipe-back” property

  “can-swipe-back”           gboolean

Whether or not the leaflet allows switching to the previous child that has 'navigatable' child property set to TRUE via a swipe gesture.

Owner: AdwLeaflet

Flags: Read / Write

Default value: FALSE

Since: 1.0


The “can-swipe-forward” property

  “can-swipe-forward”        gboolean

Whether or not the leaflet allows switching to the next child that has 'navigatable' child property set to TRUE via a swipe gesture.

Owner: AdwLeaflet

Flags: Read / Write

Default value: FALSE

Since: 1.0


The “can-unfold” property

  “can-unfold”               gboolean

Whether or not the leaflet can unfold.

Owner: AdwLeaflet

Flags: Read / Write

Default value: TRUE


The “child-transition-duration” property

  “child-transition-duration” guint

The child transition animation duration, in milliseconds.

Owner: AdwLeaflet

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: AdwLeaflet

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.

Owner: AdwLeaflet

Flags: Read

Default value: FALSE

Since: 1.0


The “hhomogeneous-folded” property

  “hhomogeneous-folded”      gboolean

Horizontally homogeneous sizing when the leaflet is folded.

Owner: AdwLeaflet

Flags: Read / Write

Default value: TRUE


The “hhomogeneous-unfolded” property

  “hhomogeneous-unfolded”    gboolean

Horizontally homogeneous sizing when the leaflet is unfolded.

Owner: AdwLeaflet

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: AdwLeaflet

Flags: Read / Write

Default value: FALSE


The “mode-transition-duration” property

  “mode-transition-duration” guint

The mode transition animation duration, in milliseconds.

Owner: AdwLeaflet

Flags: Read / Write

Default value: 250


The “pages” property

  “pages”                    GtkSelectionModel *

A selection model with the leaflet's pages.

Owner: AdwLeaflet

Flags: Read


The “transition-type” property

  “transition-type”          AdwLeafletTransitionType

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: AdwLeaflet

Flags: Read / Write

Default value: ADW_LEAFLET_TRANSITION_TYPE_OVER

Since: 1.0


The “vhomogeneous-folded” property

  “vhomogeneous-folded”      gboolean

Vertically homogeneous sizing when the leaflet is folded.

Owner: AdwLeaflet

Flags: Read / Write

Default value: TRUE


The “vhomogeneous-unfolded” property

  “vhomogeneous-unfolded”    gboolean

Vertically homogeneous sizing when the leaflet is unfolded.

Owner: AdwLeaflet

Flags: Read / Write

Default value: FALSE


The “visible-child” property

  “visible-child”            GtkWidget *

The widget currently visible when the leaflet is folded.

Owner: AdwLeaflet

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: AdwLeaflet

Flags: Read / Write

Default value: NULL


The “child” property

  “child”                    GtkWidget *

The child of the page.

Owner: AdwLeafletPage

Flags: Read / Write / Construct Only


The “name” property

  “name”                     char *

The name of the child page.

Owner: AdwLeafletPage

Flags: Read / Write

Default value: NULL


The “navigatable” property

  “navigatable”              gboolean

Whether the child can be navigated to when folded. If FALSE, the child will be ignored by adw_leaflet_get_adjacent_child(), adw_leaflet_navigate(), and swipe gestures.

This can be used used to prevent switching to widgets like separators.

Owner: AdwLeafletPage

Flags: Read / Write

Default value: TRUE

Since: 1.0