pub trait SwipeableExt: IsA<Swipeable> + Sealed + 'static {
    // Provided methods
    fn emit_child_switched(&self, index: u32, duration: i64) { ... }
    fn cancel_progress(&self) -> f64 { ... }
    fn distance(&self) -> f64 { ... }
    fn progress(&self) -> f64 { ... }
    fn snap_points(&self) -> Vec<f64> { ... }
    fn swipe_area(
        &self,
        navigation_direction: NavigationDirection,
        is_drag: bool
    ) -> Rectangle { ... }
    fn swipe_tracker(&self) -> Option<SwipeTracker> { ... }
    fn switch_child(&self, index: u32, duration: i64) { ... }
    fn connect_child_switched<F: Fn(&Self, u32, i64) + 'static>(
        &self,
        f: F
    ) -> SignalHandlerId { ... }
}
Expand description

Trait containing all Swipeable methods.

Implementors

Carousel, Deck, Flap, Leaflet, Swipeable

Provided Methods§

source

fn emit_child_switched(&self, index: u32, duration: i64)

Emits child-switched signal.

This should be called when the widget switches visible child widget.

@duration can be 0 if the child is switched without animation.

index

the index of the child to switch to

duration

animation duration, in milliseconds

source

fn cancel_progress(&self) -> f64

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

Returns

the cancel progress, unitless

source

fn distance(&self) -> f64

Gets the swipe distance of @self.

This corresponds to how many pixels 1 unit represents.

Returns

the swipe distance in pixels

source

fn progress(&self) -> f64

Gets the current progress of @self.

Returns

the current progress, unitless

source

fn snap_points(&self) -> Vec<f64>

Gets the snap points of @self.

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

Returns

the snap points

source

fn swipe_area( &self, navigation_direction: NavigationDirection, is_drag: bool ) -> 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.

Swipe area is only considered for direct swipes (as in, not initiated by SwipeGroup).

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

the direction of the swipe

is_drag

whether the swipe is caused by a dragging gesture

Returns
rect

a pointer to a rectangle to store the swipe area

source

fn swipe_tracker(&self) -> Option<SwipeTracker>

Gets the SwipeTracker used by this swipeable widget.

Returns

the swipe tracker

source

fn switch_child(&self, index: u32, duration: i64)

Switches to child with index @index.

See child-switched.

index

the index of the child to switch to

duration

animation duration, in milliseconds

source

fn connect_child_switched<F: Fn(&Self, u32, i64) + 'static>( &self, f: F ) -> SignalHandlerId

Emitted when the widget’s visible child is changed.

@duration can be 0 if the child is switched without animation.

This is used by SwipeGroup, applications should not connect to it.

index

the index of the child to switch to

duration

animation duration, in milliseconds

Object Safety§

This trait is not object safe.

Implementors§