{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Atk.Objects.Relation
(
Relation(..) ,
IsRelation ,
toRelation ,
#if defined(ENABLE_OVERLOADING)
ResolveRelationMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
RelationAddTargetMethodInfo ,
#endif
relationAddTarget ,
#if defined(ENABLE_OVERLOADING)
RelationGetRelationTypeMethodInfo ,
#endif
relationGetRelationType ,
#if defined(ENABLE_OVERLOADING)
RelationGetTargetMethodInfo ,
#endif
relationGetTarget ,
relationNew ,
#if defined(ENABLE_OVERLOADING)
RelationRemoveTargetMethodInfo ,
#endif
relationRemoveTarget ,
#if defined(ENABLE_OVERLOADING)
RelationRelationTypePropertyInfo ,
#endif
constructRelationRelationType ,
getRelationRelationType ,
#if defined(ENABLE_OVERLOADING)
relationRelationType ,
#endif
setRelationRelationType ,
#if defined(ENABLE_OVERLOADING)
RelationTargetPropertyInfo ,
#endif
clearRelationTarget ,
constructRelationTarget ,
getRelationTarget ,
#if defined(ENABLE_OVERLOADING)
relationTarget ,
#endif
setRelationTarget ,
) 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.GHashTable as B.GHT
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.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
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 qualified Data.Word as DW
import qualified Data.Int as DI
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT
#if MIN_VERSION_base(4,18,0)
import {-# SOURCE #-} qualified GI.Atk.Enums as Atk.Enums
import {-# SOURCE #-} qualified GI.Atk.Objects.Object as Atk.Object
import {-# SOURCE #-} qualified GI.Atk.Objects.RelationSet as Atk.RelationSet
import {-# SOURCE #-} qualified GI.Atk.Objects.StateSet as Atk.StateSet
import {-# SOURCE #-} qualified GI.Atk.Structs.PropertyValues as Atk.PropertyValues
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.GObject.Structs.ValueArray as GObject.ValueArray
#else
import {-# SOURCE #-} qualified GI.Atk.Enums as Atk.Enums
import {-# SOURCE #-} qualified GI.Atk.Objects.Object as Atk.Object
import qualified GI.GObject.Objects.Object as GObject.Object
import qualified GI.GObject.Structs.ValueArray as GObject.ValueArray
#endif
newtype Relation = Relation (SP.ManagedPtr Relation)
deriving (Relation -> Relation -> Bool
(Relation -> Relation -> Bool)
-> (Relation -> Relation -> Bool) -> Eq Relation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Relation -> Relation -> Bool
== :: Relation -> Relation -> Bool
$c/= :: Relation -> Relation -> Bool
/= :: Relation -> Relation -> Bool
Eq)
instance SP.ManagedPtrNewtype Relation where
toManagedPtr :: Relation -> ManagedPtr Relation
toManagedPtr (Relation ManagedPtr Relation
p) = ManagedPtr Relation
p
foreign import ccall "atk_relation_get_type"
c_atk_relation_get_type :: IO B.Types.GType
instance B.Types.TypedObject Relation where
glibType :: IO GType
glibType = IO GType
c_atk_relation_get_type
instance B.Types.GObject Relation
class (SP.GObject o, O.IsDescendantOf Relation o) => IsRelation o
instance (SP.GObject o, O.IsDescendantOf Relation o) => IsRelation o
instance O.HasParentTypes Relation
type instance O.ParentTypes Relation = '[GObject.Object.Object]
toRelation :: (MIO.MonadIO m, IsRelation o) => o -> m Relation
toRelation :: forall (m :: * -> *) o.
(MonadIO m, IsRelation o) =>
o -> m Relation
toRelation = IO Relation -> m Relation
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO Relation -> m Relation)
-> (o -> IO Relation) -> o -> m Relation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr Relation -> Relation) -> o -> IO Relation
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
B.ManagedPtr.unsafeCastTo ManagedPtr Relation -> Relation
Relation
instance B.GValue.IsGValue (Maybe Relation) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_atk_relation_get_type
gvalueSet_ :: Ptr GValue -> Maybe Relation -> IO ()
gvalueSet_ Ptr GValue
gv Maybe Relation
P.Nothing = Ptr GValue -> Ptr Relation -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv (Ptr Relation
forall a. Ptr a
FP.nullPtr :: FP.Ptr Relation)
gvalueSet_ Ptr GValue
gv (P.Just Relation
obj) = Relation -> (Ptr Relation -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Relation
obj (Ptr GValue -> Ptr Relation -> IO ()
forall a. GObject a => Ptr GValue -> Ptr a -> IO ()
B.GValue.set_object Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe Relation)
gvalueGet_ Ptr GValue
gv = do
ptr <- Ptr GValue -> IO (Ptr Relation)
forall a. GObject a => Ptr GValue -> IO (Ptr a)
B.GValue.get_object Ptr GValue
gv :: IO (FP.Ptr Relation)
if ptr /= FP.nullPtr
then P.Just <$> B.ManagedPtr.newObject Relation ptr
else return P.Nothing
#if defined(ENABLE_OVERLOADING)
type family ResolveRelationMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveRelationMethod "addTarget" o = RelationAddTargetMethodInfo
ResolveRelationMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveRelationMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveRelationMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveRelationMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveRelationMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveRelationMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveRelationMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveRelationMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveRelationMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveRelationMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveRelationMethod "removeTarget" o = RelationRemoveTargetMethodInfo
ResolveRelationMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveRelationMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveRelationMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveRelationMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveRelationMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveRelationMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveRelationMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveRelationMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveRelationMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveRelationMethod "getRelationType" o = RelationGetRelationTypeMethodInfo
ResolveRelationMethod "getTarget" o = RelationGetTargetMethodInfo
ResolveRelationMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveRelationMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
ResolveRelationMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveRelationMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveRelationMethod t Relation, O.OverloadedMethod info Relation p) => OL.IsLabel t (Relation -> 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 ~ ResolveRelationMethod t Relation, O.OverloadedMethod info Relation p, R.HasField t Relation p) => R.HasField t Relation p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveRelationMethod t Relation, O.OverloadedMethodInfo info Relation) => OL.IsLabel t (O.MethodProxy info Relation) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif
getRelationRelationType :: (MonadIO m, IsRelation o) => o -> m Atk.Enums.RelationType
getRelationRelationType :: forall (m :: * -> *) o.
(MonadIO m, IsRelation o) =>
o -> m RelationType
getRelationRelationType o
obj = IO RelationType -> m RelationType
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO RelationType -> m RelationType)
-> IO RelationType -> m RelationType
forall a b. (a -> b) -> a -> b
$ o -> String -> IO RelationType
forall a b. (GObject a, Enum b, BoxedEnum b) => a -> String -> IO b
B.Properties.getObjectPropertyEnum o
obj String
"relation-type"
setRelationRelationType :: (MonadIO m, IsRelation o) => o -> Atk.Enums.RelationType -> m ()
setRelationRelationType :: forall (m :: * -> *) o.
(MonadIO m, IsRelation o) =>
o -> RelationType -> m ()
setRelationRelationType o
obj RelationType
val = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
o -> String -> RelationType -> IO ()
forall a b.
(GObject a, Enum b, BoxedEnum b) =>
a -> String -> b -> IO ()
B.Properties.setObjectPropertyEnum o
obj String
"relation-type" RelationType
val
constructRelationRelationType :: (IsRelation o, MIO.MonadIO m) => Atk.Enums.RelationType -> m (GValueConstruct o)
constructRelationRelationType :: forall o (m :: * -> *).
(IsRelation o, MonadIO m) =>
RelationType -> m (GValueConstruct o)
constructRelationRelationType RelationType
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a. IO a -> IO a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> RelationType -> IO (GValueConstruct o)
forall a o.
(Enum a, BoxedEnum a) =>
String -> a -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyEnum String
"relation-type" RelationType
val
#if defined(ENABLE_OVERLOADING)
data RelationRelationTypePropertyInfo
instance AttrInfo RelationRelationTypePropertyInfo where
type AttrAllowedOps RelationRelationTypePropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrPut]
type AttrBaseTypeConstraint RelationRelationTypePropertyInfo = IsRelation
type AttrSetTypeConstraint RelationRelationTypePropertyInfo = (~) Atk.Enums.RelationType
type AttrTransferTypeConstraint RelationRelationTypePropertyInfo = (~) Atk.Enums.RelationType
type AttrTransferType RelationRelationTypePropertyInfo = Atk.Enums.RelationType
type AttrGetType RelationRelationTypePropertyInfo = Atk.Enums.RelationType
type AttrLabel RelationRelationTypePropertyInfo = "relation-type"
type AttrOrigin RelationRelationTypePropertyInfo = Relation
attrGet = getRelationRelationType
attrSet = setRelationRelationType
attrPut = setRelationRelationType
attrTransfer _ v = do
return v
attrConstruct = constructRelationRelationType
attrClear = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Atk.Objects.Relation.relationType"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-atk-2.0.28/docs/GI-Atk-Objects-Relation.html#g:attr:relationType"
})
#endif
getRelationTarget :: (MonadIO m, IsRelation o) => o -> m (Maybe GObject.ValueArray.ValueArray)
getRelationTarget :: forall (m :: * -> *) o.
(MonadIO m, IsRelation o) =>
o -> m (Maybe ValueArray)
getRelationTarget o
obj = IO (Maybe ValueArray) -> m (Maybe ValueArray)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (Maybe ValueArray) -> m (Maybe ValueArray))
-> IO (Maybe ValueArray) -> m (Maybe ValueArray)
forall a b. (a -> b) -> a -> b
$ o
-> String
-> (ManagedPtr ValueArray -> ValueArray)
-> IO (Maybe ValueArray)
forall a b.
(GObject a, GBoxed b) =>
a -> String -> (ManagedPtr b -> b) -> IO (Maybe b)
B.Properties.getObjectPropertyBoxed o
obj String
"target" ManagedPtr ValueArray -> ValueArray
GObject.ValueArray.ValueArray
setRelationTarget :: (MonadIO m, IsRelation o) => o -> GObject.ValueArray.ValueArray -> m ()
setRelationTarget :: forall (m :: * -> *) o.
(MonadIO m, IsRelation o) =>
o -> ValueArray -> m ()
setRelationTarget o
obj ValueArray
val = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
o -> String -> Maybe ValueArray -> IO ()
forall a b.
(GObject a, GBoxed b) =>
a -> String -> Maybe b -> IO ()
B.Properties.setObjectPropertyBoxed o
obj String
"target" (ValueArray -> Maybe ValueArray
forall a. a -> Maybe a
Just ValueArray
val)
constructRelationTarget :: (IsRelation o, MIO.MonadIO m) => GObject.ValueArray.ValueArray -> m (GValueConstruct o)
constructRelationTarget :: forall o (m :: * -> *).
(IsRelation o, MonadIO m) =>
ValueArray -> m (GValueConstruct o)
constructRelationTarget ValueArray
val = IO (GValueConstruct o) -> m (GValueConstruct o)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> m (GValueConstruct o))
-> IO (GValueConstruct o) -> m (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ do
IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a. IO a -> IO a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
MIO.liftIO (IO (GValueConstruct o) -> IO (GValueConstruct o))
-> IO (GValueConstruct o) -> IO (GValueConstruct o)
forall a b. (a -> b) -> a -> b
$ String -> Maybe ValueArray -> IO (GValueConstruct o)
forall a o. GBoxed a => String -> Maybe a -> IO (GValueConstruct o)
B.Properties.constructObjectPropertyBoxed String
"target" (ValueArray -> Maybe ValueArray
forall a. a -> Maybe a
P.Just ValueArray
val)
clearRelationTarget :: (MonadIO m, IsRelation o) => o -> m ()
clearRelationTarget :: forall (m :: * -> *) o. (MonadIO m, IsRelation o) => o -> m ()
clearRelationTarget o
obj = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ o -> String -> Maybe ValueArray -> IO ()
forall a b.
(GObject a, GBoxed b) =>
a -> String -> Maybe b -> IO ()
B.Properties.setObjectPropertyBoxed o
obj String
"target" (Maybe ValueArray
forall a. Maybe a
Nothing :: Maybe GObject.ValueArray.ValueArray)
#if defined(ENABLE_OVERLOADING)
data RelationTargetPropertyInfo
instance AttrInfo RelationTargetPropertyInfo where
type AttrAllowedOps RelationTargetPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
type AttrBaseTypeConstraint RelationTargetPropertyInfo = IsRelation
type AttrSetTypeConstraint RelationTargetPropertyInfo = (~) GObject.ValueArray.ValueArray
type AttrTransferTypeConstraint RelationTargetPropertyInfo = (~) GObject.ValueArray.ValueArray
type AttrTransferType RelationTargetPropertyInfo = GObject.ValueArray.ValueArray
type AttrGetType RelationTargetPropertyInfo = (Maybe GObject.ValueArray.ValueArray)
type AttrLabel RelationTargetPropertyInfo = "target"
type AttrOrigin RelationTargetPropertyInfo = Relation
attrGet = getRelationTarget
attrSet = setRelationTarget
attrPut = undefined
attrTransfer _ v = do
return v
attrConstruct = constructRelationTarget
attrClear = clearRelationTarget
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Atk.Objects.Relation.target"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-atk-2.0.28/docs/GI-Atk-Objects-Relation.html#g:attr:target"
})
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Relation
type instance O.AttributeList Relation = RelationAttributeList
type RelationAttributeList = ('[ '("relationType", RelationRelationTypePropertyInfo), '("target", RelationTargetPropertyInfo)] :: [(Symbol, DK.Type)])
#endif
#if defined(ENABLE_OVERLOADING)
relationRelationType :: AttrLabelProxy "relationType"
relationRelationType = AttrLabelProxy
relationTarget :: AttrLabelProxy "target"
relationTarget = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
type instance O.SignalList Relation = RelationSignalList
type RelationSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, DK.Type)])
#endif
foreign import ccall "atk_relation_new" atk_relation_new ::
Ptr (Ptr Atk.Object.Object) ->
Int32 ->
CUInt ->
IO (Ptr Relation)
relationNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
[Atk.Object.Object]
-> Atk.Enums.RelationType
-> m Relation
relationNew :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
[Object] -> RelationType -> m Relation
relationNew [Object]
targets RelationType
relationship = IO Relation -> m Relation
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Relation -> m Relation) -> IO Relation -> m Relation
forall a b. (a -> b) -> a -> b
$ do
let nTargets :: Int32
nTargets = Int -> Int32
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> Int32) -> Int -> Int32
forall a b. (a -> b) -> a -> b
$ [Object] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
P.length [Object]
targets
targets' <- (Object -> IO (Ptr Object)) -> [Object] -> IO [Ptr Object]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM Object -> IO (Ptr Object)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr [Object]
targets
targets'' <- packPtrArray targets'
let relationship' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (RelationType -> Int) -> RelationType -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. RelationType -> Int
forall a. Enum a => a -> Int
fromEnum) RelationType
relationship
result <- atk_relation_new targets'' nTargets relationship'
checkUnexpectedReturnNULL "relationNew" result
result' <- (wrapObject Relation) result
mapM_ touchManagedPtr targets
freeMem targets''
return result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "atk_relation_add_target" atk_relation_add_target ::
Ptr Relation ->
Ptr Atk.Object.Object ->
IO ()
relationAddTarget ::
(B.CallStack.HasCallStack, MonadIO m, IsRelation a, Atk.Object.IsObject b) =>
a
-> b
-> m ()
relationAddTarget :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsRelation a, IsObject b) =>
a -> b -> m ()
relationAddTarget a
relation b
target = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
relation' <- a -> IO (Ptr Relation)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
relation
target' <- unsafeManagedPtrCastPtr target
atk_relation_add_target relation' target'
touchManagedPtr relation
touchManagedPtr target
return ()
#if defined(ENABLE_OVERLOADING)
data RelationAddTargetMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsRelation a, Atk.Object.IsObject b) => O.OverloadedMethod RelationAddTargetMethodInfo a signature where
overloadedMethod = relationAddTarget
instance O.OverloadedMethodInfo RelationAddTargetMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Atk.Objects.Relation.relationAddTarget",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-atk-2.0.28/docs/GI-Atk-Objects-Relation.html#v:relationAddTarget"
})
#endif
foreign import ccall "atk_relation_get_relation_type" atk_relation_get_relation_type ::
Ptr Relation ->
IO CUInt
relationGetRelationType ::
(B.CallStack.HasCallStack, MonadIO m, IsRelation a) =>
a
-> m Atk.Enums.RelationType
relationGetRelationType :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsRelation a) =>
a -> m RelationType
relationGetRelationType a
relation = IO RelationType -> m RelationType
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO RelationType -> m RelationType)
-> IO RelationType -> m RelationType
forall a b. (a -> b) -> a -> b
$ do
relation' <- a -> IO (Ptr Relation)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
relation
result <- atk_relation_get_relation_type relation'
let result' = (Int -> RelationType
forall a. Enum a => Int -> a
toEnum (Int -> RelationType) -> (CUInt -> Int) -> CUInt -> RelationType
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
touchManagedPtr relation
return result'
#if defined(ENABLE_OVERLOADING)
data RelationGetRelationTypeMethodInfo
instance (signature ~ (m Atk.Enums.RelationType), MonadIO m, IsRelation a) => O.OverloadedMethod RelationGetRelationTypeMethodInfo a signature where
overloadedMethod = relationGetRelationType
instance O.OverloadedMethodInfo RelationGetRelationTypeMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Atk.Objects.Relation.relationGetRelationType",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-atk-2.0.28/docs/GI-Atk-Objects-Relation.html#v:relationGetRelationType"
})
#endif
foreign import ccall "atk_relation_get_target" atk_relation_get_target ::
Ptr Relation ->
IO (Ptr (GPtrArray (Ptr Atk.Object.Object)))
relationGetTarget ::
(B.CallStack.HasCallStack, MonadIO m, IsRelation a) =>
a
-> m [Atk.Object.Object]
relationGetTarget :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsRelation a) =>
a -> m [Object]
relationGetTarget a
relation = IO [Object] -> m [Object]
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [Object] -> m [Object]) -> IO [Object] -> m [Object]
forall a b. (a -> b) -> a -> b
$ do
relation' <- a -> IO (Ptr Relation)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
relation
result <- atk_relation_get_target relation'
checkUnexpectedReturnNULL "relationGetTarget" result
result' <- unpackGPtrArray result
result'' <- mapM (newObject Atk.Object.Object) result'
touchManagedPtr relation
return result''
#if defined(ENABLE_OVERLOADING)
data RelationGetTargetMethodInfo
instance (signature ~ (m [Atk.Object.Object]), MonadIO m, IsRelation a) => O.OverloadedMethod RelationGetTargetMethodInfo a signature where
overloadedMethod = relationGetTarget
instance O.OverloadedMethodInfo RelationGetTargetMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Atk.Objects.Relation.relationGetTarget",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-atk-2.0.28/docs/GI-Atk-Objects-Relation.html#v:relationGetTarget"
})
#endif
foreign import ccall "atk_relation_remove_target" atk_relation_remove_target ::
Ptr Relation ->
Ptr Atk.Object.Object ->
IO CInt
relationRemoveTarget ::
(B.CallStack.HasCallStack, MonadIO m, IsRelation a, Atk.Object.IsObject b) =>
a
-> b
-> m Bool
relationRemoveTarget :: forall (m :: * -> *) a b.
(HasCallStack, MonadIO m, IsRelation a, IsObject b) =>
a -> b -> m Bool
relationRemoveTarget a
relation b
target = IO Bool -> m Bool
forall a. IO a -> m a
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
relation' <- a -> IO (Ptr Relation)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
relation
target' <- unsafeManagedPtrCastPtr target
result <- atk_relation_remove_target relation' target'
let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
touchManagedPtr relation
touchManagedPtr target
return result'
#if defined(ENABLE_OVERLOADING)
data RelationRemoveTargetMethodInfo
instance (signature ~ (b -> m Bool), MonadIO m, IsRelation a, Atk.Object.IsObject b) => O.OverloadedMethod RelationRemoveTargetMethodInfo a signature where
overloadedMethod = relationRemoveTarget
instance O.OverloadedMethodInfo RelationRemoveTargetMethodInfo a where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Atk.Objects.Relation.relationRemoveTarget",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-atk-2.0.28/docs/GI-Atk-Objects-Relation.html#v:relationRemoveTarget"
})
#endif