gi-gdk-0.3.18.13: GI/Gdk/Structs/EventScroll.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
Generated from button presses for the buttons 4 to 7. Wheel mice are
usually configured to generate button press events for buttons 4 and 5
when the wheel is turned.
Some GDK backends can also generate “smooth” scroll events, which
can be recognized by the %GDK_SCROLL_SMOOTH scroll direction. For
these, the scroll deltas can be obtained with
gdk_event_get_scroll_deltas().
-}
module GI.Gdk.Structs.EventScroll
(
-- * Exported types
EventScroll(..) ,
newZeroEventScroll ,
noEventScroll ,
-- * Properties
-- ** DeltaX
eventScrollReadDeltaX ,
-- ** DeltaY
eventScrollReadDeltaY ,
-- ** Device
eventScrollReadDevice ,
-- ** Direction
eventScrollReadDirection ,
-- ** SendEvent
eventScrollReadSendEvent ,
-- ** State
eventScrollReadState ,
-- ** Time
eventScrollReadTime ,
-- ** Type
eventScrollReadType ,
-- ** Window
eventScrollReadWindow ,
-- ** X
eventScrollReadX ,
-- ** XRoot
eventScrollReadXRoot ,
-- ** Y
eventScrollReadY ,
-- ** YRoot
eventScrollReadYRoot ,
) where
import Prelude ()
import Data.GI.Base.ShortPrelude
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import GI.Gdk.Types
import GI.Gdk.Callbacks
newtype EventScroll = EventScroll (ForeignPtr EventScroll)
-- | Construct a `EventScroll` struct initialized to zero.
newZeroEventScroll :: MonadIO m => m EventScroll
newZeroEventScroll = liftIO $ callocBytes 88 >>= wrapPtr EventScroll
noEventScroll :: Maybe EventScroll
noEventScroll = Nothing
eventScrollReadType :: EventScroll -> IO EventType
eventScrollReadType s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO CUInt
let val' = (toEnum . fromIntegral) val
return val'
eventScrollReadWindow :: EventScroll -> IO Window
eventScrollReadWindow s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO (Ptr Window)
val' <- (newObject Window) val
return val'
eventScrollReadSendEvent :: EventScroll -> IO Int8
eventScrollReadSendEvent s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 16) :: IO Int8
return val
eventScrollReadTime :: EventScroll -> IO Word32
eventScrollReadTime s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 20) :: IO Word32
return val
eventScrollReadX :: EventScroll -> IO Double
eventScrollReadX s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 24) :: IO CDouble
let val' = realToFrac val
return val'
eventScrollReadY :: EventScroll -> IO Double
eventScrollReadY s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 32) :: IO CDouble
let val' = realToFrac val
return val'
eventScrollReadState :: EventScroll -> IO [ModifierType]
eventScrollReadState s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 40) :: IO CUInt
let val' = wordToGFlags val
return val'
eventScrollReadDirection :: EventScroll -> IO ScrollDirection
eventScrollReadDirection s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 44) :: IO CUInt
let val' = (toEnum . fromIntegral) val
return val'
eventScrollReadDevice :: EventScroll -> IO Device
eventScrollReadDevice s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 48) :: IO (Ptr Device)
val' <- (newObject Device) val
return val'
eventScrollReadXRoot :: EventScroll -> IO Double
eventScrollReadXRoot s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 56) :: IO CDouble
let val' = realToFrac val
return val'
eventScrollReadYRoot :: EventScroll -> IO Double
eventScrollReadYRoot s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 64) :: IO CDouble
let val' = realToFrac val
return val'
eventScrollReadDeltaX :: EventScroll -> IO Double
eventScrollReadDeltaX s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 72) :: IO CDouble
let val' = realToFrac val
return val'
eventScrollReadDeltaY :: EventScroll -> IO Double
eventScrollReadDeltaY s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 80) :: IO CDouble
let val' = realToFrac val
return val'
type family ResolveEventScrollMethod (t :: Symbol) (o :: *) :: * where
ResolveEventScrollMethod l o = MethodResolutionFailed l o
instance (info ~ ResolveEventScrollMethod t EventScroll, MethodInfo info EventScroll p) => IsLabelProxy t (EventScroll -> p) where
fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveEventScrollMethod t EventScroll, MethodInfo info EventScroll p) => IsLabel t (EventScroll -> p) where
fromLabel _ = overloadedMethod (MethodProxy :: MethodProxy info)
#endif