{- | 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.WebKit2WebExtension.Objects.DOMText ( -- * Exported types DOMText(..) , DOMTextK , toDOMText , noDOMText , -- * Methods -- ** dOMTextGetWholeText dOMTextGetWholeText , -- ** dOMTextReplaceWholeText dOMTextReplaceWholeText , -- ** dOMTextSplitText dOMTextSplitText , -- * Properties -- ** WholeText DOMTextWholeTextPropertyInfo , getDOMTextWholeText , ) 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.WebKit2WebExtension.Types import GI.WebKit2WebExtension.Callbacks import qualified GI.GObject as GObject newtype DOMText = DOMText (ForeignPtr DOMText) foreign import ccall "webkit_dom_text_get_type" c_webkit_dom_text_get_type :: IO GType type instance ParentTypes DOMText = DOMTextParentTypes type DOMTextParentTypes = '[DOMCharacterData, DOMNode, DOMObject, GObject.Object, DOMEventTarget] instance GObject DOMText where gobjectIsInitiallyUnowned _ = False gobjectType _ = c_webkit_dom_text_get_type class GObject o => DOMTextK o instance (GObject o, IsDescendantOf DOMText o) => DOMTextK o toDOMText :: DOMTextK o => o -> IO DOMText toDOMText = unsafeCastTo DOMText noDOMText :: Maybe DOMText noDOMText = Nothing -- VVV Prop "whole-text" -- Type: TBasicType TUTF8 -- Flags: [PropertyReadable] getDOMTextWholeText :: (MonadIO m, DOMTextK o) => o -> m T.Text getDOMTextWholeText obj = liftIO $ getObjectPropertyString obj "whole-text" data DOMTextWholeTextPropertyInfo instance AttrInfo DOMTextWholeTextPropertyInfo where type AttrAllowedOps DOMTextWholeTextPropertyInfo = '[ 'AttrGet] type AttrSetTypeConstraint DOMTextWholeTextPropertyInfo = (~) () type AttrBaseTypeConstraint DOMTextWholeTextPropertyInfo = DOMTextK type AttrGetType DOMTextWholeTextPropertyInfo = T.Text type AttrLabel DOMTextWholeTextPropertyInfo = "DOMText::whole-text" attrGet _ = getDOMTextWholeText attrSet _ = undefined attrConstruct _ = undefined type instance AttributeList DOMText = DOMTextAttributeList type DOMTextAttributeList = ('[ '("base-uri", DOMNodeBaseUriPropertyInfo), '("child-nodes", DOMNodeChildNodesPropertyInfo), '("core-object", DOMObjectCoreObjectPropertyInfo), '("data", DOMCharacterDataDataPropertyInfo), '("first-child", DOMNodeFirstChildPropertyInfo), '("last-child", DOMNodeLastChildPropertyInfo), '("length", DOMCharacterDataLengthPropertyInfo), '("local-name", DOMNodeLocalNamePropertyInfo), '("namespace-uri", DOMNodeNamespaceUriPropertyInfo), '("next-element-sibling", DOMCharacterDataNextElementSiblingPropertyInfo), '("next-sibling", DOMNodeNextSiblingPropertyInfo), '("node-name", DOMNodeNodeNamePropertyInfo), '("node-type", DOMNodeNodeTypePropertyInfo), '("node-value", DOMNodeNodeValuePropertyInfo), '("owner-document", DOMNodeOwnerDocumentPropertyInfo), '("parent-element", DOMNodeParentElementPropertyInfo), '("parent-node", DOMNodeParentNodePropertyInfo), '("prefix", DOMNodePrefixPropertyInfo), '("previous-element-sibling", DOMCharacterDataPreviousElementSiblingPropertyInfo), '("previous-sibling", DOMNodePreviousSiblingPropertyInfo), '("text-content", DOMNodeTextContentPropertyInfo), '("whole-text", DOMTextWholeTextPropertyInfo)] :: [(Symbol, *)]) type instance SignalList DOMText = DOMTextSignalList type DOMTextSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)]) -- method DOMText::get_whole_text -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2WebExtension" "DOMText", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2WebExtension" "DOMText", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TBasicType TUTF8 -- throws : False -- Skip return : False foreign import ccall "webkit_dom_text_get_whole_text" webkit_dom_text_get_whole_text :: Ptr DOMText -> -- _obj : TInterface "WebKit2WebExtension" "DOMText" IO CString dOMTextGetWholeText :: (MonadIO m, DOMTextK a) => a -> -- _obj m T.Text dOMTextGetWholeText _obj = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj result <- webkit_dom_text_get_whole_text _obj' checkUnexpectedReturnNULL "webkit_dom_text_get_whole_text" result result' <- cstringToText result freeMem result touchManagedPtr _obj return result' -- method DOMText::replace_whole_text -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2WebExtension" "DOMText", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "content", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2WebExtension" "DOMText", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "content", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "WebKit2WebExtension" "DOMText" -- throws : True -- Skip return : False foreign import ccall "webkit_dom_text_replace_whole_text" webkit_dom_text_replace_whole_text :: Ptr DOMText -> -- _obj : TInterface "WebKit2WebExtension" "DOMText" CString -> -- content : TBasicType TUTF8 Ptr (Ptr GError) -> -- error IO (Ptr DOMText) dOMTextReplaceWholeText :: (MonadIO m, DOMTextK a) => a -> -- _obj T.Text -> -- content m DOMText dOMTextReplaceWholeText _obj content = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj content' <- textToCString content onException (do result <- propagateGError $ webkit_dom_text_replace_whole_text _obj' content' checkUnexpectedReturnNULL "webkit_dom_text_replace_whole_text" result result' <- (newObject DOMText) result touchManagedPtr _obj freeMem content' return result' ) (do freeMem content' ) -- method DOMText::split_text -- method type : OrdinaryMethod -- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2WebExtension" "DOMText", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "offset", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- Lengths : [] -- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2WebExtension" "DOMText", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "offset", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}] -- returnType : TInterface "WebKit2WebExtension" "DOMText" -- throws : True -- Skip return : False foreign import ccall "webkit_dom_text_split_text" webkit_dom_text_split_text :: Ptr DOMText -> -- _obj : TInterface "WebKit2WebExtension" "DOMText" Word64 -> -- offset : TBasicType TUInt64 Ptr (Ptr GError) -> -- error IO (Ptr DOMText) dOMTextSplitText :: (MonadIO m, DOMTextK a) => a -> -- _obj Word64 -> -- offset m DOMText dOMTextSplitText _obj offset = liftIO $ do let _obj' = unsafeManagedPtrCastPtr _obj onException (do result <- propagateGError $ webkit_dom_text_split_text _obj' offset checkUnexpectedReturnNULL "webkit_dom_text_split_text" result result' <- (newObject DOMText) result touchManagedPtr _obj return result' ) (do return () )