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

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


 -- * Methods
-- ** new #method:new#

    annotLineNew                            ,


-- ** setVertices #method:setVertices#

#if ENABLE_OVERLOADING
    AnnotLineSetVerticesMethodInfo          ,
#endif
    annotLineSetVertices                    ,




    ) 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.Document as Poppler.Document
import {-# SOURCE #-} qualified GI.Poppler.Structs.Point as Poppler.Point
import {-# SOURCE #-} qualified GI.Poppler.Structs.Rectangle as Poppler.Rectangle

-- | Memory-managed wrapper type.
newtype AnnotLine = AnnotLine (ManagedPtr AnnotLine)
foreign import ccall "poppler_annot_line_get_type"
    c_poppler_annot_line_get_type :: IO GType

instance GObject AnnotLine where
    gobjectType = c_poppler_annot_line_get_type


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

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

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

-- | A convenience alias for `Nothing` :: `Maybe` `AnnotLine`.
noAnnotLine :: Maybe AnnotLine
noAnnotLine = Nothing

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

instance (info ~ ResolveAnnotLineMethod t AnnotLine, O.MethodInfo info AnnotLine p) => OL.IsLabel t (AnnotLine -> 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 AnnotLine
type instance O.AttributeList AnnotLine = AnnotLineAttributeList
type AnnotLineAttributeList = ('[ ] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
#endif

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

#endif

-- method AnnotLine::new
-- method type : Constructor
-- Args : [Arg {argCName = "doc", argType = TInterface (Name {namespace = "Poppler", name = "Document"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PopplerDocument", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "rect", argType = TInterface (Name {namespace = "Poppler", name = "Rectangle"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PopplerRectangle", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "start", argType = TInterface (Name {namespace = "Poppler", name = "Point"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PopplerPoint of the starting vertice", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "end", argType = TInterface (Name {namespace = "Poppler", name = "Point"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PopplerPoint of the ending vertice", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Poppler", name = "AnnotLine"}))
-- throws : False
-- Skip return : False

foreign import ccall "poppler_annot_line_new" poppler_annot_line_new ::
    Ptr Poppler.Document.Document ->        -- doc : TInterface (Name {namespace = "Poppler", name = "Document"})
    Ptr Poppler.Rectangle.Rectangle ->      -- rect : TInterface (Name {namespace = "Poppler", name = "Rectangle"})
    Ptr Poppler.Point.Point ->              -- start : TInterface (Name {namespace = "Poppler", name = "Point"})
    Ptr Poppler.Point.Point ->              -- end : TInterface (Name {namespace = "Poppler", name = "Point"})
    IO (Ptr AnnotLine)

{- |
Creates a new Line annotation that will be
located on /@rect@/ when added to a page. See
'GI.Poppler.Objects.Page.pageAddAnnot'

/Since: 0.26/
-}
annotLineNew ::
    (B.CallStack.HasCallStack, MonadIO m, Poppler.Document.IsDocument a) =>
    a
    {- ^ /@doc@/: a 'GI.Poppler.Objects.Document.Document' -}
    -> Poppler.Rectangle.Rectangle
    {- ^ /@rect@/: a 'GI.Poppler.Structs.Rectangle.Rectangle' -}
    -> Poppler.Point.Point
    {- ^ /@start@/: a 'GI.Poppler.Structs.Point.Point' of the starting vertice -}
    -> Poppler.Point.Point
    {- ^ /@end@/: a 'GI.Poppler.Structs.Point.Point' of the ending vertice -}
    -> m AnnotLine
    {- ^ __Returns:__ A newly created 'GI.Poppler.Objects.AnnotLine.AnnotLine' annotation -}
annotLineNew doc rect start end = liftIO $ do
    doc' <- unsafeManagedPtrCastPtr doc
    rect' <- unsafeManagedPtrGetPtr rect
    start' <- unsafeManagedPtrGetPtr start
    end' <- unsafeManagedPtrGetPtr end
    result <- poppler_annot_line_new doc' rect' start' end'
    checkUnexpectedReturnNULL "annotLineNew" result
    result' <- (wrapObject AnnotLine) result
    touchManagedPtr doc
    touchManagedPtr rect
    touchManagedPtr start
    touchManagedPtr end
    return result'

#if ENABLE_OVERLOADING
#endif

-- method AnnotLine::set_vertices
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "poppler_annot", argType = TInterface (Name {namespace = "Poppler", name = "AnnotLine"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PopplerAnnotLine", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "start", argType = TInterface (Name {namespace = "Poppler", name = "Point"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PopplerPoint of the starting vertice", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "end", argType = TInterface (Name {namespace = "Poppler", name = "Point"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #PopplerPoint of the ending vertice", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "poppler_annot_line_set_vertices" poppler_annot_line_set_vertices ::
    Ptr AnnotLine ->                        -- poppler_annot : TInterface (Name {namespace = "Poppler", name = "AnnotLine"})
    Ptr Poppler.Point.Point ->              -- start : TInterface (Name {namespace = "Poppler", name = "Point"})
    Ptr Poppler.Point.Point ->              -- end : TInterface (Name {namespace = "Poppler", name = "Point"})
    IO ()

{- |
Set the coordinate points where the /@popplerAnnot@/ starts and ends.

/Since: 0.26/
-}
annotLineSetVertices ::
    (B.CallStack.HasCallStack, MonadIO m, IsAnnotLine a) =>
    a
    {- ^ /@popplerAnnot@/: a 'GI.Poppler.Objects.AnnotLine.AnnotLine' -}
    -> Poppler.Point.Point
    {- ^ /@start@/: a 'GI.Poppler.Structs.Point.Point' of the starting vertice -}
    -> Poppler.Point.Point
    {- ^ /@end@/: a 'GI.Poppler.Structs.Point.Point' of the ending vertice -}
    -> m ()
annotLineSetVertices popplerAnnot start end = liftIO $ do
    popplerAnnot' <- unsafeManagedPtrCastPtr popplerAnnot
    start' <- unsafeManagedPtrGetPtr start
    end' <- unsafeManagedPtrGetPtr end
    poppler_annot_line_set_vertices popplerAnnot' start' end'
    touchManagedPtr popplerAnnot
    touchManagedPtr start
    touchManagedPtr end
    return ()

#if ENABLE_OVERLOADING
data AnnotLineSetVerticesMethodInfo
instance (signature ~ (Poppler.Point.Point -> Poppler.Point.Point -> m ()), MonadIO m, IsAnnotLine a) => O.MethodInfo AnnotLineSetVerticesMethodInfo a signature where
    overloadedMethod _ = annotLineSetVertices

#endif