{- | 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.Annot ( -- * Exported types Annot(..) , AnnotK , toAnnot , noAnnot , -- * Methods -- ** annotGetAnnotType annotGetAnnotType , -- ** annotGetColor annotGetColor , -- ** annotGetContents annotGetContents , -- ** annotGetFlags annotGetFlags , -- ** annotGetModified annotGetModified , -- ** annotGetName annotGetName , -- ** annotGetPageIndex annotGetPageIndex , -- ** annotGetRectangle annotGetRectangle , -- ** annotSetColor annotSetColor , -- ** annotSetContents annotSetContents , -- ** annotSetFlags annotSetFlags , -- ** annotSetRectangle annotSetRectangle , ) 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 Annot = Annot (ForeignPtr Annot) foreign import ccall "poppler_annot_get_type" c_poppler_annot_get_type :: IO GType type instance ParentTypes Annot = AnnotParentTypes type AnnotParentTypes = '[GObject.Object] instance GObject Annot where gobjectIsInitiallyUnowned _ = False gobjectType _ = c_poppler_annot_get_type class GObject o => AnnotK o instance (GObject o, IsDescendantOf Annot o) => AnnotK o toAnnot :: AnnotK o => o -> IO Annot toAnnot = unsafeCastTo Annot noAnnot :: Maybe Annot noAnnot = Nothing type instance AttributeList Annot = AnnotAttributeList type AnnotAttributeList = ('[ ] :: [(Symbol, *)]) type instance SignalList Annot = AnnotSignalList type AnnotSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)]) -- method Annot::get_annot_type -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Annot", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Annot", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Poppler" "AnnotType" -- throws : False -- Skip return : False foreign import ccall "poppler_annot_get_annot_type" poppler_annot_get_annot_type :: Ptr Annot -> -- _obj : TInterface "Poppler" "Annot" IO CUInt annotGetAnnotType :: (MonadIO m, AnnotK a) => a -> -- _obj m AnnotType annotGetAnnotType _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- poppler_annot_get_annot_type _obj' let result' = (toEnum . fromIntegral) result touchManagedPtr _obj return result' -- method Annot::get_color -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Annot", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Annot", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Poppler" "Color" -- throws : False -- Skip return : False foreign import ccall "poppler_annot_get_color" poppler_annot_get_color :: Ptr Annot -> -- _obj : TInterface "Poppler" "Annot" IO (Ptr Color) annotGetColor :: (MonadIO m, AnnotK a) => a -> -- _obj m Color annotGetColor _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- poppler_annot_get_color _obj' checkUnexpectedReturnNULL "poppler_annot_get_color" result result' <- (wrapBoxed Color) result touchManagedPtr _obj return result' -- method Annot::get_contents -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Annot", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Annot", 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_get_contents" poppler_annot_get_contents :: Ptr Annot -> -- _obj : TInterface "Poppler" "Annot" IO CString annotGetContents :: (MonadIO m, AnnotK a) => a -> -- _obj m T.Text annotGetContents _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- poppler_annot_get_contents _obj' checkUnexpectedReturnNULL "poppler_annot_get_contents" result result' <- cstringToText result freeMem result touchManagedPtr _obj return result' -- method Annot::get_flags -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Annot", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Annot", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "Poppler" "AnnotFlag" -- throws : False -- Skip return : False foreign import ccall "poppler_annot_get_flags" poppler_annot_get_flags :: Ptr Annot -> -- _obj : TInterface "Poppler" "Annot" IO CUInt annotGetFlags :: (MonadIO m, AnnotK a) => a -> -- _obj m [AnnotFlag] annotGetFlags _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- poppler_annot_get_flags _obj' let result' = wordToGFlags result touchManagedPtr _obj return result' -- method Annot::get_modified -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Annot", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Annot", 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_get_modified" poppler_annot_get_modified :: Ptr Annot -> -- _obj : TInterface "Poppler" "Annot" IO CString annotGetModified :: (MonadIO m, AnnotK a) => a -> -- _obj m T.Text annotGetModified _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- poppler_annot_get_modified _obj' checkUnexpectedReturnNULL "poppler_annot_get_modified" result result' <- cstringToText result freeMem result touchManagedPtr _obj return result' -- method Annot::get_name -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Annot", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Annot", 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_get_name" poppler_annot_get_name :: Ptr Annot -> -- _obj : TInterface "Poppler" "Annot" IO CString annotGetName :: (MonadIO m, AnnotK a) => a -> -- _obj m T.Text annotGetName _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- poppler_annot_get_name _obj' checkUnexpectedReturnNULL "poppler_annot_get_name" result result' <- cstringToText result freeMem result touchManagedPtr _obj return result' -- method Annot::get_page_index -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Annot", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Annot", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TInt32 -- throws : False -- Skip return : False foreign import ccall "poppler_annot_get_page_index" poppler_annot_get_page_index :: Ptr Annot -> -- _obj : TInterface "Poppler" "Annot" IO Int32 annotGetPageIndex :: (MonadIO m, AnnotK a) => a -> -- _obj m Int32 annotGetPageIndex _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- poppler_annot_get_page_index _obj' touchManagedPtr _obj return result -- method Annot::get_rectangle -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Annot", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "poppler_rect", argType = TInterface "Poppler" "Rectangle", direction = DirectionOut, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Annot", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "poppler_annot_get_rectangle" poppler_annot_get_rectangle :: Ptr Annot -> -- _obj : TInterface "Poppler" "Annot" Ptr Rectangle -> -- poppler_rect : TInterface "Poppler" "Rectangle" IO () annotGetRectangle :: (MonadIO m, AnnotK a) => a -> -- _obj m (Rectangle) annotGetRectangle _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj poppler_rect <- callocBoxedBytes 32 :: IO (Ptr Rectangle) poppler_annot_get_rectangle _obj' poppler_rect poppler_rect' <- (wrapBoxed Rectangle) poppler_rect touchManagedPtr _obj return poppler_rect' -- method Annot::set_color -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Annot", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "poppler_color", argType = TInterface "Poppler" "Color", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Annot", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "poppler_color", argType = TInterface "Poppler" "Color", direction = DirectionIn, mayBeNull = True, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "poppler_annot_set_color" poppler_annot_set_color :: Ptr Annot -> -- _obj : TInterface "Poppler" "Annot" Ptr Color -> -- poppler_color : TInterface "Poppler" "Color" IO () annotSetColor :: (MonadIO m, AnnotK a) => a -> -- _obj Maybe (Color) -> -- poppler_color m () annotSetColor _obj poppler_color = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj maybePoppler_color <- case poppler_color of Nothing -> return nullPtr Just jPoppler_color -> do let jPoppler_color' = unsafeManagedPtrGetPtr jPoppler_color return jPoppler_color' poppler_annot_set_color _obj' maybePoppler_color touchManagedPtr _obj whenJust poppler_color touchManagedPtr return () -- method Annot::set_contents -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Annot", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "contents", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Annot", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "contents", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "poppler_annot_set_contents" poppler_annot_set_contents :: Ptr Annot -> -- _obj : TInterface "Poppler" "Annot" CString -> -- contents : TBasicType TUTF8 IO () annotSetContents :: (MonadIO m, AnnotK a) => a -> -- _obj T.Text -> -- contents m () annotSetContents _obj contents = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj contents' <- textToCString contents poppler_annot_set_contents _obj' contents' touchManagedPtr _obj freeMem contents' return () -- method Annot::set_flags -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Annot", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Poppler" "AnnotFlag", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Annot", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "flags", argType = TInterface "Poppler" "AnnotFlag", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "poppler_annot_set_flags" poppler_annot_set_flags :: Ptr Annot -> -- _obj : TInterface "Poppler" "Annot" CUInt -> -- flags : TInterface "Poppler" "AnnotFlag" IO () annotSetFlags :: (MonadIO m, AnnotK a) => a -> -- _obj [AnnotFlag] -> -- flags m () annotSetFlags _obj flags = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj let flags' = gflagsToWord flags poppler_annot_set_flags _obj' flags' touchManagedPtr _obj return () -- method Annot::set_rectangle -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "Annot", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "poppler_rect", argType = TInterface "Poppler" "Rectangle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "Annot", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "poppler_rect", argType = TInterface "Poppler" "Rectangle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TVoid -- throws : False -- Skip return : False foreign import ccall "poppler_annot_set_rectangle" poppler_annot_set_rectangle :: Ptr Annot -> -- _obj : TInterface "Poppler" "Annot" Ptr Rectangle -> -- poppler_rect : TInterface "Poppler" "Rectangle" IO () annotSetRectangle :: (MonadIO m, AnnotK a) => a -> -- _obj Rectangle -> -- poppler_rect m () annotSetRectangle _obj poppler_rect = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj let poppler_rect' = unsafeManagedPtrGetPtr poppler_rect poppler_annot_set_rectangle _obj' poppler_rect' touchManagedPtr _obj touchManagedPtr poppler_rect return ()