HdySwipeTracker

HdySwipeTracker — Swipe tracker used in HdyCarousel and HdyLeaflet

Functions

Properties

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

Signals

Types and Values

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_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-mouse-drag” property

  “allow-mouse-drag”         gboolean

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

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.

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.

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.

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,
               gdouble          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,
               gdouble          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