Class SwipeTracker
- All Implemented Interfaces:
Orientable,Proxy
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceFunctional interface declaration of theBeginSwipeCallbackcallback.static classSwipeTracker.Builder<B extends SwipeTracker.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static interfaceFunctional interface declaration of theEndSwipeCallbackcallback.static interfaceFunctional interface declaration of thePrepareCallbackcallback.static classstatic interfaceFunctional interface declaration of theUpdateSwipeCallbackcallback.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClassNested classes/interfaces inherited from interface org.gnome.gtk.Orientable
Orientable.Orientable$Impl, Orientable.OrientableIface -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new SwipeTracker.SwipeTracker(MemorySegment address) Create a SwipeTracker proxy instance for the provided memory address.SwipeTracker(Swipeable swipeable) Creates a newAdwSwipeTrackerforwidget. -
Method Summary
Modifier and TypeMethodDescriptionprotected SwipeTrackerasParent()Returns this instance as if it were its parent type.static SwipeTracker.Builder<? extends SwipeTracker.Builder> builder()ASwipeTracker.Builderobject constructs aSwipeTrackerwith the specified properties.voidEmits the "begin-swipe" signal.voidemitEndSwipe(double velocity, double to) Emits the "end-swipe" signal.voidemitPrepare(NavigationDirection direction) Emits the "prepare" signal.voidemitUpdateSwipe(double progress) Emits the "update-swipe" signal.booleanGets whether to allow swiping for more than one snap point at a time.booleanGets whether this SwipeTracker can be dragged with mouse pointer.booleanGets whether to allow touchscreen swiping fromGtkWindowHandle.booleanGets whether this SwipeTracker is enabled.booleanGets whether to allow swiping past the first available snap point.booleanGets whether this SwipeTracker is reversing the swipe direction.Get the widget this SwipeTracker is attached to.static @Nullable TypegetType()Get the GType of the SwipeTracker classbooleanGets whether to allow swiping past the last available snap point.This signal is emitted right before a swipe will be started, after the drag threshold has been passed.onEndSwipe(SwipeTracker.EndSwipeCallback handler) This signal is emitted as soon as the gesture has stopped.onPrepare(SwipeTracker.PrepareCallback handler) This signal is emitted when a possible swipe is detected.This signal is emitted every time the progress value changes.voidsetAllowLongSwipes(boolean allowLongSwipes) Sets whether to allow swiping for more than one snap point at a time.voidsetAllowMouseDrag(boolean allowMouseDrag) Sets whether this SwipeTracker can be dragged with mouse pointer.voidsetAllowWindowHandle(boolean allowWindowHandle) Sets whether to allow touchscreen swiping fromGtkWindowHandle.voidsetEnabled(boolean enabled) Sets whether this SwipeTracker is enabled.voidsetLowerOvershoot(boolean overshoot) Sets whether to allow swiping past the first available snap point.voidsetReversed(boolean reversed) Sets whether to reverse the swipe direction.voidsetUpperOvershoot(boolean overshoot) Sets whether to allow swiping past the last available snap point.voidshiftPosition(double delta) Moves the current progress value bydelta.Methods inherited from class org.gnome.gobject.GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getMemoryLayout, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class org.javagi.base.ProxyInstance
equals, handle, hashCodeMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.gnome.gtk.Orientable
getOrientation, setOrientation
-
Constructor Details
-
SwipeTracker
Create a SwipeTracker proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
SwipeTracker
Creates a newAdwSwipeTrackerforwidget.- Parameters:
swipeable- a widget to add the tracker on
-
SwipeTracker
public SwipeTracker()Creates a new SwipeTracker.
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuperkeyword, but will set the native typeclass function pointers to the parent type. When overriding a native virtual method in Java, "chaining up" withsuper.methodName()doesn't work, because it invokes the overridden function pointer again. To chain up, callasParent().methodName(). This will call the native function pointer of this virtual method in the typeclass of the parent type. -
getAllowLongSwipes
public boolean getAllowLongSwipes()Gets whether to allow swiping for more than one snap point at a time.- Returns:
- whether long swipes are allowed
-
getAllowMouseDrag
public boolean getAllowMouseDrag()Gets whether this SwipeTracker can be dragged with mouse pointer.- Returns:
- whether mouse dragging is allowed
-
getAllowWindowHandle
public boolean getAllowWindowHandle()Gets whether to allow touchscreen swiping fromGtkWindowHandle.- Returns:
- whether swiping from window handles is allowed
- Since:
- 1.5
-
getEnabled
public boolean getEnabled()Gets whether this SwipeTracker is enabled.- Returns:
- whether this SwipeTracker is enabled
-
getLowerOvershoot
public boolean getLowerOvershoot()Gets whether to allow swiping past the first available snap point.- Returns:
- whether to allow swiping past the first available snap point
- Since:
- 1.4
-
getReversed
public boolean getReversed()Gets whether this SwipeTracker is reversing the swipe direction.- Returns:
- whether the direction is reversed
-
getSwipeable
Get the widget this SwipeTracker is attached to.- Returns:
- the swipeable widget
-
getUpperOvershoot
public boolean getUpperOvershoot()Gets whether to allow swiping past the last available snap point.- Returns:
- whether to allow swiping past the last available snap point
- Since:
- 1.4
-
setAllowLongSwipes
public void setAllowLongSwipes(boolean allowLongSwipes) 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:
allowLongSwipes- whether to allow long swipes
-
setAllowMouseDrag
public void setAllowMouseDrag(boolean allowMouseDrag) Sets whether this SwipeTracker can be dragged with mouse pointer.- Parameters:
allowMouseDrag- whether to allow mouse dragging
-
setAllowWindowHandle
public void setAllowWindowHandle(boolean allowWindowHandle) Sets whether to allow touchscreen swiping fromGtkWindowHandle.Setting it to
TRUEwill make dragging the window impossible.- Parameters:
allowWindowHandle- whether to allow swiping from window handles- Since:
- 1.5
-
setEnabled
public void setEnabled(boolean enabled) Sets whether this SwipeTracker is enabled.When it's not enabled, no events will be processed. Usually widgets will want to expose this via a property.
- Parameters:
enabled- whether this SwipeTracker is enabled
-
setLowerOvershoot
public void setLowerOvershoot(boolean overshoot) Sets whether to allow swiping past the first available snap point.- Parameters:
overshoot- whether to allow swiping past the first available snap point- Since:
- 1.4
-
setReversed
public void setReversed(boolean reversed) Sets whether to reverse the swipe direction.If the swipe tracker is horizontal, it can be used for supporting RTL text direction.
- Parameters:
reversed- whether to reverse the swipe direction
-
setUpperOvershoot
public void setUpperOvershoot(boolean overshoot) Sets whether to allow swiping past the last available snap point.- Parameters:
overshoot- whether to allow swiping past the last available snap point- Since:
- 1.4
-
shiftPosition
public void shiftPosition(double delta) Moves the current progress value bydelta.This can be used to adjust the current position if snap points move during the gesture.
- Parameters:
delta- the position delta
-
onBeginSwipe
public SignalConnection<SwipeTracker.BeginSwipeCallback> onBeginSwipe(SwipeTracker.BeginSwipeCallback handler) This signal is emitted right before a swipe will be started, after the drag threshold has been passed.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitBeginSwipe
public void emitBeginSwipe()Emits the "begin-swipe" signal. SeeonBeginSwipe(org.gnome.adw.SwipeTracker.BeginSwipeCallback). -
onEndSwipe
public SignalConnection<SwipeTracker.EndSwipeCallback> onEndSwipe(SwipeTracker.EndSwipeCallback handler) 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
towith an animation usingvelocityas the initial velocity, provided in pixels per second.SpringAnimationis usually a good fit for this.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitEndSwipe
public void emitEndSwipe(double velocity, double to) Emits the "end-swipe" signal. SeeonEndSwipe(org.gnome.adw.SwipeTracker.EndSwipeCallback). -
onPrepare
public SignalConnection<SwipeTracker.PrepareCallback> onPrepare(SwipeTracker.PrepareCallback handler) This signal is emitted when a possible swipe is detected.The
directionvalue can be used to restrict the swipe to a certain direction.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
onUpdateSwipe
public SignalConnection<SwipeTracker.UpdateSwipeCallback> onUpdateSwipe(SwipeTracker.UpdateSwipeCallback handler) This signal is emitted every time the progress value changes.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitUpdateSwipe
public void emitUpdateSwipe(double progress) Emits the "update-swipe" signal. SeeonUpdateSwipe(org.gnome.adw.SwipeTracker.UpdateSwipeCallback). -
builder
ASwipeTracker.Builderobject constructs aSwipeTrackerwith the specified properties. Use the variousset...()methods to set properties, and finish construction withSwipeTracker.Builder.build().- Returns:
- the builder object
-