Adw.SwipeTracker

g Adw.SwipeTracker Adw.SwipeTracker GObject.GInterface GObject.GInterface Gtk.Orientable Gtk.Orientable GObject.GInterface->Gtk.Orientable GObject.Object GObject.Object GObject.Object->Adw.SwipeTracker Gtk.Orientable->Adw.SwipeTracker

Subclasses:

None

Methods

Inherited:

GObject.Object (37), Gtk.Orientable (2)

Structs:

GObject.ObjectClass (5)

class

new (swipeable)

get_allow_long_swipes ()

get_allow_mouse_drag ()

get_allow_window_handle ()

get_enabled ()

get_lower_overshoot ()

get_reversed ()

get_swipeable ()

get_upper_overshoot ()

set_allow_long_swipes (allow_long_swipes)

set_allow_mouse_drag (allow_mouse_drag)

set_allow_window_handle (allow_window_handle)

set_enabled (enabled)

set_lower_overshoot (overshoot)

set_reversed (reversed)

set_upper_overshoot (overshoot)

shift_position (delta)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Inherited:

Gtk.Orientable (1)

Name

Type

Flags

Short Description

allow-long-swipes

bool

r/w/en

allow-mouse-drag

bool

r/w/en

allow-window-handle

bool

r/w/en

enabled

bool

r/w/en

lower-overshoot

bool

r/w/en

reversed

bool

r/w/en

swipeable

Adw.Swipeable

r/w/co

upper-overshoot

bool

r/w/en

Signals

Inherited:

GObject.Object (1)

Name

Short Description

begin-swipe

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

end-swipe

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

prepare

This signal is emitted when a possible swipe is detected.

update-swipe

This signal is emitted every time the progress value changes.

Fields

Inherited:

GObject.Object (1)

Class Details

class Adw.SwipeTracker(**kwargs)
Bases:

GObject.Object, Gtk.Orientable

Abstract:

No

Structure:

Adw.SwipeTrackerClass

A swipe tracker used in [class`Carousel`], [class`NavigationView`] and [class`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 [property`SwipeTracker`:py:data::enabled<Adw.SwipeTracker.props.enabled>] property. If they expect to use horizontal orientation, [property`SwipeTracker`:py:data::reversed<Adw.SwipeTracker.props.reversed>] can be used for supporting RTL text direction.

classmethod new(swipeable)
Parameters:

swipeable (Adw.Swipeable) – a widget to add the tracker on

Returns:

the newly created AdwSwipeTracker

Return type:

Adw.SwipeTracker

Creates a new AdwSwipeTracker for widget.

get_allow_long_swipes()
Returns:

whether long swipes are allowed

Return type:

bool

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

get_allow_mouse_drag()
Returns:

whether mouse dragging is allowed

Return type:

bool

Gets whether self can be dragged with mouse pointer.

get_allow_window_handle()
Returns:

whether swiping from window handles is allowed

Return type:

bool

Gets whether to allow touchscreen swiping from GtkWindowHandle.

New in version 1.5.

get_enabled()
Returns:

whether self is enabled

Return type:

bool

Gets whether self is enabled.

get_lower_overshoot()
Returns:

whether to allow swiping past the first available snap point

Return type:

bool

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

New in version 1.4.

get_reversed()
Returns:

whether the direction is reversed

Return type:

bool

Gets whether self is reversing the swipe direction.

get_swipeable()
Returns:

the swipeable widget

Return type:

Adw.Swipeable

Get the widget self is attached to.

get_upper_overshoot()
Returns:

whether to allow swiping past the last available snap point

Return type:

bool

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

New in version 1.4.

set_allow_long_swipes(allow_long_swipes)
Parameters:

allow_long_swipes (bool) – whether to 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.

set_allow_mouse_drag(allow_mouse_drag)
Parameters:

allow_mouse_drag (bool) – whether to allow mouse dragging

Sets whether self can be dragged with mouse pointer.

set_allow_window_handle(allow_window_handle)
Parameters:

allow_window_handle (bool) – whether to allow swiping from window handles

Sets whether to allow touchscreen swiping from GtkWindowHandle.

Setting it to TRUE will make dragging the window impossible.

New in version 1.5.

set_enabled(enabled)
Parameters:

enabled (bool) – whether self is 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.

set_lower_overshoot(overshoot)
Parameters:

overshoot (bool) – whether to allow swiping past the first available snap point

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

New in version 1.4.

set_reversed(reversed)
Parameters:

reversed (bool) – whether to reverse the swipe direction

Sets whether to reverse the swipe direction.

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

set_upper_overshoot(overshoot)
Parameters:

overshoot (bool) – whether to allow swiping past the last available snap point

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

New in version 1.4.

shift_position(delta)
Parameters:

delta (float) – the position delta

Moves the current progress value by delta.

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

Signal Details

Adw.SwipeTracker.signals.begin_swipe(swipe_tracker)
Signal Name:

begin-swipe

Flags:

RUN_FIRST

Parameters:

swipe_tracker (Adw.SwipeTracker) – The object which received the signal

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

Adw.SwipeTracker.signals.end_swipe(swipe_tracker, velocity, to)
Signal Name:

end-swipe

Flags:

RUN_FIRST

Parameters:
  • swipe_tracker (Adw.SwipeTracker) – The object which received the signal

  • velocity (float) – the velocity of the swipe

  • to (float) – the progress value to animate 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. [class`SpringAnimation`] is usually a good fit for this.

Adw.SwipeTracker.signals.prepare(swipe_tracker, direction)
Signal Name:

prepare

Flags:

RUN_FIRST

Parameters:

This signal is emitted when a possible swipe is detected.

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

Adw.SwipeTracker.signals.update_swipe(swipe_tracker, progress)
Signal Name:

update-swipe

Flags:

RUN_FIRST

Parameters:
  • swipe_tracker (Adw.SwipeTracker) – The object which received the signal

  • progress (float) – the current animation progress value

This signal is emitted every time the progress value changes.

Property Details

Adw.SwipeTracker.props.allow_long_swipes
Name:

allow-long-swipes

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

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.

Adw.SwipeTracker.props.allow_mouse_drag
Name:

allow-mouse-drag

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether to allow dragging with mouse pointer.

Adw.SwipeTracker.props.allow_window_handle
Name:

allow-window-handle

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether to allow touchscreen swiping from GtkWindowHandle.

This will make dragging the window impossible.

New in version 1.5.

Adw.SwipeTracker.props.enabled
Name:

enabled

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

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.

Adw.SwipeTracker.props.lower_overshoot
Name:

lower-overshoot

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether to allow swiping past the first available snap point.

New in version 1.4.

Adw.SwipeTracker.props.reversed
Name:

reversed

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether to reverse the swipe direction.

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

Adw.SwipeTracker.props.swipeable
Name:

swipeable

Type:

Adw.Swipeable

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The widget the swipe tracker is attached to.

Adw.SwipeTracker.props.upper_overshoot
Name:

upper-overshoot

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether to allow swiping past the last available snap point.

New in version 1.4.