EventControllerScroll

GtkEventControllerScroll is an event controller that handles scroll events.

It is capable of handling both discrete and continuous scroll events from mice or touchpads, abstracting them both with the [signal@Gtk.EventControllerScroll::scroll] signal. Deltas in the discrete case are multiples of 1.

In the case of continuous scroll events, GtkEventControllerScroll encloses all [signal@Gtk.EventControllerScroll::scroll] emissions between two [signal@Gtk.EventControllerScroll::scroll-begin] and [signal@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 [method@Gtk.EventControllerScroll.set_flags] (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_AXES. If any axis is disabled, the respective [signal@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 %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 [signal@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.

Constructors

this
this(GtkEventControllerScroll* gtkEventControllerScroll, bool ownedRef)

Sets our main struct and passes it to the parent class.

this
this(GtkEventControllerScrollFlags flags)

Creates a new event controller that will handle scroll events.

Members

Functions

addOnDecelerate
gulong addOnDecelerate(void delegate(double, double, EventControllerScroll) dlg, ConnectFlags connectFlags)

Emitted after scroll is finished if the %GTK_EVENT_CONTROLLER_SCROLL_KINETIC flag is set.

addOnScroll
gulong addOnScroll(bool delegate(double, double, EventControllerScroll) dlg, ConnectFlags connectFlags)

Signals that the widget should scroll by the amount specified by @dx and @dy.

addOnScrollBegin
gulong addOnScrollBegin(void delegate(EventControllerScroll) dlg, ConnectFlags connectFlags)

Signals that a new scrolling operation has begun.

addOnScrollEnd
gulong addOnScrollEnd(void delegate(EventControllerScroll) dlg, ConnectFlags connectFlags)

Signals that a scrolling operation has finished.

getEventControllerScrollStruct
GtkEventControllerScroll* getEventControllerScrollStruct(bool transferOwnership)

Get the main Gtk struct

getFlags
GtkEventControllerScrollFlags getFlags()

Gets the flags conditioning the scroll controller behavior.

getStruct
void* getStruct()

the main Gtk struct as a void*

setFlags
void setFlags(GtkEventControllerScrollFlags flags)

Sets the flags conditioning scroll controller behavior.

Static functions

getType
GType getType()

Variables

gtkEventControllerScroll
GtkEventControllerScroll* gtkEventControllerScroll;

the main Gtk struct

Inherited Members

From EventController

gtkEventController
GtkEventController* gtkEventController;

the main Gtk struct

getEventControllerStruct
GtkEventController* getEventControllerStruct(bool transferOwnership)

Get the main Gtk struct

getStruct
void* getStruct()

the main Gtk struct as a void*

getType
GType getType()
getCurrentEvent
Event getCurrentEvent()

Returns the event that is currently being handled by the controller, and %NULL at other times.

getCurrentEventDevice
Device getCurrentEventDevice()

Returns the device of the event that is currently being handled by the controller, and %NULL otherwise.

getCurrentEventState
GdkModifierType getCurrentEventState()

Returns the modifier state of the event that is currently being handled by the controller, and 0 otherwise.

getCurrentEventTime
uint getCurrentEventTime()

Returns the timestamp of the event that is currently being handled by the controller, and 0 otherwise.

getName
string getName()

Gets the name of @controller.

getPropagationLimit
GtkPropagationLimit getPropagationLimit()

Gets the propagation limit of the event controller.

getPropagationPhase
GtkPropagationPhase getPropagationPhase()

Gets the propagation phase at which @controller handles events.

getWidget
Widget getWidget()

Returns the #GtkWidget this controller relates to.

reset
void reset()

Resets the @controller to a clean state.

setName
void setName(string name)

Sets a name on the controller that can be used for debugging.

setPropagationLimit
void setPropagationLimit(GtkPropagationLimit limit)

Sets the event propagation limit on the event controller.

setPropagationPhase
void setPropagationPhase(GtkPropagationPhase phase)

Sets the propagation phase at which a controller handles events.

Meta