HdySwipeTracker: Handy Reference Manual

## HdySwipeTracker HdySwipeTracker — Swipe tracker used in HdyCarousel and HdyLeaflet |

## Functions

HdySwipeTracker * | hdy_swipe_tracker_new ()
HdySwipeable * | hdy_swipe_tracker_get_swipeable ()
gboolean | hdy_swipe_tracker_get_enabled ()
void | hdy_swipe_tracker_set_enabled ()
gboolean | hdy_swipe_tracker_get_reversed ()
void | hdy_swipe_tracker_set_reversed ()
gboolean | hdy_swipe_tracker_get_allow_mouse_drag ()
void | hdy_swipe_tracker_set_allow_mouse_drag ()
gboolean | hdy_swipe_tracker_get_allow_long_swipes ()
void | hdy_swipe_tracker_set_allow_long_swipes ()
void | hdy_swipe_tracker_shift_position ()

## Properties

gboolean | allow-long-swipes | Read / Write
gboolean | allow-mouse-drag | Read / Write
gboolean | enabled | Read / Write
gboolean | reversed | Read / Write
HdySwipeable * | swipeable | Read / Write / Construct Only

## Signals

void | begin-swipe | Run First
void | end-swipe | Run First
void | update-swipe | Run First

## Types and Values

#define | HDY_TYPE_SWIPE_TRACKER
| HdySwipeTracker

## Object Hierarchy

        GObject
        ╰── HdySwipeTracker

## Implemented Interfaces

HdySwipeTracker implements GtkOrientable.

## Description

The HdySwipeTracker object can be used for implementing widgets with swipe gestures. It supports touch-based swipes, pointer dragging, and touchpad scrolling.

The widgets will probably want to expose “enabled” property. If they expect to use horizontal orientation, “reversed” property can be used for supporting RTL text direction.

## Functions

### hdy_swipe_tracker_new ()

    HdySwipeTracker *
    hdy_swipe_tracker_new (HdySwipeable *swipeable);

Create a new HdySwipeTracker object on `widget` .

#### Parameters

swipeable | a GtkWidget to add the tracker on |

#### Returns

the newly created HdySwipeTracker object

Since: 1.0

### hdy_swipe_tracker_get_swipeable ()

    HdySwipeable *
    hdy_swipe_tracker_get_swipeable (HdySwipeTracker *self);

Get `self` 's swipeable widget.

#### Parameters

self | a HdySwipeTracker |

#### Returns

the swipeable widget.

[transfer none]

Since: 1.0

### hdy_swipe_tracker_get_enabled ()

    gboolean
    hdy_swipe_tracker_get_enabled (HdySwipeTracker *self);

Get whether `self` is enabled. When it's not enabled, no events will be processed. Generally widgets will want to expose this via a property.

#### Parameters

self | a HdySwipeTracker |

#### Returns

`TRUE` if `self` is enabled

Since: 1.0

### hdy_swipe_tracker_set_enabled ()

    void
    hdy_swipe_tracker_set_enabled (HdySwipeTracker *self,
                                   gboolean enabled);

Set whether `self` is enabled. When it's not enabled, no events will be processed. Usually widgets will want to expose this via a property.

#### Parameters

self | a HdySwipeTracker |
enabled | whether to enable to swipe tracker |

Since: 1.0

### hdy_swipe_tracker_get_reversed ()

    gboolean
    hdy_swipe_tracker_get_reversed (HdySwipeTracker *self);

Get whether `self` is reversing the swipe direction.

#### Parameters

self | a HdySwipeTracker |

#### Returns

`TRUE` is the direction is reversed

Since: 1.0

### hdy_swipe_tracker_set_reversed ()

    void
    hdy_swipe_tracker_set_reversed (HdySwipeTracker *self,
                                    gboolean reversed);

Set whether to reverse the swipe direction. If `self` is horizontal, can be used for supporting RTL text direction.

#### Parameters

self | a HdySwipeTracker |
reversed | whether to reverse the swipe direction |

Since: 1.0

### hdy_swipe_tracker_get_allow_mouse_drag ()

    gboolean
    hdy_swipe_tracker_get_allow_mouse_drag
                                   (HdySwipeTracker *self);

Get whether `self` can be dragged with mouse pointer.

#### Parameters

self | a HdySwipeTracker |

#### Returns

`TRUE` is mouse dragging is allowed

Since: 1.0

### hdy_swipe_tracker_set_allow_mouse_drag ()

    void
    hdy_swipe_tracker_set_allow_mouse_drag
                                   (HdySwipeTracker *self,
                                    gboolean allow_mouse_drag);

Set whether `self` can be dragged with mouse pointer. This should usually be `FALSE`.

#### Parameters

self | a HdySwipeTracker |
allow_mouse_drag | whether to allow mouse dragging |

Since: 1.0

### hdy_swipe_tracker_get_allow_long_swipes ()

    gboolean
    hdy_swipe_tracker_get_allow_long_swipes
                                   (HdySwipeTracker *self);

Whether to allow swiping for more than one snap point at a time. If the value is `FALSE`, each swipe can only move to the adjacent snap points.

#### Parameters

self | a HdySwipeTracker |

#### Returns

`TRUE` if long swipes are allowed, `FALSE` otherwise

Since: 1.2

### hdy_swipe_tracker_set_allow_long_swipes ()

    void
    hdy_swipe_tracker_set_allow_long_swipes
                                   (HdySwipeTracker *self,
                                    gboolean allow_long_swipes);

Sets whether to allow swiping for more than one snap point at a time. If the value is `FALSE`, each swipe can only move to the adjacent snap points.

#### Parameters

self | a HdySwipeTracker |
allow_long_swipes | whether to allow long swipes |

Since: 1.2

### hdy_swipe_tracker_shift_position ()

    void
    hdy_swipe_tracker_shift_position (HdySwipeTracker *self,
                                      gdouble delta);

Move the current progress value by `delta` . This can be used to adjust the current position if snap points move during the gesture.

#### Parameters

self | a HdySwipeTracker |
delta | the position delta |

Since: 1.0

## Types and Values

### HDY_TYPE_SWIPE_TRACKER

    #define HDY_TYPE_SWIPE_TRACKER (hdy_swipe_tracker_get_type())

### HdySwipeTracker

    typedef struct _HdySwipeTracker HdySwipeTracker;

## Property Details

### The `“allow-long-swipes”` property

      “allow-long-swipes”        gboolean

Whether to allow swiping for more than one snap point at a time. If the value is `FALSE`, each swipe can only move to the adjacent snap points.

Owner: HdySwipeTracker

Flags: Read / Write

Default value: FALSE

Since: 1.2

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

      “allow-mouse-drag”         gboolean

Whether to allow dragging with mouse pointer. This should usually be `FALSE`.

Owner: HdySwipeTracker

Flags: Read / Write

Default value: FALSE

Since: 1.0

### The `“enabled”` property

      “enabled”                  gboolean

Whether the swipe tracker is enabled. When it's not enabled, no events will be processed. Usually widgets will want to expose this via a property.

Owner: HdySwipeTracker

Flags: Read / Write

Default value: TRUE

Since: 1.0

### The `“reversed”` property

      “reversed”                 gboolean

Whether to reverse the swipe direction. If the swipe tracker is horizontal, it can be used for supporting RTL text direction.

Owner: HdySwipeTracker

Flags: Read / Write

Default value: FALSE

Since: 1.0

### The `“swipeable”` property

      “swipeable”                HdySwipeable *

The widget the swipe tracker is attached to. Must not be `NULL`.

Owner: HdySwipeTracker

Flags: Read / Write / Construct Only

Since: 1.0

## Signal Details

### The `“begin-swipe”` signal

    void
    user_function (HdySwipeTracker       *self,
                   HdyNavigationDirection direction,
                   gboolean               direct,
                   gpointer               user_data)

This signal is emitted when a possible swipe is detected.

The `direction` value can be used to restrict the swipe to a certain direction.

#### Parameters

self | The HdySwipeTracker instance |
direction | The direction of the swipe |
direct | `TRUE` if the swipe is directly triggered by a gesture, `FALSE` if it's triggered via a HdySwipeGroup |
user_data | user data set when the signal handler was connected. |

Flags: Run First

Since: 1.0

### The `“end-swipe”` signal

    void
    user_function (HdySwipeTracker *self,
                   gint64           duration,
                   double           to,
                   gpointer         user_data)

This signal is emitted as soon as the gesture has stopped.

#### Parameters

self | The HdySwipeTracker instance |
duration | Snap-back animation duration in milliseconds |
to | The progress value to animate to |
user_data | user data set when the signal handler was connected. |

Flags: Run First

Since: 1.0

### The `“update-swipe”` signal

    void
    user_function (HdySwipeTracker *self,
                   double           progress,
                   gpointer         user_data)

This signal is emitted every time the progress value changes.

#### Parameters

self | The HdySwipeTracker instance |
progress | The current animation progress value |
user_data | user data set when the signal handler was connected. |

Flags: Run First

Since: 1.0

## See Also

HdyCarousel, HdyDeck, HdyLeaflet, HdySwipeable