Class EventControllerScroll
- All Implemented Interfaces:
Proxy
It is capable of handling both discrete and continuous scroll
events from mice or touchpads, abstracting them both with the
Gtk.EventControllerScroll::scroll signal. Deltas in
the discrete case are multiples of 1.
In the case of continuous scroll events, GtkEventControllerScroll
encloses all Gtk.EventControllerScroll::scroll emissions
between two Gtk.EventControllerScroll::scroll-begin and
Gtk.EventControllerScroll::scroll-end signals.
The behavior of the event controller can be modified by the flags
given at creation time, or modified at a later point through
setFlags(java.util.Set<org.gnome.gtk.EventControllerScrollFlags>) (e.g. because the scrolling
conditions of the widget changed).
The controller can be set up to emit motion for either/both vertical
and horizontal scroll events through EventControllerScrollFlags.VERTICAL,
EventControllerScrollFlags.HORIZONTAL and EventControllerScrollFlags.BOTH_AXES.
If any axis is disabled, the respective Gtk.EventControllerScroll::scroll
delta will be 0. Vertical scroll events will be translated to horizontal
motion for the devices incapable of horizontal scrolling.
The event controller can also be forced to emit discrete events on all
devices through EventControllerScrollFlags.DISCRETE. This can be used
to implement discrete actions triggered through scroll events (e.g.
switching across combobox options).
The EventControllerScrollFlags.KINETIC flag toggles the emission of the
Gtk.EventControllerScroll::decelerate signal, emitted at the end
of scrolling with two X/Y velocity arguments that are consistent with the
motion that was received.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classInner class implementing a builder pattern to construct a GObject with properties.static interfaceFunctional interface declaration of theDecelerateCallbackcallback.static classstatic interfaceFunctional interface declaration of theScrollBeginCallbackcallback.static interfaceFunctional interface declaration of theScrollCallbackcallback.static interfaceFunctional interface declaration of theScrollEndCallbackcallback.Nested classes/interfaces inherited from class org.gnome.gtk.EventController
EventController.EventController$Impl, EventController.EventControllerClassNested classes/interfaces inherited from class org.gnome.gobject.GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new EventControllerScroll.EventControllerScroll(MemorySegment address) Create a EventControllerScroll proxy instance for the provided memory address.Creates a new event controller that will handle scroll events.Creates a new event controller that will handle scroll events. -
Method Summary
Modifier and TypeMethodDescriptionprotected EventControllerScrollasParent()Returns this instance as if it were its parent type.static EventControllerScroll.Builder<? extends EventControllerScroll.Builder> builder()AEventControllerScroll.Builderobject constructs aEventControllerScrollwith the specified properties.voidemitDecelerate(double velX, double velY) Emits the "decelerate" signal.booleanemitScroll(double dx, double dy) Emits the "scroll" signal.voidEmits the "scroll-begin" signal.voidEmits the "scroll-end" signal.getFlags()Gets the flags conditioning the scroll controller behavior.static @Nullable TypegetType()Get the GType of the EventControllerScroll classgetUnit()Gets the scroll unit of the lastGtk.EventControllerScroll::scrollsignal received.Emitted after scroll is finished if theEventControllerScrollFlags.KINETICflag is set.Signals that the widget should scroll by the amount specified bydxanddy.Signals that a new scrolling operation has begun.Signals that a scrolling operation has finished.voidsetFlags(Set<EventControllerScrollFlags> flags) Sets the flags conditioning scroll controller behavior.voidsetFlags(EventControllerScrollFlags... flags) Sets the flags conditioning scroll controller behavior.Methods inherited from class org.gnome.gtk.EventController
getCurrentEvent, getCurrentEventDevice, getCurrentEventState, getCurrentEventTime, getName, getPropagationLimit, getPropagationPhase, getWidget, reset, setName, setPropagationLimit, setPropagationPhase, setStaticNameMethods 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, hashCode
-
Constructor Details
-
EventControllerScroll
Create a EventControllerScroll proxy instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
EventControllerScroll
Creates a new event controller that will handle scroll events.- Parameters:
flags- flags affecting the controller behavior
-
EventControllerScroll
Creates a new event controller that will handle scroll events.- Parameters:
flags- flags affecting the controller behavior
-
EventControllerScroll
public EventControllerScroll()Creates a new EventControllerScroll.
-
-
Method Details
-
getType
Get the GType of the EventControllerScroll 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.- Overrides:
asParentin classEventController
-
getFlags
Gets the flags conditioning the scroll controller behavior.- Returns:
- the controller flags.
-
getUnit
Gets the scroll unit of the lastGtk.EventControllerScroll::scrollsignal received.Always returns
ScrollUnit.WHEELif theEventControllerScrollFlags.DISCRETEflag is set.- Returns:
- the scroll unit.
- Since:
- 4.8
-
setFlags
Sets the flags conditioning scroll controller behavior.- Parameters:
flags- flags affecting the controller behavior
-
setFlags
Sets the flags conditioning scroll controller behavior.- Parameters:
flags- flags affecting the controller behavior
-
onDecelerate
public SignalConnection<EventControllerScroll.DecelerateCallback> onDecelerate(EventControllerScroll.DecelerateCallback handler) Emitted after scroll is finished if theEventControllerScrollFlags.KINETICflag is set.velXandvelYexpress the initial velocity that was imprinted by the scroll events.velXandvelYare expressed in pixels/ms.- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitDecelerate
public void emitDecelerate(double velX, double velY) Emits the "decelerate" signal. SeeonDecelerate(org.gnome.gtk.EventControllerScroll.DecelerateCallback). -
onScroll
public SignalConnection<EventControllerScroll.ScrollCallback> onScroll(EventControllerScroll.ScrollCallback handler) Signals that the widget should scroll by the amount specified bydxanddy.For the representation unit of the deltas, see
getUnit().- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitScroll
public boolean emitScroll(double dx, double dy) Emits the "scroll" signal. SeeonScroll(org.gnome.gtk.EventControllerScroll.ScrollCallback). -
onScrollBegin
public SignalConnection<EventControllerScroll.ScrollBeginCallback> onScrollBegin(EventControllerScroll.ScrollBeginCallback handler) Signals that a new scrolling operation has begun.It will only be emitted on devices capable of it.
- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitScrollBegin
public void emitScrollBegin()Emits the "scroll-begin" signal. SeeonScrollBegin(org.gnome.gtk.EventControllerScroll.ScrollBeginCallback). -
onScrollEnd
public SignalConnection<EventControllerScroll.ScrollEndCallback> onScrollEnd(EventControllerScroll.ScrollEndCallback handler) Signals that a scrolling operation has finished.It will only be emitted on devices capable of it.
- Parameters:
handler- the signal handler- Returns:
- a signal handler ID to keep track of the signal connection
- See Also:
-
emitScrollEnd
public void emitScrollEnd()Emits the "scroll-end" signal. SeeonScrollEnd(org.gnome.gtk.EventControllerScroll.ScrollEndCallback). -
builder
AEventControllerScroll.Builderobject constructs aEventControllerScrollwith the specified properties. Use the variousset...()methods to set properties, and finish construction withEventControllerScroll.Builder.build().- Returns:
- the builder object
-