-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria

#if !defined(__HADDOCK_VERSION__)
#define ENABLE_OVERLOADING
#endif

module GI.Gsk.Callbacks
    ( 

 -- * Signals


-- ** ParseErrorFunc #signal:ParseErrorFunc#

    C_ParseErrorFunc                        ,
    ParseErrorFunc                          ,
    ParseErrorFunc_WithClosures             ,
    drop_closures_ParseErrorFunc            ,
    dynamic_ParseErrorFunc                  ,
    genClosure_ParseErrorFunc               ,
    mk_ParseErrorFunc                       ,
    noParseErrorFunc                        ,
    noParseErrorFunc_WithClosures           ,
    wrap_ParseErrorFunc                     ,


-- ** PathForeachFunc #signal:PathForeachFunc#

    C_PathForeachFunc                       ,
    PathForeachFunc                         ,
    PathForeachFunc_WithClosures            ,
    drop_closures_PathForeachFunc           ,
    dynamic_PathForeachFunc                 ,
    genClosure_PathForeachFunc              ,
    mk_PathForeachFunc                      ,
    noPathForeachFunc                       ,
    noPathForeachFunc_WithClosures          ,
    wrap_PathForeachFunc                    ,


-- ** PathIntersectionFunc #signal:PathIntersectionFunc#

    C_PathIntersectionFunc                  ,
    PathIntersectionFunc                    ,
    PathIntersectionFunc_WithClosures       ,
    drop_closures_PathIntersectionFunc      ,
    dynamic_PathIntersectionFunc            ,
    genClosure_PathIntersectionFunc         ,
    mk_PathIntersectionFunc                 ,
    noPathIntersectionFunc                  ,
    noPathIntersectionFunc_WithClosures     ,
    wrap_PathIntersectionFunc               ,


-- ** RenderReplayFontFilter #signal:RenderReplayFontFilter#

    C_RenderReplayFontFilter                ,
    RenderReplayFontFilter                  ,
    RenderReplayFontFilter_WithClosures     ,
    drop_closures_RenderReplayFontFilter    ,
    dynamic_RenderReplayFontFilter          ,
    genClosure_RenderReplayFontFilter       ,
    mk_RenderReplayFontFilter               ,
    noRenderReplayFontFilter                ,
    noRenderReplayFontFilter_WithClosures   ,
    wrap_RenderReplayFontFilter             ,


-- ** RenderReplayNodeFilter #signal:RenderReplayNodeFilter#

    C_RenderReplayNodeFilter                ,
    RenderReplayNodeFilter                  ,
    RenderReplayNodeFilter_WithClosures     ,
    drop_closures_RenderReplayNodeFilter    ,
    dynamic_RenderReplayNodeFilter          ,
    genClosure_RenderReplayNodeFilter       ,
    mk_RenderReplayNodeFilter               ,
    noRenderReplayNodeFilter                ,
    noRenderReplayNodeFilter_WithClosures   ,
    wrap_RenderReplayNodeFilter             ,


-- ** RenderReplayNodeForeach #signal:RenderReplayNodeForeach#

    C_RenderReplayNodeForeach               ,
    RenderReplayNodeForeach                 ,
    RenderReplayNodeForeach_WithClosures    ,
    drop_closures_RenderReplayNodeForeach   ,
    dynamic_RenderReplayNodeForeach         ,
    genClosure_RenderReplayNodeForeach      ,
    mk_RenderReplayNodeForeach              ,
    noRenderReplayNodeForeach               ,
    noRenderReplayNodeForeach_WithClosures  ,
    wrap_RenderReplayNodeForeach            ,


-- ** RenderReplayTextureFilter #signal:RenderReplayTextureFilter#

    C_RenderReplayTextureFilter             ,
    RenderReplayTextureFilter               ,
    RenderReplayTextureFilter_WithClosures  ,
    drop_closures_RenderReplayTextureFilter ,
    dynamic_RenderReplayTextureFilter       ,
    genClosure_RenderReplayTextureFilter    ,
    mk_RenderReplayTextureFilter            ,
    noRenderReplayTextureFilter             ,
    noRenderReplayTextureFilter_WithClosures,
    wrap_RenderReplayTextureFilter          ,




    ) 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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GHashTable as B.GHT
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.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
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 GHC.Records as R
import qualified Data.Word as DW
import qualified Data.Int as DI
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT

-- Workaround for https://gitlab.haskell.org/ghc/ghc/-/issues/23392
#if MIN_VERSION_base(4,18,0)
import qualified GI.Cairo.Structs.Context as Cairo.Context
import qualified GI.GLib.Callbacks as GLib.Callbacks
import qualified GI.GLib.Structs.Bytes as GLib.Bytes
import qualified GI.GLib.Structs.String as GLib.String
import qualified GI.Gdk.Objects.Texture as Gdk.Texture
import qualified GI.Graphene.Structs.Point as Graphene.Point
import qualified GI.Graphene.Structs.Rect as Graphene.Rect
import qualified GI.Graphene.Structs.Vec2 as Graphene.Vec2
import {-# SOURCE #-} qualified GI.Gsk.Enums as Gsk.Enums
import {-# SOURCE #-} qualified GI.Gsk.Flags as Gsk.Flags
import {-# SOURCE #-} qualified GI.Gsk.Objects.RenderNode as Gsk.RenderNode
import {-# SOURCE #-} qualified GI.Gsk.Structs.ParseLocation as Gsk.ParseLocation
import {-# SOURCE #-} qualified GI.Gsk.Structs.Path as Gsk.Path
import {-# SOURCE #-} qualified GI.Gsk.Structs.PathMeasure as Gsk.PathMeasure
import {-# SOURCE #-} qualified GI.Gsk.Structs.PathPoint as Gsk.PathPoint
import {-# SOURCE #-} qualified GI.Gsk.Structs.RenderReplay as Gsk.RenderReplay
import {-# SOURCE #-} qualified GI.Gsk.Structs.Stroke as Gsk.Stroke
import qualified GI.Pango.Objects.Font as Pango.Font

#else
import qualified GI.Gdk.Objects.Texture as Gdk.Texture
import qualified GI.Graphene.Structs.Point as Graphene.Point
import {-# SOURCE #-} qualified GI.Gsk.Enums as Gsk.Enums
import {-# SOURCE #-} qualified GI.Gsk.Objects.RenderNode as Gsk.RenderNode
import {-# SOURCE #-} qualified GI.Gsk.Structs.ParseLocation as Gsk.ParseLocation
import {-# SOURCE #-} qualified GI.Gsk.Structs.Path as Gsk.Path
import {-# SOURCE #-} qualified GI.Gsk.Structs.PathPoint as Gsk.PathPoint
import {-# SOURCE #-} qualified GI.Gsk.Structs.RenderReplay as Gsk.RenderReplay
import qualified GI.Pango.Objects.Font as Pango.Font

#endif

-- callback RenderReplayTextureFilter
{- Callable
  { returnType =
      Just (TInterface Name { namespace = "Gdk" , name = "Texture" })
  , returnMayBeNull = False
  , returnTransfer = TransferEverything
  , returnDocumentation =
      Documentation
        { rawDocText = Just "The filtered texture"
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "replay"
          , argType =
              TInterface Name { namespace = "Gsk" , name = "RenderReplay" }
          , argCType = Just "GskRenderReplay*"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "The replay object used to replay the node"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "texture"
          , argType =
              TInterface Name { namespace = "Gdk" , name = "Texture" }
          , argCType = Just "GdkTexture*"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "The texture to filter"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , argCType = Just "gpointer"
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "The user data" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = True
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "A function that filters textures.\n\nThe function will be called by the default replay function for\nall nodes with textures. They will then generate a node using the\nreturned texture.\n\nIt is valid for the function to return the passed in texture if\nthe texture shuld not be modified."
        , sinceVersion = Just "4.22"
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_RenderReplayTextureFilter =
    Ptr Gsk.RenderReplay.RenderReplay ->
    Ptr Gdk.Texture.Texture ->
    Ptr () ->
    IO (Ptr Gdk.Texture.Texture)

-- Args: [ Arg
--           { argCName = "replay"
--           , argType =
--               TInterface Name { namespace = "Gsk" , name = "RenderReplay" }
--           , argCType = Just "GskRenderReplay*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The replay object used to replay the node"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "texture"
--           , argType =
--               TInterface Name { namespace = "Gdk" , name = "Texture" }
--           , argCType = Just "GdkTexture*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The texture to filter"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "gpointer"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The user data" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = True
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gdk" , name = "Texture" })
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_RenderReplayTextureFilter :: FunPtr C_RenderReplayTextureFilter -> C_RenderReplayTextureFilter

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_RenderReplayTextureFilter ::
    (B.CallStack.HasCallStack, MonadIO m, Gdk.Texture.IsTexture a) =>
    FunPtr C_RenderReplayTextureFilter
    -> Gsk.RenderReplay.RenderReplay
    -- ^ /@replay@/: The replay object used to replay the node
    -> a
    -- ^ /@texture@/: The texture to filter
    -> Ptr ()
    -- ^ /@userData@/: The user data
    -> m Gdk.Texture.Texture
    -- ^ __Returns:__ The filtered texture
dynamic_RenderReplayTextureFilter :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsTexture a) =>
FunPtr C_RenderReplayTextureFilter
-> RenderReplay -> a -> Ptr () -> m Texture
dynamic_RenderReplayTextureFilter FunPtr C_RenderReplayTextureFilter
__funPtr RenderReplay
replay a
texture Ptr ()
userData = IO Texture -> m Texture
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Texture -> m Texture) -> IO Texture -> m Texture
forall a b. (a -> b) -> a -> b
$ do
    replay' <- RenderReplay -> IO (Ptr RenderReplay)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr RenderReplay
replay
    texture' <- unsafeManagedPtrCastPtr texture
    result <- (__dynamic_C_RenderReplayTextureFilter __funPtr) replay' texture' userData
    checkUnexpectedReturnNULL "renderReplayTextureFilter" result
    result' <- (wrapObject Gdk.Texture.Texture) result
    touchManagedPtr replay
    touchManagedPtr texture
    return result'

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

-- | A function that filters textures.
-- 
-- The function will be called by the default replay function for
-- all nodes with textures. They will then generate a node using the
-- returned texture.
-- 
-- It is valid for the function to return the passed in texture if
-- the texture shuld not be modified.
-- 
-- /Since: 4.22/
type RenderReplayTextureFilter =
    Gsk.RenderReplay.RenderReplay
    -- ^ /@replay@/: The replay object used to replay the node
    -> Gdk.Texture.Texture
    -- ^ /@texture@/: The texture to filter
    -> IO Gdk.Texture.Texture
    -- ^ __Returns:__ The filtered texture

-- | A convenience synonym for @`Nothing` :: `Maybe` `RenderReplayTextureFilter`@.
noRenderReplayTextureFilter :: Maybe RenderReplayTextureFilter
noRenderReplayTextureFilter :: Maybe RenderReplayTextureFilter
noRenderReplayTextureFilter = Maybe RenderReplayTextureFilter
forall a. Maybe a
Nothing

-- | A function that filters textures.
-- 
-- The function will be called by the default replay function for
-- all nodes with textures. They will then generate a node using the
-- returned texture.
-- 
-- It is valid for the function to return the passed in texture if
-- the texture shuld not be modified.
-- 
-- /Since: 4.22/
type RenderReplayTextureFilter_WithClosures =
    Gsk.RenderReplay.RenderReplay
    -- ^ /@replay@/: The replay object used to replay the node
    -> Gdk.Texture.Texture
    -- ^ /@texture@/: The texture to filter
    -> Ptr ()
    -- ^ /@userData@/: The user data
    -> IO Gdk.Texture.Texture
    -- ^ __Returns:__ The filtered texture

-- | A convenience synonym for @`Nothing` :: `Maybe` `RenderReplayTextureFilter_WithClosures`@.
noRenderReplayTextureFilter_WithClosures :: Maybe RenderReplayTextureFilter_WithClosures
noRenderReplayTextureFilter_WithClosures :: Maybe RenderReplayTextureFilter_WithClosures
noRenderReplayTextureFilter_WithClosures = Maybe RenderReplayTextureFilter_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_RenderReplayTextureFilter :: RenderReplayTextureFilter -> RenderReplayTextureFilter_WithClosures
drop_closures_RenderReplayTextureFilter :: RenderReplayTextureFilter -> RenderReplayTextureFilter_WithClosures
drop_closures_RenderReplayTextureFilter RenderReplayTextureFilter
_f RenderReplay
replay Texture
texture Ptr ()
_ = RenderReplayTextureFilter
_f RenderReplay
replay Texture
texture

-- | Wrap the callback into a `GClosure`.
genClosure_RenderReplayTextureFilter :: MonadIO m => RenderReplayTextureFilter -> m (GClosure C_RenderReplayTextureFilter)
genClosure_RenderReplayTextureFilter :: forall (m :: * -> *).
MonadIO m =>
RenderReplayTextureFilter
-> m (GClosure C_RenderReplayTextureFilter)
genClosure_RenderReplayTextureFilter RenderReplayTextureFilter
cb = IO (GClosure C_RenderReplayTextureFilter)
-> m (GClosure C_RenderReplayTextureFilter)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_RenderReplayTextureFilter)
 -> m (GClosure C_RenderReplayTextureFilter))
-> IO (GClosure C_RenderReplayTextureFilter)
-> m (GClosure C_RenderReplayTextureFilter)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: RenderReplayTextureFilter_WithClosures
cb' = RenderReplayTextureFilter -> RenderReplayTextureFilter_WithClosures
drop_closures_RenderReplayTextureFilter RenderReplayTextureFilter
cb
    let cb'' :: C_RenderReplayTextureFilter
cb'' = Maybe (Ptr (FunPtr C_RenderReplayTextureFilter))
-> RenderReplayTextureFilter_WithClosures
-> C_RenderReplayTextureFilter
wrap_RenderReplayTextureFilter Maybe (Ptr (FunPtr C_RenderReplayTextureFilter))
forall a. Maybe a
Nothing RenderReplayTextureFilter_WithClosures
cb'
    C_RenderReplayTextureFilter
-> IO (FunPtr C_RenderReplayTextureFilter)
mk_RenderReplayTextureFilter C_RenderReplayTextureFilter
cb'' IO (FunPtr C_RenderReplayTextureFilter)
-> (FunPtr C_RenderReplayTextureFilter
    -> IO (GClosure C_RenderReplayTextureFilter))
-> IO (GClosure C_RenderReplayTextureFilter)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_RenderReplayTextureFilter
-> IO (GClosure C_RenderReplayTextureFilter)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `RenderReplayTextureFilter` into a `C_RenderReplayTextureFilter`.
wrap_RenderReplayTextureFilter :: 
    Maybe (Ptr (FunPtr C_RenderReplayTextureFilter)) ->
    RenderReplayTextureFilter_WithClosures ->
    C_RenderReplayTextureFilter
wrap_RenderReplayTextureFilter :: Maybe (Ptr (FunPtr C_RenderReplayTextureFilter))
-> RenderReplayTextureFilter_WithClosures
-> C_RenderReplayTextureFilter
wrap_RenderReplayTextureFilter Maybe (Ptr (FunPtr C_RenderReplayTextureFilter))
gi'funptrptr RenderReplayTextureFilter_WithClosures
gi'cb Ptr RenderReplay
replay Ptr Texture
texture Ptr ()
userData = do
    replay' <- ((ManagedPtr RenderReplay -> RenderReplay)
-> Ptr RenderReplay -> IO RenderReplay
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr RenderReplay -> RenderReplay
Gsk.RenderReplay.RenderReplay) Ptr RenderReplay
replay
    texture' <- (newObject Gdk.Texture.Texture) texture
    result <- gi'cb  replay' texture' userData
    maybeReleaseFunPtr gi'funptrptr
    result' <- B.ManagedPtr.disownObject result
    return result'


-- callback RenderReplayNodeForeach
{- Callable
  { returnType = Just (TBasicType TBoolean)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just
              "TRUE to descend into this node's child nodes (if any)\n  or FALSE to skip them"
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "replay"
          , argType =
              TInterface Name { namespace = "Gsk" , name = "RenderReplay" }
          , argCType = Just "GskRenderReplay*"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "The replay object used to replay the node"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "node"
          , argType =
              TInterface Name { namespace = "Gsk" , name = "RenderNode" }
          , argCType = Just "GskRenderNode*"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "The node to replay" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , argCType = Just "gpointer"
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "The user data" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = True
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "A function called for every node.\n\nIf this function returns TRUE, the replay will continue and call\nthe filter function.\n\nIf it returns FALSE, the filter function will not be called and\nany child nodes will be skipped."
        , sinceVersion = Just "4.22"
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_RenderReplayNodeForeach =
    Ptr Gsk.RenderReplay.RenderReplay ->
    Ptr Gsk.RenderNode.RenderNode ->
    Ptr () ->
    IO CInt

-- Args: [ Arg
--           { argCName = "replay"
--           , argType =
--               TInterface Name { namespace = "Gsk" , name = "RenderReplay" }
--           , argCType = Just "GskRenderReplay*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The replay object used to replay the node"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "node"
--           , argType =
--               TInterface Name { namespace = "Gsk" , name = "RenderNode" }
--           , argCType = Just "GskRenderNode*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The node to replay" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "gpointer"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The user data" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = True
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_RenderReplayNodeForeach :: FunPtr C_RenderReplayNodeForeach -> C_RenderReplayNodeForeach

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_RenderReplayNodeForeach ::
    (B.CallStack.HasCallStack, MonadIO m, Gsk.RenderNode.IsRenderNode a) =>
    FunPtr C_RenderReplayNodeForeach
    -> Gsk.RenderReplay.RenderReplay
    -- ^ /@replay@/: The replay object used to replay the node
    -> a
    -- ^ /@node@/: The node to replay
    -> Ptr ()
    -- ^ /@userData@/: The user data
    -> m Bool
    -- ^ __Returns:__ TRUE to descend into this node\'s child nodes (if any)
    --   or FALSE to skip them
dynamic_RenderReplayNodeForeach :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsRenderNode a) =>
FunPtr C_RenderReplayNodeForeach
-> RenderReplay -> a -> Ptr () -> m Bool
dynamic_RenderReplayNodeForeach FunPtr C_RenderReplayNodeForeach
__funPtr RenderReplay
replay a
node Ptr ()
userData = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    replay' <- RenderReplay -> IO (Ptr RenderReplay)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr RenderReplay
replay
    node' <- unsafeManagedPtrCastPtr node
    result <- (__dynamic_C_RenderReplayNodeForeach __funPtr) replay' node' userData
    let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    touchManagedPtr replay
    touchManagedPtr node
    return result'

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

-- | A function called for every node.
-- 
-- If this function returns TRUE, the replay will continue and call
-- the filter function.
-- 
-- If it returns FALSE, the filter function will not be called and
-- any child nodes will be skipped.
-- 
-- /Since: 4.22/
type RenderReplayNodeForeach =
    Gsk.RenderReplay.RenderReplay
    -- ^ /@replay@/: The replay object used to replay the node
    -> Gsk.RenderNode.RenderNode
    -- ^ /@node@/: The node to replay
    -> IO Bool
    -- ^ __Returns:__ TRUE to descend into this node\'s child nodes (if any)
    --   or FALSE to skip them

-- | A convenience synonym for @`Nothing` :: `Maybe` `RenderReplayNodeForeach`@.
noRenderReplayNodeForeach :: Maybe RenderReplayNodeForeach
noRenderReplayNodeForeach :: Maybe RenderReplayNodeForeach
noRenderReplayNodeForeach = Maybe RenderReplayNodeForeach
forall a. Maybe a
Nothing

-- | A function called for every node.
-- 
-- If this function returns TRUE, the replay will continue and call
-- the filter function.
-- 
-- If it returns FALSE, the filter function will not be called and
-- any child nodes will be skipped.
-- 
-- /Since: 4.22/
type RenderReplayNodeForeach_WithClosures =
    Gsk.RenderReplay.RenderReplay
    -- ^ /@replay@/: The replay object used to replay the node
    -> Gsk.RenderNode.RenderNode
    -- ^ /@node@/: The node to replay
    -> Ptr ()
    -- ^ /@userData@/: The user data
    -> IO Bool
    -- ^ __Returns:__ TRUE to descend into this node\'s child nodes (if any)
    --   or FALSE to skip them

-- | A convenience synonym for @`Nothing` :: `Maybe` `RenderReplayNodeForeach_WithClosures`@.
noRenderReplayNodeForeach_WithClosures :: Maybe RenderReplayNodeForeach_WithClosures
noRenderReplayNodeForeach_WithClosures :: Maybe RenderReplayNodeForeach_WithClosures
noRenderReplayNodeForeach_WithClosures = Maybe RenderReplayNodeForeach_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_RenderReplayNodeForeach :: RenderReplayNodeForeach -> RenderReplayNodeForeach_WithClosures
drop_closures_RenderReplayNodeForeach :: RenderReplayNodeForeach -> RenderReplayNodeForeach_WithClosures
drop_closures_RenderReplayNodeForeach RenderReplayNodeForeach
_f RenderReplay
replay RenderNode
node Ptr ()
_ = RenderReplayNodeForeach
_f RenderReplay
replay RenderNode
node

-- | Wrap the callback into a `GClosure`.
genClosure_RenderReplayNodeForeach :: MonadIO m => RenderReplayNodeForeach -> m (GClosure C_RenderReplayNodeForeach)
genClosure_RenderReplayNodeForeach :: forall (m :: * -> *).
MonadIO m =>
RenderReplayNodeForeach -> m (GClosure C_RenderReplayNodeForeach)
genClosure_RenderReplayNodeForeach RenderReplayNodeForeach
cb = IO (GClosure C_RenderReplayNodeForeach)
-> m (GClosure C_RenderReplayNodeForeach)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_RenderReplayNodeForeach)
 -> m (GClosure C_RenderReplayNodeForeach))
-> IO (GClosure C_RenderReplayNodeForeach)
-> m (GClosure C_RenderReplayNodeForeach)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: RenderReplayNodeForeach_WithClosures
cb' = RenderReplayNodeForeach -> RenderReplayNodeForeach_WithClosures
drop_closures_RenderReplayNodeForeach RenderReplayNodeForeach
cb
    let cb'' :: C_RenderReplayNodeForeach
cb'' = Maybe (Ptr (FunPtr C_RenderReplayNodeForeach))
-> RenderReplayNodeForeach_WithClosures
-> C_RenderReplayNodeForeach
wrap_RenderReplayNodeForeach Maybe (Ptr (FunPtr C_RenderReplayNodeForeach))
forall a. Maybe a
Nothing RenderReplayNodeForeach_WithClosures
cb'
    C_RenderReplayNodeForeach -> IO (FunPtr C_RenderReplayNodeForeach)
mk_RenderReplayNodeForeach C_RenderReplayNodeForeach
cb'' IO (FunPtr C_RenderReplayNodeForeach)
-> (FunPtr C_RenderReplayNodeForeach
    -> IO (GClosure C_RenderReplayNodeForeach))
-> IO (GClosure C_RenderReplayNodeForeach)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_RenderReplayNodeForeach
-> IO (GClosure C_RenderReplayNodeForeach)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `RenderReplayNodeForeach` into a `C_RenderReplayNodeForeach`.
wrap_RenderReplayNodeForeach :: 
    Maybe (Ptr (FunPtr C_RenderReplayNodeForeach)) ->
    RenderReplayNodeForeach_WithClosures ->
    C_RenderReplayNodeForeach
wrap_RenderReplayNodeForeach :: Maybe (Ptr (FunPtr C_RenderReplayNodeForeach))
-> RenderReplayNodeForeach_WithClosures
-> C_RenderReplayNodeForeach
wrap_RenderReplayNodeForeach Maybe (Ptr (FunPtr C_RenderReplayNodeForeach))
gi'funptrptr RenderReplayNodeForeach_WithClosures
gi'cb Ptr RenderReplay
replay Ptr RenderNode
node Ptr ()
userData = do
    replay' <- ((ManagedPtr RenderReplay -> RenderReplay)
-> Ptr RenderReplay -> IO RenderReplay
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr RenderReplay -> RenderReplay
Gsk.RenderReplay.RenderReplay) Ptr RenderReplay
replay
    node' <- (newPtr Gsk.RenderNode.RenderNode) node
    result <- gi'cb  replay' node' userData
    maybeReleaseFunPtr gi'funptrptr
    let result' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
P.fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
P.fromEnum) Bool
result
    return result'


-- callback RenderReplayNodeFilter
{- Callable
  { returnType =
      Just (TInterface Name { namespace = "Gsk" , name = "RenderNode" })
  , returnMayBeNull = True
  , returnTransfer = TransferEverything
  , returnDocumentation =
      Documentation
        { rawDocText = Just "The replayed node" , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "replay"
          , argType =
              TInterface Name { namespace = "Gsk" , name = "RenderReplay" }
          , argCType = Just "GskRenderReplay*"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "The replay object used to replay the node"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "node"
          , argType =
              TInterface Name { namespace = "Gsk" , name = "RenderNode" }
          , argCType = Just "GskRenderNode*"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "The node to replay" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , argCType = Just "gpointer"
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "The user data" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = True
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "A function to replay a node.\n\nThe node may be returned unmodified.\n\nThe node may be discarded by returning %NULL.\n\nIf you do not want to do any handling yourself, call\n[method@Gsk.RenderReplay.default] to use the default handler\nthat calls your function on the children of the node."
        , sinceVersion = Just "4.22"
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_RenderReplayNodeFilter =
    Ptr Gsk.RenderReplay.RenderReplay ->
    Ptr Gsk.RenderNode.RenderNode ->
    Ptr () ->
    IO (Ptr Gsk.RenderNode.RenderNode)

-- Args: [ Arg
--           { argCName = "replay"
--           , argType =
--               TInterface Name { namespace = "Gsk" , name = "RenderReplay" }
--           , argCType = Just "GskRenderReplay*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The replay object used to replay the node"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "node"
--           , argType =
--               TInterface Name { namespace = "Gsk" , name = "RenderNode" }
--           , argCType = Just "GskRenderNode*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The node to replay" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "gpointer"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The user data" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = True
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Gsk" , name = "RenderNode" })
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_RenderReplayNodeFilter :: FunPtr C_RenderReplayNodeFilter -> C_RenderReplayNodeFilter

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_RenderReplayNodeFilter ::
    (B.CallStack.HasCallStack, MonadIO m, Gsk.RenderNode.IsRenderNode a) =>
    FunPtr C_RenderReplayNodeFilter
    -> Gsk.RenderReplay.RenderReplay
    -- ^ /@replay@/: The replay object used to replay the node
    -> a
    -- ^ /@node@/: The node to replay
    -> Ptr ()
    -- ^ /@userData@/: The user data
    -> m (Maybe Gsk.RenderNode.RenderNode)
    -- ^ __Returns:__ The replayed node
dynamic_RenderReplayNodeFilter :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsRenderNode a) =>
FunPtr C_RenderReplayNodeFilter
-> RenderReplay -> a -> Ptr () -> m (Maybe RenderNode)
dynamic_RenderReplayNodeFilter FunPtr C_RenderReplayNodeFilter
__funPtr RenderReplay
replay a
node Ptr ()
userData = IO (Maybe RenderNode) -> m (Maybe RenderNode)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe RenderNode) -> m (Maybe RenderNode))
-> IO (Maybe RenderNode) -> m (Maybe RenderNode)
forall a b. (a -> b) -> a -> b
$ do
    replay' <- RenderReplay -> IO (Ptr RenderReplay)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr RenderReplay
replay
    node' <- unsafeManagedPtrCastPtr node
    result <- (__dynamic_C_RenderReplayNodeFilter __funPtr) replay' node' userData
    maybeResult <- convertIfNonNull result $ \Ptr RenderNode
result' -> do
        result'' <- ((ManagedPtr RenderNode -> RenderNode)
-> Ptr RenderNode -> IO RenderNode
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr RenderNode -> RenderNode
Gsk.RenderNode.RenderNode) Ptr RenderNode
result'
        return result''
    touchManagedPtr replay
    touchManagedPtr node
    return maybeResult

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

-- | A function to replay a node.
-- 
-- The node may be returned unmodified.
-- 
-- The node may be discarded by returning 'P.Nothing'.
-- 
-- If you do not want to do any handling yourself, call
-- 'GI.Gsk.Structs.RenderReplay.renderReplayDefault' to use the default handler
-- that calls your function on the children of the node.
-- 
-- /Since: 4.22/
type RenderReplayNodeFilter =
    Gsk.RenderReplay.RenderReplay
    -- ^ /@replay@/: The replay object used to replay the node
    -> Gsk.RenderNode.RenderNode
    -- ^ /@node@/: The node to replay
    -> IO (Maybe Gsk.RenderNode.RenderNode)
    -- ^ __Returns:__ The replayed node

-- | A convenience synonym for @`Nothing` :: `Maybe` `RenderReplayNodeFilter`@.
noRenderReplayNodeFilter :: Maybe RenderReplayNodeFilter
noRenderReplayNodeFilter :: Maybe RenderReplayNodeFilter
noRenderReplayNodeFilter = Maybe RenderReplayNodeFilter
forall a. Maybe a
Nothing

-- | A function to replay a node.
-- 
-- The node may be returned unmodified.
-- 
-- The node may be discarded by returning 'P.Nothing'.
-- 
-- If you do not want to do any handling yourself, call
-- 'GI.Gsk.Structs.RenderReplay.renderReplayDefault' to use the default handler
-- that calls your function on the children of the node.
-- 
-- /Since: 4.22/
type RenderReplayNodeFilter_WithClosures =
    Gsk.RenderReplay.RenderReplay
    -- ^ /@replay@/: The replay object used to replay the node
    -> Gsk.RenderNode.RenderNode
    -- ^ /@node@/: The node to replay
    -> Ptr ()
    -- ^ /@userData@/: The user data
    -> IO (Maybe Gsk.RenderNode.RenderNode)
    -- ^ __Returns:__ The replayed node

-- | A convenience synonym for @`Nothing` :: `Maybe` `RenderReplayNodeFilter_WithClosures`@.
noRenderReplayNodeFilter_WithClosures :: Maybe RenderReplayNodeFilter_WithClosures
noRenderReplayNodeFilter_WithClosures :: Maybe RenderReplayNodeFilter_WithClosures
noRenderReplayNodeFilter_WithClosures = Maybe RenderReplayNodeFilter_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_RenderReplayNodeFilter :: RenderReplayNodeFilter -> RenderReplayNodeFilter_WithClosures
drop_closures_RenderReplayNodeFilter :: RenderReplayNodeFilter -> RenderReplayNodeFilter_WithClosures
drop_closures_RenderReplayNodeFilter RenderReplayNodeFilter
_f RenderReplay
replay RenderNode
node Ptr ()
_ = RenderReplayNodeFilter
_f RenderReplay
replay RenderNode
node

-- | Wrap the callback into a `GClosure`.
genClosure_RenderReplayNodeFilter :: MonadIO m => RenderReplayNodeFilter -> m (GClosure C_RenderReplayNodeFilter)
genClosure_RenderReplayNodeFilter :: forall (m :: * -> *).
MonadIO m =>
RenderReplayNodeFilter -> m (GClosure C_RenderReplayNodeFilter)
genClosure_RenderReplayNodeFilter RenderReplayNodeFilter
cb = IO (GClosure C_RenderReplayNodeFilter)
-> m (GClosure C_RenderReplayNodeFilter)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_RenderReplayNodeFilter)
 -> m (GClosure C_RenderReplayNodeFilter))
-> IO (GClosure C_RenderReplayNodeFilter)
-> m (GClosure C_RenderReplayNodeFilter)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: RenderReplayNodeFilter_WithClosures
cb' = RenderReplayNodeFilter -> RenderReplayNodeFilter_WithClosures
drop_closures_RenderReplayNodeFilter RenderReplayNodeFilter
cb
    let cb'' :: C_RenderReplayNodeFilter
cb'' = Maybe (Ptr (FunPtr C_RenderReplayNodeFilter))
-> RenderReplayNodeFilter_WithClosures -> C_RenderReplayNodeFilter
wrap_RenderReplayNodeFilter Maybe (Ptr (FunPtr C_RenderReplayNodeFilter))
forall a. Maybe a
Nothing RenderReplayNodeFilter_WithClosures
cb'
    C_RenderReplayNodeFilter -> IO (FunPtr C_RenderReplayNodeFilter)
mk_RenderReplayNodeFilter C_RenderReplayNodeFilter
cb'' IO (FunPtr C_RenderReplayNodeFilter)
-> (FunPtr C_RenderReplayNodeFilter
    -> IO (GClosure C_RenderReplayNodeFilter))
-> IO (GClosure C_RenderReplayNodeFilter)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_RenderReplayNodeFilter
-> IO (GClosure C_RenderReplayNodeFilter)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `RenderReplayNodeFilter` into a `C_RenderReplayNodeFilter`.
wrap_RenderReplayNodeFilter :: 
    Maybe (Ptr (FunPtr C_RenderReplayNodeFilter)) ->
    RenderReplayNodeFilter_WithClosures ->
    C_RenderReplayNodeFilter
wrap_RenderReplayNodeFilter :: Maybe (Ptr (FunPtr C_RenderReplayNodeFilter))
-> RenderReplayNodeFilter_WithClosures -> C_RenderReplayNodeFilter
wrap_RenderReplayNodeFilter Maybe (Ptr (FunPtr C_RenderReplayNodeFilter))
gi'funptrptr RenderReplayNodeFilter_WithClosures
gi'cb Ptr RenderReplay
replay Ptr RenderNode
node Ptr ()
userData = do
    replay' <- ((ManagedPtr RenderReplay -> RenderReplay)
-> Ptr RenderReplay -> IO RenderReplay
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr RenderReplay -> RenderReplay
Gsk.RenderReplay.RenderReplay) Ptr RenderReplay
replay
    node' <- (newPtr Gsk.RenderNode.RenderNode) node
    result <- gi'cb  replay' node' userData
    maybeReleaseFunPtr gi'funptrptr
    maybeM FP.nullPtr result $ \RenderNode
result' -> do
        result'' <- RenderNode -> IO (Ptr RenderNode)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
B.ManagedPtr.disownManagedPtr RenderNode
result'
        return result''


-- callback RenderReplayFontFilter
{- Callable
  { returnType =
      Just (TInterface Name { namespace = "Pango" , name = "Font" })
  , returnMayBeNull = False
  , returnTransfer = TransferEverything
  , returnDocumentation =
      Documentation
        { rawDocText = Just "The filtered font" , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "replay"
          , argType =
              TInterface Name { namespace = "Gsk" , name = "RenderReplay" }
          , argCType = Just "GskRenderReplay*"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "The replay object used to replay the node"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "font"
          , argType = TInterface Name { namespace = "Pango" , name = "Font" }
          , argCType = Just "PangoFont*"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "The font to filter" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , argCType = Just "gpointer"
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "The user data" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = True
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "A function that filters fonts.\n\nThe function will be called by the default replay function for\nall nodes with fonts. They will then generate a node using the\nreturned font.\n\nIt is valid for the function to return the passed in font if\nthe font shuld not be modified."
        , sinceVersion = Just "4.22"
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_RenderReplayFontFilter =
    Ptr Gsk.RenderReplay.RenderReplay ->
    Ptr Pango.Font.Font ->
    Ptr () ->
    IO (Ptr Pango.Font.Font)

-- Args: [ Arg
--           { argCName = "replay"
--           , argType =
--               TInterface Name { namespace = "Gsk" , name = "RenderReplay" }
--           , argCType = Just "GskRenderReplay*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The replay object used to replay the node"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "font"
--           , argType = TInterface Name { namespace = "Pango" , name = "Font" }
--           , argCType = Just "PangoFont*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The font to filter" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "gpointer"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The user data" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = True
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Pango" , name = "Font" })
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_RenderReplayFontFilter :: FunPtr C_RenderReplayFontFilter -> C_RenderReplayFontFilter

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_RenderReplayFontFilter ::
    (B.CallStack.HasCallStack, MonadIO m, Pango.Font.IsFont a) =>
    FunPtr C_RenderReplayFontFilter
    -> Gsk.RenderReplay.RenderReplay
    -- ^ /@replay@/: The replay object used to replay the node
    -> a
    -- ^ /@font@/: The font to filter
    -> Ptr ()
    -- ^ /@userData@/: The user data
    -> m Pango.Font.Font
    -- ^ __Returns:__ The filtered font
dynamic_RenderReplayFontFilter :: forall (m :: * -> *) a.
(HasCallStack, MonadIO m, IsFont a) =>
FunPtr C_RenderReplayFontFilter
-> RenderReplay -> a -> Ptr () -> m Font
dynamic_RenderReplayFontFilter FunPtr C_RenderReplayFontFilter
__funPtr RenderReplay
replay a
font Ptr ()
userData = IO Font -> m Font
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Font -> m Font) -> IO Font -> m Font
forall a b. (a -> b) -> a -> b
$ do
    replay' <- RenderReplay -> IO (Ptr RenderReplay)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr RenderReplay
replay
    font' <- unsafeManagedPtrCastPtr font
    result <- (__dynamic_C_RenderReplayFontFilter __funPtr) replay' font' userData
    checkUnexpectedReturnNULL "renderReplayFontFilter" result
    result' <- (wrapObject Pango.Font.Font) result
    touchManagedPtr replay
    touchManagedPtr font
    return result'

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

-- | A function that filters fonts.
-- 
-- The function will be called by the default replay function for
-- all nodes with fonts. They will then generate a node using the
-- returned font.
-- 
-- It is valid for the function to return the passed in font if
-- the font shuld not be modified.
-- 
-- /Since: 4.22/
type RenderReplayFontFilter =
    Gsk.RenderReplay.RenderReplay
    -- ^ /@replay@/: The replay object used to replay the node
    -> Pango.Font.Font
    -- ^ /@font@/: The font to filter
    -> IO Pango.Font.Font
    -- ^ __Returns:__ The filtered font

-- | A convenience synonym for @`Nothing` :: `Maybe` `RenderReplayFontFilter`@.
noRenderReplayFontFilter :: Maybe RenderReplayFontFilter
noRenderReplayFontFilter :: Maybe RenderReplayFontFilter
noRenderReplayFontFilter = Maybe RenderReplayFontFilter
forall a. Maybe a
Nothing

-- | A function that filters fonts.
-- 
-- The function will be called by the default replay function for
-- all nodes with fonts. They will then generate a node using the
-- returned font.
-- 
-- It is valid for the function to return the passed in font if
-- the font shuld not be modified.
-- 
-- /Since: 4.22/
type RenderReplayFontFilter_WithClosures =
    Gsk.RenderReplay.RenderReplay
    -- ^ /@replay@/: The replay object used to replay the node
    -> Pango.Font.Font
    -- ^ /@font@/: The font to filter
    -> Ptr ()
    -- ^ /@userData@/: The user data
    -> IO Pango.Font.Font
    -- ^ __Returns:__ The filtered font

-- | A convenience synonym for @`Nothing` :: `Maybe` `RenderReplayFontFilter_WithClosures`@.
noRenderReplayFontFilter_WithClosures :: Maybe RenderReplayFontFilter_WithClosures
noRenderReplayFontFilter_WithClosures :: Maybe RenderReplayFontFilter_WithClosures
noRenderReplayFontFilter_WithClosures = Maybe RenderReplayFontFilter_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_RenderReplayFontFilter :: RenderReplayFontFilter -> RenderReplayFontFilter_WithClosures
drop_closures_RenderReplayFontFilter :: RenderReplayFontFilter -> RenderReplayFontFilter_WithClosures
drop_closures_RenderReplayFontFilter RenderReplayFontFilter
_f RenderReplay
replay Font
font Ptr ()
_ = RenderReplayFontFilter
_f RenderReplay
replay Font
font

-- | Wrap the callback into a `GClosure`.
genClosure_RenderReplayFontFilter :: MonadIO m => RenderReplayFontFilter -> m (GClosure C_RenderReplayFontFilter)
genClosure_RenderReplayFontFilter :: forall (m :: * -> *).
MonadIO m =>
RenderReplayFontFilter -> m (GClosure C_RenderReplayFontFilter)
genClosure_RenderReplayFontFilter RenderReplayFontFilter
cb = IO (GClosure C_RenderReplayFontFilter)
-> m (GClosure C_RenderReplayFontFilter)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_RenderReplayFontFilter)
 -> m (GClosure C_RenderReplayFontFilter))
-> IO (GClosure C_RenderReplayFontFilter)
-> m (GClosure C_RenderReplayFontFilter)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: RenderReplayFontFilter_WithClosures
cb' = RenderReplayFontFilter -> RenderReplayFontFilter_WithClosures
drop_closures_RenderReplayFontFilter RenderReplayFontFilter
cb
    let cb'' :: C_RenderReplayFontFilter
cb'' = Maybe (Ptr (FunPtr C_RenderReplayFontFilter))
-> RenderReplayFontFilter_WithClosures -> C_RenderReplayFontFilter
wrap_RenderReplayFontFilter Maybe (Ptr (FunPtr C_RenderReplayFontFilter))
forall a. Maybe a
Nothing RenderReplayFontFilter_WithClosures
cb'
    C_RenderReplayFontFilter -> IO (FunPtr C_RenderReplayFontFilter)
mk_RenderReplayFontFilter C_RenderReplayFontFilter
cb'' IO (FunPtr C_RenderReplayFontFilter)
-> (FunPtr C_RenderReplayFontFilter
    -> IO (GClosure C_RenderReplayFontFilter))
-> IO (GClosure C_RenderReplayFontFilter)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_RenderReplayFontFilter
-> IO (GClosure C_RenderReplayFontFilter)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `RenderReplayFontFilter` into a `C_RenderReplayFontFilter`.
wrap_RenderReplayFontFilter :: 
    Maybe (Ptr (FunPtr C_RenderReplayFontFilter)) ->
    RenderReplayFontFilter_WithClosures ->
    C_RenderReplayFontFilter
wrap_RenderReplayFontFilter :: Maybe (Ptr (FunPtr C_RenderReplayFontFilter))
-> RenderReplayFontFilter_WithClosures -> C_RenderReplayFontFilter
wrap_RenderReplayFontFilter Maybe (Ptr (FunPtr C_RenderReplayFontFilter))
gi'funptrptr RenderReplayFontFilter_WithClosures
gi'cb Ptr RenderReplay
replay Ptr Font
font Ptr ()
userData = do
    replay' <- ((ManagedPtr RenderReplay -> RenderReplay)
-> Ptr RenderReplay -> IO RenderReplay
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr RenderReplay -> RenderReplay
Gsk.RenderReplay.RenderReplay) Ptr RenderReplay
replay
    font' <- (newObject Pango.Font.Font) font
    result <- gi'cb  replay' font' userData
    maybeReleaseFunPtr gi'funptrptr
    result' <- B.ManagedPtr.disownObject result
    return result'


-- callback PathIntersectionFunc
{- Callable
  { returnType = Just (TBasicType TBoolean)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just
              "true to continue iterating, false to\n  stop the iteration and not call the function again"
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "path1"
          , argType = TInterface Name { namespace = "Gsk" , name = "Path" }
          , argCType = Just "GskPath*"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the first path" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "point1"
          , argType =
              TInterface Name { namespace = "Gsk" , name = "PathPoint" }
          , argCType = Just "const GskPathPoint*"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the intersection as point on @path1"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "path2"
          , argType = TInterface Name { namespace = "Gsk" , name = "Path" }
          , argCType = Just "GskPath*"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the second path" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "point2"
          , argType =
              TInterface Name { namespace = "Gsk" , name = "PathPoint" }
          , argCType = Just "const GskPathPoint*"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the intersection as point on @path2"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "kind"
          , argType =
              TInterface Name { namespace = "Gsk" , name = "PathIntersection" }
          , argCType = Just "GskPathIntersection"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the nature of the intersection"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , argCType = Just "gpointer"
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "user data" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = True
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "Prototype of the callback to iterate through the\nintersections of two paths."
        , sinceVersion = Just "4.20"
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_PathIntersectionFunc =
    Ptr Gsk.Path.Path ->
    Ptr Gsk.PathPoint.PathPoint ->
    Ptr Gsk.Path.Path ->
    Ptr Gsk.PathPoint.PathPoint ->
    CUInt ->
    Ptr () ->
    IO CInt

-- Args: [ Arg
--           { argCName = "path1"
--           , argType = TInterface Name { namespace = "Gsk" , name = "Path" }
--           , argCType = Just "GskPath*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the first path" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "point1"
--           , argType =
--               TInterface Name { namespace = "Gsk" , name = "PathPoint" }
--           , argCType = Just "const GskPathPoint*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the intersection as point on @path1"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "path2"
--           , argType = TInterface Name { namespace = "Gsk" , name = "Path" }
--           , argCType = Just "GskPath*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the second path" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "point2"
--           , argType =
--               TInterface Name { namespace = "Gsk" , name = "PathPoint" }
--           , argCType = Just "const GskPathPoint*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the intersection as point on @path2"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "kind"
--           , argType =
--               TInterface Name { namespace = "Gsk" , name = "PathIntersection" }
--           , argCType = Just "GskPathIntersection"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the nature of the intersection"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "gpointer"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "user data" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = True
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_PathIntersectionFunc :: FunPtr C_PathIntersectionFunc -> C_PathIntersectionFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PathIntersectionFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_PathIntersectionFunc
    -> Gsk.Path.Path
    -- ^ /@path1@/: the first path
    -> Gsk.PathPoint.PathPoint
    -- ^ /@point1@/: the intersection as point on /@path1@/
    -> Gsk.Path.Path
    -- ^ /@path2@/: the second path
    -> Gsk.PathPoint.PathPoint
    -- ^ /@point2@/: the intersection as point on /@path2@/
    -> Gsk.Enums.PathIntersection
    -- ^ /@kind@/: the nature of the intersection
    -> Ptr ()
    -- ^ /@userData@/: user data
    -> m Bool
    -- ^ __Returns:__ true to continue iterating, false to
    --   stop the iteration and not call the function again
dynamic_PathIntersectionFunc :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
FunPtr C_PathIntersectionFunc
-> Path
-> PathPoint
-> Path
-> PathPoint
-> PathIntersection
-> Ptr ()
-> m Bool
dynamic_PathIntersectionFunc FunPtr C_PathIntersectionFunc
__funPtr Path
path1 PathPoint
point1 Path
path2 PathPoint
point2 PathIntersection
kind Ptr ()
userData = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    path1' <- Path -> IO (Ptr Path)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Path
path1
    point1' <- unsafeManagedPtrGetPtr point1
    path2' <- unsafeManagedPtrGetPtr path2
    point2' <- unsafeManagedPtrGetPtr point2
    let kind' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt)
-> (PathIntersection -> Int) -> PathIntersection -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PathIntersection -> Int
forall a. Enum a => a -> Int
fromEnum) PathIntersection
kind
    result <- (__dynamic_C_PathIntersectionFunc __funPtr) path1' point1' path2' point2' kind' userData
    let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    touchManagedPtr path1
    touchManagedPtr point1
    touchManagedPtr path2
    touchManagedPtr point2
    return result'

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

-- | Prototype of the callback to iterate through the
-- intersections of two paths.
-- 
-- /Since: 4.20/
type PathIntersectionFunc =
    Gsk.Path.Path
    -- ^ /@path1@/: the first path
    -> Gsk.PathPoint.PathPoint
    -- ^ /@point1@/: the intersection as point on /@path1@/
    -> Gsk.Path.Path
    -- ^ /@path2@/: the second path
    -> Gsk.PathPoint.PathPoint
    -- ^ /@point2@/: the intersection as point on /@path2@/
    -> Gsk.Enums.PathIntersection
    -- ^ /@kind@/: the nature of the intersection
    -> IO Bool
    -- ^ __Returns:__ true to continue iterating, false to
    --   stop the iteration and not call the function again

-- | A convenience synonym for @`Nothing` :: `Maybe` `PathIntersectionFunc`@.
noPathIntersectionFunc :: Maybe PathIntersectionFunc
noPathIntersectionFunc :: Maybe PathIntersectionFunc
noPathIntersectionFunc = Maybe PathIntersectionFunc
forall a. Maybe a
Nothing

-- | Prototype of the callback to iterate through the
-- intersections of two paths.
-- 
-- /Since: 4.20/
type PathIntersectionFunc_WithClosures =
    Gsk.Path.Path
    -- ^ /@path1@/: the first path
    -> Gsk.PathPoint.PathPoint
    -- ^ /@point1@/: the intersection as point on /@path1@/
    -> Gsk.Path.Path
    -- ^ /@path2@/: the second path
    -> Gsk.PathPoint.PathPoint
    -- ^ /@point2@/: the intersection as point on /@path2@/
    -> Gsk.Enums.PathIntersection
    -- ^ /@kind@/: the nature of the intersection
    -> Ptr ()
    -- ^ /@userData@/: user data
    -> IO Bool
    -- ^ __Returns:__ true to continue iterating, false to
    --   stop the iteration and not call the function again

-- | A convenience synonym for @`Nothing` :: `Maybe` `PathIntersectionFunc_WithClosures`@.
noPathIntersectionFunc_WithClosures :: Maybe PathIntersectionFunc_WithClosures
noPathIntersectionFunc_WithClosures :: Maybe PathIntersectionFunc_WithClosures
noPathIntersectionFunc_WithClosures = Maybe PathIntersectionFunc_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_PathIntersectionFunc :: PathIntersectionFunc -> PathIntersectionFunc_WithClosures
drop_closures_PathIntersectionFunc :: PathIntersectionFunc -> PathIntersectionFunc_WithClosures
drop_closures_PathIntersectionFunc PathIntersectionFunc
_f Path
path1 PathPoint
point1 Path
path2 PathPoint
point2 PathIntersection
kind Ptr ()
_ = PathIntersectionFunc
_f Path
path1 PathPoint
point1 Path
path2 PathPoint
point2 PathIntersection
kind

-- | Wrap the callback into a `GClosure`.
genClosure_PathIntersectionFunc :: MonadIO m => PathIntersectionFunc -> m (GClosure C_PathIntersectionFunc)
genClosure_PathIntersectionFunc :: forall (m :: * -> *).
MonadIO m =>
PathIntersectionFunc -> m (GClosure C_PathIntersectionFunc)
genClosure_PathIntersectionFunc PathIntersectionFunc
cb = IO (GClosure C_PathIntersectionFunc)
-> m (GClosure C_PathIntersectionFunc)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_PathIntersectionFunc)
 -> m (GClosure C_PathIntersectionFunc))
-> IO (GClosure C_PathIntersectionFunc)
-> m (GClosure C_PathIntersectionFunc)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: PathIntersectionFunc_WithClosures
cb' = PathIntersectionFunc -> PathIntersectionFunc_WithClosures
drop_closures_PathIntersectionFunc PathIntersectionFunc
cb
    let cb'' :: C_PathIntersectionFunc
cb'' = Maybe (Ptr (FunPtr C_PathIntersectionFunc))
-> PathIntersectionFunc_WithClosures -> C_PathIntersectionFunc
wrap_PathIntersectionFunc Maybe (Ptr (FunPtr C_PathIntersectionFunc))
forall a. Maybe a
Nothing PathIntersectionFunc_WithClosures
cb'
    C_PathIntersectionFunc -> IO (FunPtr C_PathIntersectionFunc)
mk_PathIntersectionFunc C_PathIntersectionFunc
cb'' IO (FunPtr C_PathIntersectionFunc)
-> (FunPtr C_PathIntersectionFunc
    -> IO (GClosure C_PathIntersectionFunc))
-> IO (GClosure C_PathIntersectionFunc)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_PathIntersectionFunc
-> IO (GClosure C_PathIntersectionFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `PathIntersectionFunc` into a `C_PathIntersectionFunc`.
wrap_PathIntersectionFunc :: 
    Maybe (Ptr (FunPtr C_PathIntersectionFunc)) ->
    PathIntersectionFunc_WithClosures ->
    C_PathIntersectionFunc
wrap_PathIntersectionFunc :: Maybe (Ptr (FunPtr C_PathIntersectionFunc))
-> PathIntersectionFunc_WithClosures -> C_PathIntersectionFunc
wrap_PathIntersectionFunc Maybe (Ptr (FunPtr C_PathIntersectionFunc))
gi'funptrptr PathIntersectionFunc_WithClosures
gi'cb Ptr Path
path1 Ptr PathPoint
point1 Ptr Path
path2 Ptr PathPoint
point2 CUInt
kind Ptr ()
userData = do
    Ptr Path -> (Path -> IO CInt) -> IO CInt
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient  Ptr Path
path1 ((Path -> IO CInt) -> IO CInt) -> (Path -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Path
path1' -> do
        Ptr PathPoint -> (PathPoint -> IO CInt) -> IO CInt
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient  Ptr PathPoint
point1 ((PathPoint -> IO CInt) -> IO CInt)
-> (PathPoint -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \PathPoint
point1' -> do
            Ptr Path -> (Path -> IO CInt) -> IO CInt
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient  Ptr Path
path2 ((Path -> IO CInt) -> IO CInt) -> (Path -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \Path
path2' -> do
                Ptr PathPoint -> (PathPoint -> IO CInt) -> IO CInt
forall a b.
(HasCallStack, ManagedPtrNewtype a) =>
Ptr a -> (a -> IO b) -> IO b
B.ManagedPtr.withTransient  Ptr PathPoint
point2 ((PathPoint -> IO CInt) -> IO CInt)
-> (PathPoint -> IO CInt) -> IO CInt
forall a b. (a -> b) -> a -> b
$ \PathPoint
point2' -> do
                    let kind' :: PathIntersection
kind' = (Int -> PathIntersection
forall a. Enum a => Int -> a
toEnum (Int -> PathIntersection)
-> (CUInt -> Int) -> CUInt -> PathIntersection
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
kind
                    result <- PathIntersectionFunc_WithClosures
gi'cb  Path
path1' PathPoint
point1' Path
path2' PathPoint
point2' PathIntersection
kind' Ptr ()
userData
                    maybeReleaseFunPtr gi'funptrptr
                    let result' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
P.fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
P.fromEnum) Bool
result
                    return result'


-- callback PathForeachFunc
{- Callable
  { returnType = Just (TBasicType TBoolean)
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation
        { rawDocText =
            Just
              "%TRUE to continue iterating the path, %FALSE to\n  immediately abort and not call the function again."
        , sinceVersion = Nothing
        }
  , args =
      [ Arg
          { argCName = "op"
          , argType =
              TInterface Name { namespace = "Gsk" , name = "PathOperation" }
          , argCType = Just "GskPathOperation"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "The operation" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "pts"
          , argType =
              TCArray
                False
                (-1)
                2
                (TInterface Name { namespace = "Graphene" , name = "Point" })
          , argCType = Just "const graphene_point_t*"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "The points of the operation"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "n_pts"
          , argType = TBasicType TSize
          , argCType = Just "gsize"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "The number of points"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "weight"
          , argType = TBasicType TFloat
          , argCType = Just "float"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText =
                    Just "The weight for conic curves, or unused if not a conic curve"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , argCType = Just "gpointer"
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "The user data provided with the function"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = True
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "Type of the callback to iterate through the operations of a path.\n\nFor each operation, the callback is given the @op itself, the points\nthat the operation is applied to in @pts, and a @weight for conic\ncurves. The @n_pts argument is somewhat redundant, since the number\nof points can be inferred from the operation.\n\nEach contour of the path starts with a @GSK_PATH_MOVE operation.\nClosed contours end with a @GSK_PATH_CLOSE operation."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_PathForeachFunc =
    CUInt ->
    Ptr Graphene.Point.Point ->
    FCT.CSize ->
    CFloat ->
    Ptr () ->
    IO CInt

-- Args: [ Arg
--           { argCName = "op"
--           , argType =
--               TInterface Name { namespace = "Gsk" , name = "PathOperation" }
--           , argCType = Just "GskPathOperation"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The operation" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "pts"
--           , argType =
--               TCArray
--                 False
--                 (-1)
--                 2
--                 (TInterface Name { namespace = "Graphene" , name = "Point" })
--           , argCType = Just "const graphene_point_t*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The points of the operation"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "n_pts"
--           , argType = TBasicType TSize
--           , argCType = Just "gsize"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The number of points"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "weight"
--           , argType = TBasicType TFloat
--           , argCType = Just "float"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText =
--                     Just "The weight for conic curves, or unused if not a conic curve"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "gpointer"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "The user data provided with the function"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = True
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: [ Arg
--              { argCName = "n_pts"
--              , argType = TBasicType TSize
--              , argCType = Just "gsize"
--              , direction = DirectionIn
--              , mayBeNull = False
--              , argDoc =
--                  Documentation
--                    { rawDocText = Just "The number of points"
--                    , sinceVersion = Nothing
--                    }
--              , argScope = ScopeTypeInvalid
--              , argClosure = -1
--              , argDestroy = -1
--              , argCallerAllocates = False
--              , argCallbackUserData = False
--              , transfer = TransferNothing
--              }
--          ]
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_PathForeachFunc :: FunPtr C_PathForeachFunc -> C_PathForeachFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_PathForeachFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_PathForeachFunc
    -> Gsk.Enums.PathOperation
    -- ^ /@op@/: The operation
    -> [Graphene.Point.Point]
    -- ^ /@pts@/: The points of the operation
    -> Float
    -- ^ /@weight@/: The weight for conic curves, or unused if not a conic curve
    -> Ptr ()
    -- ^ /@userData@/: The user data provided with the function
    -> m Bool
    -- ^ __Returns:__ 'P.True' to continue iterating the path, 'P.False' to
    --   immediately abort and not call the function again.
dynamic_PathForeachFunc :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
FunPtr C_PathForeachFunc
-> PathOperation -> [Point] -> Float -> Ptr () -> m Bool
dynamic_PathForeachFunc FunPtr C_PathForeachFunc
__funPtr PathOperation
op [Point]
pts Float
weight Ptr ()
userData = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
    let nPts :: CSize
nPts = Int -> CSize
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CSize) -> Int -> CSize
forall a b. (a -> b) -> a -> b
$ [Point] -> Int
forall a. [a] -> Int
forall (t :: * -> *) a. Foldable t => t a -> Int
P.length [Point]
pts
    let op' :: CUInt
op' = (Int -> CUInt
forall a b. (Integral a, Num b) => a -> b
fromIntegral (Int -> CUInt) -> (PathOperation -> Int) -> PathOperation -> CUInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. PathOperation -> Int
forall a. Enum a => a -> Int
fromEnum) PathOperation
op
    pts' <- (Point -> IO (Ptr Point)) -> [Point] -> IO [Ptr Point]
forall (t :: * -> *) (m :: * -> *) a b.
(Traversable t, Monad m) =>
(a -> m b) -> t a -> m (t b)
forall (m :: * -> *) a b. Monad m => (a -> m b) -> [a] -> m [b]
mapM Point -> IO (Ptr Point)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr [Point]
pts
    pts'' <- packBlockArray 8 pts'
    let weight' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
weight
    result <- (__dynamic_C_PathForeachFunc __funPtr) op' pts'' nPts weight' userData
    let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    mapM_ touchManagedPtr pts
    freeMem pts''
    return result'

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

-- | Type of the callback to iterate through the operations of a path.
-- 
-- For each operation, the callback is given the /@op@/ itself, the points
-- that the operation is applied to in /@pts@/, and a /@weight@/ for conic
-- curves. The /@nPts@/ argument is somewhat redundant, since the number
-- of points can be inferred from the operation.
-- 
-- Each contour of the path starts with a /@gSKPATHMOVE@/ operation.
-- Closed contours end with a /@gSKPATHCLOSE@/ operation.
type PathForeachFunc =
    Gsk.Enums.PathOperation
    -- ^ /@op@/: The operation
    -> [Graphene.Point.Point]
    -- ^ /@pts@/: The points of the operation
    -> Float
    -- ^ /@weight@/: The weight for conic curves, or unused if not a conic curve
    -> IO Bool
    -- ^ __Returns:__ 'P.True' to continue iterating the path, 'P.False' to
    --   immediately abort and not call the function again.

-- | A convenience synonym for @`Nothing` :: `Maybe` `PathForeachFunc`@.
noPathForeachFunc :: Maybe PathForeachFunc
noPathForeachFunc :: Maybe PathForeachFunc
noPathForeachFunc = Maybe PathForeachFunc
forall a. Maybe a
Nothing

-- | Type of the callback to iterate through the operations of a path.
-- 
-- For each operation, the callback is given the /@op@/ itself, the points
-- that the operation is applied to in /@pts@/, and a /@weight@/ for conic
-- curves. The /@nPts@/ argument is somewhat redundant, since the number
-- of points can be inferred from the operation.
-- 
-- Each contour of the path starts with a /@gSKPATHMOVE@/ operation.
-- Closed contours end with a /@gSKPATHCLOSE@/ operation.
type PathForeachFunc_WithClosures =
    Gsk.Enums.PathOperation
    -- ^ /@op@/: The operation
    -> [Graphene.Point.Point]
    -- ^ /@pts@/: The points of the operation
    -> Float
    -- ^ /@weight@/: The weight for conic curves, or unused if not a conic curve
    -> Ptr ()
    -- ^ /@userData@/: The user data provided with the function
    -> IO Bool
    -- ^ __Returns:__ 'P.True' to continue iterating the path, 'P.False' to
    --   immediately abort and not call the function again.

-- | A convenience synonym for @`Nothing` :: `Maybe` `PathForeachFunc_WithClosures`@.
noPathForeachFunc_WithClosures :: Maybe PathForeachFunc_WithClosures
noPathForeachFunc_WithClosures :: Maybe PathForeachFunc_WithClosures
noPathForeachFunc_WithClosures = Maybe PathForeachFunc_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_PathForeachFunc :: PathForeachFunc -> PathForeachFunc_WithClosures
drop_closures_PathForeachFunc :: PathForeachFunc -> PathForeachFunc_WithClosures
drop_closures_PathForeachFunc PathForeachFunc
_f PathOperation
op [Point]
pts Float
weight Ptr ()
_ = PathForeachFunc
_f PathOperation
op [Point]
pts Float
weight

-- | Wrap the callback into a `GClosure`.
genClosure_PathForeachFunc :: MonadIO m => PathForeachFunc -> m (GClosure C_PathForeachFunc)
genClosure_PathForeachFunc :: forall (m :: * -> *).
MonadIO m =>
PathForeachFunc -> m (GClosure C_PathForeachFunc)
genClosure_PathForeachFunc PathForeachFunc
cb = IO (GClosure C_PathForeachFunc) -> m (GClosure C_PathForeachFunc)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_PathForeachFunc) -> m (GClosure C_PathForeachFunc))
-> IO (GClosure C_PathForeachFunc)
-> m (GClosure C_PathForeachFunc)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: PathForeachFunc_WithClosures
cb' = PathForeachFunc -> PathForeachFunc_WithClosures
drop_closures_PathForeachFunc PathForeachFunc
cb
    let cb'' :: C_PathForeachFunc
cb'' = Maybe (Ptr (FunPtr C_PathForeachFunc))
-> PathForeachFunc_WithClosures -> C_PathForeachFunc
wrap_PathForeachFunc Maybe (Ptr (FunPtr C_PathForeachFunc))
forall a. Maybe a
Nothing PathForeachFunc_WithClosures
cb'
    C_PathForeachFunc -> IO (FunPtr C_PathForeachFunc)
mk_PathForeachFunc C_PathForeachFunc
cb'' IO (FunPtr C_PathForeachFunc)
-> (FunPtr C_PathForeachFunc -> IO (GClosure C_PathForeachFunc))
-> IO (GClosure C_PathForeachFunc)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_PathForeachFunc -> IO (GClosure C_PathForeachFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `PathForeachFunc` into a `C_PathForeachFunc`.
wrap_PathForeachFunc :: 
    Maybe (Ptr (FunPtr C_PathForeachFunc)) ->
    PathForeachFunc_WithClosures ->
    C_PathForeachFunc
wrap_PathForeachFunc :: Maybe (Ptr (FunPtr C_PathForeachFunc))
-> PathForeachFunc_WithClosures -> C_PathForeachFunc
wrap_PathForeachFunc Maybe (Ptr (FunPtr C_PathForeachFunc))
gi'funptrptr PathForeachFunc_WithClosures
gi'cb CUInt
op Ptr Point
pts CSize
nPts CFloat
weight Ptr ()
userData = do
    let op' :: PathOperation
op' = (Int -> PathOperation
forall a. Enum a => Int -> a
toEnum (Int -> PathOperation) -> (CUInt -> Int) -> CUInt -> PathOperation
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
op
    pts' <- (Int -> CSize -> Ptr Point -> IO [Ptr Point]
forall a b.
(Integral a, GBoxed b) =>
Int -> a -> Ptr b -> IO [Ptr b]
unpackBoxedArrayWithLength Int
8 CSize
nPts) Ptr Point
pts
    pts'' <- mapM (newBoxed Graphene.Point.Point) pts'
    let weight' = CFloat -> Float
forall a b. (Real a, Fractional b) => a -> b
realToFrac CFloat
weight
    result <- gi'cb  op' pts'' weight' userData
    maybeReleaseFunPtr gi'funptrptr
    let result' = (Int -> CInt
forall a b. (Integral a, Num b) => a -> b
P.fromIntegral (Int -> CInt) -> (Bool -> Int) -> Bool -> CInt
forall b c a. (b -> c) -> (a -> b) -> a -> c
. Bool -> Int
forall a. Enum a => a -> Int
P.fromEnum) Bool
result
    return result'


-- callback ParseErrorFunc
{- Callable
  { returnType = Nothing
  , returnMayBeNull = False
  , returnTransfer = TransferNothing
  , returnDocumentation =
      Documentation { rawDocText = Nothing , sinceVersion = Nothing }
  , args =
      [ Arg
          { argCName = "start"
          , argType =
              TInterface Name { namespace = "Gsk" , name = "ParseLocation" }
          , argCType = Just "const GskParseLocation*"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "start of the error location"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "end"
          , argType =
              TInterface Name { namespace = "Gsk" , name = "ParseLocation" }
          , argCType = Just "const GskParseLocation*"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "end of the error location"
                , sinceVersion = Nothing
                }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "error"
          , argType = TError
          , argCType = Just "const GError*"
          , direction = DirectionIn
          , mayBeNull = False
          , argDoc =
              Documentation
                { rawDocText = Just "the error" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = False
          , transfer = TransferNothing
          }
      , Arg
          { argCName = "user_data"
          , argType = TBasicType TPtr
          , argCType = Just "gpointer"
          , direction = DirectionIn
          , mayBeNull = True
          , argDoc =
              Documentation
                { rawDocText = Just "user data" , sinceVersion = Nothing }
          , argScope = ScopeTypeInvalid
          , argClosure = -1
          , argDestroy = -1
          , argCallerAllocates = False
          , argCallbackUserData = True
          , transfer = TransferNothing
          }
      ]
  , skipReturn = False
  , callableThrows = False
  , callableDeprecated = Nothing
  , callableDocumentation =
      Documentation
        { rawDocText =
            Just
              "Type of callback that is called when an error occurs\nduring node deserialization."
        , sinceVersion = Nothing
        }
  , callableResolvable = Nothing
  }
-}
-- | Type for the callback on the (unwrapped) C side.
type C_ParseErrorFunc =
    Ptr Gsk.ParseLocation.ParseLocation ->
    Ptr Gsk.ParseLocation.ParseLocation ->
    Ptr GError ->
    Ptr () ->
    IO ()

-- Args: [ Arg
--           { argCName = "start"
--           , argType =
--               TInterface Name { namespace = "Gsk" , name = "ParseLocation" }
--           , argCType = Just "const GskParseLocation*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "start of the error location"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "end"
--           , argType =
--               TInterface Name { namespace = "Gsk" , name = "ParseLocation" }
--           , argCType = Just "const GskParseLocation*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "end of the error location"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "error"
--           , argType = TError
--           , argCType = Just "const GError*"
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the error" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "user_data"
--           , argType = TBasicType TPtr
--           , argCType = Just "gpointer"
--           , direction = DirectionIn
--           , mayBeNull = True
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "user data" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , argCallbackUserData = True
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "dynamic" __dynamic_C_ParseErrorFunc :: FunPtr C_ParseErrorFunc -> C_ParseErrorFunc

-- | Given a pointer to a foreign C function, wrap it into a function callable from Haskell.
dynamic_ParseErrorFunc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    FunPtr C_ParseErrorFunc
    -> Gsk.ParseLocation.ParseLocation
    -- ^ /@start@/: start of the error location
    -> Gsk.ParseLocation.ParseLocation
    -- ^ /@end@/: end of the error location
    -> GError
    -- ^ /@error@/: the error
    -> Ptr ()
    -- ^ /@userData@/: user data
    -> m ()
dynamic_ParseErrorFunc :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
FunPtr C_ParseErrorFunc
-> ParseLocation -> ParseLocation -> GError -> Ptr () -> m ()
dynamic_ParseErrorFunc FunPtr C_ParseErrorFunc
__funPtr ParseLocation
start ParseLocation
end GError
error_ Ptr ()
userData = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
    start' <- ParseLocation -> IO (Ptr ParseLocation)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr ParseLocation
start
    end' <- unsafeManagedPtrGetPtr end
    error_' <- unsafeManagedPtrGetPtr error_
    (__dynamic_C_ParseErrorFunc __funPtr) start' end' error_' userData
    touchManagedPtr start
    touchManagedPtr end
    touchManagedPtr error_
    return ()

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

-- | Type of callback that is called when an error occurs
-- during node deserialization.
type ParseErrorFunc =
    Gsk.ParseLocation.ParseLocation
    -- ^ /@start@/: start of the error location
    -> Gsk.ParseLocation.ParseLocation
    -- ^ /@end@/: end of the error location
    -> GError
    -- ^ /@error@/: the error
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `ParseErrorFunc`@.
noParseErrorFunc :: Maybe ParseErrorFunc
noParseErrorFunc :: Maybe ParseErrorFunc
noParseErrorFunc = Maybe ParseErrorFunc
forall a. Maybe a
Nothing

-- | Type of callback that is called when an error occurs
-- during node deserialization.
type ParseErrorFunc_WithClosures =
    Gsk.ParseLocation.ParseLocation
    -- ^ /@start@/: start of the error location
    -> Gsk.ParseLocation.ParseLocation
    -- ^ /@end@/: end of the error location
    -> GError
    -- ^ /@error@/: the error
    -> Ptr ()
    -- ^ /@userData@/: user data
    -> IO ()

-- | A convenience synonym for @`Nothing` :: `Maybe` `ParseErrorFunc_WithClosures`@.
noParseErrorFunc_WithClosures :: Maybe ParseErrorFunc_WithClosures
noParseErrorFunc_WithClosures :: Maybe ParseErrorFunc_WithClosures
noParseErrorFunc_WithClosures = Maybe ParseErrorFunc_WithClosures
forall a. Maybe a
Nothing

-- | A simple wrapper that ignores the closure arguments.
drop_closures_ParseErrorFunc :: ParseErrorFunc -> ParseErrorFunc_WithClosures
drop_closures_ParseErrorFunc :: ParseErrorFunc -> ParseErrorFunc_WithClosures
drop_closures_ParseErrorFunc ParseErrorFunc
_f ParseLocation
start ParseLocation
end GError
error_ Ptr ()
_ = ParseErrorFunc
_f ParseLocation
start ParseLocation
end GError
error_

-- | Wrap the callback into a `GClosure`.
genClosure_ParseErrorFunc :: MonadIO m => ParseErrorFunc -> m (GClosure C_ParseErrorFunc)
genClosure_ParseErrorFunc :: forall (m :: * -> *).
MonadIO m =>
ParseErrorFunc -> m (GClosure C_ParseErrorFunc)
genClosure_ParseErrorFunc ParseErrorFunc
cb = IO (GClosure C_ParseErrorFunc) -> m (GClosure C_ParseErrorFunc)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_ParseErrorFunc) -> m (GClosure C_ParseErrorFunc))
-> IO (GClosure C_ParseErrorFunc) -> m (GClosure C_ParseErrorFunc)
forall a b. (a -> b) -> a -> b
$ do
    let cb' :: ParseErrorFunc_WithClosures
cb' = ParseErrorFunc -> ParseErrorFunc_WithClosures
drop_closures_ParseErrorFunc ParseErrorFunc
cb
    let cb'' :: C_ParseErrorFunc
cb'' = Maybe (Ptr (FunPtr C_ParseErrorFunc))
-> ParseErrorFunc_WithClosures -> C_ParseErrorFunc
wrap_ParseErrorFunc Maybe (Ptr (FunPtr C_ParseErrorFunc))
forall a. Maybe a
Nothing ParseErrorFunc_WithClosures
cb'
    C_ParseErrorFunc -> IO (FunPtr C_ParseErrorFunc)
mk_ParseErrorFunc C_ParseErrorFunc
cb'' IO (FunPtr C_ParseErrorFunc)
-> (FunPtr C_ParseErrorFunc -> IO (GClosure C_ParseErrorFunc))
-> IO (GClosure C_ParseErrorFunc)
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= FunPtr C_ParseErrorFunc -> IO (GClosure C_ParseErrorFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure


-- | Wrap a `ParseErrorFunc` into a `C_ParseErrorFunc`.
wrap_ParseErrorFunc :: 
    Maybe (Ptr (FunPtr C_ParseErrorFunc)) ->
    ParseErrorFunc_WithClosures ->
    C_ParseErrorFunc
wrap_ParseErrorFunc :: Maybe (Ptr (FunPtr C_ParseErrorFunc))
-> ParseErrorFunc_WithClosures -> C_ParseErrorFunc
wrap_ParseErrorFunc Maybe (Ptr (FunPtr C_ParseErrorFunc))
gi'funptrptr ParseErrorFunc_WithClosures
gi'cb Ptr ParseLocation
start Ptr ParseLocation
end Ptr GError
error_ Ptr ()
userData = do
    start' <- ((ManagedPtr ParseLocation -> ParseLocation)
-> Ptr ParseLocation -> IO ParseLocation
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newPtr ManagedPtr ParseLocation -> ParseLocation
Gsk.ParseLocation.ParseLocation) Ptr ParseLocation
start
    end' <- (newPtr Gsk.ParseLocation.ParseLocation) end
    error_' <- (newBoxed GError) error_
    gi'cb  start' end' error_' userData
    maybeReleaseFunPtr gi'funptrptr