gi-glib-0.2.46.13: GI/GLib/Structs/HookList.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)
The #GHookList struct represents a list of hook functions.
-}
module GI.GLib.Structs.HookList
(
-- * Exported types
HookList(..) ,
newZeroHookList ,
noHookList ,
-- * Methods
-- ** hookListClear
HookListClearMethodInfo ,
hookListClear ,
-- ** hookListInit
HookListInitMethodInfo ,
hookListInit ,
-- ** hookListInvoke
HookListInvokeMethodInfo ,
hookListInvoke ,
-- ** hookListInvokeCheck
HookListInvokeCheckMethodInfo ,
hookListInvokeCheck ,
-- * Properties
-- ** Dummy3
hookListReadDummy3 ,
-- ** HookSize
hookListReadHookSize ,
-- ** Hooks
hookListReadHooks ,
-- ** IsSetup
hookListReadIsSetup ,
-- ** SeqId
hookListReadSeqId ,
) 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.GLib.Types
import GI.GLib.Callbacks
newtype HookList = HookList (ForeignPtr HookList)
-- | Construct a `HookList` struct initialized to zero.
newZeroHookList :: MonadIO m => m HookList
newZeroHookList = liftIO $ callocBytes 56 >>= wrapPtr HookList
noHookList :: Maybe HookList
noHookList = Nothing
hookListReadSeqId :: HookList -> IO Word64
hookListReadSeqId s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO Word64
return val
hookListReadHookSize :: HookList -> IO Word32
hookListReadHookSize s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO Word32
return val
hookListReadIsSetup :: HookList -> IO Word32
hookListReadIsSetup s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 12) :: IO Word32
return val
hookListReadHooks :: HookList -> IO Hook
hookListReadHooks s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 16) :: IO (Ptr Hook)
val' <- (newPtr 64 Hook) val
return val'
hookListReadDummy3 :: HookList -> IO (Ptr ())
hookListReadDummy3 s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 24) :: IO (Ptr ())
return val
-- XXX Skipped getter for "HookList:finalize_hook" :: Not implemented: "Wrapping foreign callbacks is not supported yet"
-- XXX Skipped getter for "HookList:dummy" :: Not implemented: "Don't know how to unpack C array of type TCArray False 2 (-1) (TBasicType TVoid)"
-- method HookList::clear
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "GLib" "HookList", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_hook_list_clear" g_hook_list_clear ::
Ptr HookList -> -- _obj : TInterface "GLib" "HookList"
IO ()
hookListClear ::
(MonadIO m) =>
HookList -- _obj
-> m () -- result
hookListClear _obj = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
g_hook_list_clear _obj'
touchManagedPtr _obj
return ()
data HookListClearMethodInfo
instance (signature ~ (m ()), MonadIO m) => MethodInfo HookListClearMethodInfo HookList signature where
overloadedMethod _ = hookListClear
-- method HookList::init
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "GLib" "HookList", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "hook_size", argType = TBasicType TUInt32, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_hook_list_init" g_hook_list_init ::
Ptr HookList -> -- _obj : TInterface "GLib" "HookList"
Word32 -> -- hook_size : TBasicType TUInt32
IO ()
hookListInit ::
(MonadIO m) =>
HookList -- _obj
-> Word32 -- hookSize
-> m () -- result
hookListInit _obj hookSize = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
g_hook_list_init _obj' hookSize
touchManagedPtr _obj
return ()
data HookListInitMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m) => MethodInfo HookListInitMethodInfo HookList signature where
overloadedMethod _ = hookListInit
-- method HookList::invoke
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "GLib" "HookList", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "may_recurse", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_hook_list_invoke" g_hook_list_invoke ::
Ptr HookList -> -- _obj : TInterface "GLib" "HookList"
CInt -> -- may_recurse : TBasicType TBoolean
IO ()
hookListInvoke ::
(MonadIO m) =>
HookList -- _obj
-> Bool -- mayRecurse
-> m () -- result
hookListInvoke _obj mayRecurse = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
let mayRecurse' = (fromIntegral . fromEnum) mayRecurse
g_hook_list_invoke _obj' mayRecurse'
touchManagedPtr _obj
return ()
data HookListInvokeMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m) => MethodInfo HookListInvokeMethodInfo HookList signature where
overloadedMethod _ = hookListInvoke
-- method HookList::invoke_check
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "_obj", argType = TInterface "GLib" "HookList", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "may_recurse", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False
foreign import ccall "g_hook_list_invoke_check" g_hook_list_invoke_check ::
Ptr HookList -> -- _obj : TInterface "GLib" "HookList"
CInt -> -- may_recurse : TBasicType TBoolean
IO ()
hookListInvokeCheck ::
(MonadIO m) =>
HookList -- _obj
-> Bool -- mayRecurse
-> m () -- result
hookListInvokeCheck _obj mayRecurse = liftIO $ do
let _obj' = unsafeManagedPtrGetPtr _obj
let mayRecurse' = (fromIntegral . fromEnum) mayRecurse
g_hook_list_invoke_check _obj' mayRecurse'
touchManagedPtr _obj
return ()
data HookListInvokeCheckMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m) => MethodInfo HookListInvokeCheckMethodInfo HookList signature where
overloadedMethod _ = hookListInvokeCheck
type family ResolveHookListMethod (t :: Symbol) (o :: *) :: * where
ResolveHookListMethod "clear" o = HookListClearMethodInfo
ResolveHookListMethod "init" o = HookListInitMethodInfo
ResolveHookListMethod "invoke" o = HookListInvokeMethodInfo
ResolveHookListMethod "invokeCheck" o = HookListInvokeCheckMethodInfo
ResolveHookListMethod l o = MethodResolutionFailed l o
instance (info ~ ResolveHookListMethod t HookList, MethodInfo info HookList p) => IsLabelProxy t (HookList -> p) where
fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveHookListMethod t HookList, MethodInfo info HookList p) => IsLabel t (HookList -> p) where
fromLabel _ = overloadedMethod (MethodProxy :: MethodProxy info)
#endif