Adw.Swipeable

g Adw.Swipeable Adw.Swipeable GObject.GInterface GObject.GInterface GObject.GInterface->Adw.Swipeable

Implementations:

Adw.Carousel, Adw.Flap, Adw.Leaflet, Adw.NavigationView, Adw.OverlaySplitView

Methods

get_cancel_progress ()

get_distance ()

get_progress ()

get_snap_points ()

get_swipe_area (navigation_direction, is_drag)

Virtual Methods

do_get_cancel_progress ()

do_get_distance ()

do_get_progress ()

do_get_snap_points ()

do_get_swipe_area (navigation_direction, is_drag)

Properties

None

Signals

None

Fields

None

Class Details

class Adw.Swipeable
Bases:

GObject.GInterface

Structure:

Adw.SwipeableInterface

An interface for swipeable widgets.

The AdwSwipeable interface is implemented by all swipeable widgets.

See [class`SwipeTracker`] for details about implementing it.

get_cancel_progress()
Returns:

the cancel progress, unitless

Return type:

float

Gets the progress self will snap back to after the gesture is canceled.

get_distance()
Returns:

the swipe distance in pixels

Return type:

float

Gets the swipe distance of self.

This corresponds to how many pixels 1 unit represents.

get_progress()
Returns:

the current progress, unitless

Return type:

float

Gets the current progress of self.

get_snap_points()
Returns:

the snap points

Return type:

[float]

Gets the snap points of self.

Each snap point represents a progress value that is considered acceptable to end the swipe on.

get_swipe_area(navigation_direction, is_drag)
Parameters:
  • navigation_direction (Adw.NavigationDirection) – the direction of the swipe

  • is_drag (bool) – whether the swipe is caused by a dragging gesture

Returns:

a pointer to a rectangle to store the swipe area

Return type:

rect: Gdk.Rectangle

Gets the area self can start a swipe from for the given direction and gesture type.

This can be used to restrict swipes to only be possible from a certain area, for example, to only allow edge swipes, or to have a draggable element and ignore swipes elsewhere.

If not implemented, the default implementation returns the allocation of self, allowing swipes from anywhere.

do_get_cancel_progress() virtual
Returns:

the cancel progress, unitless

Return type:

float

Gets the progress self will snap back to after the gesture is canceled.

do_get_distance() virtual
Returns:

the swipe distance in pixels

Return type:

float

Gets the swipe distance of self.

This corresponds to how many pixels 1 unit represents.

do_get_progress() virtual
Returns:

the current progress, unitless

Return type:

float

Gets the current progress of self.

do_get_snap_points() virtual
Returns:

the snap points

Return type:

[float]

Gets the snap points of self.

Each snap point represents a progress value that is considered acceptable to end the swipe on.

do_get_swipe_area(navigation_direction, is_drag) virtual
Parameters:
  • navigation_direction (Adw.NavigationDirection) – the direction of the swipe

  • is_drag (bool) – whether the swipe is caused by a dragging gesture

Returns:

a pointer to a rectangle to store the swipe area

Return type:

rect: Gdk.Rectangle

Gets the area self can start a swipe from for the given direction and gesture type.

This can be used to restrict swipes to only be possible from a certain area, for example, to only allow edge swipes, or to have a draggable element and ignore swipes elsewhere.

If not implemented, the default implementation returns the allocation of self, allowing swipes from anywhere.