gi-poppler-0.0.30.12: GI/Poppler/Objects/AnnotText.hs
{- |
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.AnnotText
(
-- * Exported types
AnnotText(..) ,
AnnotTextK ,
toAnnotText ,
noAnnotText ,
-- * Methods
-- ** annotTextGetIcon
annotTextGetIcon ,
-- ** annotTextGetIsOpen
annotTextGetIsOpen ,
-- ** annotTextGetState
annotTextGetState ,
-- ** annotTextNew
annotTextNew ,
-- ** annotTextSetIcon
annotTextSetIcon ,
-- ** annotTextSetIsOpen
annotTextSetIsOpen ,
) 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 AnnotText = AnnotText (ForeignPtr AnnotText)
foreign import ccall "poppler_annot_text_get_type"
c_poppler_annot_text_get_type :: IO GType
type instance ParentTypes AnnotText = AnnotTextParentTypes
type AnnotTextParentTypes = '[AnnotMarkup, Annot, GObject.Object]
instance GObject AnnotText where
gobjectIsInitiallyUnowned _ = False
gobjectType _ = c_poppler_annot_text_get_type
class GObject o => AnnotTextK o
instance (GObject o, IsDescendantOf AnnotText o) => AnnotTextK o
toAnnotText :: AnnotTextK o => o -> IO AnnotText
toAnnotText = unsafeCastTo AnnotText
noAnnotText :: Maybe AnnotText
noAnnotText = Nothing
type instance AttributeList AnnotText = AnnotTextAttributeList
type AnnotTextAttributeList = ('[ ] :: [(Symbol, *)])
type instance SignalList AnnotText = AnnotTextSignalList
type AnnotTextSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])
-- method AnnotText::new
-- method type : Constructor
-- Args : [Arg {argName = "doc", argType = TInterface "Poppler" "Document", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "rect", argType = TInterface "Poppler" "Rectangle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "doc", argType = TInterface "Poppler" "Document", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "rect", argType = TInterface "Poppler" "Rectangle", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Poppler" "AnnotText"
-- throws : False
-- Skip return : False
foreign import ccall "poppler_annot_text_new" poppler_annot_text_new ::
Ptr Document -> -- doc : TInterface "Poppler" "Document"
Ptr Rectangle -> -- rect : TInterface "Poppler" "Rectangle"
IO (Ptr AnnotText)
annotTextNew ::
(MonadIO m, DocumentK a) =>
a -> -- doc
Rectangle -> -- rect
m AnnotText
annotTextNew doc rect = liftIO $ do
let doc' = unsafeManagedPtrCastPtr doc
let rect' = unsafeManagedPtrGetPtr rect
result <- poppler_annot_text_new doc' rect'
checkUnexpectedReturnNULL "poppler_annot_text_new" result
result' <- (wrapObject AnnotText) result
touchManagedPtr doc
touchManagedPtr rect
return result'
-- method AnnotText::get_icon
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "AnnotText", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "AnnotText", 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_text_get_icon" poppler_annot_text_get_icon ::
Ptr AnnotText -> -- _obj : TInterface "Poppler" "AnnotText"
IO CString
annotTextGetIcon ::
(MonadIO m, AnnotTextK a) =>
a -> -- _obj
m T.Text
annotTextGetIcon _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- poppler_annot_text_get_icon _obj'
checkUnexpectedReturnNULL "poppler_annot_text_get_icon" result
result' <- cstringToText result
freeMem result
touchManagedPtr _obj
return result'
-- method AnnotText::get_is_open
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "AnnotText", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "AnnotText", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TBoolean
-- throws : False
-- Skip return : False
foreign import ccall "poppler_annot_text_get_is_open" poppler_annot_text_get_is_open ::
Ptr AnnotText -> -- _obj : TInterface "Poppler" "AnnotText"
IO CInt
annotTextGetIsOpen ::
(MonadIO m, AnnotTextK a) =>
a -> -- _obj
m Bool
annotTextGetIsOpen _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- poppler_annot_text_get_is_open _obj'
let result' = (/= 0) result
touchManagedPtr _obj
return result'
-- method AnnotText::get_state
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "AnnotText", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "AnnotText", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "Poppler" "AnnotTextState"
-- throws : False
-- Skip return : False
foreign import ccall "poppler_annot_text_get_state" poppler_annot_text_get_state ::
Ptr AnnotText -> -- _obj : TInterface "Poppler" "AnnotText"
IO CUInt
annotTextGetState ::
(MonadIO m, AnnotTextK a) =>
a -> -- _obj
m AnnotTextState
annotTextGetState _obj = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
result <- poppler_annot_text_get_state _obj'
let result' = (toEnum . fromIntegral) result
touchManagedPtr _obj
return result'
-- method AnnotText::set_icon
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "AnnotText", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "icon", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "AnnotText", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "icon", 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_text_set_icon" poppler_annot_text_set_icon ::
Ptr AnnotText -> -- _obj : TInterface "Poppler" "AnnotText"
CString -> -- icon : TBasicType TUTF8
IO ()
annotTextSetIcon ::
(MonadIO m, AnnotTextK a) =>
a -> -- _obj
T.Text -> -- icon
m ()
annotTextSetIcon _obj icon = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
icon' <- textToCString icon
poppler_annot_text_set_icon _obj' icon'
touchManagedPtr _obj
freeMem icon'
return ()
-- method AnnotText::set_is_open
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "Poppler" "AnnotText", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "is_open", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "Poppler" "AnnotText", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "is_open", argType = TBasicType TBoolean, 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_text_set_is_open" poppler_annot_text_set_is_open ::
Ptr AnnotText -> -- _obj : TInterface "Poppler" "AnnotText"
CInt -> -- is_open : TBasicType TBoolean
IO ()
annotTextSetIsOpen ::
(MonadIO m, AnnotTextK a) =>
a -> -- _obj
Bool -> -- is_open
m ()
annotTextSetIsOpen _obj is_open = liftIO $ do
let _obj' = unsafeManagedPtrCastPtr _obj
let is_open' = (fromIntegral . fromEnum) is_open
poppler_annot_text_set_is_open _obj' is_open'
touchManagedPtr _obj
return ()