Class SwipeTracker
- All Implemented Interfaces:
Proxy
,Orientable
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
Modifier and TypeClassDescriptionstatic interface
Functional interface declaration of theBeginSwipeCallback
callback.static class
SwipeTracker.Builder<B extends SwipeTracker.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static interface
Functional interface declaration of theEndSwipeCallback
callback.static interface
Functional interface declaration of thePrepareCallback
callback.static class
static interface
Functional interface declaration of theUpdateSwipeCallback
callback.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
Nested classes/interfaces inherited from interface org.gnome.gtk.Orientable
Orientable.OrientableIface, Orientable.OrientableImpl
-
Constructor Summary
ConstructorDescriptionSwipeTracker
(MemorySegment address) Create a SwipeTracker proxy instance for the provided memory address.SwipeTracker
(Swipeable swipeable) Creates a newAdwSwipeTracker
forwidget
. -
Method Summary
Modifier and TypeMethodDescriptionprotected SwipeTracker
asParent()
Returns this instance as if it were its parent type.static SwipeTracker.Builder
<? extends SwipeTracker.Builder> builder()
ASwipeTracker.Builder
object constructs aSwipeTracker
with the specified properties.void
Emits the "begin-swipe" signal.void
emitEndSwipe
(double velocity, double to) Emits the "end-swipe" signal.void
emitPrepare
(NavigationDirection direction) Emits the "prepare" signal.void
emitUpdateSwipe
(double progress) Emits the "update-swipe" signal.boolean
Gets whether to allow swiping for more than one snap point at a time.boolean
Gets whether this SwipeTracker can be dragged with mouse pointer.boolean
Gets whether to allow touchscreen swiping fromGtkWindowHandle
.boolean
Gets whether this SwipeTracker is enabled.boolean
Gets whether to allow swiping past the first available snap point.boolean
Gets whether this SwipeTracker is reversing the swipe direction.Get the widget this SwipeTracker is attached to.static Type
getType()
Get the GType of the SwipeTracker classboolean
Gets 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.void
setAllowLongSwipes
(boolean allowLongSwipes) Sets whether to allow swiping for more than one snap point at a time.void
setAllowMouseDrag
(boolean allowMouseDrag) Sets whether this SwipeTracker can be dragged with mouse pointer.void
setAllowWindowHandle
(boolean allowWindowHandle) Sets whether to allow touchscreen swiping fromGtkWindowHandle
.void
setEnabled
(boolean enabled) Sets whether this SwipeTracker is enabled.void
setLowerOvershoot
(boolean overshoot) Sets whether to allow swiping past the first available snap point.void
setReversed
(boolean reversed) Sets whether to reverse the swipe direction.void
setUpperOvershoot
(boolean overshoot) Sets whether to allow swiping past the last available snap point.void
shiftPosition
(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, 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, withProperties
Methods inherited from class org.gnome.gobject.TypeInstance
callParent, callParent, getPrivate, readGClass, writeGClass
Methods inherited from class io.github.jwharm.javagi.base.ProxyInstance
equals, handle, hashCode
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods 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 newAdwSwipeTracker
forwidget
.- Parameters:
swipeable
- a widget to add the tracker on
-
-
Method Details
-
getType
-
asParent
Returns this instance as if it were its parent type. This is mostly synonymous to the Javasuper
keyword, 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
-
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
-
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
-
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
TRUE
will make dragging the window impossible.- Parameters:
allowWindowHandle
- whether to allow swiping from window handles
-
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
-
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
-
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
to
with an animation usingvelocity
as the initial velocity, provided in pixels per second.SpringAnimation
is 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
direction
value 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.Builder
object constructs aSwipeTracker
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withSwipeTracker.Builder.build()
.
-