AdwSwipeTracker

AdwSwipeTracker — Swipe tracker used in AdwCarousel and AdwLeaflet

Functions

Properties

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

Signals

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

Types and Values

Object Hierarchy

    GObject
    ╰── AdwSwipeTracker

Implemented Interfaces

AdwSwipeTracker implements GtkOrientable.

Description

The AdwSwipeTracker 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

adw_swipe_tracker_new ()

AdwSwipeTracker *
adw_swipe_tracker_new (AdwSwipeable *swipeable);

Create a new AdwSwipeTracker object on widget .

Parameters

swipeable

a GtkWidget to add the tracker on

 

Returns

the newly created AdwSwipeTracker object

Since: 1.0


adw_swipe_tracker_get_swipeable ()

AdwSwipeable *
adw_swipe_tracker_get_swipeable (AdwSwipeTracker *self);

Get self 's swipeable widget.

Parameters

self

a AdwSwipeTracker

 

Returns

the swipeable widget.

[transfer none]

Since: 1.0


adw_swipe_tracker_get_enabled ()

gboolean
adw_swipe_tracker_get_enabled (AdwSwipeTracker *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 AdwSwipeTracker

 

Returns

TRUE if self is enabled

Since: 1.0


adw_swipe_tracker_set_enabled ()

void
adw_swipe_tracker_set_enabled (AdwSwipeTracker *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 AdwSwipeTracker

 

enabled

whether to enable to swipe tracker

 

Since: 1.0


adw_swipe_tracker_get_reversed ()

gboolean
adw_swipe_tracker_get_reversed (AdwSwipeTracker *self);

Get whether self is reversing the swipe direction.

Parameters

self

a AdwSwipeTracker

 

Returns

TRUE is the direction is reversed

Since: 1.0


adw_swipe_tracker_set_reversed ()

void
adw_swipe_tracker_set_reversed (AdwSwipeTracker *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 AdwSwipeTracker

 

reversed

whether to reverse the swipe direction

 

Since: 1.0


adw_swipe_tracker_get_allow_mouse_drag ()

gboolean
adw_swipe_tracker_get_allow_mouse_drag
                               (AdwSwipeTracker *self);

Get whether self can be dragged with mouse pointer.

Parameters

self

a AdwSwipeTracker

 

Returns

TRUE is mouse dragging is allowed

Since: 1.0


adw_swipe_tracker_set_allow_mouse_drag ()

void
adw_swipe_tracker_set_allow_mouse_drag
                               (AdwSwipeTracker *self,
                                gboolean allow_mouse_drag);

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

Parameters

self

a AdwSwipeTracker

 

allow_mouse_drag

whether to allow mouse dragging

 

Since: 1.0


adw_swipe_tracker_get_allow_long_swipes ()

gboolean
adw_swipe_tracker_get_allow_long_swipes
                               (AdwSwipeTracker *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 AdwSwipeTracker

 

Returns

TRUE if long swipes are allowed, FALSE otherwise

Since: 1.0


adw_swipe_tracker_set_allow_long_swipes ()

void
adw_swipe_tracker_set_allow_long_swipes
                               (AdwSwipeTracker *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 AdwSwipeTracker

 

allow_long_swipes

whether to allow long swipes

 

Since: 1.0


adw_swipe_tracker_shift_position ()

void
adw_swipe_tracker_shift_position (AdwSwipeTracker *self,
                                  double 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 AdwSwipeTracker

 

delta

the position delta

 

Since: 1.0

Types and Values

ADW_TYPE_SWIPE_TRACKER

#define ADW_TYPE_SWIPE_TRACKER (adw_swipe_tracker_get_type())

AdwSwipeTracker

typedef struct _AdwSwipeTracker AdwSwipeTracker;

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

Flags: Read / Write

Default value: FALSE

Since: 1.0


The “allow-mouse-drag” property

  “allow-mouse-drag”         gboolean

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

Owner: AdwSwipeTracker

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

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

Flags: Read / Write

Default value: FALSE

Since: 1.0


The “swipeable” property

  “swipeable”                AdwSwipeable *

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

Owner: AdwSwipeTracker

Flags: Read / Write / Construct Only

Since: 1.0

Signal Details

The “begin-swipe” signal

void
user_function (AdwSwipeTracker       *self,
               AdwNavigationDirection 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 AdwSwipeTracker 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 AdwSwipeGroup

 

user_data

user data set when the signal handler was connected.

 

Flags: Run First

Since: 1.0


The “end-swipe” signal

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

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

Parameters

self

The AdwSwipeTracker 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 (AdwSwipeTracker *self,
               double           progress,
               gpointer         user_data)

This signal is emitted every time the progress value changes.

Parameters

self

The AdwSwipeTracker 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

AdwCarousel, AdwLeaflet, AdwSwipeable