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

An opaque structure used as the base of all classes.
-}

module GI.GObject.Structs.TypeClass
    ( 

-- * Exported types
    TypeClass(..)                           ,
    noTypeClass                             ,


 -- * Methods
-- ** typeClassPeekParent
    typeClassPeekParent                     ,


-- ** typeClassUnref
    typeClassUnref                          ,




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

newtype TypeClass = TypeClass (ForeignPtr TypeClass)
noTypeClass :: Maybe TypeClass
noTypeClass = Nothing

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

foreign import ccall "g_type_class_peek_parent" g_type_class_peek_parent :: 
    Ptr TypeClass ->                        -- _obj : TInterface "GObject" "TypeClass"
    IO (Ptr TypeClass)


typeClassPeekParent ::
    (MonadIO m) =>
    TypeClass ->                            -- _obj
    m TypeClass
typeClassPeekParent _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- g_type_class_peek_parent _obj'
    checkUnexpectedReturnNULL "g_type_class_peek_parent" result
    result' <- (newPtr 8 TypeClass) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "g_type_class_unref" g_type_class_unref :: 
    Ptr TypeClass ->                        -- _obj : TInterface "GObject" "TypeClass"
    IO ()


typeClassUnref ::
    (MonadIO m) =>
    TypeClass ->                            -- _obj
    m ()
typeClassUnref _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    g_type_class_unref _obj'
    touchManagedPtr _obj
    return ()