Class EventController
- All Implemented Interfaces:
Proxy
- Direct Known Subclasses:
DropControllerMotion
,DropTarget
,DropTargetAsync
,EventController.EventControllerImpl
,EventControllerFocus
,EventControllerKey
,EventControllerLegacy
,EventControllerMotion
,EventControllerScroll
,Gesture
,PadController
,ShortcutController
GtkEventController
is the base class for event controllers.
These are ancillary objects associated to widgets, which react
to GdkEvents
, and possibly trigger actions as a consequence.
Event controllers are added to a widget with
Widget.addController(org.gnome.gtk.EventController)
. It is rarely necessary to
explicitly remove a controller with Widget.removeController(org.gnome.gtk.EventController)
.
See the chapter on input handling for an overview of the basic concepts, such as the capture and bubble phases of event propagation.
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
EventController.Builder<B extends EventController.Builder<B>>
Inner class implementing a builder pattern to construct a GObject with properties.static class
static class
The EventControllerImpl type represents a native instance of the abstract EventController class.Nested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass
-
Constructor Summary
ConstructorDescriptionEventController
(MemorySegment address) Create a EventController proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected EventController
asParent()
Returns this instance as if it were its parent type.static EventController.Builder
<? extends EventController.Builder> builder()
AEventController.Builder
object constructs aEventController
with the specified properties.Returns the event that is currently being handled by the controller.Returns the device of the event that is currently being handled by the controller.Returns the modifier state of the event that is currently being handled by the controller.int
Returns the timestamp of the event that is currently being handled by the controller.getName()
Gets the name of this EventController.Gets the propagation limit of the event controller.Gets the propagation phase at which this EventController handles events.static Type
getType()
Get the GType of the EventController classReturns theGtkWidget
this controller relates to.void
reset()
Resets the this EventController to a clean state.void
Sets a name on the controller that can be used for debugging.void
Sets the event propagation limit on the event controller.void
Sets the propagation phase at which a controller handles events.void
setStaticName
(@Nullable String name) Sets a name on the controller that can be used for debugging.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
-
EventController
Create a EventController 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. -
getCurrentEvent
Returns the event that is currently being handled by the controller.At other times,
null
is returned.- Returns:
- the event that is currently handled by this EventController
-
getCurrentEventDevice
Returns the device of the event that is currently being handled by the controller.At other times,
null
is returned.- Returns:
- device of the event is currently handled by this EventController
-
getCurrentEventState
Returns the modifier state of the event that is currently being handled by the controller.At other times, 0 is returned.
- Returns:
- modifier state of the event is currently handled by this EventController
-
getCurrentEventTime
public int getCurrentEventTime()Returns the timestamp of the event that is currently being handled by the controller.At other times, 0 is returned.
- Returns:
- timestamp of the event is currently handled by this EventController
-
getName
-
getPropagationLimit
Gets the propagation limit of the event controller.- Returns:
- the propagation limit
-
getPropagationPhase
Gets the propagation phase at which this EventController handles events.- Returns:
- the propagation phase
-
getWidget
-
reset
public void reset()Resets the this EventController to a clean state. -
setName
Sets a name on the controller that can be used for debugging.- Parameters:
name
- a name for this EventController
-
setPropagationLimit
Sets the event propagation limit on the event controller.If the limit is set to
PropagationLimit.SAME_NATIVE
, the controller won't handle events that are targeted at widgets on a different surface, such as popovers.- Parameters:
limit
- the propagation limit
-
setPropagationPhase
Sets the propagation phase at which a controller handles events.If
phase
isPropagationPhase.NONE
, no automatic event handling will be performed, but other additional gesture maintenance will.- Parameters:
phase
- a propagation phase
-
setStaticName
Sets a name on the controller that can be used for debugging.- Parameters:
name
- a name for this EventController, must be a static string
-
builder
AEventController.Builder
object constructs aEventController
with the specified properties. Use the variousset...()
methods to set properties, and finish construction withEventController.Builder.build()
.
-