{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gdk.Objects.ScrollEvent
(
ScrollEvent(..) ,
IsScrollEvent ,
toScrollEvent ,
#if defined(ENABLE_OVERLOADING)
ResolveScrollEventMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
ScrollEventGetDeltasMethodInfo ,
#endif
scrollEventGetDeltas ,
#if defined(ENABLE_OVERLOADING)
ScrollEventGetDirectionMethodInfo ,
#endif
scrollEventGetDirection ,
#if defined(ENABLE_OVERLOADING)
ScrollEventIsStopMethodInfo ,
#endif
scrollEventIsStop ,
) where
import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P
import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL
import qualified GHC.Records as R
import {-# SOURCE #-} qualified GI.Gdk.Enums as Gdk.Enums
import {-# SOURCE #-} qualified GI.Gdk.Objects.Event as Gdk.Event
newtype ScrollEvent = ScrollEvent (SP.ManagedPtr ScrollEvent)
deriving (ScrollEvent -> ScrollEvent -> Bool
(ScrollEvent -> ScrollEvent -> Bool)
-> (ScrollEvent -> ScrollEvent -> Bool) -> Eq ScrollEvent
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ScrollEvent -> ScrollEvent -> Bool
$c/= :: ScrollEvent -> ScrollEvent -> Bool
== :: ScrollEvent -> ScrollEvent -> Bool
$c== :: ScrollEvent -> ScrollEvent -> Bool
Eq)
instance SP.ManagedPtrNewtype ScrollEvent where
toManagedPtr :: ScrollEvent -> ManagedPtr ScrollEvent
toManagedPtr (ScrollEvent ManagedPtr ScrollEvent
p) = ManagedPtr ScrollEvent
p
foreign import ccall "gdk_scroll_event_get_type"
c_gdk_scroll_event_get_type :: IO B.Types.GType
instance B.Types.TypedObject ScrollEvent where
glibType :: IO GType
glibType = IO GType
c_gdk_scroll_event_get_type
class (SP.BoxedPtr o, SP.TypedObject o, O.IsDescendantOf ScrollEvent o) => IsScrollEvent o
instance (SP.BoxedPtr o, SP.TypedObject o, O.IsDescendantOf ScrollEvent o) => IsScrollEvent o
instance O.HasParentTypes ScrollEvent
type instance O.ParentTypes ScrollEvent = '[Gdk.Event.Event]
toScrollEvent :: (MIO.MonadIO m, IsScrollEvent o) => o -> m ScrollEvent
toScrollEvent :: forall (m :: * -> *) o.
(MonadIO m, IsScrollEvent o) =>
o -> m ScrollEvent
toScrollEvent = IO ScrollEvent -> m ScrollEvent
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO ScrollEvent -> m ScrollEvent)
-> (o -> IO ScrollEvent) -> o -> m ScrollEvent
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr ScrollEvent -> ScrollEvent) -> o -> IO ScrollEvent
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr ScrollEvent -> ScrollEvent
ScrollEvent
#if defined(ENABLE_OVERLOADING)
type family ResolveScrollEventMethod (t :: Symbol) (o :: *) :: * where
ResolveScrollEventMethod "isStop" o = ScrollEventIsStopMethodInfo
ResolveScrollEventMethod "ref" o = Gdk.Event.EventRefMethodInfo
ResolveScrollEventMethod "triggersContextMenu" o = Gdk.Event.EventTriggersContextMenuMethodInfo
ResolveScrollEventMethod "unref" o = Gdk.Event.EventUnrefMethodInfo
ResolveScrollEventMethod "getAxes" o = Gdk.Event.EventGetAxesMethodInfo
ResolveScrollEventMethod "getAxis" o = Gdk.Event.EventGetAxisMethodInfo
ResolveScrollEventMethod "getDeltas" o = ScrollEventGetDeltasMethodInfo
ResolveScrollEventMethod "getDevice" o = Gdk.Event.EventGetDeviceMethodInfo
ResolveScrollEventMethod "getDeviceTool" o = Gdk.Event.EventGetDeviceToolMethodInfo
ResolveScrollEventMethod "getDirection" o = ScrollEventGetDirectionMethodInfo
ResolveScrollEventMethod "getDisplay" o = Gdk.Event.EventGetDisplayMethodInfo
ResolveScrollEventMethod "getEventSequence" o = Gdk.Event.EventGetEventSequenceMethodInfo
ResolveScrollEventMethod "getEventType" o = Gdk.Event.EventGetEventTypeMethodInfo
ResolveScrollEventMethod "getHistory" o = Gdk.Event.EventGetHistoryMethodInfo
ResolveScrollEventMethod "getModifierState" o = Gdk.Event.EventGetModifierStateMethodInfo
ResolveScrollEventMethod "getPointerEmulated" o = Gdk.Event.EventGetPointerEmulatedMethodInfo
ResolveScrollEventMethod "getPosition" o = Gdk.Event.EventGetPositionMethodInfo
ResolveScrollEventMethod "getSeat" o = Gdk.Event.EventGetSeatMethodInfo
ResolveScrollEventMethod "getSurface" o = Gdk.Event.EventGetSurfaceMethodInfo
ResolveScrollEventMethod "getTime" o = Gdk.Event.EventGetTimeMethodInfo
ResolveScrollEventMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveScrollEventMethod t ScrollEvent, O.OverloadedMethod info ScrollEvent p) => OL.IsLabel t (ScrollEvent -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveScrollEventMethod t ScrollEvent, O.OverloadedMethod info ScrollEvent p, R.HasField t ScrollEvent p) => R.HasField t ScrollEvent p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveScrollEventMethod t ScrollEvent, O.OverloadedMethodInfo info ScrollEvent) => OL.IsLabel t (O.MethodProxy info ScrollEvent) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
instance BoxedPtr ScrollEvent where
boxedPtrCopy :: ScrollEvent -> IO ScrollEvent
boxedPtrCopy = ScrollEvent -> IO ScrollEvent
forall (m :: * -> *) a. Monad m => a -> m a
return
boxedPtrFree :: ScrollEvent -> IO ()
boxedPtrFree = \ScrollEvent
_x -> () -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
foreign import ccall "gdk_scroll_event_get_deltas" gdk_scroll_event_get_deltas ::
Ptr ScrollEvent ->
Ptr CDouble ->
Ptr CDouble ->
IO ()
scrollEventGetDeltas ::
(B.CallStack.HasCallStack, MonadIO m, IsScrollEvent a) =>
a
-> m ((Double, Double))
scrollEventGetDeltas :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsScrollEvent a) =>
a -> m (Double, Double)
scrollEventGetDeltas a
event = IO (Double, Double) -> m (Double, Double)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Double, Double) -> m (Double, Double))
-> IO (Double, Double) -> m (Double, Double)
forall a b. (a -> b) -> a -> b
$ do
Ptr ScrollEvent
event' <- a -> IO (Ptr ScrollEvent)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
event
Ptr CDouble
deltaX <- IO (Ptr CDouble)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CDouble)
Ptr CDouble
deltaY <- IO (Ptr CDouble)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr CDouble)
Ptr ScrollEvent -> Ptr CDouble -> Ptr CDouble -> IO ()
gdk_scroll_event_get_deltas Ptr ScrollEvent
event' Ptr CDouble
deltaX Ptr CDouble
deltaY
CDouble
deltaX' <- Ptr CDouble -> IO CDouble
forall a. Storable a => Ptr a -> IO a
peek Ptr CDouble
deltaX
let deltaX'' :: Double
deltaX'' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
deltaX'
CDouble
deltaY' <- Ptr CDouble -> IO CDouble
forall a. Storable a => Ptr a -> IO a
peek Ptr CDouble
deltaY
let deltaY'' :: Double
deltaY'' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
deltaY'
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
event
Ptr CDouble -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CDouble
deltaX
Ptr CDouble -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr CDouble
deltaY
(Double, Double) -> IO (Double, Double)
forall (m :: * -> *) a. Monad m => a -> m a
return (Double
deltaX'', Double
deltaY'')
#if defined(ENABLE_OVERLOADING)
data ScrollEventGetDeltasMethodInfo
instance (signature ~ (m ((Double, Double))), MonadIO m, IsScrollEvent a) => O.OverloadedMethod ScrollEventGetDeltasMethodInfo a signature where
overloadedMethod = scrollEventGetDeltas
instance O.OverloadedMethodInfo ScrollEventGetDeltasMethodInfo a where
overloadedMethodInfo = O.MethodInfo {
O.overloadedMethodName = "GI.Gdk.Objects.ScrollEvent.scrollEventGetDeltas",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gdk-4.0.3/docs/GI-Gdk-Objects-ScrollEvent.html#v:scrollEventGetDeltas"
}
#endif
foreign import ccall "gdk_scroll_event_get_direction" gdk_scroll_event_get_direction ::
Ptr ScrollEvent ->
IO CUInt
scrollEventGetDirection ::
(B.CallStack.HasCallStack, MonadIO m, IsScrollEvent a) =>
a
-> m Gdk.Enums.ScrollDirection
scrollEventGetDirection :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsScrollEvent a) =>
a -> m ScrollDirection
scrollEventGetDirection a
event = IO ScrollDirection -> m ScrollDirection
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ScrollDirection -> m ScrollDirection)
-> IO ScrollDirection -> m ScrollDirection
forall a b. (a -> b) -> a -> b
$ do
Ptr ScrollEvent
event' <- a -> IO (Ptr ScrollEvent)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
event
CUInt
result <- Ptr ScrollEvent -> IO CUInt
gdk_scroll_event_get_direction Ptr ScrollEvent
event'
let result' :: ScrollDirection
result' = (Int -> ScrollDirection
forall a. Enum a => Int -> a
toEnum (Int -> ScrollDirection)
-> (CUInt -> Int) -> CUInt -> ScrollDirection
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
event
ScrollDirection -> IO ScrollDirection
forall (m :: * -> *) a. Monad m => a -> m a
return ScrollDirection
result'
#if defined(ENABLE_OVERLOADING)
data ScrollEventGetDirectionMethodInfo
instance (signature ~ (m Gdk.Enums.ScrollDirection), MonadIO m, IsScrollEvent a) => O.OverloadedMethod ScrollEventGetDirectionMethodInfo a signature where
overloadedMethod = scrollEventGetDirection
instance O.OverloadedMethodInfo ScrollEventGetDirectionMethodInfo a where
overloadedMethodInfo = O.MethodInfo {
O.overloadedMethodName = "GI.Gdk.Objects.ScrollEvent.scrollEventGetDirection",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gdk-4.0.3/docs/GI-Gdk-Objects-ScrollEvent.html#v:scrollEventGetDirection"
}
#endif
foreign import ccall "gdk_scroll_event_is_stop" gdk_scroll_event_is_stop ::
Ptr ScrollEvent ->
IO CInt
scrollEventIsStop ::
(B.CallStack.HasCallStack, MonadIO m, IsScrollEvent a) =>
a
-> m Bool
scrollEventIsStop :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsScrollEvent a) =>
a -> m Bool
scrollEventIsStop a
event = IO Bool -> m Bool
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
Ptr ScrollEvent
event' <- a -> IO (Ptr ScrollEvent)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
event
CInt
result <- Ptr ScrollEvent -> IO CInt
gdk_scroll_event_is_stop Ptr ScrollEvent
event'
let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
event
Bool -> IO Bool
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'
#if defined(ENABLE_OVERLOADING)
data ScrollEventIsStopMethodInfo
instance (signature ~ (m Bool), MonadIO m, IsScrollEvent a) => O.OverloadedMethod ScrollEventIsStopMethodInfo a signature where
overloadedMethod = scrollEventIsStop
instance O.OverloadedMethodInfo ScrollEventIsStopMethodInfo a where
overloadedMethodInfo = O.MethodInfo {
O.overloadedMethodName = "GI.Gdk.Objects.ScrollEvent.scrollEventIsStop",
O.overloadedMethodURL = "https://hackage.haskell.org/package/gi-gdk-4.0.3/docs/GI-Gdk-Objects-ScrollEvent.html#v:scrollEventIsStop"
}
#endif