#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gdk.Structs.EventProperty
(
EventProperty(..) ,
newZeroEventProperty ,
noEventProperty ,
#if ENABLE_OVERLOADING
eventProperty_atom ,
#endif
getEventPropertyAtom ,
#if ENABLE_OVERLOADING
eventProperty_sendEvent ,
#endif
getEventPropertySendEvent ,
setEventPropertySendEvent ,
#if ENABLE_OVERLOADING
eventProperty_state ,
#endif
getEventPropertyState ,
setEventPropertyState ,
#if ENABLE_OVERLOADING
eventProperty_time ,
#endif
getEventPropertyTime ,
setEventPropertyTime ,
#if ENABLE_OVERLOADING
eventProperty_type ,
#endif
getEventPropertyType ,
setEventPropertyType ,
clearEventPropertyWindow ,
#if ENABLE_OVERLOADING
eventProperty_window ,
#endif
getEventPropertyWindow ,
setEventPropertyWindow ,
) 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.ManagedPtr as B.ManagedPtr
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.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import {-# SOURCE #-} qualified GI.Gdk.Enums as Gdk.Enums
import {-# SOURCE #-} qualified GI.Gdk.Objects.Window as Gdk.Window
import {-# SOURCE #-} qualified GI.Gdk.Structs.Atom as Gdk.Atom
newtype EventProperty = EventProperty (ManagedPtr EventProperty)
instance WrappedPtr EventProperty where
wrappedPtrCalloc = callocBytes 40
wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 40 >=> wrapPtr EventProperty)
wrappedPtrFree = Just ptr_to_g_free
newZeroEventProperty :: MonadIO m => m EventProperty
newZeroEventProperty = liftIO $ wrappedPtrCalloc >>= wrapPtr EventProperty
instance tag ~ 'AttrSet => Constructible EventProperty tag where
new _ attrs = do
o <- newZeroEventProperty
GI.Attributes.set o attrs
return o
noEventProperty :: Maybe EventProperty
noEventProperty = Nothing
getEventPropertyType :: MonadIO m => EventProperty -> m Gdk.Enums.EventType
getEventPropertyType s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO CUInt
let val' = (toEnum . fromIntegral) val
return val'
setEventPropertyType :: MonadIO m => EventProperty -> Gdk.Enums.EventType -> m ()
setEventPropertyType s val = liftIO $ withManagedPtr s $ \ptr -> do
let val' = (fromIntegral . fromEnum) val
poke (ptr `plusPtr` 0) (val' :: CUInt)
#if ENABLE_OVERLOADING
data EventPropertyTypeFieldInfo
instance AttrInfo EventPropertyTypeFieldInfo where
type AttrAllowedOps EventPropertyTypeFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint EventPropertyTypeFieldInfo = (~) Gdk.Enums.EventType
type AttrBaseTypeConstraint EventPropertyTypeFieldInfo = (~) EventProperty
type AttrGetType EventPropertyTypeFieldInfo = Gdk.Enums.EventType
type AttrLabel EventPropertyTypeFieldInfo = "type"
type AttrOrigin EventPropertyTypeFieldInfo = EventProperty
attrGet _ = getEventPropertyType
attrSet _ = setEventPropertyType
attrConstruct = undefined
attrClear _ = undefined
eventProperty_type :: AttrLabelProxy "type"
eventProperty_type = AttrLabelProxy
#endif
getEventPropertyWindow :: MonadIO m => EventProperty -> m (Maybe Gdk.Window.Window)
getEventPropertyWindow s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO (Ptr Gdk.Window.Window)
result <- SP.convertIfNonNull val $ \val' -> do
val'' <- (newObject Gdk.Window.Window) val'
return val''
return result
setEventPropertyWindow :: MonadIO m => EventProperty -> Ptr Gdk.Window.Window -> m ()
setEventPropertyWindow s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 8) (val :: Ptr Gdk.Window.Window)
clearEventPropertyWindow :: MonadIO m => EventProperty -> m ()
clearEventPropertyWindow s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 8) (FP.nullPtr :: Ptr Gdk.Window.Window)
#if ENABLE_OVERLOADING
data EventPropertyWindowFieldInfo
instance AttrInfo EventPropertyWindowFieldInfo where
type AttrAllowedOps EventPropertyWindowFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint EventPropertyWindowFieldInfo = (~) (Ptr Gdk.Window.Window)
type AttrBaseTypeConstraint EventPropertyWindowFieldInfo = (~) EventProperty
type AttrGetType EventPropertyWindowFieldInfo = Maybe Gdk.Window.Window
type AttrLabel EventPropertyWindowFieldInfo = "window"
type AttrOrigin EventPropertyWindowFieldInfo = EventProperty
attrGet _ = getEventPropertyWindow
attrSet _ = setEventPropertyWindow
attrConstruct = undefined
attrClear _ = clearEventPropertyWindow
eventProperty_window :: AttrLabelProxy "window"
eventProperty_window = AttrLabelProxy
#endif
getEventPropertySendEvent :: MonadIO m => EventProperty -> m Int8
getEventPropertySendEvent s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 16) :: IO Int8
return val
setEventPropertySendEvent :: MonadIO m => EventProperty -> Int8 -> m ()
setEventPropertySendEvent s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 16) (val :: Int8)
#if ENABLE_OVERLOADING
data EventPropertySendEventFieldInfo
instance AttrInfo EventPropertySendEventFieldInfo where
type AttrAllowedOps EventPropertySendEventFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint EventPropertySendEventFieldInfo = (~) Int8
type AttrBaseTypeConstraint EventPropertySendEventFieldInfo = (~) EventProperty
type AttrGetType EventPropertySendEventFieldInfo = Int8
type AttrLabel EventPropertySendEventFieldInfo = "send_event"
type AttrOrigin EventPropertySendEventFieldInfo = EventProperty
attrGet _ = getEventPropertySendEvent
attrSet _ = setEventPropertySendEvent
attrConstruct = undefined
attrClear _ = undefined
eventProperty_sendEvent :: AttrLabelProxy "sendEvent"
eventProperty_sendEvent = AttrLabelProxy
#endif
getEventPropertyAtom :: MonadIO m => EventProperty -> m Gdk.Atom.Atom
getEventPropertyAtom s = liftIO $ withManagedPtr s $ \ptr -> do
let val = ptr `plusPtr` 24 :: (Ptr Gdk.Atom.Atom)
val' <- (newPtr Gdk.Atom.Atom) val
return val'
#if ENABLE_OVERLOADING
data EventPropertyAtomFieldInfo
instance AttrInfo EventPropertyAtomFieldInfo where
type AttrAllowedOps EventPropertyAtomFieldInfo = '[ 'AttrGet]
type AttrSetTypeConstraint EventPropertyAtomFieldInfo = (~) (Ptr Gdk.Atom.Atom)
type AttrBaseTypeConstraint EventPropertyAtomFieldInfo = (~) EventProperty
type AttrGetType EventPropertyAtomFieldInfo = Gdk.Atom.Atom
type AttrLabel EventPropertyAtomFieldInfo = "atom"
type AttrOrigin EventPropertyAtomFieldInfo = EventProperty
attrGet _ = getEventPropertyAtom
attrSet _ = undefined
attrConstruct = undefined
attrClear _ = undefined
eventProperty_atom :: AttrLabelProxy "atom"
eventProperty_atom = AttrLabelProxy
#endif
getEventPropertyTime :: MonadIO m => EventProperty -> m Word32
getEventPropertyTime s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 32) :: IO Word32
return val
setEventPropertyTime :: MonadIO m => EventProperty -> Word32 -> m ()
setEventPropertyTime s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 32) (val :: Word32)
#if ENABLE_OVERLOADING
data EventPropertyTimeFieldInfo
instance AttrInfo EventPropertyTimeFieldInfo where
type AttrAllowedOps EventPropertyTimeFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint EventPropertyTimeFieldInfo = (~) Word32
type AttrBaseTypeConstraint EventPropertyTimeFieldInfo = (~) EventProperty
type AttrGetType EventPropertyTimeFieldInfo = Word32
type AttrLabel EventPropertyTimeFieldInfo = "time"
type AttrOrigin EventPropertyTimeFieldInfo = EventProperty
attrGet _ = getEventPropertyTime
attrSet _ = setEventPropertyTime
attrConstruct = undefined
attrClear _ = undefined
eventProperty_time :: AttrLabelProxy "time"
eventProperty_time = AttrLabelProxy
#endif
getEventPropertyState :: MonadIO m => EventProperty -> m Gdk.Enums.PropertyState
getEventPropertyState s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 36) :: IO CUInt
let val' = (toEnum . fromIntegral) val
return val'
setEventPropertyState :: MonadIO m => EventProperty -> Gdk.Enums.PropertyState -> m ()
setEventPropertyState s val = liftIO $ withManagedPtr s $ \ptr -> do
let val' = (fromIntegral . fromEnum) val
poke (ptr `plusPtr` 36) (val' :: CUInt)
#if ENABLE_OVERLOADING
data EventPropertyStateFieldInfo
instance AttrInfo EventPropertyStateFieldInfo where
type AttrAllowedOps EventPropertyStateFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint EventPropertyStateFieldInfo = (~) Gdk.Enums.PropertyState
type AttrBaseTypeConstraint EventPropertyStateFieldInfo = (~) EventProperty
type AttrGetType EventPropertyStateFieldInfo = Gdk.Enums.PropertyState
type AttrLabel EventPropertyStateFieldInfo = "state"
type AttrOrigin EventPropertyStateFieldInfo = EventProperty
attrGet _ = getEventPropertyState
attrSet _ = setEventPropertyState
attrConstruct = undefined
attrClear _ = undefined
eventProperty_state :: AttrLabelProxy "state"
eventProperty_state = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList EventProperty
type instance O.AttributeList EventProperty = EventPropertyAttributeList
type EventPropertyAttributeList = ('[ '("type", EventPropertyTypeFieldInfo), '("window", EventPropertyWindowFieldInfo), '("sendEvent", EventPropertySendEventFieldInfo), '("atom", EventPropertyAtomFieldInfo), '("time", EventPropertyTimeFieldInfo), '("state", EventPropertyStateFieldInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
type family ResolveEventPropertyMethod (t :: Symbol) (o :: *) :: * where
ResolveEventPropertyMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveEventPropertyMethod t EventProperty, O.MethodInfo info EventProperty p) => O.IsLabelProxy t (EventProperty -> p) where
fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveEventPropertyMethod t EventProperty, O.MethodInfo info EventProperty p) => O.IsLabel t (EventProperty -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif
#endif