#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Poppler.Objects.Annot
(
Annot(..) ,
IsAnnot ,
toAnnot ,
noAnnot ,
#if ENABLE_OVERLOADING
AnnotGetAnnotTypeMethodInfo ,
#endif
annotGetAnnotType ,
#if ENABLE_OVERLOADING
AnnotGetColorMethodInfo ,
#endif
annotGetColor ,
#if ENABLE_OVERLOADING
AnnotGetContentsMethodInfo ,
#endif
annotGetContents ,
#if ENABLE_OVERLOADING
AnnotGetFlagsMethodInfo ,
#endif
annotGetFlags ,
#if ENABLE_OVERLOADING
AnnotGetModifiedMethodInfo ,
#endif
annotGetModified ,
#if ENABLE_OVERLOADING
AnnotGetNameMethodInfo ,
#endif
annotGetName ,
#if ENABLE_OVERLOADING
AnnotGetPageIndexMethodInfo ,
#endif
annotGetPageIndex ,
#if ENABLE_OVERLOADING
AnnotGetRectangleMethodInfo ,
#endif
annotGetRectangle ,
#if ENABLE_OVERLOADING
AnnotSetColorMethodInfo ,
#endif
annotSetColor ,
#if ENABLE_OVERLOADING
AnnotSetContentsMethodInfo ,
#endif
annotSetContents ,
#if ENABLE_OVERLOADING
AnnotSetFlagsMethodInfo ,
#endif
annotSetFlags ,
#if ENABLE_OVERLOADING
AnnotSetRectangleMethodInfo ,
#endif
annotSetRectangle ,
) 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.Enums as Poppler.Enums
import {-# SOURCE #-} qualified GI.Poppler.Flags as Poppler.Flags
import {-# SOURCE #-} qualified GI.Poppler.Structs.Color as Poppler.Color
import {-# SOURCE #-} qualified GI.Poppler.Structs.Rectangle as Poppler.Rectangle
newtype Annot = Annot (ManagedPtr Annot)
foreign import ccall "poppler_annot_get_type"
c_poppler_annot_get_type :: IO GType
instance GObject Annot where
gobjectType = c_poppler_annot_get_type
class (GObject o, O.IsDescendantOf Annot o) => IsAnnot o
instance (GObject o, O.IsDescendantOf Annot o) => IsAnnot o
instance O.HasParentTypes Annot
type instance O.ParentTypes Annot = '[GObject.Object.Object]
toAnnot :: (MonadIO m, IsAnnot o) => o -> m Annot
toAnnot = liftIO . unsafeCastTo Annot
noAnnot :: Maybe Annot
noAnnot = Nothing
#if ENABLE_OVERLOADING
type family ResolveAnnotMethod (t :: Symbol) (o :: *) :: * where
ResolveAnnotMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveAnnotMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveAnnotMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveAnnotMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveAnnotMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveAnnotMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveAnnotMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveAnnotMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveAnnotMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveAnnotMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveAnnotMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveAnnotMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveAnnotMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveAnnotMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveAnnotMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveAnnotMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveAnnotMethod "getAnnotType" o = AnnotGetAnnotTypeMethodInfo
ResolveAnnotMethod "getColor" o = AnnotGetColorMethodInfo
ResolveAnnotMethod "getContents" o = AnnotGetContentsMethodInfo
ResolveAnnotMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveAnnotMethod "getFlags" o = AnnotGetFlagsMethodInfo
ResolveAnnotMethod "getModified" o = AnnotGetModifiedMethodInfo
ResolveAnnotMethod "getName" o = AnnotGetNameMethodInfo
ResolveAnnotMethod "getPageIndex" o = AnnotGetPageIndexMethodInfo
ResolveAnnotMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveAnnotMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveAnnotMethod "getRectangle" o = AnnotGetRectangleMethodInfo
ResolveAnnotMethod "setColor" o = AnnotSetColorMethodInfo
ResolveAnnotMethod "setContents" o = AnnotSetContentsMethodInfo
ResolveAnnotMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveAnnotMethod "setFlags" o = AnnotSetFlagsMethodInfo
ResolveAnnotMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveAnnotMethod "setRectangle" o = AnnotSetRectangleMethodInfo
ResolveAnnotMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveAnnotMethod t Annot, O.MethodInfo info Annot p) => OL.IsLabel t (Annot -> 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 Annot
type instance O.AttributeList Annot = AnnotAttributeList
type AnnotAttributeList = ('[ ] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
#endif
#if ENABLE_OVERLOADING
type instance O.SignalList Annot = AnnotSignalList
type AnnotSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "poppler_annot_get_annot_type" poppler_annot_get_annot_type ::
Ptr Annot ->
IO CUInt
annotGetAnnotType ::
(B.CallStack.HasCallStack, MonadIO m, IsAnnot a) =>
a
-> m Poppler.Enums.AnnotType
annotGetAnnotType popplerAnnot = liftIO $ do
popplerAnnot' <- unsafeManagedPtrCastPtr popplerAnnot
result <- poppler_annot_get_annot_type popplerAnnot'
let result' = (toEnum . fromIntegral) result
touchManagedPtr popplerAnnot
return result'
#if ENABLE_OVERLOADING
data AnnotGetAnnotTypeMethodInfo
instance (signature ~ (m Poppler.Enums.AnnotType), MonadIO m, IsAnnot a) => O.MethodInfo AnnotGetAnnotTypeMethodInfo a signature where
overloadedMethod _ = annotGetAnnotType
#endif
foreign import ccall "poppler_annot_get_color" poppler_annot_get_color ::
Ptr Annot ->
IO (Ptr Poppler.Color.Color)
annotGetColor ::
(B.CallStack.HasCallStack, MonadIO m, IsAnnot a) =>
a
-> m Poppler.Color.Color
annotGetColor popplerAnnot = liftIO $ do
popplerAnnot' <- unsafeManagedPtrCastPtr popplerAnnot
result <- poppler_annot_get_color popplerAnnot'
checkUnexpectedReturnNULL "annotGetColor" result
result' <- (wrapBoxed Poppler.Color.Color) result
touchManagedPtr popplerAnnot
return result'
#if ENABLE_OVERLOADING
data AnnotGetColorMethodInfo
instance (signature ~ (m Poppler.Color.Color), MonadIO m, IsAnnot a) => O.MethodInfo AnnotGetColorMethodInfo a signature where
overloadedMethod _ = annotGetColor
#endif
foreign import ccall "poppler_annot_get_contents" poppler_annot_get_contents ::
Ptr Annot ->
IO CString
annotGetContents ::
(B.CallStack.HasCallStack, MonadIO m, IsAnnot a) =>
a
-> m T.Text
annotGetContents popplerAnnot = liftIO $ do
popplerAnnot' <- unsafeManagedPtrCastPtr popplerAnnot
result <- poppler_annot_get_contents popplerAnnot'
checkUnexpectedReturnNULL "annotGetContents" result
result' <- cstringToText result
freeMem result
touchManagedPtr popplerAnnot
return result'
#if ENABLE_OVERLOADING
data AnnotGetContentsMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsAnnot a) => O.MethodInfo AnnotGetContentsMethodInfo a signature where
overloadedMethod _ = annotGetContents
#endif
foreign import ccall "poppler_annot_get_flags" poppler_annot_get_flags ::
Ptr Annot ->
IO CUInt
annotGetFlags ::
(B.CallStack.HasCallStack, MonadIO m, IsAnnot a) =>
a
-> m [Poppler.Flags.AnnotFlag]
annotGetFlags popplerAnnot = liftIO $ do
popplerAnnot' <- unsafeManagedPtrCastPtr popplerAnnot
result <- poppler_annot_get_flags popplerAnnot'
let result' = wordToGFlags result
touchManagedPtr popplerAnnot
return result'
#if ENABLE_OVERLOADING
data AnnotGetFlagsMethodInfo
instance (signature ~ (m [Poppler.Flags.AnnotFlag]), MonadIO m, IsAnnot a) => O.MethodInfo AnnotGetFlagsMethodInfo a signature where
overloadedMethod _ = annotGetFlags
#endif
foreign import ccall "poppler_annot_get_modified" poppler_annot_get_modified ::
Ptr Annot ->
IO CString
annotGetModified ::
(B.CallStack.HasCallStack, MonadIO m, IsAnnot a) =>
a
-> m T.Text
annotGetModified popplerAnnot = liftIO $ do
popplerAnnot' <- unsafeManagedPtrCastPtr popplerAnnot
result <- poppler_annot_get_modified popplerAnnot'
checkUnexpectedReturnNULL "annotGetModified" result
result' <- cstringToText result
freeMem result
touchManagedPtr popplerAnnot
return result'
#if ENABLE_OVERLOADING
data AnnotGetModifiedMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsAnnot a) => O.MethodInfo AnnotGetModifiedMethodInfo a signature where
overloadedMethod _ = annotGetModified
#endif
foreign import ccall "poppler_annot_get_name" poppler_annot_get_name ::
Ptr Annot ->
IO CString
annotGetName ::
(B.CallStack.HasCallStack, MonadIO m, IsAnnot a) =>
a
-> m T.Text
annotGetName popplerAnnot = liftIO $ do
popplerAnnot' <- unsafeManagedPtrCastPtr popplerAnnot
result <- poppler_annot_get_name popplerAnnot'
checkUnexpectedReturnNULL "annotGetName" result
result' <- cstringToText result
freeMem result
touchManagedPtr popplerAnnot
return result'
#if ENABLE_OVERLOADING
data AnnotGetNameMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsAnnot a) => O.MethodInfo AnnotGetNameMethodInfo a signature where
overloadedMethod _ = annotGetName
#endif
foreign import ccall "poppler_annot_get_page_index" poppler_annot_get_page_index ::
Ptr Annot ->
IO Int32
annotGetPageIndex ::
(B.CallStack.HasCallStack, MonadIO m, IsAnnot a) =>
a
-> m Int32
annotGetPageIndex popplerAnnot = liftIO $ do
popplerAnnot' <- unsafeManagedPtrCastPtr popplerAnnot
result <- poppler_annot_get_page_index popplerAnnot'
touchManagedPtr popplerAnnot
return result
#if ENABLE_OVERLOADING
data AnnotGetPageIndexMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsAnnot a) => O.MethodInfo AnnotGetPageIndexMethodInfo a signature where
overloadedMethod _ = annotGetPageIndex
#endif
foreign import ccall "poppler_annot_get_rectangle" poppler_annot_get_rectangle ::
Ptr Annot ->
Ptr Poppler.Rectangle.Rectangle ->
IO ()
annotGetRectangle ::
(B.CallStack.HasCallStack, MonadIO m, IsAnnot a) =>
a
-> m (Poppler.Rectangle.Rectangle)
annotGetRectangle popplerAnnot = liftIO $ do
popplerAnnot' <- unsafeManagedPtrCastPtr popplerAnnot
popplerRect <- callocBoxedBytes 32 :: IO (Ptr Poppler.Rectangle.Rectangle)
poppler_annot_get_rectangle popplerAnnot' popplerRect
popplerRect' <- (wrapBoxed Poppler.Rectangle.Rectangle) popplerRect
touchManagedPtr popplerAnnot
return popplerRect'
#if ENABLE_OVERLOADING
data AnnotGetRectangleMethodInfo
instance (signature ~ (m (Poppler.Rectangle.Rectangle)), MonadIO m, IsAnnot a) => O.MethodInfo AnnotGetRectangleMethodInfo a signature where
overloadedMethod _ = annotGetRectangle
#endif
foreign import ccall "poppler_annot_set_color" poppler_annot_set_color ::
Ptr Annot ->
Ptr Poppler.Color.Color ->
IO ()
annotSetColor ::
(B.CallStack.HasCallStack, MonadIO m, IsAnnot a) =>
a
-> Maybe (Poppler.Color.Color)
-> m ()
annotSetColor popplerAnnot popplerColor = liftIO $ do
popplerAnnot' <- unsafeManagedPtrCastPtr popplerAnnot
maybePopplerColor <- case popplerColor of
Nothing -> return nullPtr
Just jPopplerColor -> do
jPopplerColor' <- unsafeManagedPtrGetPtr jPopplerColor
return jPopplerColor'
poppler_annot_set_color popplerAnnot' maybePopplerColor
touchManagedPtr popplerAnnot
whenJust popplerColor touchManagedPtr
return ()
#if ENABLE_OVERLOADING
data AnnotSetColorMethodInfo
instance (signature ~ (Maybe (Poppler.Color.Color) -> m ()), MonadIO m, IsAnnot a) => O.MethodInfo AnnotSetColorMethodInfo a signature where
overloadedMethod _ = annotSetColor
#endif
foreign import ccall "poppler_annot_set_contents" poppler_annot_set_contents ::
Ptr Annot ->
CString ->
IO ()
annotSetContents ::
(B.CallStack.HasCallStack, MonadIO m, IsAnnot a) =>
a
-> T.Text
-> m ()
annotSetContents popplerAnnot contents = liftIO $ do
popplerAnnot' <- unsafeManagedPtrCastPtr popplerAnnot
contents' <- textToCString contents
poppler_annot_set_contents popplerAnnot' contents'
touchManagedPtr popplerAnnot
freeMem contents'
return ()
#if ENABLE_OVERLOADING
data AnnotSetContentsMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, IsAnnot a) => O.MethodInfo AnnotSetContentsMethodInfo a signature where
overloadedMethod _ = annotSetContents
#endif
foreign import ccall "poppler_annot_set_flags" poppler_annot_set_flags ::
Ptr Annot ->
CUInt ->
IO ()
annotSetFlags ::
(B.CallStack.HasCallStack, MonadIO m, IsAnnot a) =>
a
-> [Poppler.Flags.AnnotFlag]
-> m ()
annotSetFlags popplerAnnot flags = liftIO $ do
popplerAnnot' <- unsafeManagedPtrCastPtr popplerAnnot
let flags' = gflagsToWord flags
poppler_annot_set_flags popplerAnnot' flags'
touchManagedPtr popplerAnnot
return ()
#if ENABLE_OVERLOADING
data AnnotSetFlagsMethodInfo
instance (signature ~ ([Poppler.Flags.AnnotFlag] -> m ()), MonadIO m, IsAnnot a) => O.MethodInfo AnnotSetFlagsMethodInfo a signature where
overloadedMethod _ = annotSetFlags
#endif
foreign import ccall "poppler_annot_set_rectangle" poppler_annot_set_rectangle ::
Ptr Annot ->
Ptr Poppler.Rectangle.Rectangle ->
IO ()
annotSetRectangle ::
(B.CallStack.HasCallStack, MonadIO m, IsAnnot a) =>
a
-> Poppler.Rectangle.Rectangle
-> m ()
annotSetRectangle popplerAnnot popplerRect = liftIO $ do
popplerAnnot' <- unsafeManagedPtrCastPtr popplerAnnot
popplerRect' <- unsafeManagedPtrGetPtr popplerRect
poppler_annot_set_rectangle popplerAnnot' popplerRect'
touchManagedPtr popplerAnnot
touchManagedPtr popplerRect
return ()
#if ENABLE_OVERLOADING
data AnnotSetRectangleMethodInfo
instance (signature ~ (Poppler.Rectangle.Rectangle -> m ()), MonadIO m, IsAnnot a) => O.MethodInfo AnnotSetRectangleMethodInfo a signature where
overloadedMethod _ = annotSetRectangle
#endif