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

-- * Exported types
    AnnotFileAttachment(..)                 ,
    AnnotFileAttachmentK                    ,
    toAnnotFileAttachment                   ,
    noAnnotFileAttachment                   ,


 -- * Methods
-- ** annotFileAttachmentGetAttachment
    annotFileAttachmentGetAttachment        ,


-- ** annotFileAttachmentGetName
    annotFileAttachmentGetName              ,




    ) 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 AnnotFileAttachment = AnnotFileAttachment (ForeignPtr AnnotFileAttachment)
foreign import ccall "poppler_annot_file_attachment_get_type"
    c_poppler_annot_file_attachment_get_type :: IO GType

type instance ParentTypes AnnotFileAttachment = AnnotFileAttachmentParentTypes
type AnnotFileAttachmentParentTypes = '[AnnotMarkup, Annot, GObject.Object]

instance GObject AnnotFileAttachment where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_poppler_annot_file_attachment_get_type
    

class GObject o => AnnotFileAttachmentK o
instance (GObject o, IsDescendantOf AnnotFileAttachment o) => AnnotFileAttachmentK o

toAnnotFileAttachment :: AnnotFileAttachmentK o => o -> IO AnnotFileAttachment
toAnnotFileAttachment = unsafeCastTo AnnotFileAttachment

noAnnotFileAttachment :: Maybe AnnotFileAttachment
noAnnotFileAttachment = Nothing

type instance AttributeList AnnotFileAttachment = AnnotFileAttachmentAttributeList
type AnnotFileAttachmentAttributeList = ('[ ] :: [(Symbol, *)])

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

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

foreign import ccall "poppler_annot_file_attachment_get_attachment" poppler_annot_file_attachment_get_attachment :: 
    Ptr AnnotFileAttachment ->              -- _obj : TInterface "Poppler" "AnnotFileAttachment"
    IO (Ptr Attachment)


annotFileAttachmentGetAttachment ::
    (MonadIO m, AnnotFileAttachmentK a) =>
    a ->                                    -- _obj
    m Attachment
annotFileAttachmentGetAttachment _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- poppler_annot_file_attachment_get_attachment _obj'
    checkUnexpectedReturnNULL "poppler_annot_file_attachment_get_attachment" result
    result' <- (wrapObject Attachment) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "poppler_annot_file_attachment_get_name" poppler_annot_file_attachment_get_name :: 
    Ptr AnnotFileAttachment ->              -- _obj : TInterface "Poppler" "AnnotFileAttachment"
    IO CString


annotFileAttachmentGetName ::
    (MonadIO m, AnnotFileAttachmentK a) =>
    a ->                                    -- _obj
    m T.Text
annotFileAttachmentGetName _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- poppler_annot_file_attachment_get_name _obj'
    checkUnexpectedReturnNULL "poppler_annot_file_attachment_get_name" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr _obj
    return result'