#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gtk.Structs.TargetPair
(
TargetPair(..) ,
newZeroTargetPair ,
noTargetPair ,
getTargetPairFlags ,
setTargetPairFlags ,
#if ENABLE_OVERLOADING
targetPair_flags ,
#endif
getTargetPairInfo ,
setTargetPairInfo ,
#if ENABLE_OVERLOADING
targetPair_info ,
#endif
getTargetPairTarget ,
#if ENABLE_OVERLOADING
targetPair_target ,
#endif
) 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 qualified GI.Gdk.Structs.Atom as Gdk.Atom
newtype TargetPair = TargetPair (ManagedPtr TargetPair)
instance WrappedPtr TargetPair where
wrappedPtrCalloc = callocBytes 16
wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 16 >=> wrapPtr TargetPair)
wrappedPtrFree = Just ptr_to_g_free
newZeroTargetPair :: MonadIO m => m TargetPair
newZeroTargetPair = liftIO $ wrappedPtrCalloc >>= wrapPtr TargetPair
instance tag ~ 'AttrSet => Constructible TargetPair tag where
new _ attrs = do
o <- newZeroTargetPair
GI.Attributes.set o attrs
return o
noTargetPair :: Maybe TargetPair
noTargetPair = Nothing
getTargetPairTarget :: MonadIO m => TargetPair -> m Gdk.Atom.Atom
getTargetPairTarget s = liftIO $ withManagedPtr s $ \ptr -> do
let val = ptr `plusPtr` 0 :: (Ptr Gdk.Atom.Atom)
val' <- (newPtr Gdk.Atom.Atom) val
return val'
#if ENABLE_OVERLOADING
data TargetPairTargetFieldInfo
instance AttrInfo TargetPairTargetFieldInfo where
type AttrAllowedOps TargetPairTargetFieldInfo = '[ 'AttrGet]
type AttrSetTypeConstraint TargetPairTargetFieldInfo = (~) (Ptr Gdk.Atom.Atom)
type AttrBaseTypeConstraint TargetPairTargetFieldInfo = (~) TargetPair
type AttrGetType TargetPairTargetFieldInfo = Gdk.Atom.Atom
type AttrLabel TargetPairTargetFieldInfo = "target"
type AttrOrigin TargetPairTargetFieldInfo = TargetPair
attrGet _ = getTargetPairTarget
attrSet _ = undefined
attrConstruct = undefined
attrClear _ = undefined
targetPair_target :: AttrLabelProxy "target"
targetPair_target = AttrLabelProxy
#endif
getTargetPairFlags :: MonadIO m => TargetPair -> m Word32
getTargetPairFlags s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO Word32
return val
setTargetPairFlags :: MonadIO m => TargetPair -> Word32 -> m ()
setTargetPairFlags s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 8) (val :: Word32)
#if ENABLE_OVERLOADING
data TargetPairFlagsFieldInfo
instance AttrInfo TargetPairFlagsFieldInfo where
type AttrAllowedOps TargetPairFlagsFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint TargetPairFlagsFieldInfo = (~) Word32
type AttrBaseTypeConstraint TargetPairFlagsFieldInfo = (~) TargetPair
type AttrGetType TargetPairFlagsFieldInfo = Word32
type AttrLabel TargetPairFlagsFieldInfo = "flags"
type AttrOrigin TargetPairFlagsFieldInfo = TargetPair
attrGet _ = getTargetPairFlags
attrSet _ = setTargetPairFlags
attrConstruct = undefined
attrClear _ = undefined
targetPair_flags :: AttrLabelProxy "flags"
targetPair_flags = AttrLabelProxy
#endif
getTargetPairInfo :: MonadIO m => TargetPair -> m Word32
getTargetPairInfo s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 12) :: IO Word32
return val
setTargetPairInfo :: MonadIO m => TargetPair -> Word32 -> m ()
setTargetPairInfo s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 12) (val :: Word32)
#if ENABLE_OVERLOADING
data TargetPairInfoFieldInfo
instance AttrInfo TargetPairInfoFieldInfo where
type AttrAllowedOps TargetPairInfoFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint TargetPairInfoFieldInfo = (~) Word32
type AttrBaseTypeConstraint TargetPairInfoFieldInfo = (~) TargetPair
type AttrGetType TargetPairInfoFieldInfo = Word32
type AttrLabel TargetPairInfoFieldInfo = "info"
type AttrOrigin TargetPairInfoFieldInfo = TargetPair
attrGet _ = getTargetPairInfo
attrSet _ = setTargetPairInfo
attrConstruct = undefined
attrClear _ = undefined
targetPair_info :: AttrLabelProxy "info"
targetPair_info = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList TargetPair
type instance O.AttributeList TargetPair = TargetPairAttributeList
type TargetPairAttributeList = ('[ '("target", TargetPairTargetFieldInfo), '("flags", TargetPairFlagsFieldInfo), '("info", TargetPairInfoFieldInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
type family ResolveTargetPairMethod (t :: Symbol) (o :: *) :: * where
ResolveTargetPairMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveTargetPairMethod t TargetPair, O.MethodInfo info TargetPair p) => O.IsLabelProxy t (TargetPair -> p) where
fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveTargetPairMethod t TargetPair, O.MethodInfo info TargetPair p) => O.IsLabel t (TargetPair -> 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