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

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

module GI.Pango.Callbacks
    (

 -- * Signals
-- ** AttrClassDestroyFieldCallback #signal:AttrClassDestroyFieldCallback#

    AttrClassDestroyFieldCallback           ,
    C_AttrClassDestroyFieldCallback         ,
    dynamic_AttrClassDestroyFieldCallback   ,
    genClosure_AttrClassDestroyFieldCallback,
    mk_AttrClassDestroyFieldCallback        ,
    noAttrClassDestroyFieldCallback         ,
    wrap_AttrClassDestroyFieldCallback      ,


-- ** AttrClassEqualFieldCallback #signal:AttrClassEqualFieldCallback#

    AttrClassEqualFieldCallback             ,
    C_AttrClassEqualFieldCallback           ,
    dynamic_AttrClassEqualFieldCallback     ,
    genClosure_AttrClassEqualFieldCallback  ,
    mk_AttrClassEqualFieldCallback          ,
    noAttrClassEqualFieldCallback           ,
    wrap_AttrClassEqualFieldCallback        ,


-- ** AttrDataCopyFunc #signal:AttrDataCopyFunc#

    AttrDataCopyFunc                        ,
    AttrDataCopyFunc_WithClosures           ,
    C_AttrDataCopyFunc                      ,
    drop_closures_AttrDataCopyFunc          ,
    dynamic_AttrDataCopyFunc                ,
    genClosure_AttrDataCopyFunc             ,
    mk_AttrDataCopyFunc                     ,
    noAttrDataCopyFunc                      ,
    noAttrDataCopyFunc_WithClosures         ,
    wrap_AttrDataCopyFunc                   ,


-- ** AttrFilterFunc #signal:AttrFilterFunc#

    AttrFilterFunc                          ,
    AttrFilterFunc_WithClosures             ,
    C_AttrFilterFunc                        ,
    drop_closures_AttrFilterFunc            ,
    dynamic_AttrFilterFunc                  ,
    genClosure_AttrFilterFunc               ,
    mk_AttrFilterFunc                       ,
    noAttrFilterFunc                        ,
    noAttrFilterFunc_WithClosures           ,
    wrap_AttrFilterFunc                     ,


-- ** FontsetForeachFunc #signal:FontsetForeachFunc#

    C_FontsetForeachFunc                    ,
    FontsetForeachFunc                      ,
    FontsetForeachFunc_WithClosures         ,
    drop_closures_FontsetForeachFunc        ,
    dynamic_FontsetForeachFunc              ,
    genClosure_FontsetForeachFunc           ,
    mk_FontsetForeachFunc                   ,
    noFontsetForeachFunc                    ,
    noFontsetForeachFunc_WithClosures       ,
    wrap_FontsetForeachFunc                 ,


-- ** IncludedModuleExitFieldCallback #signal:IncludedModuleExitFieldCallback#

    C_IncludedModuleExitFieldCallback       ,
    IncludedModuleExitFieldCallback         ,
    dynamic_IncludedModuleExitFieldCallback ,
    genClosure_IncludedModuleExitFieldCallback,
    mk_IncludedModuleExitFieldCallback      ,
    noIncludedModuleExitFieldCallback       ,
    wrap_IncludedModuleExitFieldCallback    ,


-- ** IncludedModuleInitFieldCallback #signal:IncludedModuleInitFieldCallback#

    C_IncludedModuleInitFieldCallback       ,
    IncludedModuleInitFieldCallback         ,
    dynamic_IncludedModuleInitFieldCallback ,
    genClosure_IncludedModuleInitFieldCallback,
    mk_IncludedModuleInitFieldCallback      ,
    noIncludedModuleInitFieldCallback       ,
    wrap_IncludedModuleInitFieldCallback    ,


-- ** IncludedModuleListFieldCallback #signal:IncludedModuleListFieldCallback#

    C_IncludedModuleListFieldCallback       ,
    IncludedModuleListFieldCallback         ,
    dynamic_IncludedModuleListFieldCallback ,
    genClosure_IncludedModuleListFieldCallback,
    mk_IncludedModuleListFieldCallback      ,
    noIncludedModuleListFieldCallback       ,
    wrap_IncludedModuleListFieldCallback    ,




    ) 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.GObject.Objects.TypeModule as GObject.TypeModule
import {-# SOURCE #-} qualified GI.Pango.Objects.Font as Pango.Font
import {-# SOURCE #-} qualified GI.Pango.Objects.Fontset as Pango.Fontset
import {-# SOURCE #-} qualified GI.Pango.Structs.Attribute as Pango.Attribute
import {-# SOURCE #-} qualified GI.Pango.Structs.EngineInfo as Pango.EngineInfo

-- callback IncludedModuleListFieldCallback
--          -> Callable {returnType = Nothing, returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "engines", argType = TInterface (Name {namespace = "Pango", name = "EngineInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_engines", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_IncludedModuleListFieldCallback =
    Ptr Pango.EngineInfo.EngineInfo ->
    Int32 ->
    IO ()

-- Args : [Arg {argCName = "engines", argType = TInterface (Name {namespace = "Pango", name = "EngineInfo"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "n_engines", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_IncludedModuleListFieldCallback :: FunPtr C_IncludedModuleListFieldCallback -> C_IncludedModuleListFieldCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_IncludedModuleListFieldCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_IncludedModuleListFieldCallback
    -> Pango.EngineInfo.EngineInfo
    -> Int32
    -> m ()
dynamic_IncludedModuleListFieldCallback __funPtr engines nEngines = liftIO $ do
    engines' <- unsafeManagedPtrGetPtr engines
    (__dynamic_C_IncludedModuleListFieldCallback __funPtr) engines' nEngines
    touchManagedPtr engines
    return ()

-- | Generate a function pointer callable from C code, from a `C_IncludedModuleListFieldCallback`.
foreign import ccall "wrapper"
    mk_IncludedModuleListFieldCallback :: C_IncludedModuleListFieldCallback -> IO (FunPtr C_IncludedModuleListFieldCallback)

{- |
/No description available in the introspection data./
-}
type IncludedModuleListFieldCallback =
    Pango.EngineInfo.EngineInfo
    -> Int32
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `IncludedModuleListFieldCallback`@.
noIncludedModuleListFieldCallback :: Maybe IncludedModuleListFieldCallback
noIncludedModuleListFieldCallback = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_IncludedModuleListFieldCallback :: MonadIO m => IncludedModuleListFieldCallback -> m (GClosure C_IncludedModuleListFieldCallback)
genClosure_IncludedModuleListFieldCallback cb = liftIO $ do
    let cb' = wrap_IncludedModuleListFieldCallback Nothing cb
    mk_IncludedModuleListFieldCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `IncludedModuleListFieldCallback` into a `C_IncludedModuleListFieldCallback`.
wrap_IncludedModuleListFieldCallback ::
    Maybe (Ptr (FunPtr C_IncludedModuleListFieldCallback)) ->
    IncludedModuleListFieldCallback ->
    C_IncludedModuleListFieldCallback
wrap_IncludedModuleListFieldCallback funptrptr _cb engines nEngines = do
    engines' <- (newPtr Pango.EngineInfo.EngineInfo) engines
    _cb  engines' nEngines
    maybeReleaseFunPtr funptrptr


-- callback IncludedModuleInitFieldCallback
--          -> Callable {returnType = Nothing, returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "module", argType = TInterface (Name {namespace = "GObject", name = "TypeModule"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_IncludedModuleInitFieldCallback =
    Ptr GObject.TypeModule.TypeModule ->
    IO ()

-- Args : [Arg {argCName = "module", argType = TInterface (Name {namespace = "GObject", name = "TypeModule"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_IncludedModuleInitFieldCallback :: FunPtr C_IncludedModuleInitFieldCallback -> C_IncludedModuleInitFieldCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_IncludedModuleInitFieldCallback ::
    (B.CallStack.HasCallStack, MonadIO m, GObject.TypeModule.IsTypeModule a) =>
    FunPtr C_IncludedModuleInitFieldCallback
    -> a
    -> m ()
dynamic_IncludedModuleInitFieldCallback __funPtr module_ = liftIO $ do
    module_' <- unsafeManagedPtrCastPtr module_
    (__dynamic_C_IncludedModuleInitFieldCallback __funPtr) module_'
    touchManagedPtr module_
    return ()

-- | Generate a function pointer callable from C code, from a `C_IncludedModuleInitFieldCallback`.
foreign import ccall "wrapper"
    mk_IncludedModuleInitFieldCallback :: C_IncludedModuleInitFieldCallback -> IO (FunPtr C_IncludedModuleInitFieldCallback)

{- |
/No description available in the introspection data./
-}
type IncludedModuleInitFieldCallback =
    GObject.TypeModule.TypeModule
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `IncludedModuleInitFieldCallback`@.
noIncludedModuleInitFieldCallback :: Maybe IncludedModuleInitFieldCallback
noIncludedModuleInitFieldCallback = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_IncludedModuleInitFieldCallback :: MonadIO m => IncludedModuleInitFieldCallback -> m (GClosure C_IncludedModuleInitFieldCallback)
genClosure_IncludedModuleInitFieldCallback cb = liftIO $ do
    let cb' = wrap_IncludedModuleInitFieldCallback Nothing cb
    mk_IncludedModuleInitFieldCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `IncludedModuleInitFieldCallback` into a `C_IncludedModuleInitFieldCallback`.
wrap_IncludedModuleInitFieldCallback ::
    Maybe (Ptr (FunPtr C_IncludedModuleInitFieldCallback)) ->
    IncludedModuleInitFieldCallback ->
    C_IncludedModuleInitFieldCallback
wrap_IncludedModuleInitFieldCallback funptrptr _cb module_ = do
    module_' <- (newObject GObject.TypeModule.TypeModule) module_
    _cb  module_'
    maybeReleaseFunPtr funptrptr


-- callback IncludedModuleExitFieldCallback
--          -> Callable {returnType = Nothing, returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_IncludedModuleExitFieldCallback =
    IO ()

-- Args : []
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_IncludedModuleExitFieldCallback :: FunPtr C_IncludedModuleExitFieldCallback -> C_IncludedModuleExitFieldCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_IncludedModuleExitFieldCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_IncludedModuleExitFieldCallback
    -> m ()
dynamic_IncludedModuleExitFieldCallback __funPtr = liftIO $ do
    (__dynamic_C_IncludedModuleExitFieldCallback __funPtr)
    return ()

-- | Generate a function pointer callable from C code, from a `C_IncludedModuleExitFieldCallback`.
foreign import ccall "wrapper"
    mk_IncludedModuleExitFieldCallback :: C_IncludedModuleExitFieldCallback -> IO (FunPtr C_IncludedModuleExitFieldCallback)

{- |
/No description available in the introspection data./
-}
type IncludedModuleExitFieldCallback =
    IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `IncludedModuleExitFieldCallback`@.
noIncludedModuleExitFieldCallback :: Maybe IncludedModuleExitFieldCallback
noIncludedModuleExitFieldCallback = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_IncludedModuleExitFieldCallback :: MonadIO m => IncludedModuleExitFieldCallback -> m (GClosure C_IncludedModuleExitFieldCallback)
genClosure_IncludedModuleExitFieldCallback cb = liftIO $ do
    let cb' = wrap_IncludedModuleExitFieldCallback Nothing cb
    mk_IncludedModuleExitFieldCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `IncludedModuleExitFieldCallback` into a `C_IncludedModuleExitFieldCallback`.
wrap_IncludedModuleExitFieldCallback ::
    Maybe (Ptr (FunPtr C_IncludedModuleExitFieldCallback)) ->
    IncludedModuleExitFieldCallback ->
    C_IncludedModuleExitFieldCallback
wrap_IncludedModuleExitFieldCallback funptrptr _cb = do
    _cb
    maybeReleaseFunPtr funptrptr


-- callback FontsetForeachFunc
--          -> Callable {returnType = Just (TBasicType TBoolean), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "if %TRUE, stop iteration and return immediately.", sinceVersion = Nothing}, args = [Arg {argCName = "fontset", argType = TInterface (Name {namespace = "Pango", name = "Fontset"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoFontset", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "font", argType = TInterface (Name {namespace = "Pango", name = "Font"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a font from @fontset", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "callback data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "A callback function used by pango_fontset_foreach() when enumerating\nthe fonts in a fontset.", sinceVersion = Just "1.4"}}
-- | Type for the callback on the (unwrapped) C side.
type C_FontsetForeachFunc =
    Ptr Pango.Fontset.Fontset ->
    Ptr Pango.Font.Font ->
    Ptr () ->
    IO CInt

-- Args : [Arg {argCName = "fontset", argType = TInterface (Name {namespace = "Pango", name = "Fontset"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PangoFontset", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "font", argType = TInterface (Name {namespace = "Pango", name = "Font"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a font from @fontset", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "callback data", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 2, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_FontsetForeachFunc :: FunPtr C_FontsetForeachFunc -> C_FontsetForeachFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_FontsetForeachFunc ::
    (B.CallStack.HasCallStack, MonadIO m, Pango.Fontset.IsFontset a, Pango.Font.IsFont b) =>
    FunPtr C_FontsetForeachFunc
    -> a
    {- ^ /@fontset@/: a 'GI.Pango.Objects.Fontset.Fontset' -}
    -> b
    {- ^ /@font@/: a font from /@fontset@/ -}
    -> Ptr ()
    {- ^ /@userData@/: callback data -}
    -> m Bool
    {- ^ __Returns:__ if 'True', stop iteration and return immediately. -}
dynamic_FontsetForeachFunc __funPtr fontset font userData = liftIO $ do
    fontset' <- unsafeManagedPtrCastPtr fontset
    font' <- unsafeManagedPtrCastPtr font
    result <- (__dynamic_C_FontsetForeachFunc __funPtr) fontset' font' userData
    let result' = (/= 0) result
    touchManagedPtr fontset
    touchManagedPtr font
    return result'

-- | Generate a function pointer callable from C code, from a `C_FontsetForeachFunc`.
foreign import ccall "wrapper"
    mk_FontsetForeachFunc :: C_FontsetForeachFunc -> IO (FunPtr C_FontsetForeachFunc)

{- |
A callback function used by 'GI.Pango.Objects.Fontset.fontsetForeach' when enumerating
the fonts in a fontset.

/Since: 1.4/
-}
type FontsetForeachFunc =
    Pango.Fontset.Fontset
    {- ^ /@fontset@/: a 'GI.Pango.Objects.Fontset.Fontset' -}
    -> Pango.Font.Font
    {- ^ /@font@/: a font from /@fontset@/ -}
    -> IO Bool
    {- ^ __Returns:__ if 'True', stop iteration and return immediately. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `FontsetForeachFunc`@.
noFontsetForeachFunc :: Maybe FontsetForeachFunc
noFontsetForeachFunc = Nothing

{- |
A callback function used by 'GI.Pango.Objects.Fontset.fontsetForeach' when enumerating
the fonts in a fontset.

/Since: 1.4/
-}
type FontsetForeachFunc_WithClosures =
    Pango.Fontset.Fontset
    {- ^ /@fontset@/: a 'GI.Pango.Objects.Fontset.Fontset' -}
    -> Pango.Font.Font
    {- ^ /@font@/: a font from /@fontset@/ -}
    -> Ptr ()
    {- ^ /@userData@/: callback data -}
    -> IO Bool
    {- ^ __Returns:__ if 'True', stop iteration and return immediately. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `FontsetForeachFunc_WithClosures`@.
noFontsetForeachFunc_WithClosures :: Maybe FontsetForeachFunc_WithClosures
noFontsetForeachFunc_WithClosures = Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_FontsetForeachFunc :: FontsetForeachFunc -> FontsetForeachFunc_WithClosures
drop_closures_FontsetForeachFunc _f fontset font _ = _f fontset font

-- | Wrap the callback into a `GClosure`.
genClosure_FontsetForeachFunc :: MonadIO m => FontsetForeachFunc -> m (GClosure C_FontsetForeachFunc)
genClosure_FontsetForeachFunc cb = liftIO $ do
    let cb' = drop_closures_FontsetForeachFunc cb
    let cb'' = wrap_FontsetForeachFunc Nothing cb'
    mk_FontsetForeachFunc cb'' >>= B.GClosure.newGClosure


-- | Wrap a `FontsetForeachFunc` into a `C_FontsetForeachFunc`.
wrap_FontsetForeachFunc ::
    Maybe (Ptr (FunPtr C_FontsetForeachFunc)) ->
    FontsetForeachFunc_WithClosures ->
    C_FontsetForeachFunc
wrap_FontsetForeachFunc funptrptr _cb fontset font userData = do
    fontset' <- (newObject Pango.Fontset.Fontset) fontset
    font' <- (newObject Pango.Font.Font) font
    result <- _cb  fontset' font' userData
    maybeReleaseFunPtr funptrptr
    let result' = (fromIntegral . fromEnum) result
    return result'


-- callback AttrFilterFunc
--          -> Callable {returnType = Just (TBasicType TBoolean), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "%TRUE if the attribute should be selected for\nfiltering, %FALSE otherwise.", sinceVersion = Nothing}, args = [Arg {argCName = "attribute", argType = TInterface (Name {namespace = "Pango", name = "Attribute"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Pango attribute", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data passed to the function", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Type of a function filtering a list of attributes.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_AttrFilterFunc =
    Ptr Pango.Attribute.Attribute ->
    Ptr () ->
    IO CInt

-- Args : [Arg {argCName = "attribute", argType = TInterface (Name {namespace = "Pango", name = "Attribute"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a Pango attribute", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data passed to the function", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_AttrFilterFunc :: FunPtr C_AttrFilterFunc -> C_AttrFilterFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_AttrFilterFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_AttrFilterFunc
    -> Pango.Attribute.Attribute
    {- ^ /@attribute@/: a Pango attribute -}
    -> Ptr ()
    {- ^ /@userData@/: user data passed to the function -}
    -> m Bool
    {- ^ __Returns:__ 'True' if the attribute should be selected for
filtering, 'False' otherwise. -}
dynamic_AttrFilterFunc __funPtr attribute userData = liftIO $ do
    attribute' <- unsafeManagedPtrGetPtr attribute
    result <- (__dynamic_C_AttrFilterFunc __funPtr) attribute' userData
    let result' = (/= 0) result
    touchManagedPtr attribute
    return result'

-- | Generate a function pointer callable from C code, from a `C_AttrFilterFunc`.
foreign import ccall "wrapper"
    mk_AttrFilterFunc :: C_AttrFilterFunc -> IO (FunPtr C_AttrFilterFunc)

{- |
Type of a function filtering a list of attributes.
-}
type AttrFilterFunc =
    Pango.Attribute.Attribute
    {- ^ /@attribute@/: a Pango attribute -}
    -> IO Bool
    {- ^ __Returns:__ 'True' if the attribute should be selected for
filtering, 'False' otherwise. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `AttrFilterFunc`@.
noAttrFilterFunc :: Maybe AttrFilterFunc
noAttrFilterFunc = Nothing

{- |
Type of a function filtering a list of attributes.
-}
type AttrFilterFunc_WithClosures =
    Pango.Attribute.Attribute
    {- ^ /@attribute@/: a Pango attribute -}
    -> Ptr ()
    {- ^ /@userData@/: user data passed to the function -}
    -> IO Bool
    {- ^ __Returns:__ 'True' if the attribute should be selected for
filtering, 'False' otherwise. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `AttrFilterFunc_WithClosures`@.
noAttrFilterFunc_WithClosures :: Maybe AttrFilterFunc_WithClosures
noAttrFilterFunc_WithClosures = Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_AttrFilterFunc :: AttrFilterFunc -> AttrFilterFunc_WithClosures
drop_closures_AttrFilterFunc _f attribute _ = _f attribute

-- | Wrap the callback into a `GClosure`.
genClosure_AttrFilterFunc :: MonadIO m => AttrFilterFunc -> m (GClosure C_AttrFilterFunc)
genClosure_AttrFilterFunc cb = liftIO $ do
    let cb' = drop_closures_AttrFilterFunc cb
    let cb'' = wrap_AttrFilterFunc Nothing cb'
    mk_AttrFilterFunc cb'' >>= B.GClosure.newGClosure


-- | Wrap a `AttrFilterFunc` into a `C_AttrFilterFunc`.
wrap_AttrFilterFunc ::
    Maybe (Ptr (FunPtr C_AttrFilterFunc)) ->
    AttrFilterFunc_WithClosures ->
    C_AttrFilterFunc
wrap_AttrFilterFunc funptrptr _cb attribute userData = do
    attribute' <- (newPtr Pango.Attribute.Attribute) attribute
    result <- _cb  attribute' userData
    maybeReleaseFunPtr funptrptr
    let result' = (fromIntegral . fromEnum) result
    return result'


-- callback AttrDataCopyFunc
--          -> Callable {returnType = Just (TBasicType TPtr), returnMayBeNull = True, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Just "new copy of @user_data.", sinceVersion = Nothing}, args = [Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data to copy", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 0, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Just "Type of a function that can duplicate user data for an attribute.", sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_AttrDataCopyFunc =
    Ptr () ->
    IO (Ptr ())

-- Args : [Arg {argCName = "user_data", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "user data to copy", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = 0, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TPtr)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_AttrDataCopyFunc :: FunPtr C_AttrDataCopyFunc -> C_AttrDataCopyFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_AttrDataCopyFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_AttrDataCopyFunc
    -> Ptr ()
    {- ^ /@userData@/: user data to copy -}
    -> m (Ptr ())
    {- ^ __Returns:__ new copy of /@userData@/. -}
dynamic_AttrDataCopyFunc __funPtr userData = liftIO $ do
    result <- (__dynamic_C_AttrDataCopyFunc __funPtr) userData
    return result

-- | Generate a function pointer callable from C code, from a `C_AttrDataCopyFunc`.
foreign import ccall "wrapper"
    mk_AttrDataCopyFunc :: C_AttrDataCopyFunc -> IO (FunPtr C_AttrDataCopyFunc)

{- |
Type of a function that can duplicate user data for an attribute.
-}
type AttrDataCopyFunc =
    IO (Ptr ())
    {- ^ __Returns:__ new copy of /@userData@/. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `AttrDataCopyFunc`@.
noAttrDataCopyFunc :: Maybe AttrDataCopyFunc
noAttrDataCopyFunc = Nothing

{- |
Type of a function that can duplicate user data for an attribute.
-}
type AttrDataCopyFunc_WithClosures =
    Ptr ()
    {- ^ /@userData@/: user data to copy -}
    -> IO (Ptr ())
    {- ^ __Returns:__ new copy of /@userData@/. -}

-- | A convenience synonym for @`Nothing` :: `Maybe` `AttrDataCopyFunc_WithClosures`@.
noAttrDataCopyFunc_WithClosures :: Maybe AttrDataCopyFunc_WithClosures
noAttrDataCopyFunc_WithClosures = Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_AttrDataCopyFunc :: AttrDataCopyFunc -> AttrDataCopyFunc_WithClosures
drop_closures_AttrDataCopyFunc _f _ = _f

-- | Wrap the callback into a `GClosure`.
genClosure_AttrDataCopyFunc :: MonadIO m => AttrDataCopyFunc -> m (GClosure C_AttrDataCopyFunc)
genClosure_AttrDataCopyFunc cb = liftIO $ do
    let cb' = drop_closures_AttrDataCopyFunc cb
    let cb'' = wrap_AttrDataCopyFunc Nothing cb'
    mk_AttrDataCopyFunc cb'' >>= B.GClosure.newGClosure


-- | Wrap a `AttrDataCopyFunc` into a `C_AttrDataCopyFunc`.
wrap_AttrDataCopyFunc ::
    Maybe (Ptr (FunPtr C_AttrDataCopyFunc)) ->
    AttrDataCopyFunc_WithClosures ->
    C_AttrDataCopyFunc
wrap_AttrDataCopyFunc funptrptr _cb userData = do
    result <- _cb  userData
    maybeReleaseFunPtr funptrptr
    return result


-- callback AttrClassEqualFieldCallback
--          -> Callable {returnType = Just (TBasicType TBoolean), returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "attr1", argType = TInterface (Name {namespace = "Pango", name = "Attribute"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "attr2", argType = TInterface (Name {namespace = "Pango", name = "Attribute"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_AttrClassEqualFieldCallback =
    Ptr Pango.Attribute.Attribute ->
    Ptr Pango.Attribute.Attribute ->
    IO CInt

-- Args : [Arg {argCName = "attr1", argType = TInterface (Name {namespace = "Pango", name = "Attribute"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "attr2", argType = TInterface (Name {namespace = "Pango", name = "Attribute"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_AttrClassEqualFieldCallback :: FunPtr C_AttrClassEqualFieldCallback -> C_AttrClassEqualFieldCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_AttrClassEqualFieldCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_AttrClassEqualFieldCallback
    -> Pango.Attribute.Attribute
    -> Pango.Attribute.Attribute
    -> m Bool
dynamic_AttrClassEqualFieldCallback __funPtr attr1 attr2 = liftIO $ do
    attr1' <- unsafeManagedPtrGetPtr attr1
    attr2' <- unsafeManagedPtrGetPtr attr2
    result <- (__dynamic_C_AttrClassEqualFieldCallback __funPtr) attr1' attr2'
    let result' = (/= 0) result
    touchManagedPtr attr1
    touchManagedPtr attr2
    return result'

-- | Generate a function pointer callable from C code, from a `C_AttrClassEqualFieldCallback`.
foreign import ccall "wrapper"
    mk_AttrClassEqualFieldCallback :: C_AttrClassEqualFieldCallback -> IO (FunPtr C_AttrClassEqualFieldCallback)

{- |
/No description available in the introspection data./
-}
type AttrClassEqualFieldCallback =
    Pango.Attribute.Attribute
    -> Pango.Attribute.Attribute
    -> IO Bool

-- | A convenience synonym for @`Nothing` :: `Maybe` `AttrClassEqualFieldCallback`@.
noAttrClassEqualFieldCallback :: Maybe AttrClassEqualFieldCallback
noAttrClassEqualFieldCallback = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_AttrClassEqualFieldCallback :: MonadIO m => AttrClassEqualFieldCallback -> m (GClosure C_AttrClassEqualFieldCallback)
genClosure_AttrClassEqualFieldCallback cb = liftIO $ do
    let cb' = wrap_AttrClassEqualFieldCallback Nothing cb
    mk_AttrClassEqualFieldCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `AttrClassEqualFieldCallback` into a `C_AttrClassEqualFieldCallback`.
wrap_AttrClassEqualFieldCallback ::
    Maybe (Ptr (FunPtr C_AttrClassEqualFieldCallback)) ->
    AttrClassEqualFieldCallback ->
    C_AttrClassEqualFieldCallback
wrap_AttrClassEqualFieldCallback funptrptr _cb attr1 attr2 = do
    attr1' <- (newPtr Pango.Attribute.Attribute) attr1
    attr2' <- (newPtr Pango.Attribute.Attribute) attr2
    result <- _cb  attr1' attr2'
    maybeReleaseFunPtr funptrptr
    let result' = (fromIntegral . fromEnum) result
    return result'


-- callback AttrClassDestroyFieldCallback
--          -> Callable {returnType = Nothing, returnMayBeNull = False, returnTransfer = TransferNothing, returnDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, args = [Arg {argCName = "attr", argType = TInterface (Name {namespace = "Pango", name = "Attribute"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}], skipReturn = False, callableThrows = False, callableDeprecated = Nothing, callableDocumentation = Documentation {rawDocText = Nothing, sinceVersion = Nothing}}
-- | Type for the callback on the (unwrapped) C side.
type C_AttrClassDestroyFieldCallback =
    Ptr Pango.Attribute.Attribute ->
    IO ()

-- Args : [Arg {argCName = "attr", argType = TInterface (Name {namespace = "Pango", name = "Attribute"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Nothing, sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_AttrClassDestroyFieldCallback :: FunPtr C_AttrClassDestroyFieldCallback -> C_AttrClassDestroyFieldCallback

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_AttrClassDestroyFieldCallback ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_AttrClassDestroyFieldCallback
    -> Pango.Attribute.Attribute
    -> m ()
dynamic_AttrClassDestroyFieldCallback __funPtr attr = liftIO $ do
    attr' <- unsafeManagedPtrGetPtr attr
    (__dynamic_C_AttrClassDestroyFieldCallback __funPtr) attr'
    touchManagedPtr attr
    return ()

-- | Generate a function pointer callable from C code, from a `C_AttrClassDestroyFieldCallback`.
foreign import ccall "wrapper"
    mk_AttrClassDestroyFieldCallback :: C_AttrClassDestroyFieldCallback -> IO (FunPtr C_AttrClassDestroyFieldCallback)

{- |
/No description available in the introspection data./
-}
type AttrClassDestroyFieldCallback =
    Pango.Attribute.Attribute
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `AttrClassDestroyFieldCallback`@.
noAttrClassDestroyFieldCallback :: Maybe AttrClassDestroyFieldCallback
noAttrClassDestroyFieldCallback = Nothing

-- | Wrap the callback into a `GClosure`.
genClosure_AttrClassDestroyFieldCallback :: MonadIO m => AttrClassDestroyFieldCallback -> m (GClosure C_AttrClassDestroyFieldCallback)
genClosure_AttrClassDestroyFieldCallback cb = liftIO $ do
    let cb' = wrap_AttrClassDestroyFieldCallback Nothing cb
    mk_AttrClassDestroyFieldCallback cb' >>= B.GClosure.newGClosure


-- | Wrap a `AttrClassDestroyFieldCallback` into a `C_AttrClassDestroyFieldCallback`.
wrap_AttrClassDestroyFieldCallback ::
    Maybe (Ptr (FunPtr C_AttrClassDestroyFieldCallback)) ->
    AttrClassDestroyFieldCallback ->
    C_AttrClassDestroyFieldCallback
wrap_AttrClassDestroyFieldCallback funptrptr _cb attr = do
    attr' <- (newPtr Pango.Attribute.Attribute) attr
    _cb  attr'
    maybeReleaseFunPtr funptrptr