EventControllerScroll

#GtkEventControllerScroll is an event controller meant to handle scroll events from mice and touchpads. It is capable of handling both discrete and continuous scroll events, abstracting them both on the #GtkEventControllerScroll::scroll signal (deltas in the discrete case are multiples of 1).

In the case of continuous scroll events, #GtkEventControllerScroll encloses all #GtkEventControllerScroll::scroll events between two #GtkEventControllerScroll::scroll-begin and #GtkEventControllerScroll::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 gtk.event_controller_scroll.EventControllerScroll.setFlags (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 #GTK_EVENT_CONTROLLER_SCROLL_VERTICAL, #GTK_EVENT_CONTROLLER_SCROLL_HORIZONTAL and #GTK_EVENT_CONTROLLER_SCROLL_BOTH. If any axis is disabled, the respective #GtkEventControllerScroll::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 #GTK_EVENT_CONTROLLER_SCROLL_DISCRETE. This can be used to implement discrete actions triggered through scroll events (e.g. switching across combobox options).

The #GTK_EVENT_CONTROLLER_SCROLL_KINETIC flag toggles the emission of the #GtkEventControllerScroll::decelerate signal, emitted at the end of scrolling with two X/Y velocity arguments that are consistent with the motion that was received.

This object was added in 3.24.

Constructors

this
this(void* ptr, Flag!"Take" take)
this
this(gtk.widget.Widget widget, gtk.types.EventControllerScrollFlags flags)

Creates a new event controller that will handle scroll events for the given widget.

Members

Functions

connectDecelerate
gulong connectDecelerate(T callback, Flag!"After" after)

Connect to Decelerate signal.

connectScroll
gulong connectScroll(T callback, Flag!"After" after)

Connect to Scroll signal.

connectScrollBegin
gulong connectScrollBegin(T callback, Flag!"After" after)

Connect to ScrollBegin signal.

connectScrollEnd
gulong connectScrollEnd(T callback, Flag!"After" after)

Connect to ScrollEnd signal.

getFlags
gtk.types.EventControllerScrollFlags getFlags()

Gets the flags conditioning the scroll controller behavior.

self
EventControllerScroll self()

Returns this, for use in with statements.

setFlags
void setFlags(gtk.types.EventControllerScrollFlags flags)

Sets the flags conditioning scroll controller behavior.

Properties

_gType
GType _gType [@property getter]
flags
gtk.types.EventControllerScrollFlags flags [@property getter]

Get flags property.

flags
gtk.types.EventControllerScrollFlags flags [@property setter]

Set flags property.

Static functions

_getGType
GType _getGType()
builder
EventControllerScrollGidBuilder builder()

Get builder for gtk.event_controller_scroll.EventControllerScroll

Inherited Members

From EventController

_getGType
GType _getGType()
_gType
GType _gType [@property getter]
self
EventController self()

Returns this, for use in with statements.

builder
EventControllerGidBuilder builder()

Get builder for gtk.event_controller.EventController

propagationPhase
gtk.types.PropagationPhase propagationPhase [@property getter]

Get propagationPhase property.

propagationPhase
gtk.types.PropagationPhase propagationPhase [@property setter]

Set propagationPhase property.

widget
gtk.widget.Widget widget [@property getter]

Get widget property.

getPropagationPhase
gtk.types.PropagationPhase getPropagationPhase()

Gets the propagation phase at which controller handles events.

getWidget
gtk.widget.Widget getWidget()

Returns the #GtkWidget this controller relates to.

handleEvent
bool handleEvent(gdk.event.Event event)

Feeds an events into controller, so it can be interpreted and the controller actions triggered.

reset
void reset()

Resets the controller to a clean state. Every interaction the controller did through #GtkEventController::handle-event will be dropped at this point.

setPropagationPhase
void setPropagationPhase(gtk.types.PropagationPhase phase)

Sets the propagation phase at which a controller handles events.