Gtk.EventControllerScroll

g GObject.Object GObject.Object Gtk.EventController Gtk.EventController GObject.Object->Gtk.EventController Gtk.EventControllerScroll Gtk.EventControllerScroll Gtk.EventController->Gtk.EventControllerScroll

Subclasses:

None

Methods

Inherited:

Gtk.EventController (5), GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (widget, flags)

get_flags ()

set_flags (flags)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Inherited:

Gtk.EventController (2)

Name

Type

Flags

Short Description

flags

Gtk.EventControllerScrollFlags

r/w/en

Flags

Signals

Inherited:

GObject.Object (1)

Name

Short Description

decelerate

Emitted after scroll is finished if the Gtk.EventControllerScrollFlags.KINETIC flag is set.

scroll

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

scroll-begin

Signals that a new scrolling operation has begun.

scroll-end

Signals that a new scrolling operation has finished.

Fields

Inherited:

GObject.Object (1)

Class Details

class Gtk.EventControllerScroll(**kwargs)
Bases:

Gtk.EventController

Abstract:

No

Structure:

Gtk.EventControllerScrollClass

Gtk.EventControllerScroll 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 Gtk.EventControllerScroll ::scroll signal (deltas in the discrete case are multiples of 1).

In the case of continuous scroll events, Gtk.EventControllerScroll encloses all Gtk.EventControllerScroll ::scroll events 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 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.EventControllerScrollFlags.VERTICAL, Gtk.EventControllerScrollFlags.HORIZONTAL and #GTK_EVENT_CONTROLLER_SCROLL_BOTH. 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 Gtk.EventControllerScrollFlags.DISCRETE. This can be used to implement discrete actions triggered through scroll events (e.g. switching across combobox options).

The Gtk.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.

This object was added in 3.24.

classmethod new(widget, flags)[source]
Parameters:
Returns:

a new Gtk.EventControllerScroll

Return type:

Gtk.EventController

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

New in version 3.24.

get_flags()[source]
Returns:

the controller flags.

Return type:

Gtk.EventControllerScrollFlags

Gets the flags conditioning the scroll controller behavior.

New in version 3.24.

set_flags(flags)[source]
Parameters:

flags (Gtk.EventControllerScrollFlags) – behavior flags

Sets the flags conditioning scroll controller behavior.

New in version 3.24.

Signal Details

Gtk.EventControllerScroll.signals.decelerate(event_controller_scroll, vel_x, vel_y)
Signal Name:

decelerate

Flags:

RUN_FIRST

Parameters:

Emitted after scroll is finished if the Gtk.EventControllerScrollFlags.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.signals.scroll(event_controller_scroll, dx, dy)
Signal Name:

scroll

Flags:

RUN_FIRST

Parameters:

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

Gtk.EventControllerScroll.signals.scroll_begin(event_controller_scroll)
Signal Name:

scroll-begin

Flags:

RUN_FIRST

Parameters:

event_controller_scroll (Gtk.EventControllerScroll) – The object which received the signal

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

Gtk.EventControllerScroll.signals.scroll_end(event_controller_scroll)
Signal Name:

scroll-end

Flags:

RUN_FIRST

Parameters:

event_controller_scroll (Gtk.EventControllerScroll) – The object which received the signal

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

Property Details

Gtk.EventControllerScroll.props.flags
Name:

flags

Type:

Gtk.EventControllerScrollFlags

Default Value:

Gtk.EventControllerScrollFlags.NONE

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The flags affecting event controller behavior

New in version 3.24.