{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
-}

module GI.Atk.Objects.RelationSet
    ( 

-- * Exported types
    RelationSet(..)                         ,
    RelationSetK                            ,
    toRelationSet                           ,
    noRelationSet                           ,


 -- * Methods
-- ** relationSetAdd
    relationSetAdd                          ,


-- ** relationSetAddRelationByType
    relationSetAddRelationByType            ,


-- ** relationSetContains
    relationSetContains                     ,


-- ** relationSetContainsTarget
    relationSetContainsTarget               ,


-- ** relationSetGetNRelations
    relationSetGetNRelations                ,


-- ** relationSetGetRelation
    relationSetGetRelation                  ,


-- ** relationSetGetRelationByType
    relationSetGetRelationByType            ,


-- ** relationSetNew
    relationSetNew                          ,


-- ** relationSetRemove
    relationSetRemove                       ,




    ) 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.Atk.Types
import GI.Atk.Callbacks
import qualified GI.GObject as GObject

newtype RelationSet = RelationSet (ForeignPtr RelationSet)
foreign import ccall "atk_relation_set_get_type"
    c_atk_relation_set_get_type :: IO GType

type instance ParentTypes RelationSet = RelationSetParentTypes
type RelationSetParentTypes = '[GObject.Object]

instance GObject RelationSet where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_atk_relation_set_get_type
    

class GObject o => RelationSetK o
instance (GObject o, IsDescendantOf RelationSet o) => RelationSetK o

toRelationSet :: RelationSetK o => o -> IO RelationSet
toRelationSet = unsafeCastTo RelationSet

noRelationSet :: Maybe RelationSet
noRelationSet = Nothing

type instance AttributeList RelationSet = RelationSetAttributeList
type RelationSetAttributeList = ('[ ] :: [(Symbol, *)])

type instance SignalList RelationSet = RelationSetSignalList
type RelationSetSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method RelationSet::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TInterface "Atk" "RelationSet"
-- throws : False
-- Skip return : False

foreign import ccall "atk_relation_set_new" atk_relation_set_new :: 
    IO (Ptr RelationSet)


relationSetNew ::
    (MonadIO m) =>
    m RelationSet
relationSetNew  = liftIO $ do
    result <- atk_relation_set_new
    checkUnexpectedReturnNULL "atk_relation_set_new" result
    result' <- (wrapObject RelationSet) result
    return result'

-- method RelationSet::add
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Atk" "RelationSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "relation", argType = TInterface "Atk" "Relation", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Atk" "RelationSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "relation", argType = TInterface "Atk" "Relation", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "atk_relation_set_add" atk_relation_set_add :: 
    Ptr RelationSet ->                      -- _obj : TInterface "Atk" "RelationSet"
    Ptr Relation ->                         -- relation : TInterface "Atk" "Relation"
    IO ()


relationSetAdd ::
    (MonadIO m, RelationSetK a, RelationK b) =>
    a ->                                    -- _obj
    b ->                                    -- relation
    m ()
relationSetAdd _obj relation = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let relation' = unsafeManagedPtrCastPtr relation
    atk_relation_set_add _obj' relation'
    touchManagedPtr _obj
    touchManagedPtr relation
    return ()

-- method RelationSet::add_relation_by_type
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Atk" "RelationSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "relationship", argType = TInterface "Atk" "RelationType", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "target", argType = TInterface "Atk" "Object", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Atk" "RelationSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "relationship", argType = TInterface "Atk" "RelationType", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "target", argType = TInterface "Atk" "Object", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "atk_relation_set_add_relation_by_type" atk_relation_set_add_relation_by_type :: 
    Ptr RelationSet ->                      -- _obj : TInterface "Atk" "RelationSet"
    CUInt ->                                -- relationship : TInterface "Atk" "RelationType"
    Ptr Object ->                           -- target : TInterface "Atk" "Object"
    IO ()


relationSetAddRelationByType ::
    (MonadIO m, RelationSetK a, ObjectK b) =>
    a ->                                    -- _obj
    RelationType ->                         -- relationship
    b ->                                    -- target
    m ()
relationSetAddRelationByType _obj relationship target = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let relationship' = (fromIntegral . fromEnum) relationship
    let target' = unsafeManagedPtrCastPtr target
    atk_relation_set_add_relation_by_type _obj' relationship' target'
    touchManagedPtr _obj
    touchManagedPtr target
    return ()

-- method RelationSet::contains
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Atk" "RelationSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "relationship", argType = TInterface "Atk" "RelationType", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Atk" "RelationSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "relationship", argType = TInterface "Atk" "RelationType", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "atk_relation_set_contains" atk_relation_set_contains :: 
    Ptr RelationSet ->                      -- _obj : TInterface "Atk" "RelationSet"
    CUInt ->                                -- relationship : TInterface "Atk" "RelationType"
    IO CInt


relationSetContains ::
    (MonadIO m, RelationSetK a) =>
    a ->                                    -- _obj
    RelationType ->                         -- relationship
    m Bool
relationSetContains _obj relationship = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let relationship' = (fromIntegral . fromEnum) relationship
    result <- atk_relation_set_contains _obj' relationship'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

-- method RelationSet::contains_target
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Atk" "RelationSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "relationship", argType = TInterface "Atk" "RelationType", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "target", argType = TInterface "Atk" "Object", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Atk" "RelationSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "relationship", argType = TInterface "Atk" "RelationType", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "target", argType = TInterface "Atk" "Object", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False

foreign import ccall "atk_relation_set_contains_target" atk_relation_set_contains_target :: 
    Ptr RelationSet ->                      -- _obj : TInterface "Atk" "RelationSet"
    CUInt ->                                -- relationship : TInterface "Atk" "RelationType"
    Ptr Object ->                           -- target : TInterface "Atk" "Object"
    IO CInt


relationSetContainsTarget ::
    (MonadIO m, RelationSetK a, ObjectK b) =>
    a ->                                    -- _obj
    RelationType ->                         -- relationship
    b ->                                    -- target
    m Bool
relationSetContainsTarget _obj relationship target = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let relationship' = (fromIntegral . fromEnum) relationship
    let target' = unsafeManagedPtrCastPtr target
    result <- atk_relation_set_contains_target _obj' relationship' target'
    let result' = (/= 0) result
    touchManagedPtr _obj
    touchManagedPtr target
    return result'

-- method RelationSet::get_n_relations
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Atk" "RelationSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Atk" "RelationSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TInt32
-- throws : False
-- Skip return : False

foreign import ccall "atk_relation_set_get_n_relations" atk_relation_set_get_n_relations :: 
    Ptr RelationSet ->                      -- _obj : TInterface "Atk" "RelationSet"
    IO Int32


relationSetGetNRelations ::
    (MonadIO m, RelationSetK a) =>
    a ->                                    -- _obj
    m Int32
relationSetGetNRelations _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- atk_relation_set_get_n_relations _obj'
    touchManagedPtr _obj
    return result

-- method RelationSet::get_relation
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Atk" "RelationSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "i", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Atk" "RelationSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "i", argType = TBasicType TInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Atk" "Relation"
-- throws : False
-- Skip return : False

foreign import ccall "atk_relation_set_get_relation" atk_relation_set_get_relation :: 
    Ptr RelationSet ->                      -- _obj : TInterface "Atk" "RelationSet"
    Int32 ->                                -- i : TBasicType TInt32
    IO (Ptr Relation)


relationSetGetRelation ::
    (MonadIO m, RelationSetK a) =>
    a ->                                    -- _obj
    Int32 ->                                -- i
    m Relation
relationSetGetRelation _obj i = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- atk_relation_set_get_relation _obj' i
    checkUnexpectedReturnNULL "atk_relation_set_get_relation" result
    result' <- (newObject Relation) result
    touchManagedPtr _obj
    return result'

-- method RelationSet::get_relation_by_type
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Atk" "RelationSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "relationship", argType = TInterface "Atk" "RelationType", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Atk" "RelationSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "relationship", argType = TInterface "Atk" "RelationType", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Atk" "Relation"
-- throws : False
-- Skip return : False

foreign import ccall "atk_relation_set_get_relation_by_type" atk_relation_set_get_relation_by_type :: 
    Ptr RelationSet ->                      -- _obj : TInterface "Atk" "RelationSet"
    CUInt ->                                -- relationship : TInterface "Atk" "RelationType"
    IO (Ptr Relation)


relationSetGetRelationByType ::
    (MonadIO m, RelationSetK a) =>
    a ->                                    -- _obj
    RelationType ->                         -- relationship
    m Relation
relationSetGetRelationByType _obj relationship = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let relationship' = (fromIntegral . fromEnum) relationship
    result <- atk_relation_set_get_relation_by_type _obj' relationship'
    checkUnexpectedReturnNULL "atk_relation_set_get_relation_by_type" result
    result' <- (newObject Relation) result
    touchManagedPtr _obj
    return result'

-- method RelationSet::remove
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Atk" "RelationSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "relation", argType = TInterface "Atk" "Relation", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Atk" "RelationSet", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "relation", argType = TInterface "Atk" "Relation", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "atk_relation_set_remove" atk_relation_set_remove :: 
    Ptr RelationSet ->                      -- _obj : TInterface "Atk" "RelationSet"
    Ptr Relation ->                         -- relation : TInterface "Atk" "Relation"
    IO ()


relationSetRemove ::
    (MonadIO m, RelationSetK a, RelationK b) =>
    a ->                                    -- _obj
    b ->                                    -- relation
    m ()
relationSetRemove _obj relation = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let relation' = unsafeManagedPtrCastPtr relation
    atk_relation_set_remove _obj' relation'
    touchManagedPtr _obj
    touchManagedPtr relation
    return ()