HdyDeck: Handy Reference Manual

## HdyDeck HdyDeck — A swipeable widget showing one of the visible children at a time. |

## Functions

GtkWidget * | hdy_deck_new ()
GtkWidget * | hdy_deck_get_visible_child ()
void | hdy_deck_set_visible_child ()
const gchar * | hdy_deck_get_visible_child_name ()
void | hdy_deck_set_visible_child_name ()
gboolean | hdy_deck_get_homogeneous ()
void | hdy_deck_set_homogeneous ()
HdyDeckTransitionType | hdy_deck_get_transition_type ()
void | hdy_deck_set_transition_type ()
guint | hdy_deck_get_transition_duration ()
void | hdy_deck_set_transition_duration ()
gboolean | hdy_deck_get_transition_running ()
gboolean | hdy_deck_get_interpolate_size ()
void | hdy_deck_set_interpolate_size ()
gboolean | hdy_deck_get_can_swipe_back ()
void | hdy_deck_set_can_swipe_back ()
gboolean | hdy_deck_get_can_swipe_forward ()
void | hdy_deck_set_can_swipe_forward ()
GtkWidget * | hdy_deck_get_adjacent_child ()
gboolean | hdy_deck_navigate ()
GtkWidget * | hdy_deck_get_child_by_name ()

## Properties

gboolean | can-swipe-back | Read / Write
gboolean | can-swipe-forward | Read / Write
gboolean | hhomogeneous | Read / Write
gboolean | interpolate-size | Read / Write
guint | transition-duration | Read / Write
gboolean | transition-running | Read
HdyDeckTransitionType | transition-type | Read / Write
gboolean | vhomogeneous | Read / Write
GtkWidget * | visible-child | Read / Write
char * | visible-child-name | Read / Write

## Types and Values

#define | HDY_TYPE_DECK
enum | HdyDeckTransitionType
struct | HdyDeckClass
| HdyDeck

## Object Hierarchy

        GObject
        ╰── GInitiallyUnowned
            ╰── GtkWidget
                ╰── GtkContainer
                    ╰── HdyDeck

## Implemented Interfaces

HdyDeck implements AtkImplementorIface, GtkBuildable, GtkOrientable and HdySwipeable.

## Description

The HdyDeck widget displays one of the visible children, similar to a GtkStack. 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 HdyWindow or HdyApplicationWindow as they will crop anything drawn beyond the rounded corners.

### CSS nodes

HdyDeck has a single CSS node with name deck.

## Functions

### hdy_deck_new ()

    GtkWidget *
    hdy_deck_new (void);

### hdy_deck_get_visible_child ()

    GtkWidget *
    hdy_deck_get_visible_child (HdyDeck *self);

Gets the visible child widget.

#### Parameters

self | a HdyDeck |

#### Returns

the visible child widget.

[transfer none]

Since: 1.0

### hdy_deck_set_visible_child ()

    void
    hdy_deck_set_visible_child (HdyDeck *self,
                                GtkWidget *visible_child);

Makes `visible_child` visible using a transition determined by HdyDeck:transition-type and HdyDeck: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 HdyDeck |
visible_child | the new child |

Since: 1.0

### hdy_deck_get_visible_child_name ()

    const gchar *
    hdy_deck_get_visible_child_name (HdyDeck *self);

Gets the name of the currently visible child widget.

#### Parameters

self | a HdyDeck |

#### Returns

the name of the visible child.

[transfer none]

Since: 1.0

### hdy_deck_set_visible_child_name ()

    void
    hdy_deck_set_visible_child_name (HdyDeck *self,
                                     const gchar *name);

Makes the child with the name `name` visible.

See `hdy_deck_set_visible_child()` for more details.

#### Parameters

self | a HdyDeck |
name | the name of a child |

Since: 1.0

### hdy_deck_get_homogeneous ()

    gboolean
    hdy_deck_get_homogeneous (HdyDeck *self,
                              GtkOrientation orientation);

Gets whether `self` is homogeneous for the given orientation. See `hdy_deck_set_homogeneous()`.

#### Parameters

self | a HdyDeck |
orientation | the orientation |

#### Returns

whether `self` is homogeneous for the given orientation.

Since: 1.0

### hdy_deck_set_homogeneous ()

    void
    hdy_deck_set_homogeneous (HdyDeck *self,
                              GtkOrientation orientation,
                              gboolean homogeneous);

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

#### Parameters

self | a HdyDeck |
orientation | the orientation |
homogeneous | `TRUE` to make `self` homogeneous |

Since: 1.0

### hdy_deck_get_transition_type ()

    HdyDeckTransitionType
    hdy_deck_get_transition_type (HdyDeck *self);

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

#### Parameters

self | a HdyDeck |

#### Returns

the current transition type of `self`

Since: 1.0

### hdy_deck_set_transition_type ()

    void
    hdy_deck_set_transition_type (HdyDeck *self,
                                  HdyDeckTransitionType transition);

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 HdyDeck |
transition | the new transition type |

Since: 1.0

### hdy_deck_get_transition_duration ()

    guint
    hdy_deck_get_transition_duration (HdyDeck *self);

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

#### Parameters

self | a HdyDeck |

#### Returns

the child transition duration

Since: 1.0

### hdy_deck_set_transition_duration ()

    void
    hdy_deck_set_transition_duration (HdyDeck *self,
                                      guint duration);

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

#### Parameters

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

Since: 1.0

### hdy_deck_get_transition_running ()

    gboolean
    hdy_deck_get_transition_running (HdyDeck *self);

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

#### Parameters

self | a HdyDeck |

#### Returns

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

Since: 1.0

### hdy_deck_get_interpolate_size ()

    gboolean
    hdy_deck_get_interpolate_size (HdyDeck *self);

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

#### Parameters

self | a HdyDeck |

#### Returns

`TRUE` if child sizes are interpolated

Since: 1.0

### hdy_deck_set_interpolate_size ()

    void
    hdy_deck_set_interpolate_size (HdyDeck *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 HdyDeck |
interpolate_size | the new value |

Since: 1.0

### hdy_deck_get_can_swipe_back ()

    gboolean
    hdy_deck_get_can_swipe_back (HdyDeck *self);

Returns whether the HdyDeck allows swiping to the previous child.

#### Parameters

self | a HdyDeck |

#### Returns

`TRUE` if back swipe is enabled.

Since: 1.0

### hdy_deck_set_can_swipe_back ()

    void
    hdy_deck_set_can_swipe_back (HdyDeck *self,
                                 gboolean can_swipe_back);

Sets whether or not `self` allows switching to the previous child via a swipe gesture.

#### Parameters

self | a HdyDeck |
can_swipe_back | the new value |

Since: 1.0

### hdy_deck_get_can_swipe_forward ()

    gboolean
    hdy_deck_get_can_swipe_forward (HdyDeck *self);

Returns whether the HdyDeck allows swiping to the next child.

#### Parameters

self | a HdyDeck |

#### Returns

`TRUE` if forward swipe is enabled.

Since: 1.0

### hdy_deck_set_can_swipe_forward ()

    void
    hdy_deck_set_can_swipe_forward (HdyDeck *self,
                                    gboolean can_swipe_forward);

Sets whether or not `self` allows switching to the next child via a swipe gesture.

#### Parameters

self | a HdyDeck |
can_swipe_forward | the new value |

Since: 1.0

### hdy_deck_get_adjacent_child ()

    GtkWidget *
    hdy_deck_get_adjacent_child (HdyDeck *self,
                                 HdyNavigationDirection direction);

Gets the previous or next child, or `NULL` if it doesn't exist. This will be the same widget `hdy_deck_navigate()` will navigate to.

#### Parameters

self | a HdyDeck |
direction | the direction |

#### Returns

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

[nullable][transfer none]

Since: 1.0

### hdy_deck_navigate ()

    gboolean
    hdy_deck_navigate (HdyDeck *self,
                       HdyNavigationDirection direction);

Switches to the previous or next child, similar to performing a swipe gesture to go in `direction` .

#### Parameters

self | a HdyDeck |
direction | the direction |

#### Returns

`TRUE` if visible child was changed, `FALSE` otherwise.

Since: 1.0

### hdy_deck_get_child_by_name ()

    GtkWidget *
    hdy_deck_get_child_by_name (HdyDeck *self,
                                const gchar *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 HdyDeck |
name | the name of the child to find |

#### Returns

the requested child of `self` .

[transfer none][nullable]

Since: 1.0

## Types and Values

### HDY_TYPE_DECK

    #define HDY_TYPE_DECK (hdy_deck_get_type())

### enum HdyDeckTransitionType

This enumeration value describes the possible transitions between children in a HdyDeck widget.

New values may be added to this enumeration over time.

#### Members

HDY_DECK_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_DECK_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 |
HDY_DECK_TRANSITION_TYPE_SLIDE | Slide from left, right, up or down according to the orientation, text direction and the children order |

Since: 1.0

### struct HdyDeckClass

    struct HdyDeckClass {
      GtkContainerClass parent_class;
    };

#### Members

### HdyDeck

    typedef struct _HdyDeck HdyDeck;

## Property Details

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

      “can-swipe-back”           gboolean

Whether or not the deck allows switching to the previous child via a swipe gesture.

Owner: HdyDeck

Flags: Read / Write

Default value: FALSE

Since: 1.0

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

      “can-swipe-forward”        gboolean

Whether or not the deck allows switching to the next child via a swipe gesture.

Owner: HdyDeck

Flags: Read / Write

Default value: FALSE

Since: 1.0

### The `“hhomogeneous”` property

      “hhomogeneous”             gboolean

Horizontally homogeneous sizing.

Owner: HdyDeck

Flags: Read / Write

Default value: TRUE

Since: 1.0

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

      “interpolate-size”         gboolean

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

Owner: HdyDeck

Flags: Read / Write

Default value: FALSE

Since: 1.0

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

      “transition-duration”      guint

The transition animation duration, in milliseconds.

Owner: HdyDeck

Flags: Read / Write

Default value: 200

Since: 1.0

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

      “transition-running”       gboolean

Whether or not the transition is currently running.

Owner: HdyDeck

Flags: Read

Default value: FALSE

Since: 1.0

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

      “transition-type”          HdyDeckTransitionType

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.

Owner: HdyDeck

Flags: Read / Write

Default value: HDY_DECK_TRANSITION_TYPE_OVER

Since: 1.0

### The `“vhomogeneous”` property

      “vhomogeneous”             gboolean

Vertically homogeneous sizing.

Owner: HdyDeck

Flags: Read / Write

Default value: TRUE

Since: 1.0

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

      “visible-child”            GtkWidget *

The widget currently visible.

Owner: HdyDeck

Flags: Read / Write

Since: 1.0

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

      “visible-child-name”       char *

The name of the widget currently visible.

Owner: HdyDeck

Flags: Read / Write

Default value: NULL

Since: 1.0