{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- /No description available in the introspection data./

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

module GI.Poppler.Objects.AnnotFreeText
    ( 

-- * Exported types
    AnnotFreeText(..)                       ,
    IsAnnotFreeText                         ,
    toAnnotFreeText                         ,


 -- * Methods
-- ** Overloaded methods #method:Overloaded methods#

#if defined(ENABLE_OVERLOADING)
    ResolveAnnotFreeTextMethod              ,
#endif


-- ** getCalloutLine #method:getCalloutLine#

#if defined(ENABLE_OVERLOADING)
    AnnotFreeTextGetCalloutLineMethodInfo   ,
#endif
    annotFreeTextGetCalloutLine             ,


-- ** getQuadding #method:getQuadding#

#if defined(ENABLE_OVERLOADING)
    AnnotFreeTextGetQuaddingMethodInfo      ,
#endif
    annotFreeTextGetQuadding                ,




    ) 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.BasicTypes as B.Types
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.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
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.Enums as Poppler.Enums
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.Structs.AnnotCalloutLine as Poppler.AnnotCalloutLine

-- | Memory-managed wrapper type.
newtype AnnotFreeText = AnnotFreeText (SP.ManagedPtr AnnotFreeText)
    deriving (AnnotFreeText -> AnnotFreeText -> Bool
(AnnotFreeText -> AnnotFreeText -> Bool)
-> (AnnotFreeText -> AnnotFreeText -> Bool) -> Eq AnnotFreeText
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AnnotFreeText -> AnnotFreeText -> Bool
$c/= :: AnnotFreeText -> AnnotFreeText -> Bool
== :: AnnotFreeText -> AnnotFreeText -> Bool
$c== :: AnnotFreeText -> AnnotFreeText -> Bool
Eq)

instance SP.ManagedPtrNewtype AnnotFreeText where
    toManagedPtr :: AnnotFreeText -> ManagedPtr AnnotFreeText
toManagedPtr (AnnotFreeText ManagedPtr AnnotFreeText
p) = ManagedPtr AnnotFreeText
p

foreign import ccall "poppler_annot_free_text_get_type"
    c_poppler_annot_free_text_get_type :: IO B.Types.GType

instance B.Types.TypedObject AnnotFreeText where
    glibType :: IO GType
glibType = IO GType
c_poppler_annot_free_text_get_type

instance B.Types.GObject AnnotFreeText

-- | Convert 'AnnotFreeText' to and from 'Data.GI.Base.GValue.GValue' with 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue AnnotFreeText where
    toGValue :: AnnotFreeText -> IO GValue
toGValue AnnotFreeText
o = do
        GType
gtype <- IO GType
c_poppler_annot_free_text_get_type
        AnnotFreeText -> (Ptr AnnotFreeText -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr AnnotFreeText
o (GType
-> (GValue -> Ptr AnnotFreeText -> IO ())
-> Ptr AnnotFreeText
-> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr AnnotFreeText -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
        
    fromGValue :: GValue -> IO AnnotFreeText
fromGValue GValue
gv = do
        Ptr AnnotFreeText
ptr <- GValue -> IO (Ptr AnnotFreeText)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr AnnotFreeText)
        (ManagedPtr AnnotFreeText -> AnnotFreeText)
-> Ptr AnnotFreeText -> IO AnnotFreeText
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr AnnotFreeText -> AnnotFreeText
AnnotFreeText Ptr AnnotFreeText
ptr
        
    

-- | Type class for types which can be safely cast to `AnnotFreeText`, for instance with `toAnnotFreeText`.
class (SP.GObject o, O.IsDescendantOf AnnotFreeText o) => IsAnnotFreeText o
instance (SP.GObject o, O.IsDescendantOf AnnotFreeText o) => IsAnnotFreeText o

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

-- | Cast to `AnnotFreeText`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toAnnotFreeText :: (MonadIO m, IsAnnotFreeText o) => o -> m AnnotFreeText
toAnnotFreeText :: o -> m AnnotFreeText
toAnnotFreeText = IO AnnotFreeText -> m AnnotFreeText
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO AnnotFreeText -> m AnnotFreeText)
-> (o -> IO AnnotFreeText) -> o -> m AnnotFreeText
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr AnnotFreeText -> AnnotFreeText)
-> o -> IO AnnotFreeText
forall o o'.
(HasCallStack, ManagedPtrNewtype o, TypedObject o,
 ManagedPtrNewtype o', TypedObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr AnnotFreeText -> AnnotFreeText
AnnotFreeText

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

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

#endif

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

#if defined(ENABLE_OVERLOADING)
#endif

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

#endif

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

foreign import ccall "poppler_annot_free_text_get_callout_line" poppler_annot_free_text_get_callout_line :: 
    Ptr AnnotFreeText ->                    -- poppler_annot : TInterface (Name {namespace = "Poppler", name = "AnnotFreeText"})
    IO (Ptr Poppler.AnnotCalloutLine.AnnotCalloutLine)

-- | Retrieves a t'GI.Poppler.Structs.AnnotCalloutLine.AnnotCalloutLine' of four or six numbers specifying a callout
-- line attached to the /@popplerAnnot@/.
annotFreeTextGetCalloutLine ::
    (B.CallStack.HasCallStack, MonadIO m, IsAnnotFreeText a) =>
    a
    -- ^ /@popplerAnnot@/: a t'GI.Poppler.Objects.AnnotFreeText.AnnotFreeText'
    -> m Poppler.AnnotCalloutLine.AnnotCalloutLine
    -- ^ __Returns:__ a new allocated t'GI.Poppler.Structs.AnnotCalloutLine.AnnotCalloutLine' if the annot has a callout
    --               line, 'P.Nothing' in other case. It must be freed with 'GI.GLib.Functions.free' when
    --               done.
annotFreeTextGetCalloutLine :: a -> m AnnotCalloutLine
annotFreeTextGetCalloutLine a
popplerAnnot = IO AnnotCalloutLine -> m AnnotCalloutLine
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO AnnotCalloutLine -> m AnnotCalloutLine)
-> IO AnnotCalloutLine -> m AnnotCalloutLine
forall a b. (a -> b) -> a -> b
$ do
    Ptr AnnotFreeText
popplerAnnot' <- a -> IO (Ptr AnnotFreeText)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
popplerAnnot
    Ptr AnnotCalloutLine
result <- Ptr AnnotFreeText -> IO (Ptr AnnotCalloutLine)
poppler_annot_free_text_get_callout_line Ptr AnnotFreeText
popplerAnnot'
    Text -> Ptr AnnotCalloutLine -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"annotFreeTextGetCalloutLine" Ptr AnnotCalloutLine
result
    AnnotCalloutLine
result' <- ((ManagedPtr AnnotCalloutLine -> AnnotCalloutLine)
-> Ptr AnnotCalloutLine -> IO AnnotCalloutLine
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr AnnotCalloutLine -> AnnotCalloutLine
Poppler.AnnotCalloutLine.AnnotCalloutLine) Ptr AnnotCalloutLine
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
popplerAnnot
    AnnotCalloutLine -> IO AnnotCalloutLine
forall (m :: * -> *) a. Monad m => a -> m a
return AnnotCalloutLine
result'

#if defined(ENABLE_OVERLOADING)
data AnnotFreeTextGetCalloutLineMethodInfo
instance (signature ~ (m Poppler.AnnotCalloutLine.AnnotCalloutLine), MonadIO m, IsAnnotFreeText a) => O.MethodInfo AnnotFreeTextGetCalloutLineMethodInfo a signature where
    overloadedMethod = annotFreeTextGetCalloutLine

#endif

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

foreign import ccall "poppler_annot_free_text_get_quadding" poppler_annot_free_text_get_quadding :: 
    Ptr AnnotFreeText ->                    -- poppler_annot : TInterface (Name {namespace = "Poppler", name = "AnnotFreeText"})
    IO CUInt

-- | Retrieves the justification of the text of /@popplerAnnot@/.
annotFreeTextGetQuadding ::
    (B.CallStack.HasCallStack, MonadIO m, IsAnnotFreeText a) =>
    a
    -- ^ /@popplerAnnot@/: a t'GI.Poppler.Objects.AnnotFreeText.AnnotFreeText'
    -> m Poppler.Enums.AnnotFreeTextQuadding
    -- ^ __Returns:__ t'GI.Poppler.Enums.AnnotFreeTextQuadding' of /@popplerAnnot@/.
annotFreeTextGetQuadding :: a -> m AnnotFreeTextQuadding
annotFreeTextGetQuadding a
popplerAnnot = IO AnnotFreeTextQuadding -> m AnnotFreeTextQuadding
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO AnnotFreeTextQuadding -> m AnnotFreeTextQuadding)
-> IO AnnotFreeTextQuadding -> m AnnotFreeTextQuadding
forall a b. (a -> b) -> a -> b
$ do
    Ptr AnnotFreeText
popplerAnnot' <- a -> IO (Ptr AnnotFreeText)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
popplerAnnot
    CUInt
result <- Ptr AnnotFreeText -> IO CUInt
poppler_annot_free_text_get_quadding Ptr AnnotFreeText
popplerAnnot'
    let result' :: AnnotFreeTextQuadding
result' = (Int -> AnnotFreeTextQuadding
forall a. Enum a => Int -> a
toEnum (Int -> AnnotFreeTextQuadding)
-> (CUInt -> Int) -> CUInt -> AnnotFreeTextQuadding
forall b c a. (b -> c) -> (a -> b) -> a -> c
. CUInt -> Int
forall a b. (Integral a, Num b) => a -> b
fromIntegral) CUInt
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
popplerAnnot
    AnnotFreeTextQuadding -> IO AnnotFreeTextQuadding
forall (m :: * -> *) a. Monad m => a -> m a
return AnnotFreeTextQuadding
result'

#if defined(ENABLE_OVERLOADING)
data AnnotFreeTextGetQuaddingMethodInfo
instance (signature ~ (m Poppler.Enums.AnnotFreeTextQuadding), MonadIO m, IsAnnotFreeText a) => O.MethodInfo AnnotFreeTextGetQuaddingMethodInfo a signature where
    overloadedMethod = annotFreeTextGetQuadding

#endif