Class

GtkEventControllerScroll

Description [src]

final class Gtk.EventControllerScroll : Gtk.EventController
{
  /* No available fields */
}

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_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.

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.

Hierarchy

hierarchy this GtkEventControllerScroll ancestor_0 GtkEventController ancestor_0--this ancestor_1 GObject ancestor_1--ancestor_0

Constructors

gtk_event_controller_scroll_new

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

since: 3.24

Instance methods

gtk_event_controller_scroll_get_flags

Gets the flags conditioning the scroll controller behavior.

since: 3.24

gtk_event_controller_scroll_set_flags

Sets the flags conditioning scroll controller behavior.

since: 3.24

Methods inherited from GtkEventController (5)
gtk_event_controller_get_propagation_phase

Gets the propagation phase at which controller handles events.

since: 3.14

gtk_event_controller_get_widget

Returns the GtkWidget this controller relates to.

since: 3.14

gtk_event_controller_handle_event

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

since: 3.14

gtk_event_controller_reset

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

since: 3.14

gtk_event_controller_set_propagation_phase

Sets the propagation phase at which a controller handles events.

since: 3.14

Methods inherited from GObject (43)

Please see GObject for a full list of methods.

Properties

Gtk.EventControllerScroll:flags

The flags affecting event controller behavior.

since: 3.24

Properties inherited from GtkEventController (2)
Gtk.EventController:propagation-phase

The propagation phase at which this controller will handle events.

since: 3.14

Gtk.EventController:widget

The widget receiving the GdkEvents that the controller will handle.

since: 3.14

Signals

Gtk.EventControllerScroll::decelerate

Emitted after scroll is finished if the #GTK_EVENT_CONTROLLER_SCROLL_KINETIC flag is set. vel_x and vel_y express the initial velocity that was imprinted by the scroll events. vel_x and vel_y are expressed in pixels/ms.

Gtk.EventControllerScroll::scroll

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

Gtk.EventControllerScroll::scroll-begin

Signals that a new scrolling operation has begun. It will only be emitted on devices capable of it.

Gtk.EventControllerScroll::scroll-end

Signals that a new scrolling operation has finished. It will only be emitted on devices capable of it.

Signals inherited from GObject (1)
GObject::notify

The notify signal is emitted on an object when one of its properties has its value set through g_object_set_property(), g_object_set(), et al.

Class structure

struct GtkEventControllerScrollClass {
  /* no available fields */
}

No description available.