#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Rsvg.Callbacks
(
C_SizeFunc ,
SizeFunc ,
SizeFunc_WithClosures ,
drop_closures_SizeFunc ,
dynamic_SizeFunc ,
genClosure_SizeFunc ,
mk_SizeFunc ,
noSizeFunc ,
noSizeFunc_WithClosures ,
wrap_SizeFunc ,
) 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.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
type C_SizeFunc =
Ptr Int32 ->
Ptr Int32 ->
Ptr () ->
IO ()
foreign import ccall "dynamic" __dynamic_C_SizeFunc :: FunPtr C_SizeFunc -> C_SizeFunc
dynamic_SizeFunc ::
(B.CallStack.HasCallStack, MonadIO m) =>
FunPtr C_SizeFunc
-> Ptr ()
-> m ((Int32, Int32))
dynamic_SizeFunc :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
FunPtr C_SizeFunc -> Ptr () -> m (Int32, Int32)
dynamic_SizeFunc FunPtr C_SizeFunc
__funPtr Ptr ()
userData = IO (Int32, Int32) -> m (Int32, Int32)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Int32, Int32) -> m (Int32, Int32))
-> IO (Int32, Int32) -> m (Int32, Int32)
forall a b. (a -> b) -> a -> b
$ do
Ptr Int32
width <- IO (Ptr Int32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Int32)
Ptr Int32
height <- IO (Ptr Int32)
forall a. Storable a => IO (Ptr a)
allocMem :: IO (Ptr Int32)
(FunPtr C_SizeFunc -> C_SizeFunc
__dynamic_C_SizeFunc FunPtr C_SizeFunc
__funPtr) Ptr Int32
width Ptr Int32
height Ptr ()
userData
Int32
width' <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek Ptr Int32
width
Int32
height' <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek Ptr Int32
height
Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
width
Ptr Int32 -> IO ()
forall a. Ptr a -> IO ()
freeMem Ptr Int32
height
(Int32, Int32) -> IO (Int32, Int32)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return (Int32
width', Int32
height')
foreign import ccall "wrapper"
mk_SizeFunc :: C_SizeFunc -> IO (FunPtr C_SizeFunc)
{-# DEPRECATED SizeFunc ["(Since version 2.14.)","Use 'GI.Rsvg.Objects.Handle.handleRenderDocument' instead, which lets you specify","a viewport size in which to render the SVG document."] #-}
type SizeFunc =
IO ((Int32, Int32))
noSizeFunc :: Maybe SizeFunc
noSizeFunc :: Maybe (IO (Int32, Int32))
noSizeFunc = Maybe (IO (Int32, Int32))
forall a. Maybe a
Nothing
type SizeFunc_WithClosures =
Ptr ()
-> IO ((Int32, Int32))
noSizeFunc_WithClosures :: Maybe SizeFunc_WithClosures
noSizeFunc_WithClosures :: Maybe SizeFunc_WithClosures
noSizeFunc_WithClosures = Maybe SizeFunc_WithClosures
forall a. Maybe a
Nothing
drop_closures_SizeFunc :: SizeFunc -> SizeFunc_WithClosures
drop_closures_SizeFunc :: IO (Int32, Int32) -> SizeFunc_WithClosures
drop_closures_SizeFunc IO (Int32, Int32)
_f Ptr ()
_ = IO (Int32, Int32)
_f
genClosure_SizeFunc :: MonadIO m => SizeFunc -> m (GClosure C_SizeFunc)
genClosure_SizeFunc :: forall (m :: * -> *).
MonadIO m =>
IO (Int32, Int32) -> m (GClosure C_SizeFunc)
genClosure_SizeFunc IO (Int32, Int32)
cb = IO (GClosure C_SizeFunc) -> m (GClosure C_SizeFunc)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (GClosure C_SizeFunc) -> m (GClosure C_SizeFunc))
-> IO (GClosure C_SizeFunc) -> m (GClosure C_SizeFunc)
forall a b. (a -> b) -> a -> b
$ do
let cb' :: SizeFunc_WithClosures
cb' = IO (Int32, Int32) -> SizeFunc_WithClosures
drop_closures_SizeFunc IO (Int32, Int32)
cb
let cb'' :: C_SizeFunc
cb'' = Maybe (Ptr (FunPtr C_SizeFunc))
-> SizeFunc_WithClosures -> C_SizeFunc
wrap_SizeFunc Maybe (Ptr (FunPtr C_SizeFunc))
forall a. Maybe a
Nothing SizeFunc_WithClosures
cb'
C_SizeFunc -> IO (FunPtr C_SizeFunc)
mk_SizeFunc C_SizeFunc
cb'' IO (FunPtr C_SizeFunc)
-> (FunPtr C_SizeFunc -> IO (GClosure C_SizeFunc))
-> IO (GClosure C_SizeFunc)
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_SizeFunc -> IO (GClosure C_SizeFunc)
forall (m :: * -> *) a. MonadIO m => FunPtr a -> m (GClosure a)
B.GClosure.newGClosure
wrap_SizeFunc ::
Maybe (Ptr (FunPtr C_SizeFunc)) ->
SizeFunc_WithClosures ->
C_SizeFunc
wrap_SizeFunc :: Maybe (Ptr (FunPtr C_SizeFunc))
-> SizeFunc_WithClosures -> C_SizeFunc
wrap_SizeFunc Maybe (Ptr (FunPtr C_SizeFunc))
gi'funptrptr SizeFunc_WithClosures
gi'cb Ptr Int32
width Ptr Int32
height Ptr ()
userData = do
(Int32
outwidth, Int32
outheight) <- SizeFunc_WithClosures
gi'cb Ptr ()
userData
Ptr Int32 -> Int32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr Int32
width Int32
outwidth
Ptr Int32 -> Int32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke Ptr Int32
height Int32
outheight
Maybe (Ptr (FunPtr C_SizeFunc)) -> IO ()
forall a. Maybe (Ptr (FunPtr a)) -> IO ()
maybeReleaseFunPtr Maybe (Ptr (FunPtr C_SizeFunc))
gi'funptrptr