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

A #PopplerAnnotMapping structure represents the location
of @annot on the page
-}

module GI.Poppler.Structs.AnnotMapping
    ( 

-- * Exported types
    AnnotMapping(..)                        ,
    noAnnotMapping                          ,


 -- * Methods
-- ** annotMappingCopy
    annotMappingCopy                        ,


-- ** annotMappingFree
    annotMappingFree                        ,


-- ** annotMappingNew
    annotMappingNew                         ,




 -- * Properties
-- ** Annot
    annotMappingReadAnnot                   ,


-- ** Area
    annotMappingReadArea                    ,




    ) where

import Prelude ()
import Data.GI.Base.ShortPrelude

import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map

import GI.Poppler.Types
import GI.Poppler.Callbacks

newtype AnnotMapping = AnnotMapping (ForeignPtr AnnotMapping)
foreign import ccall "poppler_annot_mapping_get_type" c_poppler_annot_mapping_get_type :: 
    IO GType

instance BoxedObject AnnotMapping where
    boxedType _ = c_poppler_annot_mapping_get_type

noAnnotMapping :: Maybe AnnotMapping
noAnnotMapping = Nothing

annotMappingReadArea :: AnnotMapping -> IO Rectangle
annotMappingReadArea s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 0) :: IO (Ptr Rectangle)
    val' <- (newBoxed Rectangle) val
    return val'

annotMappingReadAnnot :: AnnotMapping -> IO Annot
annotMappingReadAnnot s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 32) :: IO (Ptr Annot)
    val' <- (newObject Annot) val
    return val'

-- method AnnotMapping::new
-- method type : Constructor
-- Args : []
-- Lengths : []
-- hInArgs : []
-- returnType : TInterface "Poppler" "AnnotMapping"
-- throws : False
-- Skip return : False

foreign import ccall "poppler_annot_mapping_new" poppler_annot_mapping_new :: 
    IO (Ptr AnnotMapping)


annotMappingNew ::
    (MonadIO m) =>
    m AnnotMapping
annotMappingNew  = liftIO $ do
    result <- poppler_annot_mapping_new
    checkUnexpectedReturnNULL "poppler_annot_mapping_new" result
    result' <- (wrapBoxed AnnotMapping) result
    return result'

-- method AnnotMapping::copy
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "AnnotMapping", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "AnnotMapping", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Poppler" "AnnotMapping"
-- throws : False
-- Skip return : False

foreign import ccall "poppler_annot_mapping_copy" poppler_annot_mapping_copy :: 
    Ptr AnnotMapping ->                     -- _obj : TInterface "Poppler" "AnnotMapping"
    IO (Ptr AnnotMapping)


annotMappingCopy ::
    (MonadIO m) =>
    AnnotMapping ->                         -- _obj
    m AnnotMapping
annotMappingCopy _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- poppler_annot_mapping_copy _obj'
    checkUnexpectedReturnNULL "poppler_annot_mapping_copy" result
    result' <- (wrapBoxed AnnotMapping) result
    touchManagedPtr _obj
    return result'

-- method AnnotMapping::free
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "AnnotMapping", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "AnnotMapping", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TVoid
-- throws : False
-- Skip return : False

foreign import ccall "poppler_annot_mapping_free" poppler_annot_mapping_free :: 
    Ptr AnnotMapping ->                     -- _obj : TInterface "Poppler" "AnnotMapping"
    IO ()


annotMappingFree ::
    (MonadIO m) =>
    AnnotMapping ->                         -- _obj
    m ()
annotMappingFree _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    poppler_annot_mapping_free _obj'
    touchManagedPtr _obj
    return ()