{-# LINE 1 "src/Graphics/QML/Internal/BindCanvas.chs" #-}
{-# LANGUAGE
ForeignFunctionInterface
#-}
module Graphics.QML.Internal.BindCanvas where
import qualified Foreign.C.Types as C2HSImp
import qualified Foreign.ForeignPtr as C2HSImp
import qualified Foreign.Ptr as C2HSImp
import Graphics.QML.Internal.BindPrim
{-# LINE 7 "src/Graphics/QML/Internal/BindCanvas.chs" #-}
import Foreign.C.Types
import Foreign.Marshal.Utils
import Foreign.Ptr
import Foreign.ForeignPtr
import Foreign.Storable
newtype HsQMLGLDelegateHandle = HsQMLGLDelegateHandle (C2HSImp.ForeignPtr (HsQMLGLDelegateHandle))
withHsQMLGLDelegateHandle :: HsQMLGLDelegateHandle -> (C2HSImp.Ptr HsQMLGLDelegateHandle -> IO b) -> IO b
withHsQMLGLDelegateHandle (HsQMLGLDelegateHandle fptr) = C2HSImp.withForeignPtr fptr
{-# LINE 21 "src/Graphics/QML/Internal/BindCanvas.chs" #-}
type SetupCb = CInt -> CInt -> CInt -> IO ()
type CleanupCb = IO ()
type SyncCb = HsQMLJValHandle -> IO CInt
type PaintCb = Ptr CFloat -> CFloat -> CFloat -> IO ()
type MakeCb = Ptr (FunPtr SetupCb) -> Ptr (FunPtr CleanupCb) ->
Ptr (FunPtr SyncCb) -> Ptr (FunPtr PaintCb) -> IO ()
type CallbacksFactory = IO (SetupCb, CleanupCb, SyncCb, PaintCb)
data HsQMLGLCanvasType = HsqmlGlDesktop
| HsqmlGlEs
deriving (Enum)
{-# LINE 31 "src/Graphics/QML/Internal/BindCanvas.chs" #-}
foreign import ccall "wrapper"
marshalSetupCb :: SetupCb -> IO (FunPtr SetupCb)
foreign import ccall "wrapper"
marshalCleanupCb :: CleanupCb -> IO (FunPtr CleanupCb)
foreign import ccall "wrapper"
marshalSyncCb :: SyncCb -> IO (FunPtr SyncCb)
foreign import ccall "wrapper"
marshalPaintCb :: PaintCb -> IO (FunPtr PaintCb)
foreign import ccall "wrapper"
marshalMakeCb :: MakeCb -> IO (FunPtr MakeCb)
withCallbacksFactory :: CallbacksFactory -> (FunPtr MakeCb -> IO a) -> IO a
withCallbacksFactory factory with = do
let makeFn setupPtrFPtr cleanupPtrFPtr syncPtrFPtr paintPtrFPtr = do
(setupFn, cleanupFn, syncFn, paintFn) <- factory
setupFPtr <- marshalSetupCb setupFn
poke setupPtrFPtr setupFPtr
cleanupFPtr <- marshalCleanupCb cleanupFn
poke cleanupPtrFPtr cleanupFPtr
syncFPtr <- marshalSyncCb syncFn
poke syncPtrFPtr syncFPtr
paintFPtr <- marshalPaintCb paintFn
poke paintPtrFPtr paintFPtr
makeFPtr <- marshalMakeCb makeFn
with makeFPtr
foreign import ccall "hsqml.h &hsqml_finalise_gldelegate_handle"
hsqmlFinaliseGldelegateHandlePtr ::
FunPtr (Ptr HsQMLGLDelegateHandle -> IO ())
newGLDelegateHandle :: Ptr HsQMLGLDelegateHandle -> IO HsQMLGLDelegateHandle
newGLDelegateHandle p = do
fp <- newForeignPtr hsqmlFinaliseGldelegateHandlePtr p
return $ HsQMLGLDelegateHandle fp
hsqmlCreateGldelegate :: IO ((HsQMLGLDelegateHandle))
hsqmlCreateGldelegate =
hsqmlCreateGldelegate'_ >>= \res ->
newGLDelegateHandle res >>= \res' ->
return (res')
{-# LINE 74 "src/Graphics/QML/Internal/BindCanvas.chs" #-}
hsqmlGldelegateSetup :: (HsQMLGLDelegateHandle) -> (CallbacksFactory) -> IO ()
hsqmlGldelegateSetup a1 a2 =
withHsQMLGLDelegateHandle a1 $ \a1' ->
withCallbacksFactory a2 $ \a2' ->
hsqmlGldelegateSetup'_ a1' a2' >>
return ()
{-# LINE 79 "src/Graphics/QML/Internal/BindCanvas.chs" #-}
hsqmlGldelegateToJval :: (HsQMLGLDelegateHandle) -> (HsQMLJValHandle) -> IO ()
hsqmlGldelegateToJval a1 a2 =
withHsQMLGLDelegateHandle a1 $ \a1' ->
let {a2' = id a2} in
hsqmlGldelegateToJval'_ a1' a2' >>
return ()
{-# LINE 84 "src/Graphics/QML/Internal/BindCanvas.chs" #-}
hsqmlGldelegateFromJval :: (HsQMLGLDelegateHandle) -> (HsQMLJValHandle) -> IO ((Bool))
hsqmlGldelegateFromJval a1 a2 =
withHsQMLGLDelegateHandle a1 $ \a1' ->
let {a2' = id a2} in
hsqmlGldelegateFromJval'_ a1' a2' >>= \res ->
let {res' = toBool res} in
return (res')
{-# LINE 89 "src/Graphics/QML/Internal/BindCanvas.chs" #-}
foreign import ccall unsafe "Graphics/QML/Internal/BindCanvas.chs.h hsqml_create_gldelegate"
hsqmlCreateGldelegate'_ :: (IO (C2HSImp.Ptr (HsQMLGLDelegateHandle)))
foreign import ccall unsafe "Graphics/QML/Internal/BindCanvas.chs.h hsqml_gldelegate_setup"
hsqmlGldelegateSetup'_ :: ((C2HSImp.Ptr (HsQMLGLDelegateHandle)) -> ((C2HSImp.FunPtr ((C2HSImp.Ptr (C2HSImp.FunPtr (C2HSImp.CInt -> (C2HSImp.CInt -> (C2HSImp.CInt -> (IO ())))))) -> ((C2HSImp.Ptr (C2HSImp.FunPtr (IO ()))) -> ((C2HSImp.Ptr (C2HSImp.FunPtr ((HsQMLJValHandle) -> (IO C2HSImp.CInt)))) -> ((C2HSImp.Ptr (C2HSImp.FunPtr ((C2HSImp.Ptr C2HSImp.CFloat) -> (C2HSImp.CFloat -> (C2HSImp.CFloat -> (IO ())))))) -> (IO ())))))) -> (IO ())))
foreign import ccall unsafe "Graphics/QML/Internal/BindCanvas.chs.h hsqml_gldelegate_to_jval"
hsqmlGldelegateToJval'_ :: ((C2HSImp.Ptr (HsQMLGLDelegateHandle)) -> ((HsQMLJValHandle) -> (IO ())))
foreign import ccall unsafe "Graphics/QML/Internal/BindCanvas.chs.h hsqml_gldelegate_from_jval"
hsqmlGldelegateFromJval'_ :: ((C2HSImp.Ptr (HsQMLGLDelegateHandle)) -> ((HsQMLJValHandle) -> (IO C2HSImp.CInt)))