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

/No description available in the introspection data./
-}

#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
       && !defined(__HADDOCK_VERSION__))

module GI.Poppler.Objects.AnnotFileAttachment
    (

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


 -- * Methods
-- ** getAttachment #method:getAttachment#

#if ENABLE_OVERLOADING
    AnnotFileAttachmentGetAttachmentMethodInfo,
#endif
    annotFileAttachmentGetAttachment        ,


-- ** getName #method:getName#

#if ENABLE_OVERLOADING
    AnnotFileAttachmentGetNameMethodInfo    ,
#endif
    annotFileAttachmentGetName              ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL

import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Poppler.Objects.Annot as Poppler.Annot
import {-# SOURCE #-} qualified GI.Poppler.Objects.AnnotMarkup as Poppler.AnnotMarkup
import {-# SOURCE #-} qualified GI.Poppler.Objects.Attachment as Poppler.Attachment

-- | Memory-managed wrapper type.
newtype AnnotFileAttachment = AnnotFileAttachment (ManagedPtr AnnotFileAttachment)
foreign import ccall "poppler_annot_file_attachment_get_type"
    c_poppler_annot_file_attachment_get_type :: IO GType

instance GObject AnnotFileAttachment where
    gobjectType = c_poppler_annot_file_attachment_get_type


-- | Type class for types which can be safely cast to `AnnotFileAttachment`, for instance with `toAnnotFileAttachment`.
class (GObject o, O.IsDescendantOf AnnotFileAttachment o) => IsAnnotFileAttachment o
instance (GObject o, O.IsDescendantOf AnnotFileAttachment o) => IsAnnotFileAttachment o

instance O.HasParentTypes AnnotFileAttachment
type instance O.ParentTypes AnnotFileAttachment = '[Poppler.AnnotMarkup.AnnotMarkup, Poppler.Annot.Annot, GObject.Object.Object]

-- | Cast to `AnnotFileAttachment`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toAnnotFileAttachment :: (MonadIO m, IsAnnotFileAttachment o) => o -> m AnnotFileAttachment
toAnnotFileAttachment = liftIO . unsafeCastTo AnnotFileAttachment

-- | A convenience alias for `Nothing` :: `Maybe` `AnnotFileAttachment`.
noAnnotFileAttachment :: Maybe AnnotFileAttachment
noAnnotFileAttachment = Nothing

#if ENABLE_OVERLOADING
type family ResolveAnnotFileAttachmentMethod (t :: Symbol) (o :: *) :: * where
    ResolveAnnotFileAttachmentMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveAnnotFileAttachmentMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveAnnotFileAttachmentMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveAnnotFileAttachmentMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveAnnotFileAttachmentMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveAnnotFileAttachmentMethod "hasPopup" o = Poppler.AnnotMarkup.AnnotMarkupHasPopupMethodInfo
    ResolveAnnotFileAttachmentMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveAnnotFileAttachmentMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveAnnotFileAttachmentMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveAnnotFileAttachmentMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveAnnotFileAttachmentMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveAnnotFileAttachmentMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveAnnotFileAttachmentMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveAnnotFileAttachmentMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveAnnotFileAttachmentMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveAnnotFileAttachmentMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveAnnotFileAttachmentMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveAnnotFileAttachmentMethod "getAnnotType" o = Poppler.Annot.AnnotGetAnnotTypeMethodInfo
    ResolveAnnotFileAttachmentMethod "getAttachment" o = AnnotFileAttachmentGetAttachmentMethodInfo
    ResolveAnnotFileAttachmentMethod "getColor" o = Poppler.Annot.AnnotGetColorMethodInfo
    ResolveAnnotFileAttachmentMethod "getContents" o = Poppler.Annot.AnnotGetContentsMethodInfo
    ResolveAnnotFileAttachmentMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveAnnotFileAttachmentMethod "getDate" o = Poppler.AnnotMarkup.AnnotMarkupGetDateMethodInfo
    ResolveAnnotFileAttachmentMethod "getExternalData" o = Poppler.AnnotMarkup.AnnotMarkupGetExternalDataMethodInfo
    ResolveAnnotFileAttachmentMethod "getFlags" o = Poppler.Annot.AnnotGetFlagsMethodInfo
    ResolveAnnotFileAttachmentMethod "getLabel" o = Poppler.AnnotMarkup.AnnotMarkupGetLabelMethodInfo
    ResolveAnnotFileAttachmentMethod "getModified" o = Poppler.Annot.AnnotGetModifiedMethodInfo
    ResolveAnnotFileAttachmentMethod "getName" o = AnnotFileAttachmentGetNameMethodInfo
    ResolveAnnotFileAttachmentMethod "getOpacity" o = Poppler.AnnotMarkup.AnnotMarkupGetOpacityMethodInfo
    ResolveAnnotFileAttachmentMethod "getPageIndex" o = Poppler.Annot.AnnotGetPageIndexMethodInfo
    ResolveAnnotFileAttachmentMethod "getPopupIsOpen" o = Poppler.AnnotMarkup.AnnotMarkupGetPopupIsOpenMethodInfo
    ResolveAnnotFileAttachmentMethod "getPopupRectangle" o = Poppler.AnnotMarkup.AnnotMarkupGetPopupRectangleMethodInfo
    ResolveAnnotFileAttachmentMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveAnnotFileAttachmentMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveAnnotFileAttachmentMethod "getRectangle" o = Poppler.Annot.AnnotGetRectangleMethodInfo
    ResolveAnnotFileAttachmentMethod "getReplyTo" o = Poppler.AnnotMarkup.AnnotMarkupGetReplyToMethodInfo
    ResolveAnnotFileAttachmentMethod "getSubject" o = Poppler.AnnotMarkup.AnnotMarkupGetSubjectMethodInfo
    ResolveAnnotFileAttachmentMethod "setColor" o = Poppler.Annot.AnnotSetColorMethodInfo
    ResolveAnnotFileAttachmentMethod "setContents" o = Poppler.Annot.AnnotSetContentsMethodInfo
    ResolveAnnotFileAttachmentMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveAnnotFileAttachmentMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveAnnotFileAttachmentMethod "setFlags" o = Poppler.Annot.AnnotSetFlagsMethodInfo
    ResolveAnnotFileAttachmentMethod "setLabel" o = Poppler.AnnotMarkup.AnnotMarkupSetLabelMethodInfo
    ResolveAnnotFileAttachmentMethod "setOpacity" o = Poppler.AnnotMarkup.AnnotMarkupSetOpacityMethodInfo
    ResolveAnnotFileAttachmentMethod "setPopup" o = Poppler.AnnotMarkup.AnnotMarkupSetPopupMethodInfo
    ResolveAnnotFileAttachmentMethod "setPopupIsOpen" o = Poppler.AnnotMarkup.AnnotMarkupSetPopupIsOpenMethodInfo
    ResolveAnnotFileAttachmentMethod "setPopupRectangle" o = Poppler.AnnotMarkup.AnnotMarkupSetPopupRectangleMethodInfo
    ResolveAnnotFileAttachmentMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveAnnotFileAttachmentMethod "setRectangle" o = Poppler.Annot.AnnotSetRectangleMethodInfo
    ResolveAnnotFileAttachmentMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveAnnotFileAttachmentMethod t AnnotFileAttachment, O.MethodInfo info AnnotFileAttachment p) => OL.IsLabel t (AnnotFileAttachment -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

#endif

#if ENABLE_OVERLOADING
instance O.HasAttributeList AnnotFileAttachment
type instance O.AttributeList AnnotFileAttachment = AnnotFileAttachmentAttributeList
type AnnotFileAttachmentAttributeList = ('[ ] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
#endif

#if ENABLE_OVERLOADING
type instance O.SignalList AnnotFileAttachment = AnnotFileAttachmentSignalList
type AnnotFileAttachmentSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method AnnotFileAttachment::get_attachment
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "poppler_annot", argType = TInterface (Name {namespace = "Poppler", name = "AnnotFileAttachment"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PopplerAnnotFileAttachment", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Poppler", name = "Attachment"}))
-- throws : False
-- Skip return : False

foreign import ccall "poppler_annot_file_attachment_get_attachment" poppler_annot_file_attachment_get_attachment ::
    Ptr AnnotFileAttachment ->              -- poppler_annot : TInterface (Name {namespace = "Poppler", name = "AnnotFileAttachment"})
    IO (Ptr Poppler.Attachment.Attachment)

{- |
Creates a 'GI.Poppler.Objects.Attachment.Attachment' for the file of the file attachment annotation /@annot@/.
The 'GI.Poppler.Objects.Attachment.Attachment' must be unrefed with g_object_unref by the caller.

/Since: 0.14/
-}
annotFileAttachmentGetAttachment ::
    (B.CallStack.HasCallStack, MonadIO m, IsAnnotFileAttachment a) =>
    a
    {- ^ /@popplerAnnot@/: a 'GI.Poppler.Objects.AnnotFileAttachment.AnnotFileAttachment' -}
    -> m Poppler.Attachment.Attachment
    {- ^ __Returns:__ /@popplerAttachment@/ -}
annotFileAttachmentGetAttachment popplerAnnot = liftIO $ do
    popplerAnnot' <- unsafeManagedPtrCastPtr popplerAnnot
    result <- poppler_annot_file_attachment_get_attachment popplerAnnot'
    checkUnexpectedReturnNULL "annotFileAttachmentGetAttachment" result
    result' <- (wrapObject Poppler.Attachment.Attachment) result
    touchManagedPtr popplerAnnot
    return result'

#if ENABLE_OVERLOADING
data AnnotFileAttachmentGetAttachmentMethodInfo
instance (signature ~ (m Poppler.Attachment.Attachment), MonadIO m, IsAnnotFileAttachment a) => O.MethodInfo AnnotFileAttachmentGetAttachmentMethodInfo a signature where
    overloadedMethod _ = annotFileAttachmentGetAttachment

#endif

-- method AnnotFileAttachment::get_name
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "poppler_annot", argType = TInterface (Name {namespace = "Poppler", name = "AnnotFileAttachment"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PopplerAnnotFileAttachment", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "poppler_annot_file_attachment_get_name" poppler_annot_file_attachment_get_name ::
    Ptr AnnotFileAttachment ->              -- poppler_annot : TInterface (Name {namespace = "Poppler", name = "AnnotFileAttachment"})
    IO CString

{- |
Retrieves the name of /@popplerAnnot@/.

/Since: 0.14/
-}
annotFileAttachmentGetName ::
    (B.CallStack.HasCallStack, MonadIO m, IsAnnotFileAttachment a) =>
    a
    {- ^ /@popplerAnnot@/: a 'GI.Poppler.Objects.AnnotFileAttachment.AnnotFileAttachment' -}
    -> m T.Text
    {- ^ __Returns:__ a new allocated string with the name of /@popplerAnnot@/. It must
              be freed with 'GI.GLib.Functions.free' when done. -}
annotFileAttachmentGetName popplerAnnot = liftIO $ do
    popplerAnnot' <- unsafeManagedPtrCastPtr popplerAnnot
    result <- poppler_annot_file_attachment_get_name popplerAnnot'
    checkUnexpectedReturnNULL "annotFileAttachmentGetName" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr popplerAnnot
    return result'

#if ENABLE_OVERLOADING
data AnnotFileAttachmentGetNameMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsAnnotFileAttachment a) => O.MethodInfo AnnotFileAttachmentGetNameMethodInfo a signature where
    overloadedMethod _ = annotFileAttachmentGetName

#endif