## HdyPaginator

HdyPaginator — A paginated scrolling widget.

## Functions

HdyPaginator * | hdy_paginator_new ()
void | hdy_paginator_prepend ()
void | hdy_paginator_insert ()
void | hdy_paginator_reorder ()
void | hdy_paginator_scroll_to ()
void | hdy_paginator_scroll_to_full ()
guint | hdy_paginator_get_n_pages ()
gdouble | hdy_paginator_get_position ()
gboolean | hdy_paginator_get_interactive ()
void | hdy_paginator_set_interactive ()
HdyPaginatorIndicatorStyle | hdy_paginator_get_indicator_style ()
void | hdy_paginator_set_indicator_style ()
guint | hdy_paginator_get_indicator_spacing ()
void | hdy_paginator_set_indicator_spacing ()
gboolean | hdy_paginator_get_center_content ()
void | hdy_paginator_set_center_content ()
guint | hdy_paginator_get_spacing ()
void | hdy_paginator_set_spacing ()
guint | hdy_paginator_get_animation_duration ()
void | hdy_paginator_set_animation_duration ()
gboolean | hdy_paginator_get_allow_mouse_drag ()
void | hdy_paginator_set_allow_mouse_drag ()

## Properties

gboolean | allow-mouse-drag | Read / Write
guint | animation-duration | Read / Write
gboolean | center-content | Read / Write
guint | indicator-spacing | Read / Write
HdyPaginatorIndicatorStyle | indicator-style | Read / Write
gboolean | interactive | Read / Write
guint | n-pages | Read
double | position | Read
guint | spacing | Read / Write

## Signals

void | page-changed | Run Last

## Types and Values

#define | HDY_TYPE_PAGINATOR
enum | HdyPaginatorIndicatorStyle
| HdyPaginator

## Object Hierarchy

        GEnum
        ╰── HdyPaginatorIndicatorStyle
        GObject
        ╰── GInitiallyUnowned
            ╰── GtkWidget
                ╰── GtkContainer
                    ╰── GtkBin
                        ╰── GtkEventBox
                            ╰── HdyPaginator

## Implemented Interfaces

HdyPaginator implements AtkImplementorIface, GtkBuildable, GtkOrientable and HdySwipeable.

## Description

The HdyPaginator widget can be used to display a set of pages with swipe-based navigation between them and optional indicators.

## Functions

### hdy_paginator_new ()

    HdyPaginator *
    hdy_paginator_new (void);

Create a new HdyPaginator widget.

#### Returns

The newly created HdyPaginator widget

Since: 0.0.11

### hdy_paginator_prepend ()

    void
    hdy_paginator_prepend (HdyPaginator *self,
                           GtkWidget *child);

Prepends `child` to `self`

#### Parameters

self | a HdyPaginator |
child | a widget to add |

Since: 0.0.11

### hdy_paginator_insert ()

    void
    hdy_paginator_insert (HdyPaginator *self,
                          GtkWidget *child,
                          gint position);

Inserts `child` into `self` at position `position` .

If position is -1, or larger than the number of pages, `child` will be appended to the end.

#### Parameters

self | a HdyPaginator |
child | a widget to add |
position | the position to insert `child` in. |

Since: 0.0.11

### hdy_paginator_reorder ()

    void
    hdy_paginator_reorder (HdyPaginator *self,
                           GtkWidget *child,
                           gint position);

Moves `child` into position `position` .

If position is -1, or larger than the number of pages, `child` will be moved to the end.

#### Parameters

self | a HdyPaginator |
child | a widget to add |
position | the position to move `child` to. |

Since: 0.0.11

### hdy_paginator_scroll_to ()

    void
    hdy_paginator_scroll_to (HdyPaginator *self,
                             GtkWidget *widget);

Scrolls to `widget` position with an animation. “animation-duration” property can be used for controlling the duration.

#### Parameters

self | a HdyPaginator |
widget | a child of `self` |

Since: 0.0.11

### hdy_paginator_scroll_to_full ()

    void
    hdy_paginator_scroll_to_full (HdyPaginator *self,
                                  GtkWidget *widget,
                                  gint64 duration);

Scrolls to `widget` position with an animation.

#### Parameters

self | a HdyPaginator |
widget | a child of `self` |
duration | animation duration in milliseconds |

Since: 0.0.11

### hdy_paginator_get_n_pages ()

    guint
    hdy_paginator_get_n_pages (HdyPaginator *self);

Gets the number of pages in `self` .

#### Parameters

self | a HdyPaginator |

#### Returns

The number of pages in `self`

Since: 0.0.11

### hdy_paginator_get_position ()

    gdouble
    hdy_paginator_get_position (HdyPaginator *self);

Gets current scroll position in `self` . It's unitless, 1 matches 1 page.

#### Parameters

self | a HdyPaginator |

#### Returns

The scroll position

Since: 0.0.11

### hdy_paginator_get_interactive ()

    gboolean
    hdy_paginator_get_interactive (HdyPaginator *self);

Gets whether `self` can be navigated.

#### Parameters

self | a HdyPaginator |

#### Returns

`TRUE` if `self` can be swiped

Since: 0.0.11

### hdy_paginator_set_interactive ()

    void
    hdy_paginator_set_interactive (HdyPaginator *self,
                                   gboolean interactive);

Sets whether `self` can be navigated. This can be used to temporarily disable a HdyPaginator to only allow swiping in a certain state.

#### Parameters

self | a HdyPaginator |
interactive | whether `self` can be swiped. |

Since: 0.0.11

### hdy_paginator_get_indicator_style ()

    HdyPaginatorIndicatorStyle
    hdy_paginator_get_indicator_style (HdyPaginator *self);

Gets the current page indicator style.

#### Parameters

self | a HdyPaginator |

#### Returns

the current indicator style

Since: 0.0.11

### hdy_paginator_set_indicator_style ()

    void
    hdy_paginator_set_indicator_style (HdyPaginator *self,
                                       HdyPaginatorIndicatorStyle style);

Sets style of page indicators. Depending on orientation, they are displayed below or besides the pages. If the pages are meant to be centered, “center-content” can be used to compensate for that.

#### Parameters

self | a HdyPaginator |
style | indicator style to use |

Since: 0.0.11

### hdy_paginator_get_indicator_spacing ()

    guint
    hdy_paginator_get_indicator_spacing (HdyPaginator *self);

Gets spacing between content and page indicators.

#### Parameters

self | a HdyPaginator |

#### Returns

Spacing between content and indicators

Since: 0.0.11

### hdy_paginator_set_indicator_spacing ()

    void
    hdy_paginator_set_indicator_spacing (HdyPaginator *self,
                                         guint spacing);

Sets spacing between content and page indicators. Does nothing if “indicator-style” is `HDY_PAGINATOR_INDICATOR_STYLE_NONE` .

#### Parameters

self | a HdyPaginator |
spacing | the new spacing value |

Since: 0.0.11

### hdy_paginator_get_center_content ()

    gboolean
    hdy_paginator_get_center_content (HdyPaginator *self);

Sets whether `self` is centering pages.

#### Parameters

self | a HdyPaginator |

#### Returns

`TRUE` if `self` is centering pages

Since: 0.0.11

### hdy_paginator_set_center_content ()

    void
    hdy_paginator_set_center_content (HdyPaginator *self,
                                      gboolean center_content);

Sets whether `self` is centering content. If “indicator-style” is `HDY_PAGINATOR_INDICATOR_STYLE_NONE` , centering does nothing, otherwise it adds whitespace to the left or above the pages to compensate for the indicators.

#### Parameters

self | a HdyPaginator |
center_content | whether `self` should center contents |

Since: 0.0.11

### hdy_paginator_get_spacing ()

    guint
    hdy_paginator_get_spacing (HdyPaginator *self);

Gets spacing between pages in pixels.

#### Parameters

self | a HdyPaginator |

#### Returns

Spacing between pages

Since: 0.0.11

### hdy_paginator_set_spacing ()

    void
    hdy_paginator_set_spacing (HdyPaginator *self,
                               guint spacing);

Sets spacing between pages in pixels.

#### Parameters

self | a HdyPaginator |
spacing | the new spacing value |

Since: 0.0.11

### hdy_paginator_get_animation_duration ()

    guint
    hdy_paginator_get_animation_duration (HdyPaginator *self);

Gets animation duration used by `hdy_paginator_scroll_to()`.

#### Parameters

self | a HdyPaginator |

#### Returns

Animation duration in milliseconds

Since: 0.0.11

### hdy_paginator_set_animation_duration ()

    void
    hdy_paginator_set_animation_duration (HdyPaginator *self,
                                          guint duration);

Sets animation duration used by `hdy_paginator_scroll_to()`.

#### Parameters

self | a HdyPaginator |
duration | animation duration in milliseconds |

Since: 0.0.11

### hdy_paginator_get_allow_mouse_drag ()

    gboolean
    hdy_paginator_get_allow_mouse_drag (HdyPaginator *self);

Sets whether `self` can be dragged with mouse pointer

#### Parameters

self | a HdyPaginator |

#### Returns

`TRUE` if `self` can be dragged with mouse

Since: 0.0.12

### hdy_paginator_set_allow_mouse_drag ()

    void
    hdy_paginator_set_allow_mouse_drag (HdyPaginator *self,
                                        gboolean allow_mouse_drag);

Sets whether `self` can be dragged with mouse pointer. If `allow_mouse_drag` is `FALSE`, dragging is only available on touch.

This should usually be `FALSE`.

#### Parameters

self | a HdyPaginator |
allow_mouse_drag | whether `self` can be dragged with mouse pointer |

Since: 0.0.12

## Types and Values

### HDY_TYPE_PAGINATOR

    #define HDY_TYPE_PAGINATOR (hdy_paginator_get_type())

### enum HdyPaginatorIndicatorStyle

These enumeration values describe the possible page indicator styles in a HdyPaginator widget.

New values may be added to this enumeration over time.

#### Members

HDY_PAGINATOR_INDICATOR_STYLE_NONE | No indicators |
HDY_PAGINATOR_INDICATOR_STYLE_DOTS | Each page is represented by a dot. Active dot gradually becomes larger and more opaque. |
HDY_PAGINATOR_INDICATOR_STYLE_LINES | Each page is represented by a thin and long line, and active view is shown with another line that moves between them |

### HdyPaginator

    typedef struct _HdyPaginator HdyPaginator;

## Property Details

### The `“allow-mouse-drag”` property

      “allow-mouse-drag”         gboolean

Sets whether the HdyPaginator can be dragged with mouse pointer. If the value is `FALSE`, dragging is only available on touch.

This should usually be `FALSE`.

Owner: HdyPaginator

Flags: Read / Write

Default value: FALSE

Since: 0.0.12

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

      “animation-duration”       guint

Animation duration in milliseconds, used by `hdy_paginator_scroll_to()`.

Owner: HdyPaginator

Flags: Read / Write

Default value: 250

Since: 0.0.11

### The `“center-content”` property

      “center-content”           gboolean

Whether the HdyPaginator is centering pages. If “indicator-style” is `HDY_PAGINATOR_INDICATOR_STYLE_NONE` , centering does nothing, otherwise it adds whitespace to the left or above the pages to compensate for the indicators.

Owner: HdyPaginator

Flags: Read / Write

Default value: FALSE

Since: 0.0.11

### The `“indicator-spacing”` property

      “indicator-spacing”        guint

Spacing between content and page indicators. Does nothing if “indicator-style” is `HDY_PAGINATOR_INDICATOR_STYLE_NONE` .

Owner: HdyPaginator

Flags: Read / Write

Default value: 0

Since: 0.0.11

### The `“indicator-style”` property

      “indicator-style”          HdyPaginatorIndicatorStyle

The style of page indicators. Depending on orientation, they are displayed below or besides the pages. If the pages are meant to be centered, “center-content” can be used to compensate for that.

Owner: HdyPaginator

Flags: Read / Write

Default value: HDY_PAGINATOR_INDICATOR_STYLE_NONE

Since: 0.0.11

### The `“interactive”` property

      “interactive”              gboolean

Whether `self` can be navigated. This can be used to temporarily disable a HdyPaginator to only allow navigating it in a certain state.

Owner: HdyPaginator

Flags: Read / Write

Default value: TRUE

Since: 0.0.11

### The `“n-pages”` property

      “n-pages”                  guint

The number of pages in a HdyPaginator

Owner: HdyPaginator

Flags: Read

Default value: 0

Since: 0.0.11

### The `“position”` property

      “position”                 double

Current scrolling position, unitless. 1 matches 1 page. Use `hdy_paginator_scroll_to()` for changing it.

Owner: HdyPaginator

Flags: Read

Allowed values: >= 0

Default value: 0

Since: 0.0.11

### The `“spacing”` property

      “spacing”                  guint

Spacing between pages in pixels.

Owner: HdyPaginator

Flags: Read / Write

Default value: 0

Since: 0.0.11

## Signal Details

### The `“page-changed”` signal

    void
    user_function (HdyPaginator *self,
                   guint         index,
                   gpointer      user_data)

This signal is emitted after a page has been changed. This can be used to implement "infinite scrolling" by connecting to this signal and amending the pages.

#### Parameters

self | The HdyPaginator instance |
index | Current page |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

Since: 0.0.12