{- |
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.Registry
    ( 

-- * Exported types
    Registry(..)                            ,
    RegistryK                               ,
    toRegistry                              ,
    noRegistry                              ,


 -- * Methods
-- ** registryGetFactory
    registryGetFactory                      ,


-- ** registryGetFactoryType
    registryGetFactoryType                  ,


-- ** registrySetFactoryType
    registrySetFactoryType                  ,




    ) 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 Registry = Registry (ForeignPtr Registry)
foreign import ccall "atk_registry_get_type"
    c_atk_registry_get_type :: IO GType

type instance ParentTypes Registry = RegistryParentTypes
type RegistryParentTypes = '[GObject.Object]

instance GObject Registry where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_atk_registry_get_type
    

class GObject o => RegistryK o
instance (GObject o, IsDescendantOf Registry o) => RegistryK o

toRegistry :: RegistryK o => o -> IO Registry
toRegistry = unsafeCastTo Registry

noRegistry :: Maybe Registry
noRegistry = Nothing

type instance AttributeList Registry = RegistryAttributeList
type RegistryAttributeList = ('[ ] :: [(Symbol, *)])

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

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

foreign import ccall "atk_registry_get_factory" atk_registry_get_factory :: 
    Ptr Registry ->                         -- _obj : TInterface "Atk" "Registry"
    CGType ->                               -- type : TBasicType TGType
    IO (Ptr ObjectFactory)


registryGetFactory ::
    (MonadIO m, RegistryK a) =>
    a ->                                    -- _obj
    GType ->                                -- type
    m ObjectFactory
registryGetFactory _obj type_ = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let type_' = gtypeToCGType type_
    result <- atk_registry_get_factory _obj' type_'
    checkUnexpectedReturnNULL "atk_registry_get_factory" result
    result' <- (newObject ObjectFactory) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "atk_registry_get_factory_type" atk_registry_get_factory_type :: 
    Ptr Registry ->                         -- _obj : TInterface "Atk" "Registry"
    CGType ->                               -- type : TBasicType TGType
    IO CGType


registryGetFactoryType ::
    (MonadIO m, RegistryK a) =>
    a ->                                    -- _obj
    GType ->                                -- type
    m GType
registryGetFactoryType _obj type_ = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let type_' = gtypeToCGType type_
    result <- atk_registry_get_factory_type _obj' type_'
    let result' = GType result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "atk_registry_set_factory_type" atk_registry_set_factory_type :: 
    Ptr Registry ->                         -- _obj : TInterface "Atk" "Registry"
    CGType ->                               -- type : TBasicType TGType
    CGType ->                               -- factory_type : TBasicType TGType
    IO ()


registrySetFactoryType ::
    (MonadIO m, RegistryK a) =>
    a ->                                    -- _obj
    GType ->                                -- type
    GType ->                                -- factory_type
    m ()
registrySetFactoryType _obj type_ factory_type = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let type_' = gtypeToCGType type_
    let factory_type' = gtypeToCGType factory_type
    atk_registry_set_factory_type _obj' type_' factory_type'
    touchManagedPtr _obj
    return ()