Gtk.EventControllerScroll¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/en |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
Emitted after scroll is finished if the |
|
Signals that the widget should scroll by the amount specified by dx and dy. |
|
Signals that a new scrolling operation has begun. |
|
Signals that a scrolling operation has finished. |
Fields¶
- Inherited:
Class Details¶
- class Gtk.EventControllerScroll(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
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.EventControllerScrollFlags.VERTICAL
,Gtk.EventControllerScrollFlags.HORIZONTAL
andGtk.EventControllerScrollFlags.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.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 [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.- classmethod new(flags)[source]¶
- Parameters:
flags (
Gtk.EventControllerScrollFlags
) – flags affecting the controller behavior- Returns:
a new
GtkEventControllerScroll
- Return type:
Creates a new event controller that will handle scroll events.
- get_flags()[source]¶
- Returns:
the controller flags.
- Return type:
Gets the flags conditioning the scroll controller behavior.
- get_unit()[source]¶
- Returns:
the scroll unit.
- Return type:
Gets the scroll unit of the last [signal`Gtk`.EventControllerScroll::scroll] signal received.
Always returns
Gdk.ScrollUnit.WHEEL
if theGtk.EventControllerScrollFlags.DISCRETE
flag is set.New in version 4.8.
- set_flags(flags)[source]¶
- Parameters:
flags (
Gtk.EventControllerScrollFlags
) – flags affecting the controller behavior
Sets the flags conditioning scroll controller behavior.
Signal Details¶
- Gtk.EventControllerScroll.signals.decelerate(event_controller_scroll, vel_x, vel_y)¶
- Signal Name:
decelerate
- Flags:
- Parameters:
event_controller_scroll (
Gtk.EventControllerScroll
) – The object which received the signalvel_x (
float
) – X velocityvel_y (
float
) – Y velocity
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:
- Parameters:
event_controller_scroll (
Gtk.EventControllerScroll
) – The object which received the signaldx (
float
) – X deltady (
float
) – Y delta
- Returns:
- Return type:
Signals that the widget should scroll by the amount specified by dx and dy.
For the representation unit of the deltas, see [method`Gtk`.EventControllerScroll.get_unit].
- Gtk.EventControllerScroll.signals.scroll_begin(event_controller_scroll)¶
- Signal Name:
scroll-begin
- Flags:
- 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:
- Parameters:
event_controller_scroll (
Gtk.EventControllerScroll
) – The object which received the signal
Signals that a scrolling operation has finished.
It will only be emitted on devices capable of it.
Property Details¶
- Gtk.EventControllerScroll.props.flags¶
- Name:
flags
- Type:
- Default Value:
- Flags:
The flags affecting event controller behavior.