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

-- * Exported types
    ObjectFactory(..)                       ,
    ObjectFactoryK                          ,
    toObjectFactory                         ,
    noObjectFactory                         ,


 -- * Methods
-- ** objectFactoryCreateAccessible
    objectFactoryCreateAccessible           ,


-- ** objectFactoryGetAccessibleType
    objectFactoryGetAccessibleType          ,


-- ** objectFactoryInvalidate
    objectFactoryInvalidate                 ,




    ) 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 ObjectFactory = ObjectFactory (ForeignPtr ObjectFactory)
foreign import ccall "atk_object_factory_get_type"
    c_atk_object_factory_get_type :: IO GType

type instance ParentTypes ObjectFactory = ObjectFactoryParentTypes
type ObjectFactoryParentTypes = '[GObject.Object]

instance GObject ObjectFactory where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_atk_object_factory_get_type
    

class GObject o => ObjectFactoryK o
instance (GObject o, IsDescendantOf ObjectFactory o) => ObjectFactoryK o

toObjectFactory :: ObjectFactoryK o => o -> IO ObjectFactory
toObjectFactory = unsafeCastTo ObjectFactory

noObjectFactory :: Maybe ObjectFactory
noObjectFactory = Nothing

type instance AttributeList ObjectFactory = ObjectFactoryAttributeList
type ObjectFactoryAttributeList = ('[ ] :: [(Symbol, *)])

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

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

foreign import ccall "atk_object_factory_create_accessible" atk_object_factory_create_accessible :: 
    Ptr ObjectFactory ->                    -- _obj : TInterface "Atk" "ObjectFactory"
    Ptr GObject.Object ->                   -- obj : TInterface "GObject" "Object"
    IO (Ptr Object)


objectFactoryCreateAccessible ::
    (MonadIO m, ObjectFactoryK a, GObject.ObjectK b) =>
    a ->                                    -- _obj
    b ->                                    -- obj
    m Object
objectFactoryCreateAccessible _obj obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let obj' = unsafeManagedPtrCastPtr obj
    result <- atk_object_factory_create_accessible _obj' obj'
    checkUnexpectedReturnNULL "atk_object_factory_create_accessible" result
    result' <- (wrapObject Object) result
    touchManagedPtr _obj
    touchManagedPtr obj
    return result'

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

foreign import ccall "atk_object_factory_get_accessible_type" atk_object_factory_get_accessible_type :: 
    Ptr ObjectFactory ->                    -- _obj : TInterface "Atk" "ObjectFactory"
    IO CGType


objectFactoryGetAccessibleType ::
    (MonadIO m, ObjectFactoryK a) =>
    a ->                                    -- _obj
    m GType
objectFactoryGetAccessibleType _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- atk_object_factory_get_accessible_type _obj'
    let result' = GType result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "atk_object_factory_invalidate" atk_object_factory_invalidate :: 
    Ptr ObjectFactory ->                    -- _obj : TInterface "Atk" "ObjectFactory"
    IO ()


objectFactoryInvalidate ::
    (MonadIO m, ObjectFactoryK a) =>
    a ->                                    -- _obj
    m ()
objectFactoryInvalidate _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    atk_object_factory_invalidate _obj'
    touchManagedPtr _obj
    return ()