1.59 <AdwSwipeTracker>

Class: <AdwSwipeTracker>

It derives from <GObject>.

A swipe tracker used in Carousel, NavigationView and OverlaySplitView.

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 the SwipeTracker:enabled property. If they expect to use horizontal orientation, SwipeTracker:reversed can be used for supporting RTL text direction.

Properties

Property: swipe-tracker:allow-long-swipes 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.

Its value is a boolean.

Set it with (set! (swipe-tracker:allow-long-swipes self) value).

Property: swipe-tracker:allow-mouse-drag self

Whether to allow dragging with mouse pointer.

Its value is a boolean.

Set it with (set! (swipe-tracker:allow-mouse-drag self) value).

Property: swipe-tracker:allow-window-handle self

Whether to allow touchscreen swiping from <GtkWindowHandle>.

This will make dragging the window impossible.

Its value is a boolean.

Set it with (set! (swipe-tracker:allow-window-handle self) value).

Property: swipe-tracker:enabled self

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.

Its value is a boolean.

Set it with (set! (swipe-tracker:enabled self) value).

Property: swipe-tracker:lower-overshoot self

Whether to allow swiping past the first available snap point.

Its value is a boolean.

Set it with (set! (swipe-tracker:lower-overshoot self) value).

Property: swipe-tracker:reversed self

Whether to reverse the swipe direction.

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

Its value is a boolean.

Set it with (set! (swipe-tracker:reversed self) value).

Property: swipe-tracker:swipeable self

The widget the swipe tracker is attached to.

Its value is a <AdwSwipeable>, or #f.

It can only be set when the object is made, with #:swipeable.

Property: swipe-tracker:upper-overshoot self

Whether to allow swiping past the last available snap point.

Its value is a boolean.

Set it with (set! (swipe-tracker:upper-overshoot self) value).

Procedures

Method: swipe-tracker:get-allow-long-swipes? self ⇒ %return
Method: get-allow-long-swipes? self ⇒ %return

Gets whether to allow swiping for more than one snap point at a time.

self

Passed: a <AdwSwipeTracker>.

a swipe tracker

%return

Returned: a boolean.

whether long swipes are allowed

Method: swipe-tracker:get-allow-mouse-drag? self ⇒ %return
Method: get-allow-mouse-drag? self ⇒ %return

Gets whether self can be dragged with mouse pointer.

self

Passed: a <AdwSwipeTracker>.

a swipe tracker

%return

Returned: a boolean.

whether mouse dragging is allowed

Method: swipe-tracker:get-allow-window-handle? self ⇒ %return
Method: get-allow-window-handle? self ⇒ %return

Gets whether to allow touchscreen swiping from <GtkWindowHandle>.

self

Passed: a <AdwSwipeTracker>.

a swipe tracker

%return

Returned: a boolean.

whether swiping from window handles is allowed

Method: swipe-tracker:get-enabled? self ⇒ %return
Method: get-enabled? self ⇒ %return

Gets whether self is enabled.

self

Passed: a <AdwSwipeTracker>.

a swipe tracker

%return

Returned: a boolean.

whether self is enabled

Method: swipe-tracker:get-lower-overshoot? self ⇒ %return
Method: get-lower-overshoot? self ⇒ %return

Gets whether to allow swiping past the first available snap point.

self

Passed: a <AdwSwipeTracker>.

a swipe tracker

%return

Returned: a boolean.

whether to allow swiping past the first available snap point

Method: swipe-tracker:get-reversed? self ⇒ %return
Method: get-reversed? self ⇒ %return

Gets whether self is reversing the swipe direction.

self

Passed: a <AdwSwipeTracker>.

a swipe tracker

%return

Returned: a boolean.

whether the direction is reversed

Method: swipe-tracker:get-swipeable self ⇒ %return
Method: get-swipeable self ⇒ %return

Get the widget self is attached to.

self

Passed: a <AdwSwipeTracker>.

a swipe tracker

%return

Returned: a <AdwSwipeable>.

the swipeable widget

Method: swipe-tracker:get-upper-overshoot? self ⇒ %return
Method: get-upper-overshoot? self ⇒ %return

Gets whether to allow swiping past the last available snap point.

self

Passed: a <AdwSwipeTracker>.

a swipe tracker

%return

Returned: a boolean.

whether to allow swiping past the last available snap point

Procedure: swipe-tracker:new swipeable ⇒ %return

Creates a new <AdwSwipeTracker> for widget.

swipeable

Passed: a <AdwSwipeable>.

a widget to add the tracker on

%return

Returned: a <AdwSwipeTracker>.

the newly created <AdwSwipeTracker>

Method: swipe-tracker:set-allow-long-swipes self allow-long-swipes
Method: set-allow-long-swipes self 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.

self

Passed: a <AdwSwipeTracker>.

a swipe tracker

allow-long-swipes

Passed: a boolean.

whether to allow long swipes

Method: swipe-tracker:set-allow-mouse-drag self allow-mouse-drag
Method: set-allow-mouse-drag self allow-mouse-drag

Sets whether self can be dragged with mouse pointer.

self

Passed: a <AdwSwipeTracker>.

a swipe tracker

allow-mouse-drag

Passed: a boolean.

whether to allow mouse dragging

Method: swipe-tracker:set-allow-window-handle self allow-window-handle
Method: set-allow-window-handle self allow-window-handle

Sets whether to allow touchscreen swiping from <GtkWindowHandle>.

Setting it to TRUE will make dragging the window impossible.

self

Passed: a <AdwSwipeTracker>.

a swipe tracker

allow-window-handle

Passed: a boolean.

whether to allow swiping from window handles

Method: swipe-tracker:set-enabled self enabled
Method: set-enabled self enabled

Sets whether self is enabled.

When it’s not enabled, no events will be processed. Usually widgets will want to expose this via a property.

self

Passed: a <AdwSwipeTracker>.

a swipe tracker

enabled

Passed: a boolean.

whether self is enabled

Method: swipe-tracker:set-lower-overshoot self overshoot
Method: set-lower-overshoot self overshoot

Sets whether to allow swiping past the first available snap point.

self

Passed: a <AdwSwipeTracker>.

a swipe tracker

overshoot

Passed: a boolean.

whether to allow swiping past the first available snap point

Method: swipe-tracker:set-reversed self reversed
Method: set-reversed self reversed

Sets whether to reverse the swipe direction.

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

self

Passed: a <AdwSwipeTracker>.

a swipe tracker

reversed

Passed: a boolean.

whether to reverse the swipe direction

Method: swipe-tracker:set-upper-overshoot self overshoot
Method: set-upper-overshoot self overshoot

Sets whether to allow swiping past the last available snap point.

self

Passed: a <AdwSwipeTracker>.

a swipe tracker

overshoot

Passed: a boolean.

whether to allow swiping past the last available snap point

Method: swipe-tracker:shift-position self delta
Method: shift-position self delta

Moves the current progress value by delta.

This can be used to adjust the current position if snap points move during the gesture.

self

Passed: a <AdwSwipeTracker>.

a swipe tracker

delta

Passed: a real number.

the position delta

Signals

Signal: swipe-tracker:begin-swipe

Connect a handler with (connect object swipe-tracker:begin-swipe handler). It is called as (handler self).

This signal is emitted right before a swipe will be started, after the drag threshold has been passed.

self

Passed: a <AdwSwipeTracker>.

Signal: swipe-tracker:end-swipe

Connect a handler with (connect object swipe-tracker:end-swipe handler). It is called as (handler self velocity to).

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

The user is expected to animate the deceleration from the current progress value to to with an animation using velocity as the initial velocity, provided in pixels per second. SpringAnimation is usually a good fit for this.

self

Passed: a <AdwSwipeTracker>.

velocity

Passed: a real number.

the velocity of the swipe

to

Passed: a real number.

the progress value to animate to

Signal: swipe-tracker:prepare

Connect a handler with (connect object swipe-tracker:prepare handler). It is called as (handler self direction).

This signal is emitted when a possible swipe is detected.

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

self

Passed: a <AdwSwipeTracker>.

direction

Passed: a <AdwNavigationDirection>.

the direction of the swipe

Signal: swipe-tracker:update-swipe

Connect a handler with (connect object swipe-tracker:update-swipe handler). It is called as (handler self progress).

This signal is emitted every time the progress value changes.

self

Passed: a <AdwSwipeTracker>.

progress

Passed: a real number.

the current animation progress value