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

The 'GI.GLib.Structs.HookList.HookList' struct represents a list of hook functions.
-}

#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
       && !defined(__HADDOCK_VERSION__))

module GI.GLib.Structs.HookList
    (

-- * Exported types
    HookList(..)                            ,
    newZeroHookList                         ,
    noHookList                              ,


 -- * Methods
-- ** clear #method:clear#

#if ENABLE_OVERLOADING
    HookListClearMethodInfo                 ,
#endif
    hookListClear                           ,


-- ** init #method:init#

#if ENABLE_OVERLOADING
    HookListInitMethodInfo                  ,
#endif
    hookListInit                            ,


-- ** invoke #method:invoke#

#if ENABLE_OVERLOADING
    HookListInvokeMethodInfo                ,
#endif
    hookListInvoke                          ,


-- ** invokeCheck #method:invokeCheck#

#if ENABLE_OVERLOADING
    HookListInvokeCheckMethodInfo           ,
#endif
    hookListInvokeCheck                     ,




 -- * Properties
-- ** dummy3 #attr:dummy3#
{- | unused
-}
    clearHookListDummy3                     ,
    getHookListDummy3                       ,
#if ENABLE_OVERLOADING
    hookList_dummy3                         ,
#endif
    setHookListDummy3                       ,


-- ** finalizeHook #attr:finalizeHook#
{- | the function to call to finalize a 'GI.GLib.Structs.Hook.Hook' element.
    The default behaviour is to call the hooks /@destroy@/ function
-}
    clearHookListFinalizeHook               ,
    getHookListFinalizeHook                 ,
#if ENABLE_OVERLOADING
    hookList_finalizeHook                   ,
#endif
    setHookListFinalizeHook                 ,


-- ** hookSize #attr:hookSize#
{- | the size of the 'GI.GLib.Structs.HookList.HookList' elements, in bytes
-}
    getHookListHookSize                     ,
#if ENABLE_OVERLOADING
    hookList_hookSize                       ,
#endif
    setHookListHookSize                     ,


-- ** hooks #attr:hooks#
{- | the first 'GI.GLib.Structs.Hook.Hook' element in the list
-}
    clearHookListHooks                      ,
    getHookListHooks                        ,
#if ENABLE_OVERLOADING
    hookList_hooks                          ,
#endif
    setHookListHooks                        ,


-- ** isSetup #attr:isSetup#
{- | 1 if the 'GI.GLib.Structs.HookList.HookList' has been initialized
-}
    getHookListIsSetup                      ,
#if ENABLE_OVERLOADING
    hookList_isSetup                        ,
#endif
    setHookListIsSetup                      ,


-- ** seqId #attr:seqId#
{- | the next free 'GI.GLib.Structs.Hook.Hook' id
-}
    getHookListSeqId                        ,
#if ENABLE_OVERLOADING
    hookList_seqId                          ,
#endif
    setHookListSeqId                        ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL

import qualified GI.GLib.Callbacks as GLib.Callbacks
import {-# SOURCE #-} qualified GI.GLib.Structs.Hook as GLib.Hook

-- | Memory-managed wrapper type.
newtype HookList = HookList (ManagedPtr HookList)
instance WrappedPtr HookList where
    wrappedPtrCalloc = callocBytes 56
    wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 56 >=> wrapPtr HookList)
    wrappedPtrFree = Just ptr_to_g_free

-- | Construct a `HookList` struct initialized to zero.
newZeroHookList :: MonadIO m => m HookList
newZeroHookList = liftIO $ wrappedPtrCalloc >>= wrapPtr HookList

instance tag ~ 'AttrSet => Constructible HookList tag where
    new _ attrs = do
        o <- newZeroHookList
        GI.Attributes.set o attrs
        return o


-- | A convenience alias for `Nothing` :: `Maybe` `HookList`.
noHookList :: Maybe HookList
noHookList = Nothing

{- |
Get the value of the “@seq_id@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' hookList #seqId
@
-}
getHookListSeqId :: MonadIO m => HookList -> m CULong
getHookListSeqId s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 0) :: IO CULong
    return val

{- |
Set the value of the “@seq_id@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' hookList [ #seqId 'Data.GI.Base.Attributes.:=' value ]
@
-}
setHookListSeqId :: MonadIO m => HookList -> CULong -> m ()
setHookListSeqId s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 0) (val :: CULong)

#if ENABLE_OVERLOADING
data HookListSeqIdFieldInfo
instance AttrInfo HookListSeqIdFieldInfo where
    type AttrAllowedOps HookListSeqIdFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint HookListSeqIdFieldInfo = (~) CULong
    type AttrBaseTypeConstraint HookListSeqIdFieldInfo = (~) HookList
    type AttrGetType HookListSeqIdFieldInfo = CULong
    type AttrLabel HookListSeqIdFieldInfo = "seq_id"
    type AttrOrigin HookListSeqIdFieldInfo = HookList
    attrGet _ = getHookListSeqId
    attrSet _ = setHookListSeqId
    attrConstruct = undefined
    attrClear _ = undefined

hookList_seqId :: AttrLabelProxy "seqId"
hookList_seqId = AttrLabelProxy

#endif


{- |
Get the value of the “@hook_size@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' hookList #hookSize
@
-}
getHookListHookSize :: MonadIO m => HookList -> m Word32
getHookListHookSize s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 8) :: IO Word32
    return val

{- |
Set the value of the “@hook_size@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' hookList [ #hookSize 'Data.GI.Base.Attributes.:=' value ]
@
-}
setHookListHookSize :: MonadIO m => HookList -> Word32 -> m ()
setHookListHookSize s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 8) (val :: Word32)

#if ENABLE_OVERLOADING
data HookListHookSizeFieldInfo
instance AttrInfo HookListHookSizeFieldInfo where
    type AttrAllowedOps HookListHookSizeFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint HookListHookSizeFieldInfo = (~) Word32
    type AttrBaseTypeConstraint HookListHookSizeFieldInfo = (~) HookList
    type AttrGetType HookListHookSizeFieldInfo = Word32
    type AttrLabel HookListHookSizeFieldInfo = "hook_size"
    type AttrOrigin HookListHookSizeFieldInfo = HookList
    attrGet _ = getHookListHookSize
    attrSet _ = setHookListHookSize
    attrConstruct = undefined
    attrClear _ = undefined

hookList_hookSize :: AttrLabelProxy "hookSize"
hookList_hookSize = AttrLabelProxy

#endif


{- |
Get the value of the “@is_setup@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' hookList #isSetup
@
-}
getHookListIsSetup :: MonadIO m => HookList -> m Word32
getHookListIsSetup s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 12) :: IO Word32
    return val

{- |
Set the value of the “@is_setup@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' hookList [ #isSetup 'Data.GI.Base.Attributes.:=' value ]
@
-}
setHookListIsSetup :: MonadIO m => HookList -> Word32 -> m ()
setHookListIsSetup s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 12) (val :: Word32)

#if ENABLE_OVERLOADING
data HookListIsSetupFieldInfo
instance AttrInfo HookListIsSetupFieldInfo where
    type AttrAllowedOps HookListIsSetupFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint HookListIsSetupFieldInfo = (~) Word32
    type AttrBaseTypeConstraint HookListIsSetupFieldInfo = (~) HookList
    type AttrGetType HookListIsSetupFieldInfo = Word32
    type AttrLabel HookListIsSetupFieldInfo = "is_setup"
    type AttrOrigin HookListIsSetupFieldInfo = HookList
    attrGet _ = getHookListIsSetup
    attrSet _ = setHookListIsSetup
    attrConstruct = undefined
    attrClear _ = undefined

hookList_isSetup :: AttrLabelProxy "isSetup"
hookList_isSetup = AttrLabelProxy

#endif


{- |
Get the value of the “@hooks@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' hookList #hooks
@
-}
getHookListHooks :: MonadIO m => HookList -> m (Maybe GLib.Hook.Hook)
getHookListHooks s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 16) :: IO (Ptr GLib.Hook.Hook)
    result <- SP.convertIfNonNull val $ \val' -> do
        val'' <- (newPtr GLib.Hook.Hook) val'
        return val''
    return result

{- |
Set the value of the “@hooks@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' hookList [ #hooks 'Data.GI.Base.Attributes.:=' value ]
@
-}
setHookListHooks :: MonadIO m => HookList -> Ptr GLib.Hook.Hook -> m ()
setHookListHooks s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 16) (val :: Ptr GLib.Hook.Hook)

{- |
Set the value of the “@hooks@” field to `Nothing`.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.clear' #hooks
@
-}
clearHookListHooks :: MonadIO m => HookList -> m ()
clearHookListHooks s = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 16) (FP.nullPtr :: Ptr GLib.Hook.Hook)

#if ENABLE_OVERLOADING
data HookListHooksFieldInfo
instance AttrInfo HookListHooksFieldInfo where
    type AttrAllowedOps HookListHooksFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint HookListHooksFieldInfo = (~) (Ptr GLib.Hook.Hook)
    type AttrBaseTypeConstraint HookListHooksFieldInfo = (~) HookList
    type AttrGetType HookListHooksFieldInfo = Maybe GLib.Hook.Hook
    type AttrLabel HookListHooksFieldInfo = "hooks"
    type AttrOrigin HookListHooksFieldInfo = HookList
    attrGet _ = getHookListHooks
    attrSet _ = setHookListHooks
    attrConstruct = undefined
    attrClear _ = clearHookListHooks

hookList_hooks :: AttrLabelProxy "hooks"
hookList_hooks = AttrLabelProxy

#endif


{- |
Get the value of the “@dummy3@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' hookList #dummy3
@
-}
getHookListDummy3 :: MonadIO m => HookList -> m (Ptr ())
getHookListDummy3 s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 24) :: IO (Ptr ())
    return val

{- |
Set the value of the “@dummy3@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' hookList [ #dummy3 'Data.GI.Base.Attributes.:=' value ]
@
-}
setHookListDummy3 :: MonadIO m => HookList -> Ptr () -> m ()
setHookListDummy3 s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 24) (val :: Ptr ())

{- |
Set the value of the “@dummy3@” field to `Nothing`.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.clear' #dummy3
@
-}
clearHookListDummy3 :: MonadIO m => HookList -> m ()
clearHookListDummy3 s = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 24) (FP.nullPtr :: Ptr ())

#if ENABLE_OVERLOADING
data HookListDummy3FieldInfo
instance AttrInfo HookListDummy3FieldInfo where
    type AttrAllowedOps HookListDummy3FieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint HookListDummy3FieldInfo = (~) (Ptr ())
    type AttrBaseTypeConstraint HookListDummy3FieldInfo = (~) HookList
    type AttrGetType HookListDummy3FieldInfo = Ptr ()
    type AttrLabel HookListDummy3FieldInfo = "dummy3"
    type AttrOrigin HookListDummy3FieldInfo = HookList
    attrGet _ = getHookListDummy3
    attrSet _ = setHookListDummy3
    attrConstruct = undefined
    attrClear _ = clearHookListDummy3

hookList_dummy3 :: AttrLabelProxy "dummy3"
hookList_dummy3 = AttrLabelProxy

#endif


{- |
Get the value of the “@finalize_hook@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' hookList #finalizeHook
@
-}
getHookListFinalizeHook :: MonadIO m => HookList -> m (Maybe GLib.Callbacks.HookFinalizeFunc)
getHookListFinalizeHook s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 32) :: IO (FunPtr GLib.Callbacks.C_HookFinalizeFunc)
    result <- SP.convertFunPtrIfNonNull val $ \val' -> do
        let val'' = GLib.Callbacks.dynamic_HookFinalizeFunc val'
        return val''
    return result

{- |
Set the value of the “@finalize_hook@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.set' hookList [ #finalizeHook 'Data.GI.Base.Attributes.:=' value ]
@
-}
setHookListFinalizeHook :: MonadIO m => HookList -> FunPtr GLib.Callbacks.C_HookFinalizeFunc -> m ()
setHookListFinalizeHook s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 32) (val :: FunPtr GLib.Callbacks.C_HookFinalizeFunc)

{- |
Set the value of the “@finalize_hook@” field to `Nothing`.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.clear' #finalizeHook
@
-}
clearHookListFinalizeHook :: MonadIO m => HookList -> m ()
clearHookListFinalizeHook s = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 32) (FP.nullFunPtr :: FunPtr GLib.Callbacks.C_HookFinalizeFunc)

#if ENABLE_OVERLOADING
data HookListFinalizeHookFieldInfo
instance AttrInfo HookListFinalizeHookFieldInfo where
    type AttrAllowedOps HookListFinalizeHookFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint HookListFinalizeHookFieldInfo = (~) (FunPtr GLib.Callbacks.C_HookFinalizeFunc)
    type AttrBaseTypeConstraint HookListFinalizeHookFieldInfo = (~) HookList
    type AttrGetType HookListFinalizeHookFieldInfo = Maybe GLib.Callbacks.HookFinalizeFunc
    type AttrLabel HookListFinalizeHookFieldInfo = "finalize_hook"
    type AttrOrigin HookListFinalizeHookFieldInfo = HookList
    attrGet _ = getHookListFinalizeHook
    attrSet _ = setHookListFinalizeHook
    attrConstruct = undefined
    attrClear _ = clearHookListFinalizeHook

hookList_finalizeHook :: AttrLabelProxy "finalizeHook"
hookList_finalizeHook = AttrLabelProxy

#endif


-- XXX Skipped attribute for "HookList:dummy" :: Not implemented: "Don't know how to unpack C array of type TCArray False 2 (-1) (TBasicType TPtr)"

#if ENABLE_OVERLOADING
instance O.HasAttributeList HookList
type instance O.AttributeList HookList = HookListAttributeList
type HookListAttributeList = ('[ '("seqId", HookListSeqIdFieldInfo), '("hookSize", HookListHookSizeFieldInfo), '("isSetup", HookListIsSetupFieldInfo), '("hooks", HookListHooksFieldInfo), '("dummy3", HookListDummy3FieldInfo), '("finalizeHook", HookListFinalizeHookFieldInfo)] :: [(Symbol, *)])
#endif

-- method HookList::clear
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "hook_list", argType = TInterface (Name {namespace = "GLib", name = "HookList"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GHookList", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_hook_list_clear" g_hook_list_clear ::
    Ptr HookList ->                         -- hook_list : TInterface (Name {namespace = "GLib", name = "HookList"})
    IO ()

{- |
Removes all the 'GI.GLib.Structs.Hook.Hook' elements from a 'GI.GLib.Structs.HookList.HookList'.
-}
hookListClear ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HookList
    {- ^ /@hookList@/: a 'GI.GLib.Structs.HookList.HookList' -}
    -> m ()
hookListClear hookList = liftIO $ do
    hookList' <- unsafeManagedPtrGetPtr hookList
    g_hook_list_clear hookList'
    touchManagedPtr hookList
    return ()

#if ENABLE_OVERLOADING
data HookListClearMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo HookListClearMethodInfo HookList signature where
    overloadedMethod _ = hookListClear

#endif

-- method HookList::init
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "hook_list", argType = TInterface (Name {namespace = "GLib", name = "HookList"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GHookList", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "hook_size", argType = TBasicType TUInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the size of each element in the #GHookList,\n    typically `sizeof (GHook)`.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_hook_list_init" g_hook_list_init ::
    Ptr HookList ->                         -- hook_list : TInterface (Name {namespace = "GLib", name = "HookList"})
    Word32 ->                               -- hook_size : TBasicType TUInt
    IO ()

{- |
Initializes a 'GI.GLib.Structs.HookList.HookList'.
This must be called before the 'GI.GLib.Structs.HookList.HookList' is used.
-}
hookListInit ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HookList
    {- ^ /@hookList@/: a 'GI.GLib.Structs.HookList.HookList' -}
    -> Word32
    {- ^ /@hookSize@/: the size of each element in the 'GI.GLib.Structs.HookList.HookList',
    typically @sizeof (GHook)@. -}
    -> m ()
hookListInit hookList hookSize = liftIO $ do
    hookList' <- unsafeManagedPtrGetPtr hookList
    g_hook_list_init hookList' hookSize
    touchManagedPtr hookList
    return ()

#if ENABLE_OVERLOADING
data HookListInitMethodInfo
instance (signature ~ (Word32 -> m ()), MonadIO m) => O.MethodInfo HookListInitMethodInfo HookList signature where
    overloadedMethod _ = hookListInit

#endif

-- method HookList::invoke
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "hook_list", argType = TInterface (Name {namespace = "GLib", name = "HookList"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GHookList", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "may_recurse", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "%TRUE if functions which are already running\n    (e.g. in another thread) can be called. If set to %FALSE,\n    these are skipped", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_hook_list_invoke" g_hook_list_invoke ::
    Ptr HookList ->                         -- hook_list : TInterface (Name {namespace = "GLib", name = "HookList"})
    CInt ->                                 -- may_recurse : TBasicType TBoolean
    IO ()

{- |
Calls all of the 'GI.GLib.Structs.Hook.Hook' functions in a 'GI.GLib.Structs.HookList.HookList'.
-}
hookListInvoke ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HookList
    {- ^ /@hookList@/: a 'GI.GLib.Structs.HookList.HookList' -}
    -> Bool
    {- ^ /@mayRecurse@/: 'True' if functions which are already running
    (e.g. in another thread) can be called. If set to 'False',
    these are skipped -}
    -> m ()
hookListInvoke hookList mayRecurse = liftIO $ do
    hookList' <- unsafeManagedPtrGetPtr hookList
    let mayRecurse' = (fromIntegral . fromEnum) mayRecurse
    g_hook_list_invoke hookList' mayRecurse'
    touchManagedPtr hookList
    return ()

#if ENABLE_OVERLOADING
data HookListInvokeMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m) => O.MethodInfo HookListInvokeMethodInfo HookList signature where
    overloadedMethod _ = hookListInvoke

#endif

-- method HookList::invoke_check
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "hook_list", argType = TInterface (Name {namespace = "GLib", name = "HookList"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GHookList", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "may_recurse", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "%TRUE if functions which are already running\n    (e.g. in another thread) can be called. If set to %FALSE,\n    these are skipped", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "g_hook_list_invoke_check" g_hook_list_invoke_check ::
    Ptr HookList ->                         -- hook_list : TInterface (Name {namespace = "GLib", name = "HookList"})
    CInt ->                                 -- may_recurse : TBasicType TBoolean
    IO ()

{- |
Calls all of the 'GI.GLib.Structs.Hook.Hook' functions in a 'GI.GLib.Structs.HookList.HookList'.
Any function which returns 'False' is removed from the 'GI.GLib.Structs.HookList.HookList'.
-}
hookListInvokeCheck ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    HookList
    {- ^ /@hookList@/: a 'GI.GLib.Structs.HookList.HookList' -}
    -> Bool
    {- ^ /@mayRecurse@/: 'True' if functions which are already running
    (e.g. in another thread) can be called. If set to 'False',
    these are skipped -}
    -> m ()
hookListInvokeCheck hookList mayRecurse = liftIO $ do
    hookList' <- unsafeManagedPtrGetPtr hookList
    let mayRecurse' = (fromIntegral . fromEnum) mayRecurse
    g_hook_list_invoke_check hookList' mayRecurse'
    touchManagedPtr hookList
    return ()

#if ENABLE_OVERLOADING
data HookListInvokeCheckMethodInfo
instance (signature ~ (Bool -> m ()), MonadIO m) => O.MethodInfo HookListInvokeCheckMethodInfo HookList signature where
    overloadedMethod _ = hookListInvokeCheck

#endif

#if ENABLE_OVERLOADING
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 = O.MethodResolutionFailed l o

instance (info ~ ResolveHookListMethod t HookList, O.MethodInfo info HookList p) => OL.IsLabel t (HookList -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

#endif