Class GestureSingle
- All Implemented Interfaces:
Proxy
- Direct Known Subclasses:
DragSource
,GestureClick
,GestureDrag
,GestureLongPress
,GestureStylus
,GestureSwipe
GtkGestureSingle
is a GtkGestures
subclass optimized for singe-touch
and mouse gestures.
Under interaction, these gestures stick to the first interacting sequence,
which is accessible through getCurrentSequence()
while the gesture is being interacted with.
By default gestures react to both GDK_BUTTON_PRIMARY
and touch events.
setTouchOnly(boolean)
can be used to change the
touch behavior. Callers may also specify a different mouse button number
to interact with through setButton(int)
, or react
to any mouse button by setting it to 0. While the gesture is active, the
button being currently pressed can be known through
getCurrentButton()
.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
GestureSingle.Builder<B extends GestureSingle.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static class
Nested classes/interfaces inherited from class org.gnome.gtk.Gesture
Gesture.BeginCallback, Gesture.CancelCallback, Gesture.EndCallback, Gesture.GestureClass, Gesture.GestureImpl, Gesture.SequenceStateChangedCallback, Gesture.UpdateCallback
Nested classes/interfaces inherited from class org.gnome.gtk.EventController
EventController.EventControllerClass, EventController.EventControllerImpl
Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionGestureSingle
(MemorySegment address) Create a GestureSingle proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected GestureSingle
asParent()
Returns this instance as if it were its parent type.static GestureSingle.Builder
<? extends GestureSingle.Builder> builder()
AGestureSingle.Builder
object constructs aGestureSingle
with the specified properties.int
Returns the button number this GestureSingle listens for.int
Returns the button number currently interacting with this GestureSingle, or 0 if there is none.Returns the event sequence currently interacting with this GestureSingle.boolean
Gets whether a gesture is exclusive.boolean
Returnstrue
if the gesture is only triggered by touch events.static Type
getType()
Get the GType of the GestureSingle classvoid
setButton
(int button) Sets the button number this GestureSingle listens to.void
setExclusive
(boolean exclusive) Sets whether this GestureSingle is exclusive.void
setTouchOnly
(boolean touchOnly) Sets whether to handle only touch events.Methods inherited from class org.gnome.gtk.Gesture
emitBegin, emitCancel, emitEnd, emitSequenceStateChanged, emitUpdate, getBoundingBox, getBoundingBoxCenter, getDevice, getGroup, getLastEvent, getLastUpdatedSequence, getPoint, getSequences, getSequenceState, group, handlesSequence, isActive, isGroupedWith, isRecognized, onBegin, onCancel, onEnd, onSequenceStateChanged, onUpdate, setSequenceState, setState, ungroup
Methods inherited from class org.gnome.gtk.EventController
getCurrentEvent, getCurrentEventDevice, getCurrentEventState, getCurrentEventTime, getName, getPropagationLimit, getPropagationPhase, getWidget, reset, setName, setPropagationLimit, setPropagationPhase, setStaticName
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
-
Constructor Details
-
GestureSingle
Create a GestureSingle proxy instance for the provided memory address.- Parameters:
address
- the memory address of the native object
-
-
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. -
getButton
public int getButton()Returns the button number this GestureSingle listens for.If this is 0, the gesture reacts to any button press.
- Returns:
- The button number, or 0 for any button
-
getCurrentButton
public int getCurrentButton()Returns the button number currently interacting with this GestureSingle, or 0 if there is none.- Returns:
- The current button number
-
getCurrentSequence
Returns the event sequence currently interacting with this GestureSingle.This is only meaningful if
Gesture.isActive()
returnstrue
.- Returns:
- the current sequence
-
getExclusive
public boolean getExclusive()Gets whether a gesture is exclusive.For more information, see
setExclusive(boolean)
.- Returns:
- Whether the gesture is exclusive
-
getTouchOnly
public boolean getTouchOnly()Returnstrue
if the gesture is only triggered by touch events.- Returns:
true
if the gesture only handles touch events
-
setButton
public void setButton(int button) Sets the button number this GestureSingle listens to.If non-0, every button press from a different button number will be ignored. Touch events implicitly match with button 1.
- Parameters:
button
- button number to listen to, or 0 for any button
-
setExclusive
public void setExclusive(boolean exclusive) Sets whether this GestureSingle is exclusive.An exclusive gesture will only handle pointer and "pointer emulated" touch events, so at any given time, there is only one sequence able to interact with those.
- Parameters:
exclusive
-true
to make this GestureSingle exclusive
-
setTouchOnly
public void setTouchOnly(boolean touchOnly) Sets whether to handle only touch events.If
touchOnly
istrue
, this GestureSingle will only handle events of typeEventType.TOUCH_BEGIN
,EventType.TOUCH_UPDATE
orEventType.TOUCH_END
. Iffalse
, mouse events will be handled too.- Parameters:
touchOnly
- whether this GestureSingle handles only touch events
-
builder
AGestureSingle.Builder
object constructs aGestureSingle
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withGestureSingle.Builder.build()
.
-