gi-gtk4-4.0.12: Gtk 4.x bindings

Copyright | Will Thompson and Iñaki García Etxebarria
License | LGPL-2.1
Maintainer | Iñaki García Etxebarria
Safe Haskell | None
Language | Haskell2010

GI.Gtk.Objects.EventControllerScroll

Contents

- Exported types
- Methods
  - getFlags
  - getUnit
  - new
  - setFlags
- Properties
  - flags
- Signals
  - decelerate
  - scroll
  - scrollBegin
  - scrollEnd

Description

Handles scroll events.

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

In the case of continuous scroll events, `GtkEventControllerScroll` encloses all EventControllerScroll::scroll emissions between two EventControllerScroll::scrollBegin and EventControllerScroll::scrollEnd signals.

The behavior of the event controller can be modified by the flags given at creation time, or modified at a later point through `eventControllerScrollSetFlags` (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 `EventControllerScrollFlagsVertical`, `EventControllerScrollFlagsHorizontal` and `EventControllerScrollFlagsBothAxes`. If any axis is disabled, the respective 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 `EventControllerScrollFlagsDiscrete`. This can be used to implement discrete actions triggered through scroll events (e.g. switching across combobox options).

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

Synopsis

- newtype EventControllerScroll = EventControllerScroll (ManagedPtr EventControllerScroll)
- class (GObject o, IsDescendantOf EventControllerScroll o) => IsEventControllerScroll o
- toEventControllerScroll :: (MonadIO m, IsEventControllerScroll o) => o -> m EventControllerScroll
- eventControllerScrollGetFlags :: (HasCallStack, MonadIO m, IsEventControllerScroll a) => a -> m [EventControllerScrollFlags]
- eventControllerScrollGetUnit :: (HasCallStack, MonadIO m, IsEventControllerScroll a) => a -> m ScrollUnit
- eventControllerScrollNew :: (HasCallStack, MonadIO m) => [EventControllerScrollFlags] -> m EventControllerScroll
- eventControllerScrollSetFlags :: (HasCallStack, MonadIO m, IsEventControllerScroll a) => a -> [EventControllerScrollFlags] -> m ()
- constructEventControllerScrollFlags :: (IsEventControllerScroll o, MonadIO m) => [EventControllerScrollFlags] -> m (GValueConstruct o)
- getEventControllerScrollFlags :: (MonadIO m, IsEventControllerScroll o) => o -> m [EventControllerScrollFlags]
- setEventControllerScrollFlags :: (MonadIO m, IsEventControllerScroll o) => o -> [EventControllerScrollFlags] -> m ()
- type EventControllerScrollDecelerateCallback = Double -> Double -> IO ()
- afterEventControllerScrollDecelerate :: (IsEventControllerScroll a, MonadIO m) => a -> ((?self :: a) => EventControllerScrollDecelerateCallback) -> m SignalHandlerId
- onEventControllerScrollDecelerate :: (IsEventControllerScroll a, MonadIO m) => a -> ((?self :: a) => EventControllerScrollDecelerateCallback) -> m SignalHandlerId
- type EventControllerScrollScrollCallback = Double -> Double -> IO Bool
- afterEventControllerScrollScroll :: (IsEventControllerScroll a, MonadIO m) => a -> ((?self :: a) => EventControllerScrollScrollCallback) -> m SignalHandlerId
- onEventControllerScrollScroll :: (IsEventControllerScroll a, MonadIO m) => a -> ((?self :: a) => EventControllerScrollScrollCallback) -> m SignalHandlerId
- type EventControllerScrollScrollBeginCallback = IO ()
- afterEventControllerScrollScrollBegin :: (IsEventControllerScroll a, MonadIO m) => a -> ((?self :: a) => EventControllerScrollScrollBeginCallback) -> m SignalHandlerId
- onEventControllerScrollScrollBegin :: (IsEventControllerScroll a, MonadIO m) => a -> ((?self :: a) => EventControllerScrollScrollBeginCallback) -> m SignalHandlerId
- type EventControllerScrollScrollEndCallback = IO ()
- afterEventControllerScrollScrollEnd :: (IsEventControllerScroll a, MonadIO m) => a -> ((?self :: a) => EventControllerScrollScrollEndCallback) -> m SignalHandlerId
- onEventControllerScrollScrollEnd :: (IsEventControllerScroll a, MonadIO m) => a -> ((?self :: a) => EventControllerScrollScrollEndCallback) -> m SignalHandlerId

# Exported types

newtype EventControllerScroll Source #

Memory-managed wrapper type.

Constructors

EventControllerScroll (ManagedPtr EventControllerScroll) |

#### Instances

Instances details

Eq EventControllerScroll Source # |
Instance details Defined in GI.Gtk.Objects.EventControllerScroll Methods (==) :: EventControllerScroll -> EventControllerScroll -> Bool Source # (/=) :: EventControllerScroll -> EventControllerScroll -> Bool Source #
GObject EventControllerScroll Source # |
Instance details Defined in GI.Gtk.Objects.EventControllerScroll
ManagedPtrNewtype EventControllerScroll Source # |
Instance details Defined in GI.Gtk.Objects.EventControllerScroll Methods toManagedPtr :: EventControllerScroll -> ManagedPtr EventControllerScroll Source #
TypedObject EventControllerScroll Source # |
Instance details Defined in GI.Gtk.Objects.EventControllerScroll Methods glibType :: IO GType Source #
HasParentTypes EventControllerScroll Source # |
Instance details Defined in GI.Gtk.Objects.EventControllerScroll
IsGValue (Maybe EventControllerScroll) Source # | Convert `EventControllerScroll` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gtk.Objects.EventControllerScroll Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe EventControllerScroll -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe EventControllerScroll) Source #
type ParentTypes EventControllerScroll Source # |
Instance details Defined in GI.Gtk.Objects.EventControllerScroll type ParentTypes EventControllerScroll = '[EventController, Object]

class (GObject o, IsDescendantOf EventControllerScroll o) => IsEventControllerScroll o Source #

Type class for types which can be safely cast to `EventControllerScroll`, for instance with `toEventControllerScroll`.

#### Instances

Instances details

(GObject o, IsDescendantOf EventControllerScroll o) => IsEventControllerScroll o Source # |
Instance details Defined in GI.Gtk.Objects.EventControllerScroll

toEventControllerScroll :: (MonadIO m, IsEventControllerScroll o) => o -> m EventControllerScroll Source #

Cast to `EventControllerScroll`, for types for which this is known to be safe. For general casts, use `castTo`.

# Methods

### Click to display all available methods, including inherited ones

Expand

#### Methods

bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, isFloating, notify, notifyByPspec, ref, refSink, reset, runDispose, stealData, stealQdata, thawNotify, unref, watchClosure.

#### Getters

getCurrentEvent, getCurrentEventDevice, getCurrentEventState, getCurrentEventTime, getData, getFlags, getName, getPropagationLimit, getPropagationPhase, getProperty, getQdata, getUnit, getWidget.

#### Setters

setData, setDataFull, setFlags, setName, setPropagationLimit, setPropagationPhase, setProperty, setStaticName.

## getFlags

eventControllerScrollGetFlags Source #

Arguments

:: (HasCallStack, MonadIO m, IsEventControllerScroll a) |
=> a | `scroll`: a `GtkEventControllerScroll`
-> m [EventControllerScrollFlags] | Returns: the controller flags.

Gets the flags conditioning the scroll controller behavior.

## getUnit

eventControllerScrollGetUnit Source #

Arguments

:: (HasCallStack, MonadIO m, IsEventControllerScroll a) |
=> a | `scroll`: a `GtkEventControllerScroll`.
-> m ScrollUnit | Returns: the scroll unit.

Gets the scroll unit of the last EventControllerScroll::scroll signal received.

Always returns `ScrollUnitWheel` if the `EventControllerScrollFlagsDiscrete` flag is set.

Since: 4.8

## new

eventControllerScrollNew Source #

Arguments

:: (HasCallStack, MonadIO m) |
=> [EventControllerScrollFlags] | `flags`: flags affecting the controller behavior
-> m EventControllerScroll | Returns: a new `GtkEventControllerScroll`

Creates a new event controller that will handle scroll events.

## setFlags

eventControllerScrollSetFlags Source #

Arguments

:: (HasCallStack, MonadIO m, IsEventControllerScroll a) |
=> a | `scroll`: a `GtkEventControllerScroll`
-> [EventControllerScrollFlags] | `flags`: flags affecting the controller behavior
-> m () |

Sets the flags conditioning scroll controller behavior.

# Properties

## flags

The flags affecting event controller behavior.

constructEventControllerScrollFlags :: (IsEventControllerScroll o, MonadIO m) => [EventControllerScrollFlags] -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`flags`” property. This is rarely needed directly, but it is used by `new`.

getEventControllerScrollFlags :: (MonadIO m, IsEventControllerScroll o) => o -> m [EventControllerScrollFlags] Source #

Get the value of the “`flags`” property. When overloading is enabled, this is equivalent to

    get eventControllerScroll #flags

setEventControllerScrollFlags :: (MonadIO m, IsEventControllerScroll o) => o -> [EventControllerScrollFlags] -> m () Source #

Set the value of the “`flags`” property. When overloading is enabled, this is equivalent to

    set eventControllerScroll [ #flags := value ]

# Signals

## decelerate

type EventControllerScrollDecelerateCallback Source #

Arguments

= Double | `velX`: X velocity
-> Double | `velY`: Y velocity
-> IO () |

Emitted after scroll is finished if the `EventControllerScrollFlagsKinetic` flag is set.

`velX` and `velY` express the initial velocity that was imprinted by the scroll events. `velX` and `velY` are expressed in pixels/ms.

afterEventControllerScrollDecelerate :: (IsEventControllerScroll a, MonadIO m) => a -> ((?self :: a) => EventControllerScrollDecelerateCallback) -> m SignalHandlerId Source #

Connect a signal handler for the decelerate signal, to be run after the default handler. When overloading is enabled, this is equivalent to

    after eventControllerScroll #decelerate callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit `?self` parameter. Note that this requires activating the `ImplicitParams` GHC extension.

onEventControllerScrollDecelerate :: (IsEventControllerScroll a, MonadIO m) => a -> ((?self :: a) => EventControllerScrollDecelerateCallback) -> m SignalHandlerId Source #

Connect a signal handler for the decelerate signal, to be run before the default handler. When overloading is enabled, this is equivalent to

    on eventControllerScroll #decelerate callback

## scroll

type EventControllerScrollScrollCallback Source #

Arguments

= Double | `dx`: X delta
-> Double | `dy`: Y delta
-> IO Bool | Returns: `True` if the scroll event was handled, `False` otherwise.

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

For the representation unit of the deltas, see `eventControllerScrollGetUnit`.

afterEventControllerScrollScroll :: (IsEventControllerScroll a, MonadIO m) => a -> ((?self :: a) => EventControllerScrollScrollCallback) -> m SignalHandlerId Source #

Connect a signal handler for the scroll signal, to be run after the default handler. When overloading is enabled, this is equivalent to

    after eventControllerScroll #scroll callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit `?self` parameter. Note that this requires activating the `ImplicitParams` GHC extension.

onEventControllerScrollScroll :: (IsEventControllerScroll a, MonadIO m) => a -> ((?self :: a) => EventControllerScrollScrollCallback) -> m SignalHandlerId Source #

Connect a signal handler for the scroll signal, to be run before the default handler. When overloading is enabled, this is equivalent to

    on eventControllerScroll #scroll callback

## scrollBegin

type EventControllerScrollScrollBeginCallback = IO () Source #

Signals that a new scrolling operation has begun.

It will only be emitted on devices capable of it.

afterEventControllerScrollScrollBegin :: (IsEventControllerScroll a, MonadIO m) => a -> ((?self :: a) => EventControllerScrollScrollBeginCallback) -> m SignalHandlerId Source #

Connect a signal handler for the scrollBegin signal, to be run after the default handler. When overloading is enabled, this is equivalent to

    after eventControllerScroll #scrollBegin callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit `?self` parameter. Note that this requires activating the `ImplicitParams` GHC extension.

onEventControllerScrollScrollBegin :: (IsEventControllerScroll a, MonadIO m) => a -> ((?self :: a) => EventControllerScrollScrollBeginCallback) -> m SignalHandlerId Source #

Connect a signal handler for the scrollBegin signal, to be run before the default handler. When overloading is enabled, this is equivalent to

    on eventControllerScroll #scrollBegin callback

## scrollEnd

type EventControllerScrollScrollEndCallback = IO () Source #

Signals that a scrolling operation has finished.

It will only be emitted on devices capable of it.

afterEventControllerScrollScrollEnd :: (IsEventControllerScroll a, MonadIO m) => a -> ((?self :: a) => EventControllerScrollScrollEndCallback) -> m SignalHandlerId Source #

Connect a signal handler for the scrollEnd signal, to be run after the default handler. When overloading is enabled, this is equivalent to

    after eventControllerScroll #scrollEnd callback

By default the object invoking the signal is not passed to the callback. If you need to access it, you can use the implit `?self` parameter. Note that this requires activating the `ImplicitParams` GHC extension.

onEventControllerScrollScrollEnd :: (IsEventControllerScroll a, MonadIO m) => a -> ((?self :: a) => EventControllerScrollScrollEndCallback) -> m SignalHandlerId Source #

Connect a signal handler for the scrollEnd signal, to be run before the default handler. When overloading is enabled, this is equivalent to

    on eventControllerScroll #scrollEnd callback