{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- Proximity events are generated when using GDK’s wrapper for the
-- XInput extension. The XInput extension is an add-on for standard X
-- that allows you to use nonstandard devices such as graphics tablets.
-- A proximity event indicates that the stylus has moved in or out of
-- contact with the tablet, or perhaps that the user’s finger has moved
-- in or out of contact with a touch screen.
-- 
-- This event type will be used pretty rarely. It only is important for
-- XInput aware programs that are drawing their own cursor.

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.Gdk.Structs.EventProximity
    ( 

-- * Exported types
    EventProximity(..)                      ,
    newZeroEventProximity                   ,


 -- * Methods
-- ** Overloaded methods #method:Overloaded methods#

#if defined(ENABLE_OVERLOADING)
    ResolveEventProximityMethod             ,
#endif




 -- * Properties
-- ** device #attr:device#
-- | the master device that the event originated from. Use
-- 'GI.Gdk.Unions.Event.eventGetSourceDevice' to get the slave device.

    clearEventProximityDevice               ,
#if defined(ENABLE_OVERLOADING)
    eventProximity_device                   ,
#endif
    getEventProximityDevice                 ,
    setEventProximityDevice                 ,


-- ** sendEvent #attr:sendEvent#
-- | 'P.True' if the event was sent explicitly.

#if defined(ENABLE_OVERLOADING)
    eventProximity_sendEvent                ,
#endif
    getEventProximitySendEvent              ,
    setEventProximitySendEvent              ,


-- ** time #attr:time#
-- | the time of the event in milliseconds.

#if defined(ENABLE_OVERLOADING)
    eventProximity_time                     ,
#endif
    getEventProximityTime                   ,
    setEventProximityTime                   ,


-- ** type #attr:type#
-- | the type of the event ('GI.Gdk.Enums.EventTypeProximityIn' or 'GI.Gdk.Enums.EventTypeProximityOut').

#if defined(ENABLE_OVERLOADING)
    eventProximity_type                     ,
#endif
    getEventProximityType                   ,
    setEventProximityType                   ,


-- ** window #attr:window#
-- | the window which received the event.

    clearEventProximityWindow               ,
#if defined(ENABLE_OVERLOADING)
    eventProximity_window                   ,
#endif
    getEventProximityWindow                 ,
    setEventProximityWindow                 ,




    ) 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.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 {-# SOURCE #-} qualified GI.Gdk.Enums as Gdk.Enums
import {-# SOURCE #-} qualified GI.Gdk.Objects.Device as Gdk.Device
import {-# SOURCE #-} qualified GI.Gdk.Objects.Window as Gdk.Window

-- | Memory-managed wrapper type.
newtype EventProximity = EventProximity (SP.ManagedPtr EventProximity)
    deriving (EventProximity -> EventProximity -> Bool
(EventProximity -> EventProximity -> Bool)
-> (EventProximity -> EventProximity -> Bool) -> Eq EventProximity
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EventProximity -> EventProximity -> Bool
$c/= :: EventProximity -> EventProximity -> Bool
== :: EventProximity -> EventProximity -> Bool
$c== :: EventProximity -> EventProximity -> Bool
Eq)

instance SP.ManagedPtrNewtype EventProximity where
    toManagedPtr :: EventProximity -> ManagedPtr EventProximity
toManagedPtr (EventProximity ManagedPtr EventProximity
p) = ManagedPtr EventProximity
p

instance BoxedPtr EventProximity where
    boxedPtrCopy :: EventProximity -> IO EventProximity
boxedPtrCopy = \EventProximity
p -> EventProximity
-> (Ptr EventProximity -> IO EventProximity) -> IO EventProximity
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr EventProximity
p (Int -> Ptr EventProximity -> IO (Ptr EventProximity)
forall a. (HasCallStack, CallocPtr a) => Int -> Ptr a -> IO (Ptr a)
copyBytes Int
32 (Ptr EventProximity -> IO (Ptr EventProximity))
-> (Ptr EventProximity -> IO EventProximity)
-> Ptr EventProximity
-> IO EventProximity
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> (ManagedPtr EventProximity -> EventProximity)
-> Ptr EventProximity -> IO EventProximity
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.wrapPtr ManagedPtr EventProximity -> EventProximity
EventProximity)
    boxedPtrFree :: EventProximity -> IO ()
boxedPtrFree = \EventProximity
x -> EventProximity -> (Ptr EventProximity -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
SP.withManagedPtr EventProximity
x Ptr EventProximity -> IO ()
forall a. Ptr a -> IO ()
SP.freeMem
instance CallocPtr EventProximity where
    boxedPtrCalloc :: IO (Ptr EventProximity)
boxedPtrCalloc = Int -> IO (Ptr EventProximity)
forall a. Int -> IO (Ptr a)
callocBytes Int
32


-- | Construct a `EventProximity` struct initialized to zero.
newZeroEventProximity :: MonadIO m => m EventProximity
newZeroEventProximity :: m EventProximity
newZeroEventProximity = IO EventProximity -> m EventProximity
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO EventProximity -> m EventProximity)
-> IO EventProximity -> m EventProximity
forall a b. (a -> b) -> a -> b
$ IO (Ptr EventProximity)
forall a. CallocPtr a => IO (Ptr a)
boxedPtrCalloc IO (Ptr EventProximity)
-> (Ptr EventProximity -> IO EventProximity) -> IO EventProximity
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr EventProximity -> EventProximity)
-> Ptr EventProximity -> IO EventProximity
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr EventProximity -> EventProximity
EventProximity

instance tag ~ 'AttrSet => Constructible EventProximity tag where
    new :: (ManagedPtr EventProximity -> EventProximity)
-> [AttrOp EventProximity tag] -> m EventProximity
new ManagedPtr EventProximity -> EventProximity
_ [AttrOp EventProximity tag]
attrs = do
        EventProximity
o <- m EventProximity
forall (m :: * -> *). MonadIO m => m EventProximity
newZeroEventProximity
        EventProximity -> [AttrOp EventProximity 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set EventProximity
o [AttrOp EventProximity tag]
[AttrOp EventProximity 'AttrSet]
attrs
        EventProximity -> m EventProximity
forall (m :: * -> *) a. Monad m => a -> m a
return EventProximity
o


-- | Get the value of the “@type@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' eventProximity #type
-- @
getEventProximityType :: MonadIO m => EventProximity -> m Gdk.Enums.EventType
getEventProximityType :: EventProximity -> m EventType
getEventProximityType EventProximity
s = IO EventType -> m EventType
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO EventType -> m EventType) -> IO EventType -> m EventType
forall a b. (a -> b) -> a -> b
$ EventProximity
-> (Ptr EventProximity -> IO EventType) -> IO EventType
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr EventProximity
s ((Ptr EventProximity -> IO EventType) -> IO EventType)
-> (Ptr EventProximity -> IO EventType) -> IO EventType
forall a b. (a -> b) -> a -> b
$ \Ptr EventProximity
ptr -> do
    CInt
val <- Ptr CInt -> IO CInt
forall a. Storable a => Ptr a -> IO a
peek (Ptr EventProximity
ptr Ptr EventProximity -> Int -> Ptr CInt
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) :: IO CInt
    let val' :: EventType
val' = (Int -> EventType
forall a. Enum a => Int -> a
toEnum (Int -> EventType) -> (CInt -> Int) -> CInt -> EventType
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CInt
val
    EventType -> IO EventType
forall (m :: * -> *) a. Monad m => a -> m a
return EventType
val'

-- | Set the value of the “@type@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' eventProximity [ #type 'Data.GI.Base.Attributes.:=' value ]
-- @
setEventProximityType :: MonadIO m => EventProximity -> Gdk.Enums.EventType -> m ()
setEventProximityType :: EventProximity -> EventType -> m ()
setEventProximityType EventProximity
s EventType
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ EventProximity -> (Ptr EventProximity -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr EventProximity
s ((Ptr EventProximity -> IO ()) -> IO ())
-> (Ptr EventProximity -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr EventProximity
ptr -> do
    let val' :: CInt
val' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CInt) -> (EventType -> Int) -> EventType -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. EventType -> Int
forall a. Enum a => a -> Int
fromEnum) EventType
val
    Ptr CInt -> CInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr EventProximity
ptr Ptr EventProximity -> Int -> Ptr CInt
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) (CInt
val' :: CInt)

#if defined(ENABLE_OVERLOADING)
data EventProximityTypeFieldInfo
instance AttrInfo EventProximityTypeFieldInfo where
    type AttrBaseTypeConstraint EventProximityTypeFieldInfo = (~) EventProximity
    type AttrAllowedOps EventProximityTypeFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint EventProximityTypeFieldInfo = (~) Gdk.Enums.EventType
    type AttrTransferTypeConstraint EventProximityTypeFieldInfo = (~)Gdk.Enums.EventType
    type AttrTransferType EventProximityTypeFieldInfo = Gdk.Enums.EventType
    type AttrGetType EventProximityTypeFieldInfo = Gdk.Enums.EventType
    type AttrLabel EventProximityTypeFieldInfo = "type"
    type AttrOrigin EventProximityTypeFieldInfo = EventProximity
    attrGet = getEventProximityType
    attrSet = setEventProximityType
    attrConstruct = undefined
    attrClear = undefined
    attrTransfer _ v = do
        return v

eventProximity_type :: AttrLabelProxy "type"
eventProximity_type = AttrLabelProxy

#endif


-- | Get the value of the “@window@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' eventProximity #window
-- @
getEventProximityWindow :: MonadIO m => EventProximity -> m (Maybe Gdk.Window.Window)
getEventProximityWindow :: EventProximity -> m (Maybe Window)
getEventProximityWindow EventProximity
s = IO (Maybe Window) -> m (Maybe Window)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Window) -> m (Maybe Window))
-> IO (Maybe Window) -> m (Maybe Window)
forall a b. (a -> b) -> a -> b
$ EventProximity
-> (Ptr EventProximity -> IO (Maybe Window)) -> IO (Maybe Window)
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr EventProximity
s ((Ptr EventProximity -> IO (Maybe Window)) -> IO (Maybe Window))
-> (Ptr EventProximity -> IO (Maybe Window)) -> IO (Maybe Window)
forall a b. (a -> b) -> a -> b
$ \Ptr EventProximity
ptr -> do
    Ptr Window
val <- Ptr (Ptr Window) -> IO (Ptr Window)
forall a. Storable a => Ptr a -> IO a
peek (Ptr EventProximity
ptr Ptr EventProximity -> Int -> Ptr (Ptr Window)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) :: IO (Ptr Gdk.Window.Window)
    Maybe Window
result <- Ptr Window -> (Ptr Window -> IO Window) -> IO (Maybe Window)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
SP.convertIfNonNull Ptr Window
val ((Ptr Window -> IO Window) -> IO (Maybe Window))
-> (Ptr Window -> IO Window) -> IO (Maybe Window)
forall a b. (a -> b) -> a -> b
$ \Ptr Window
val' -> do
        Window
val'' <- ((ManagedPtr Window -> Window) -> Ptr Window -> IO Window
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Window -> Window
Gdk.Window.Window) Ptr Window
val'
        Window -> IO Window
forall (m :: * -> *) a. Monad m => a -> m a
return Window
val''
    Maybe Window -> IO (Maybe Window)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Window
result

-- | Set the value of the “@window@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' eventProximity [ #window 'Data.GI.Base.Attributes.:=' value ]
-- @
setEventProximityWindow :: MonadIO m => EventProximity -> Ptr Gdk.Window.Window -> m ()
setEventProximityWindow :: EventProximity -> Ptr Window -> m ()
setEventProximityWindow EventProximity
s Ptr Window
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ EventProximity -> (Ptr EventProximity -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr EventProximity
s ((Ptr EventProximity -> IO ()) -> IO ())
-> (Ptr EventProximity -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr EventProximity
ptr -> do
    Ptr (Ptr Window) -> Ptr Window -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr EventProximity
ptr Ptr EventProximity -> Int -> Ptr (Ptr Window)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) (Ptr Window
val :: Ptr Gdk.Window.Window)

-- | Set the value of the “@window@” field to `Nothing`.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.clear' #window
-- @
clearEventProximityWindow :: MonadIO m => EventProximity -> m ()
clearEventProximityWindow :: EventProximity -> m ()
clearEventProximityWindow EventProximity
s = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ EventProximity -> (Ptr EventProximity -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr EventProximity
s ((Ptr EventProximity -> IO ()) -> IO ())
-> (Ptr EventProximity -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr EventProximity
ptr -> do
    Ptr (Ptr Window) -> Ptr Window -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr EventProximity
ptr Ptr EventProximity -> Int -> Ptr (Ptr Window)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) (Ptr Window
forall a. Ptr a
FP.nullPtr :: Ptr Gdk.Window.Window)

#if defined(ENABLE_OVERLOADING)
data EventProximityWindowFieldInfo
instance AttrInfo EventProximityWindowFieldInfo where
    type AttrBaseTypeConstraint EventProximityWindowFieldInfo = (~) EventProximity
    type AttrAllowedOps EventProximityWindowFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint EventProximityWindowFieldInfo = (~) (Ptr Gdk.Window.Window)
    type AttrTransferTypeConstraint EventProximityWindowFieldInfo = (~)(Ptr Gdk.Window.Window)
    type AttrTransferType EventProximityWindowFieldInfo = (Ptr Gdk.Window.Window)
    type AttrGetType EventProximityWindowFieldInfo = Maybe Gdk.Window.Window
    type AttrLabel EventProximityWindowFieldInfo = "window"
    type AttrOrigin EventProximityWindowFieldInfo = EventProximity
    attrGet = getEventProximityWindow
    attrSet = setEventProximityWindow
    attrConstruct = undefined
    attrClear = clearEventProximityWindow
    attrTransfer _ v = do
        return v

eventProximity_window :: AttrLabelProxy "window"
eventProximity_window = AttrLabelProxy

#endif


-- | Get the value of the “@send_event@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' eventProximity #sendEvent
-- @
getEventProximitySendEvent :: MonadIO m => EventProximity -> m Int8
getEventProximitySendEvent :: EventProximity -> m Int8
getEventProximitySendEvent EventProximity
s = IO Int8 -> m Int8
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int8 -> m Int8) -> IO Int8 -> m Int8
forall a b. (a -> b) -> a -> b
$ EventProximity -> (Ptr EventProximity -> IO Int8) -> IO Int8
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr EventProximity
s ((Ptr EventProximity -> IO Int8) -> IO Int8)
-> (Ptr EventProximity -> IO Int8) -> IO Int8
forall a b. (a -> b) -> a -> b
$ \Ptr EventProximity
ptr -> do
    Int8
val <- Ptr Int8 -> IO Int8
forall a. Storable a => Ptr a -> IO a
peek (Ptr EventProximity
ptr Ptr EventProximity -> Int -> Ptr Int8
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16) :: IO Int8
    Int8 -> IO Int8
forall (m :: * -> *) a. Monad m => a -> m a
return Int8
val

-- | Set the value of the “@send_event@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' eventProximity [ #sendEvent 'Data.GI.Base.Attributes.:=' value ]
-- @
setEventProximitySendEvent :: MonadIO m => EventProximity -> Int8 -> m ()
setEventProximitySendEvent :: EventProximity -> Int8 -> m ()
setEventProximitySendEvent EventProximity
s Int8
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ EventProximity -> (Ptr EventProximity -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr EventProximity
s ((Ptr EventProximity -> IO ()) -> IO ())
-> (Ptr EventProximity -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr EventProximity
ptr -> do
    Ptr Int8 -> Int8 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr EventProximity
ptr Ptr EventProximity -> Int -> Ptr Int8
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16) (Int8
val :: Int8)

#if defined(ENABLE_OVERLOADING)
data EventProximitySendEventFieldInfo
instance AttrInfo EventProximitySendEventFieldInfo where
    type AttrBaseTypeConstraint EventProximitySendEventFieldInfo = (~) EventProximity
    type AttrAllowedOps EventProximitySendEventFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint EventProximitySendEventFieldInfo = (~) Int8
    type AttrTransferTypeConstraint EventProximitySendEventFieldInfo = (~)Int8
    type AttrTransferType EventProximitySendEventFieldInfo = Int8
    type AttrGetType EventProximitySendEventFieldInfo = Int8
    type AttrLabel EventProximitySendEventFieldInfo = "send_event"
    type AttrOrigin EventProximitySendEventFieldInfo = EventProximity
    attrGet = getEventProximitySendEvent
    attrSet = setEventProximitySendEvent
    attrConstruct = undefined
    attrClear = undefined
    attrTransfer _ v = do
        return v

eventProximity_sendEvent :: AttrLabelProxy "sendEvent"
eventProximity_sendEvent = AttrLabelProxy

#endif


-- | Get the value of the “@time@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' eventProximity #time
-- @
getEventProximityTime :: MonadIO m => EventProximity -> m Word32
getEventProximityTime :: EventProximity -> m Word32
getEventProximityTime EventProximity
s = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ EventProximity -> (Ptr EventProximity -> IO Word32) -> IO Word32
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr EventProximity
s ((Ptr EventProximity -> IO Word32) -> IO Word32)
-> (Ptr EventProximity -> IO Word32) -> IO Word32
forall a b. (a -> b) -> a -> b
$ \Ptr EventProximity
ptr -> do
    Word32
val <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek (Ptr EventProximity
ptr Ptr EventProximity -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20) :: IO Word32
    Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
val

-- | Set the value of the “@time@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' eventProximity [ #time 'Data.GI.Base.Attributes.:=' value ]
-- @
setEventProximityTime :: MonadIO m => EventProximity -> Word32 -> m ()
setEventProximityTime :: EventProximity -> Word32 -> m ()
setEventProximityTime EventProximity
s Word32
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ EventProximity -> (Ptr EventProximity -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr EventProximity
s ((Ptr EventProximity -> IO ()) -> IO ())
-> (Ptr EventProximity -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr EventProximity
ptr -> do
    Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr EventProximity
ptr Ptr EventProximity -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20) (Word32
val :: Word32)

#if defined(ENABLE_OVERLOADING)
data EventProximityTimeFieldInfo
instance AttrInfo EventProximityTimeFieldInfo where
    type AttrBaseTypeConstraint EventProximityTimeFieldInfo = (~) EventProximity
    type AttrAllowedOps EventProximityTimeFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint EventProximityTimeFieldInfo = (~) Word32
    type AttrTransferTypeConstraint EventProximityTimeFieldInfo = (~)Word32
    type AttrTransferType EventProximityTimeFieldInfo = Word32
    type AttrGetType EventProximityTimeFieldInfo = Word32
    type AttrLabel EventProximityTimeFieldInfo = "time"
    type AttrOrigin EventProximityTimeFieldInfo = EventProximity
    attrGet = getEventProximityTime
    attrSet = setEventProximityTime
    attrConstruct = undefined
    attrClear = undefined
    attrTransfer _ v = do
        return v

eventProximity_time :: AttrLabelProxy "time"
eventProximity_time = AttrLabelProxy

#endif


-- | Get the value of the “@device@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' eventProximity #device
-- @
getEventProximityDevice :: MonadIO m => EventProximity -> m (Maybe Gdk.Device.Device)
getEventProximityDevice :: EventProximity -> m (Maybe Device)
getEventProximityDevice EventProximity
s = IO (Maybe Device) -> m (Maybe Device)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe Device) -> m (Maybe Device))
-> IO (Maybe Device) -> m (Maybe Device)
forall a b. (a -> b) -> a -> b
$ EventProximity
-> (Ptr EventProximity -> IO (Maybe Device)) -> IO (Maybe Device)
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr EventProximity
s ((Ptr EventProximity -> IO (Maybe Device)) -> IO (Maybe Device))
-> (Ptr EventProximity -> IO (Maybe Device)) -> IO (Maybe Device)
forall a b. (a -> b) -> a -> b
$ \Ptr EventProximity
ptr -> do
    Ptr Device
val <- Ptr (Ptr Device) -> IO (Ptr Device)
forall a. Storable a => Ptr a -> IO a
peek (Ptr EventProximity
ptr Ptr EventProximity -> Int -> Ptr (Ptr Device)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24) :: IO (Ptr Gdk.Device.Device)
    Maybe Device
result <- Ptr Device -> (Ptr Device -> IO Device) -> IO (Maybe Device)
forall a b. Ptr a -> (Ptr a -> IO b) -> IO (Maybe b)
SP.convertIfNonNull Ptr Device
val ((Ptr Device -> IO Device) -> IO (Maybe Device))
-> (Ptr Device -> IO Device) -> IO (Maybe Device)
forall a b. (a -> b) -> a -> b
$ \Ptr Device
val' -> do
        Device
val'' <- ((ManagedPtr Device -> Device) -> Ptr Device -> IO Device
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
newObject ManagedPtr Device -> Device
Gdk.Device.Device) Ptr Device
val'
        Device -> IO Device
forall (m :: * -> *) a. Monad m => a -> m a
return Device
val''
    Maybe Device -> IO (Maybe Device)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Device
result

-- | Set the value of the “@device@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' eventProximity [ #device 'Data.GI.Base.Attributes.:=' value ]
-- @
setEventProximityDevice :: MonadIO m => EventProximity -> Ptr Gdk.Device.Device -> m ()
setEventProximityDevice :: EventProximity -> Ptr Device -> m ()
setEventProximityDevice EventProximity
s Ptr Device
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ EventProximity -> (Ptr EventProximity -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr EventProximity
s ((Ptr EventProximity -> IO ()) -> IO ())
-> (Ptr EventProximity -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr EventProximity
ptr -> do
    Ptr (Ptr Device) -> Ptr Device -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr EventProximity
ptr Ptr EventProximity -> Int -> Ptr (Ptr Device)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24) (Ptr Device
val :: Ptr Gdk.Device.Device)

-- | Set the value of the “@device@” field to `Nothing`.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.clear' #device
-- @
clearEventProximityDevice :: MonadIO m => EventProximity -> m ()
clearEventProximityDevice :: EventProximity -> m ()
clearEventProximityDevice EventProximity
s = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ EventProximity -> (Ptr EventProximity -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr EventProximity
s ((Ptr EventProximity -> IO ()) -> IO ())
-> (Ptr EventProximity -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr EventProximity
ptr -> do
    Ptr (Ptr Device) -> Ptr Device -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr EventProximity
ptr Ptr EventProximity -> Int -> Ptr (Ptr Device)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24) (Ptr Device
forall a. Ptr a
FP.nullPtr :: Ptr Gdk.Device.Device)

#if defined(ENABLE_OVERLOADING)
data EventProximityDeviceFieldInfo
instance AttrInfo EventProximityDeviceFieldInfo where
    type AttrBaseTypeConstraint EventProximityDeviceFieldInfo = (~) EventProximity
    type AttrAllowedOps EventProximityDeviceFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint EventProximityDeviceFieldInfo = (~) (Ptr Gdk.Device.Device)
    type AttrTransferTypeConstraint EventProximityDeviceFieldInfo = (~)(Ptr Gdk.Device.Device)
    type AttrTransferType EventProximityDeviceFieldInfo = (Ptr Gdk.Device.Device)
    type AttrGetType EventProximityDeviceFieldInfo = Maybe Gdk.Device.Device
    type AttrLabel EventProximityDeviceFieldInfo = "device"
    type AttrOrigin EventProximityDeviceFieldInfo = EventProximity
    attrGet = getEventProximityDevice
    attrSet = setEventProximityDevice
    attrConstruct = undefined
    attrClear = clearEventProximityDevice
    attrTransfer _ v = do
        return v

eventProximity_device :: AttrLabelProxy "device"
eventProximity_device = AttrLabelProxy

#endif



#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList EventProximity
type instance O.AttributeList EventProximity = EventProximityAttributeList
type EventProximityAttributeList = ('[ '("type", EventProximityTypeFieldInfo), '("window", EventProximityWindowFieldInfo), '("sendEvent", EventProximitySendEventFieldInfo), '("time", EventProximityTimeFieldInfo), '("device", EventProximityDeviceFieldInfo)] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveEventProximityMethod (t :: Symbol) (o :: *) :: * where
    ResolveEventProximityMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveEventProximityMethod t EventProximity, O.MethodInfo info EventProximity p) => OL.IsLabel t (EventProximity -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#endif