Class EventController
- All Implemented Interfaces:
Proxy
- Direct Known Subclasses:
DropControllerMotion,DropTarget,DropTargetAsync,EventController.EventController$Impl,EventControllerFocus,EventControllerKey,EventControllerLegacy,EventControllerMotion,EventControllerScroll,Gesture,PadController,ShortcutController
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
Nested ClassesModifier and TypeClassDescriptionstatic classEventController.Builder<B extends EventController.Builder<B>>Inner class implementing a builder pattern to construct a GObject with properties.static classThe EventController$Impl type represents a native instance of the abstract EventController class.static classNested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new EventController.EventController(MemorySegment address) Create a EventController proxy instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected EventControllerasParent()Returns this instance as if it were its parent type.@Nullable EventReturns the event that is currently being handled by the controller.@Nullable DeviceReturns 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.intReturns the timestamp of the event that is currently being handled by the controller.@Nullable StringgetName()Gets the name ofcontroller.Gets the propagation limit of the event controller.Gets the propagation phase at which this EventController handles events.static @Nullable TypegetType()Get the GType of the EventController class@Nullable WidgetReturns theGtkWidgetthis controller relates to.voidreset()Resets the this EventController to a clean state.voidSets a name on the controller that can be used for debugging.voidSets the event propagation limit on the event controller.voidSets the propagation phase at which a controller handles events.voidsetStaticName(@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, builder, 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, hashCode
-
Constructor Details
-
EventController
Create a EventController proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
EventController
public EventController()Creates a new EventController.
-
-
Method Details
-
getType
Get the GType of the EventController class- Returns:
- the GType
-
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. -
getCurrentEvent
Returns the event that is currently being handled by the controller.At other times,
nullis 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,
nullis 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
Returns theGtkWidgetthis controller relates to.- Returns:
- a
GtkWidget
-
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
phaseisPropagationPhase.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 forcontroller,must be a static string- Since:
- 4.8
-