Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
A swipe tracker used in [classcarousel
], [classflap
] and [classleaflet
].
The AdwSwipeTracker
object can be used for implementing widgets with swipe
gestures. It supports touch-based swipes, pointer dragging, and touchpad
scrolling.
The widgets will probably want to expose the [propertyswipeTracker
:enabled]
property. If they expect to use horizontal orientation,
[propertyswipeTracker
:reversed] can be used for supporting RTL text
direction.
Since: 1.0
Synopsis
- newtype SwipeTracker = SwipeTracker (ManagedPtr SwipeTracker)
- class (GObject o, IsDescendantOf SwipeTracker o) => IsSwipeTracker o
- toSwipeTracker :: (MonadIO m, IsSwipeTracker o) => o -> m SwipeTracker
- swipeTrackerGetAllowLongSwipes :: (HasCallStack, MonadIO m, IsSwipeTracker a) => a -> m Bool
- swipeTrackerGetAllowMouseDrag :: (HasCallStack, MonadIO m, IsSwipeTracker a) => a -> m Bool
- swipeTrackerGetEnabled :: (HasCallStack, MonadIO m, IsSwipeTracker a) => a -> m Bool
- swipeTrackerGetReversed :: (HasCallStack, MonadIO m, IsSwipeTracker a) => a -> m Bool
- swipeTrackerGetSwipeable :: (HasCallStack, MonadIO m, IsSwipeTracker a) => a -> m Swipeable
- swipeTrackerNew :: (HasCallStack, MonadIO m, IsSwipeable a) => a -> m SwipeTracker
- swipeTrackerSetAllowLongSwipes :: (HasCallStack, MonadIO m, IsSwipeTracker a) => a -> Bool -> m ()
- swipeTrackerSetAllowMouseDrag :: (HasCallStack, MonadIO m, IsSwipeTracker a) => a -> Bool -> m ()
- swipeTrackerSetEnabled :: (HasCallStack, MonadIO m, IsSwipeTracker a) => a -> Bool -> m ()
- swipeTrackerSetReversed :: (HasCallStack, MonadIO m, IsSwipeTracker a) => a -> Bool -> m ()
- swipeTrackerShiftPosition :: (HasCallStack, MonadIO m, IsSwipeTracker a) => a -> Double -> m ()
- constructSwipeTrackerAllowLongSwipes :: (IsSwipeTracker o, MonadIO m) => Bool -> m (GValueConstruct o)
- getSwipeTrackerAllowLongSwipes :: (MonadIO m, IsSwipeTracker o) => o -> m Bool
- setSwipeTrackerAllowLongSwipes :: (MonadIO m, IsSwipeTracker o) => o -> Bool -> m ()
- constructSwipeTrackerAllowMouseDrag :: (IsSwipeTracker o, MonadIO m) => Bool -> m (GValueConstruct o)
- getSwipeTrackerAllowMouseDrag :: (MonadIO m, IsSwipeTracker o) => o -> m Bool
- setSwipeTrackerAllowMouseDrag :: (MonadIO m, IsSwipeTracker o) => o -> Bool -> m ()
- constructSwipeTrackerEnabled :: (IsSwipeTracker o, MonadIO m) => Bool -> m (GValueConstruct o)
- getSwipeTrackerEnabled :: (MonadIO m, IsSwipeTracker o) => o -> m Bool
- setSwipeTrackerEnabled :: (MonadIO m, IsSwipeTracker o) => o -> Bool -> m ()
- constructSwipeTrackerReversed :: (IsSwipeTracker o, MonadIO m) => Bool -> m (GValueConstruct o)
- getSwipeTrackerReversed :: (MonadIO m, IsSwipeTracker o) => o -> m Bool
- setSwipeTrackerReversed :: (MonadIO m, IsSwipeTracker o) => o -> Bool -> m ()
- constructSwipeTrackerSwipeable :: (IsSwipeTracker o, MonadIO m, IsSwipeable a) => a -> m (GValueConstruct o)
- getSwipeTrackerSwipeable :: (MonadIO m, IsSwipeTracker o) => o -> m Swipeable
- type SwipeTrackerBeginSwipeCallback = IO ()
- afterSwipeTrackerBeginSwipe :: (IsSwipeTracker a, MonadIO m) => a -> ((?self :: a) => SwipeTrackerBeginSwipeCallback) -> m SignalHandlerId
- onSwipeTrackerBeginSwipe :: (IsSwipeTracker a, MonadIO m) => a -> ((?self :: a) => SwipeTrackerBeginSwipeCallback) -> m SignalHandlerId
- type SwipeTrackerEndSwipeCallback = Double -> Double -> IO ()
- afterSwipeTrackerEndSwipe :: (IsSwipeTracker a, MonadIO m) => a -> ((?self :: a) => SwipeTrackerEndSwipeCallback) -> m SignalHandlerId
- onSwipeTrackerEndSwipe :: (IsSwipeTracker a, MonadIO m) => a -> ((?self :: a) => SwipeTrackerEndSwipeCallback) -> m SignalHandlerId
- type SwipeTrackerPrepareCallback = NavigationDirection -> IO ()
- afterSwipeTrackerPrepare :: (IsSwipeTracker a, MonadIO m) => a -> ((?self :: a) => SwipeTrackerPrepareCallback) -> m SignalHandlerId
- onSwipeTrackerPrepare :: (IsSwipeTracker a, MonadIO m) => a -> ((?self :: a) => SwipeTrackerPrepareCallback) -> m SignalHandlerId
- type SwipeTrackerUpdateSwipeCallback = Double -> IO ()
- afterSwipeTrackerUpdateSwipe :: (IsSwipeTracker a, MonadIO m) => a -> ((?self :: a) => SwipeTrackerUpdateSwipeCallback) -> m SignalHandlerId
- onSwipeTrackerUpdateSwipe :: (IsSwipeTracker a, MonadIO m) => a -> ((?self :: a) => SwipeTrackerUpdateSwipeCallback) -> m SignalHandlerId
Exported types
newtype SwipeTracker Source #
Memory-managed wrapper type.
SwipeTracker (ManagedPtr SwipeTracker) |
Instances
Eq SwipeTracker Source # | |
Defined in GI.Adw.Objects.SwipeTracker (==) :: SwipeTracker -> SwipeTracker -> Bool # (/=) :: SwipeTracker -> SwipeTracker -> Bool # | |
GObject SwipeTracker Source # | |
Defined in GI.Adw.Objects.SwipeTracker | |
ManagedPtrNewtype SwipeTracker Source # | |
Defined in GI.Adw.Objects.SwipeTracker toManagedPtr :: SwipeTracker -> ManagedPtr SwipeTracker | |
TypedObject SwipeTracker Source # | |
Defined in GI.Adw.Objects.SwipeTracker | |
HasParentTypes SwipeTracker Source # | |
Defined in GI.Adw.Objects.SwipeTracker | |
IsGValue (Maybe SwipeTracker) Source # | Convert |
Defined in GI.Adw.Objects.SwipeTracker gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe SwipeTracker -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe SwipeTracker) | |
type ParentTypes SwipeTracker Source # | |
Defined in GI.Adw.Objects.SwipeTracker type ParentTypes SwipeTracker = '[Object, Orientable] |
class (GObject o, IsDescendantOf SwipeTracker o) => IsSwipeTracker o Source #
Type class for types which can be safely cast to SwipeTracker
, for instance with toSwipeTracker
.
Instances
(GObject o, IsDescendantOf SwipeTracker o) => IsSwipeTracker o Source # | |
Defined in GI.Adw.Objects.SwipeTracker |
toSwipeTracker :: (MonadIO m, IsSwipeTracker o) => o -> m SwipeTracker Source #
Cast to SwipeTracker
, 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
Methods
bindProperty, bindPropertyFull, forceFloating, freezeNotify, getv, isFloating, notify, notifyByPspec, ref, refSink, runDispose, shiftPosition, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getAllowLongSwipes, getAllowMouseDrag, getData, getEnabled, getOrientation, getProperty, getQdata, getReversed, getSwipeable.
Setters
setAllowLongSwipes, setAllowMouseDrag, setData, setDataFull, setEnabled, setOrientation, setProperty, setReversed.
getAllowLongSwipes
swipeTrackerGetAllowLongSwipes Source #
:: (HasCallStack, MonadIO m, IsSwipeTracker a) | |
=> a |
|
-> m Bool | Returns: whether long swipes are allowed |
Gets whether to allow swiping for more than one snap point at a time.
Since: 1.0
getAllowMouseDrag
swipeTrackerGetAllowMouseDrag Source #
:: (HasCallStack, MonadIO m, IsSwipeTracker a) | |
=> a |
|
-> m Bool | Returns: whether mouse dragging is allowed |
Gets whether self
can be dragged with mouse pointer.
Since: 1.0
getEnabled
swipeTrackerGetEnabled Source #
:: (HasCallStack, MonadIO m, IsSwipeTracker a) | |
=> a |
|
-> m Bool | Returns: whether |
Gets whether self
is enabled.
Since: 1.0
getReversed
swipeTrackerGetReversed Source #
:: (HasCallStack, MonadIO m, IsSwipeTracker a) | |
=> a |
|
-> m Bool | Returns: whether the direction is reversed |
Gets whether self
is reversing the swipe direction.
Since: 1.0
getSwipeable
swipeTrackerGetSwipeable Source #
:: (HasCallStack, MonadIO m, IsSwipeTracker a) | |
=> a |
|
-> m Swipeable | Returns: the swipeable widget |
Get the widget self
is attached to.
Since: 1.0
new
:: (HasCallStack, MonadIO m, IsSwipeable a) | |
=> a |
|
-> m SwipeTracker | Returns: the newly created |
Creates a new AdwSwipeTracker
for widget
.
Since: 1.0
setAllowLongSwipes
swipeTrackerSetAllowLongSwipes Source #
:: (HasCallStack, MonadIO m, IsSwipeTracker a) | |
=> a |
|
-> Bool |
|
-> m () |
Sets whether to allow swiping for more than one snap point at a time.
Since: 1.0
setAllowMouseDrag
swipeTrackerSetAllowMouseDrag Source #
:: (HasCallStack, MonadIO m, IsSwipeTracker a) | |
=> a |
|
-> Bool |
|
-> m () |
Sets whether self
can be dragged with mouse pointer.
Since: 1.0
setEnabled
swipeTrackerSetEnabled Source #
:: (HasCallStack, MonadIO m, IsSwipeTracker a) | |
=> a |
|
-> Bool |
|
-> m () |
Sets whether self
is enabled.
Since: 1.0
setReversed
swipeTrackerSetReversed Source #
:: (HasCallStack, MonadIO m, IsSwipeTracker a) | |
=> a |
|
-> Bool |
|
-> m () |
Sets whether to reverse the swipe direction.
Since: 1.0
shiftPosition
swipeTrackerShiftPosition Source #
:: (HasCallStack, MonadIO m, IsSwipeTracker a) | |
=> a |
|
-> Double |
|
-> m () |
Moves the current progress value by delta
.
This can be used to adjust the current position if snap points move during the gesture.
Since: 1.0
Properties
allowLongSwipes
Whether to allow swiping for more than one snap point at a time.
If the value is FALSE
, each swipe can only move to the adjacent snap
points.
Since: 1.0
constructSwipeTrackerAllowLongSwipes :: (IsSwipeTracker o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “allow-long-swipes
” property. This is rarely needed directly, but it is used by new
.
getSwipeTrackerAllowLongSwipes :: (MonadIO m, IsSwipeTracker o) => o -> m Bool Source #
Get the value of the “allow-long-swipes
” property.
When overloading is enabled, this is equivalent to
get
swipeTracker #allowLongSwipes
setSwipeTrackerAllowLongSwipes :: (MonadIO m, IsSwipeTracker o) => o -> Bool -> m () Source #
Set the value of the “allow-long-swipes
” property.
When overloading is enabled, this is equivalent to
set
swipeTracker [ #allowLongSwipes:=
value ]
allowMouseDrag
Whether to allow dragging with mouse pointer.
Since: 1.0
constructSwipeTrackerAllowMouseDrag :: (IsSwipeTracker o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “allow-mouse-drag
” property. This is rarely needed directly, but it is used by new
.
getSwipeTrackerAllowMouseDrag :: (MonadIO m, IsSwipeTracker o) => o -> m Bool Source #
Get the value of the “allow-mouse-drag
” property.
When overloading is enabled, this is equivalent to
get
swipeTracker #allowMouseDrag
setSwipeTrackerAllowMouseDrag :: (MonadIO m, IsSwipeTracker o) => o -> Bool -> m () Source #
Set the value of the “allow-mouse-drag
” property.
When overloading is enabled, this is equivalent to
set
swipeTracker [ #allowMouseDrag:=
value ]
enabled
Whether the swipe tracker is enabled.
When it's not enabled, no events will be processed. Usually widgets will want to expose this via a property.
Since: 1.0
constructSwipeTrackerEnabled :: (IsSwipeTracker o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “enabled
” property. This is rarely needed directly, but it is used by new
.
getSwipeTrackerEnabled :: (MonadIO m, IsSwipeTracker o) => o -> m Bool Source #
Get the value of the “enabled
” property.
When overloading is enabled, this is equivalent to
get
swipeTracker #enabled
setSwipeTrackerEnabled :: (MonadIO m, IsSwipeTracker o) => o -> Bool -> m () Source #
Set the value of the “enabled
” property.
When overloading is enabled, this is equivalent to
set
swipeTracker [ #enabled:=
value ]
reversed
Whether to reverse the swipe direction.
If the swipe tracker is horizontal, it can be used for supporting RTL text direction.
Since: 1.0
constructSwipeTrackerReversed :: (IsSwipeTracker o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “reversed
” property. This is rarely needed directly, but it is used by new
.
getSwipeTrackerReversed :: (MonadIO m, IsSwipeTracker o) => o -> m Bool Source #
Get the value of the “reversed
” property.
When overloading is enabled, this is equivalent to
get
swipeTracker #reversed
setSwipeTrackerReversed :: (MonadIO m, IsSwipeTracker o) => o -> Bool -> m () Source #
Set the value of the “reversed
” property.
When overloading is enabled, this is equivalent to
set
swipeTracker [ #reversed:=
value ]
swipeable
The widget the swipe tracker is attached to.
Since: 1.0
constructSwipeTrackerSwipeable :: (IsSwipeTracker o, MonadIO m, IsSwipeable a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “swipeable
” property. This is rarely needed directly, but it is used by new
.
getSwipeTrackerSwipeable :: (MonadIO m, IsSwipeTracker o) => o -> m Swipeable Source #
Get the value of the “swipeable
” property.
When overloading is enabled, this is equivalent to
get
swipeTracker #swipeable
Signals
beginSwipe
type SwipeTrackerBeginSwipeCallback = IO () Source #
This signal is emitted right before a swipe will be started, after the drag threshold has been passed.
Since: 1.0
afterSwipeTrackerBeginSwipe :: (IsSwipeTracker a, MonadIO m) => a -> ((?self :: a) => SwipeTrackerBeginSwipeCallback) -> m SignalHandlerId Source #
Connect a signal handler for the beginSwipe signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
swipeTracker #beginSwipe 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.
onSwipeTrackerBeginSwipe :: (IsSwipeTracker a, MonadIO m) => a -> ((?self :: a) => SwipeTrackerBeginSwipeCallback) -> m SignalHandlerId Source #
Connect a signal handler for the beginSwipe signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
swipeTracker #beginSwipe callback
endSwipe
type SwipeTrackerEndSwipeCallback Source #
This signal is emitted as soon as the gesture has stopped.
The user is expected to animate the deceleration from the current progress
value to to
with an animation using velocity
as the initial velocity,
provided in pixels per second. [classspringAnimation
] is usually a good
fit for this.
Since: 1.0
afterSwipeTrackerEndSwipe :: (IsSwipeTracker a, MonadIO m) => a -> ((?self :: a) => SwipeTrackerEndSwipeCallback) -> m SignalHandlerId Source #
Connect a signal handler for the endSwipe signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
swipeTracker #endSwipe 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.
onSwipeTrackerEndSwipe :: (IsSwipeTracker a, MonadIO m) => a -> ((?self :: a) => SwipeTrackerEndSwipeCallback) -> m SignalHandlerId Source #
Connect a signal handler for the endSwipe signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
swipeTracker #endSwipe callback
prepare
type SwipeTrackerPrepareCallback Source #
= NavigationDirection |
|
-> IO () |
This signal is emitted when a possible swipe is detected.
The direction
value can be used to restrict the swipe to a certain
direction.
Since: 1.0
afterSwipeTrackerPrepare :: (IsSwipeTracker a, MonadIO m) => a -> ((?self :: a) => SwipeTrackerPrepareCallback) -> m SignalHandlerId Source #
Connect a signal handler for the prepare signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
swipeTracker #prepare 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.
onSwipeTrackerPrepare :: (IsSwipeTracker a, MonadIO m) => a -> ((?self :: a) => SwipeTrackerPrepareCallback) -> m SignalHandlerId Source #
Connect a signal handler for the prepare signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
swipeTracker #prepare callback
updateSwipe
type SwipeTrackerUpdateSwipeCallback Source #
This signal is emitted every time the progress value changes.
Since: 1.0
afterSwipeTrackerUpdateSwipe :: (IsSwipeTracker a, MonadIO m) => a -> ((?self :: a) => SwipeTrackerUpdateSwipeCallback) -> m SignalHandlerId Source #
Connect a signal handler for the updateSwipe signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
swipeTracker #updateSwipe 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.
onSwipeTrackerUpdateSwipe :: (IsSwipeTracker a, MonadIO m) => a -> ((?self :: a) => SwipeTrackerUpdateSwipeCallback) -> m SignalHandlerId Source #
Connect a signal handler for the updateSwipe signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
swipeTracker #updateSwipe callback