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

module GI.Poppler.Objects.AnnotTextMarkup
    ( 

-- * Exported types
    AnnotTextMarkup(..)                     ,
    AnnotTextMarkupK                        ,
    toAnnotTextMarkup                       ,
    noAnnotTextMarkup                       ,


 -- * Methods
-- ** annotTextMarkupGetQuadrilaterals
    annotTextMarkupGetQuadrilaterals        ,


-- ** annotTextMarkupNewHighlight
    annotTextMarkupNewHighlight             ,


-- ** annotTextMarkupNewSquiggly
    annotTextMarkupNewSquiggly              ,


-- ** annotTextMarkupNewStrikeout
    annotTextMarkupNewStrikeout             ,


-- ** annotTextMarkupNewUnderline
    annotTextMarkupNewUnderline             ,


-- ** annotTextMarkupSetQuadrilaterals
    annotTextMarkupSetQuadrilaterals        ,




    ) 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
import qualified GI.GObject as GObject

newtype AnnotTextMarkup = AnnotTextMarkup (ForeignPtr AnnotTextMarkup)
foreign import ccall "poppler_annot_text_markup_get_type"
    c_poppler_annot_text_markup_get_type :: IO GType

type instance ParentTypes AnnotTextMarkup = AnnotTextMarkupParentTypes
type AnnotTextMarkupParentTypes = '[AnnotMarkup, Annot, GObject.Object]

instance GObject AnnotTextMarkup where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_poppler_annot_text_markup_get_type
    

class GObject o => AnnotTextMarkupK o
instance (GObject o, IsDescendantOf AnnotTextMarkup o) => AnnotTextMarkupK o

toAnnotTextMarkup :: AnnotTextMarkupK o => o -> IO AnnotTextMarkup
toAnnotTextMarkup = unsafeCastTo AnnotTextMarkup

noAnnotTextMarkup :: Maybe AnnotTextMarkup
noAnnotTextMarkup = Nothing

type instance AttributeList AnnotTextMarkup = AnnotTextMarkupAttributeList
type AnnotTextMarkupAttributeList = ('[ ] :: [(Symbol, *)])

type instance SignalList AnnotTextMarkup = AnnotTextMarkupSignalList
type AnnotTextMarkupSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method AnnotTextMarkup::new_highlight
-- method type : Constructor
-- Args : [Arg {argName = "doc", argType = TInterface "Poppler" "Document", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "rect", argType = TInterface "Poppler" "Rectangle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "quadrilaterals", argType = TGArray (TInterface "Poppler" "Quadrilateral"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "doc", argType = TInterface "Poppler" "Document", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "rect", argType = TInterface "Poppler" "Rectangle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "quadrilaterals", argType = TGArray (TInterface "Poppler" "Quadrilateral"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Poppler" "AnnotTextMarkup"
-- throws : False
-- Skip return : False

foreign import ccall "poppler_annot_text_markup_new_highlight" poppler_annot_text_markup_new_highlight :: 
    Ptr Document ->                         -- doc : TInterface "Poppler" "Document"
    Ptr Rectangle ->                        -- rect : TInterface "Poppler" "Rectangle"
    Ptr (GArray (Ptr Quadrilateral)) ->     -- quadrilaterals : TGArray (TInterface "Poppler" "Quadrilateral")
    IO (Ptr AnnotTextMarkup)


annotTextMarkupNewHighlight ::
    (MonadIO m, DocumentK a) =>
    a ->                                    -- doc
    Rectangle ->                            -- rect
    [Quadrilateral] ->                      -- quadrilaterals
    m AnnotTextMarkup
annotTextMarkupNewHighlight doc rect quadrilaterals = liftIO $ do
    let doc' = unsafeManagedPtrCastPtr doc
    let rect' = unsafeManagedPtrGetPtr rect
    let quadrilaterals' = map unsafeManagedPtrGetPtr quadrilaterals
    quadrilaterals'' <- packGArray quadrilaterals'
    result <- poppler_annot_text_markup_new_highlight doc' rect' quadrilaterals''
    checkUnexpectedReturnNULL "poppler_annot_text_markup_new_highlight" result
    result' <- (wrapObject AnnotTextMarkup) result
    touchManagedPtr doc
    touchManagedPtr rect
    mapM_ touchManagedPtr quadrilaterals
    unrefGArray quadrilaterals''
    return result'

-- method AnnotTextMarkup::new_squiggly
-- method type : Constructor
-- Args : [Arg {argName = "doc", argType = TInterface "Poppler" "Document", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "rect", argType = TInterface "Poppler" "Rectangle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "quadrilaterals", argType = TGArray (TInterface "Poppler" "Quadrilateral"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "doc", argType = TInterface "Poppler" "Document", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "rect", argType = TInterface "Poppler" "Rectangle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "quadrilaterals", argType = TGArray (TInterface "Poppler" "Quadrilateral"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Poppler" "AnnotTextMarkup"
-- throws : False
-- Skip return : False

foreign import ccall "poppler_annot_text_markup_new_squiggly" poppler_annot_text_markup_new_squiggly :: 
    Ptr Document ->                         -- doc : TInterface "Poppler" "Document"
    Ptr Rectangle ->                        -- rect : TInterface "Poppler" "Rectangle"
    Ptr (GArray (Ptr Quadrilateral)) ->     -- quadrilaterals : TGArray (TInterface "Poppler" "Quadrilateral")
    IO (Ptr AnnotTextMarkup)


annotTextMarkupNewSquiggly ::
    (MonadIO m, DocumentK a) =>
    a ->                                    -- doc
    Rectangle ->                            -- rect
    [Quadrilateral] ->                      -- quadrilaterals
    m AnnotTextMarkup
annotTextMarkupNewSquiggly doc rect quadrilaterals = liftIO $ do
    let doc' = unsafeManagedPtrCastPtr doc
    let rect' = unsafeManagedPtrGetPtr rect
    let quadrilaterals' = map unsafeManagedPtrGetPtr quadrilaterals
    quadrilaterals'' <- packGArray quadrilaterals'
    result <- poppler_annot_text_markup_new_squiggly doc' rect' quadrilaterals''
    checkUnexpectedReturnNULL "poppler_annot_text_markup_new_squiggly" result
    result' <- (wrapObject AnnotTextMarkup) result
    touchManagedPtr doc
    touchManagedPtr rect
    mapM_ touchManagedPtr quadrilaterals
    unrefGArray quadrilaterals''
    return result'

-- method AnnotTextMarkup::new_strikeout
-- method type : Constructor
-- Args : [Arg {argName = "doc", argType = TInterface "Poppler" "Document", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "rect", argType = TInterface "Poppler" "Rectangle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "quadrilaterals", argType = TGArray (TInterface "Poppler" "Quadrilateral"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "doc", argType = TInterface "Poppler" "Document", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "rect", argType = TInterface "Poppler" "Rectangle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "quadrilaterals", argType = TGArray (TInterface "Poppler" "Quadrilateral"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Poppler" "AnnotTextMarkup"
-- throws : False
-- Skip return : False

foreign import ccall "poppler_annot_text_markup_new_strikeout" poppler_annot_text_markup_new_strikeout :: 
    Ptr Document ->                         -- doc : TInterface "Poppler" "Document"
    Ptr Rectangle ->                        -- rect : TInterface "Poppler" "Rectangle"
    Ptr (GArray (Ptr Quadrilateral)) ->     -- quadrilaterals : TGArray (TInterface "Poppler" "Quadrilateral")
    IO (Ptr AnnotTextMarkup)


annotTextMarkupNewStrikeout ::
    (MonadIO m, DocumentK a) =>
    a ->                                    -- doc
    Rectangle ->                            -- rect
    [Quadrilateral] ->                      -- quadrilaterals
    m AnnotTextMarkup
annotTextMarkupNewStrikeout doc rect quadrilaterals = liftIO $ do
    let doc' = unsafeManagedPtrCastPtr doc
    let rect' = unsafeManagedPtrGetPtr rect
    let quadrilaterals' = map unsafeManagedPtrGetPtr quadrilaterals
    quadrilaterals'' <- packGArray quadrilaterals'
    result <- poppler_annot_text_markup_new_strikeout doc' rect' quadrilaterals''
    checkUnexpectedReturnNULL "poppler_annot_text_markup_new_strikeout" result
    result' <- (wrapObject AnnotTextMarkup) result
    touchManagedPtr doc
    touchManagedPtr rect
    mapM_ touchManagedPtr quadrilaterals
    unrefGArray quadrilaterals''
    return result'

-- method AnnotTextMarkup::new_underline
-- method type : Constructor
-- Args : [Arg {argName = "doc", argType = TInterface "Poppler" "Document", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "rect", argType = TInterface "Poppler" "Rectangle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "quadrilaterals", argType = TGArray (TInterface "Poppler" "Quadrilateral"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "doc", argType = TInterface "Poppler" "Document", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "rect", argType = TInterface "Poppler" "Rectangle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "quadrilaterals", argType = TGArray (TInterface "Poppler" "Quadrilateral"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Poppler" "AnnotTextMarkup"
-- throws : False
-- Skip return : False

foreign import ccall "poppler_annot_text_markup_new_underline" poppler_annot_text_markup_new_underline :: 
    Ptr Document ->                         -- doc : TInterface "Poppler" "Document"
    Ptr Rectangle ->                        -- rect : TInterface "Poppler" "Rectangle"
    Ptr (GArray (Ptr Quadrilateral)) ->     -- quadrilaterals : TGArray (TInterface "Poppler" "Quadrilateral")
    IO (Ptr AnnotTextMarkup)


annotTextMarkupNewUnderline ::
    (MonadIO m, DocumentK a) =>
    a ->                                    -- doc
    Rectangle ->                            -- rect
    [Quadrilateral] ->                      -- quadrilaterals
    m AnnotTextMarkup
annotTextMarkupNewUnderline doc rect quadrilaterals = liftIO $ do
    let doc' = unsafeManagedPtrCastPtr doc
    let rect' = unsafeManagedPtrGetPtr rect
    let quadrilaterals' = map unsafeManagedPtrGetPtr quadrilaterals
    quadrilaterals'' <- packGArray quadrilaterals'
    result <- poppler_annot_text_markup_new_underline doc' rect' quadrilaterals''
    checkUnexpectedReturnNULL "poppler_annot_text_markup_new_underline" result
    result' <- (wrapObject AnnotTextMarkup) result
    touchManagedPtr doc
    touchManagedPtr rect
    mapM_ touchManagedPtr quadrilaterals
    unrefGArray quadrilaterals''
    return result'

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

foreign import ccall "poppler_annot_text_markup_get_quadrilaterals" poppler_annot_text_markup_get_quadrilaterals :: 
    Ptr AnnotTextMarkup ->                  -- _obj : TInterface "Poppler" "AnnotTextMarkup"
    IO (Ptr (GArray (Ptr Quadrilateral)))


annotTextMarkupGetQuadrilaterals ::
    (MonadIO m, AnnotTextMarkupK a) =>
    a ->                                    -- _obj
    m [Quadrilateral]
annotTextMarkupGetQuadrilaterals _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- poppler_annot_text_markup_get_quadrilaterals _obj'
    checkUnexpectedReturnNULL "poppler_annot_text_markup_get_quadrilaterals" result
    result' <- unpackGArray result
    result'' <- mapM (wrapBoxed Quadrilateral) result'
    unrefGArray result
    touchManagedPtr _obj
    return result''

-- method AnnotTextMarkup::set_quadrilaterals
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "AnnotTextMarkup", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "quadrilaterals", argType = TGArray (TInterface "Poppler" "Quadrilateral"), direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "AnnotTextMarkup", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "quadrilaterals", argType = TGArray (TInterface "Poppler" "Quadrilateral"), 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_text_markup_set_quadrilaterals" poppler_annot_text_markup_set_quadrilaterals :: 
    Ptr AnnotTextMarkup ->                  -- _obj : TInterface "Poppler" "AnnotTextMarkup"
    Ptr (GArray (Ptr Quadrilateral)) ->     -- quadrilaterals : TGArray (TInterface "Poppler" "Quadrilateral")
    IO ()


annotTextMarkupSetQuadrilaterals ::
    (MonadIO m, AnnotTextMarkupK a) =>
    a ->                                    -- _obj
    [Quadrilateral] ->                      -- quadrilaterals
    m ()
annotTextMarkupSetQuadrilaterals _obj quadrilaterals = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let quadrilaterals' = map unsafeManagedPtrGetPtr quadrilaterals
    quadrilaterals'' <- packGArray quadrilaterals'
    poppler_annot_text_markup_set_quadrilaterals _obj' quadrilaterals''
    touchManagedPtr _obj
    mapM_ touchManagedPtr quadrilaterals
    unrefGArray quadrilaterals''
    return ()