{- |
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.AnnotLine
    ( 

-- * Exported types
    AnnotLine(..)                           ,
    AnnotLineK                              ,
    toAnnotLine                             ,
    noAnnotLine                             ,


 -- * Methods
-- ** annotLineNew
    annotLineNew                            ,


-- ** annotLineSetVertices
    annotLineSetVertices                    ,




    ) 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 AnnotLine = AnnotLine (ForeignPtr AnnotLine)
foreign import ccall "poppler_annot_line_get_type"
    c_poppler_annot_line_get_type :: IO GType

type instance ParentTypes AnnotLine = AnnotLineParentTypes
type AnnotLineParentTypes = '[AnnotMarkup, Annot, GObject.Object]

instance GObject AnnotLine where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_poppler_annot_line_get_type
    

class GObject o => AnnotLineK o
instance (GObject o, IsDescendantOf AnnotLine o) => AnnotLineK o

toAnnotLine :: AnnotLineK o => o -> IO AnnotLine
toAnnotLine = unsafeCastTo AnnotLine

noAnnotLine :: Maybe AnnotLine
noAnnotLine = Nothing

type instance AttributeList AnnotLine = AnnotLineAttributeList
type AnnotLineAttributeList = ('[ ] :: [(Symbol, *)])

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

-- method AnnotLine::new
-- 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 = "start", argType = TInterface "Poppler" "Point", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "end", argType = TInterface "Poppler" "Point", 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 = "start", argType = TInterface "Poppler" "Point", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "end", argType = TInterface "Poppler" "Point", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Poppler" "AnnotLine"
-- throws : False
-- Skip return : False

foreign import ccall "poppler_annot_line_new" poppler_annot_line_new :: 
    Ptr Document ->                         -- doc : TInterface "Poppler" "Document"
    Ptr Rectangle ->                        -- rect : TInterface "Poppler" "Rectangle"
    Ptr Point ->                            -- start : TInterface "Poppler" "Point"
    Ptr Point ->                            -- end : TInterface "Poppler" "Point"
    IO (Ptr AnnotLine)


annotLineNew ::
    (MonadIO m, DocumentK a) =>
    a ->                                    -- doc
    Rectangle ->                            -- rect
    Point ->                                -- start
    Point ->                                -- end
    m AnnotLine
annotLineNew doc rect start end = liftIO $ do
    let doc' = unsafeManagedPtrCastPtr doc
    let rect' = unsafeManagedPtrGetPtr rect
    let start' = unsafeManagedPtrGetPtr start
    let end' = unsafeManagedPtrGetPtr end
    result <- poppler_annot_line_new doc' rect' start' end'
    checkUnexpectedReturnNULL "poppler_annot_line_new" result
    result' <- (wrapObject AnnotLine) result
    touchManagedPtr doc
    touchManagedPtr rect
    touchManagedPtr start
    touchManagedPtr end
    return result'

-- method AnnotLine::set_vertices
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "AnnotLine", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "start", argType = TInterface "Poppler" "Point", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "end", argType = TInterface "Poppler" "Point", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "AnnotLine", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "start", argType = TInterface "Poppler" "Point", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "end", argType = TInterface "Poppler" "Point", 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_line_set_vertices" poppler_annot_line_set_vertices :: 
    Ptr AnnotLine ->                        -- _obj : TInterface "Poppler" "AnnotLine"
    Ptr Point ->                            -- start : TInterface "Poppler" "Point"
    Ptr Point ->                            -- end : TInterface "Poppler" "Point"
    IO ()


annotLineSetVertices ::
    (MonadIO m, AnnotLineK a) =>
    a ->                                    -- _obj
    Point ->                                -- start
    Point ->                                -- end
    m ()
annotLineSetVertices _obj start end = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let start' = unsafeManagedPtrGetPtr start
    let end' = unsafeManagedPtrGetPtr end
    poppler_annot_line_set_vertices _obj' start' end'
    touchManagedPtr _obj
    touchManagedPtr start
    touchManagedPtr end
    return ()