gi-webkit2webextension-4.0.19: GI/WebKit2WebExtension/Objects/WebExtension.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)
/No description available in the introspection data./
-}
#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.WebKit2WebExtension.Objects.WebExtension
(
-- * Exported types
WebExtension(..) ,
IsWebExtension ,
toWebExtension ,
noWebExtension ,
-- * Methods
-- ** getPage #method:getPage#
#if ENABLE_OVERLOADING
WebExtensionGetPageMethodInfo ,
#endif
webExtensionGetPage ,
-- * Signals
-- ** pageCreated #signal:pageCreated#
C_WebExtensionPageCreatedCallback ,
WebExtensionPageCreatedCallback ,
#if ENABLE_OVERLOADING
WebExtensionPageCreatedSignalInfo ,
#endif
afterWebExtensionPageCreated ,
genClosure_WebExtensionPageCreated ,
mk_WebExtensionPageCreatedCallback ,
noWebExtensionPageCreatedCallback ,
onWebExtensionPageCreated ,
wrap_WebExtensionPageCreatedCallback ,
) 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.WebKit2WebExtension.Objects.WebPage as WebKit2WebExtension.WebPage
-- | Memory-managed wrapper type.
newtype WebExtension = WebExtension (ManagedPtr WebExtension)
foreign import ccall "webkit_web_extension_get_type"
c_webkit_web_extension_get_type :: IO GType
instance GObject WebExtension where
gobjectType = c_webkit_web_extension_get_type
-- | Type class for types which can be safely cast to `WebExtension`, for instance with `toWebExtension`.
class (GObject o, O.IsDescendantOf WebExtension o) => IsWebExtension o
instance (GObject o, O.IsDescendantOf WebExtension o) => IsWebExtension o
instance O.HasParentTypes WebExtension
type instance O.ParentTypes WebExtension = '[GObject.Object.Object]
-- | Cast to `WebExtension`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toWebExtension :: (MonadIO m, IsWebExtension o) => o -> m WebExtension
toWebExtension = liftIO . unsafeCastTo WebExtension
-- | A convenience alias for `Nothing` :: `Maybe` `WebExtension`.
noWebExtension :: Maybe WebExtension
noWebExtension = Nothing
#if ENABLE_OVERLOADING
type family ResolveWebExtensionMethod (t :: Symbol) (o :: *) :: * where
ResolveWebExtensionMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveWebExtensionMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveWebExtensionMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveWebExtensionMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveWebExtensionMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveWebExtensionMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveWebExtensionMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveWebExtensionMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveWebExtensionMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveWebExtensionMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveWebExtensionMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveWebExtensionMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveWebExtensionMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveWebExtensionMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveWebExtensionMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveWebExtensionMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveWebExtensionMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveWebExtensionMethod "getPage" o = WebExtensionGetPageMethodInfo
ResolveWebExtensionMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveWebExtensionMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveWebExtensionMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveWebExtensionMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveWebExtensionMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveWebExtensionMethod t WebExtension, O.MethodInfo info WebExtension p) => OL.IsLabel t (WebExtension -> 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
-- signal WebExtension::page-created
{- |
This signal is emitted when a new 'GI.WebKit2WebExtension.Objects.WebPage.WebPage' is created in
the Web Process.
-}
type WebExtensionPageCreatedCallback =
WebKit2WebExtension.WebPage.WebPage
{- ^ /@webPage@/: the 'GI.WebKit2WebExtension.Objects.WebPage.WebPage' created -}
-> IO ()
-- | A convenience synonym for @`Nothing` :: `Maybe` `WebExtensionPageCreatedCallback`@.
noWebExtensionPageCreatedCallback :: Maybe WebExtensionPageCreatedCallback
noWebExtensionPageCreatedCallback = Nothing
-- | Type for the callback on the (unwrapped) C side.
type C_WebExtensionPageCreatedCallback =
Ptr () -> -- object
Ptr WebKit2WebExtension.WebPage.WebPage ->
Ptr () -> -- user_data
IO ()
-- | Generate a function pointer callable from C code, from a `C_WebExtensionPageCreatedCallback`.
foreign import ccall "wrapper"
mk_WebExtensionPageCreatedCallback :: C_WebExtensionPageCreatedCallback -> IO (FunPtr C_WebExtensionPageCreatedCallback)
-- | Wrap the callback into a `GClosure`.
genClosure_WebExtensionPageCreated :: MonadIO m => WebExtensionPageCreatedCallback -> m (GClosure C_WebExtensionPageCreatedCallback)
genClosure_WebExtensionPageCreated cb = liftIO $ do
let cb' = wrap_WebExtensionPageCreatedCallback cb
mk_WebExtensionPageCreatedCallback cb' >>= B.GClosure.newGClosure
-- | Wrap a `WebExtensionPageCreatedCallback` into a `C_WebExtensionPageCreatedCallback`.
wrap_WebExtensionPageCreatedCallback ::
WebExtensionPageCreatedCallback ->
C_WebExtensionPageCreatedCallback
wrap_WebExtensionPageCreatedCallback _cb _ webPage _ = do
webPage' <- (newObject WebKit2WebExtension.WebPage.WebPage) webPage
_cb webPage'
{- |
Connect a signal handler for the “@page-created@” signal, to be run before the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Signals.on' webExtension #pageCreated callback
@
-}
onWebExtensionPageCreated :: (IsWebExtension a, MonadIO m) => a -> WebExtensionPageCreatedCallback -> m SignalHandlerId
onWebExtensionPageCreated obj cb = liftIO $ do
let cb' = wrap_WebExtensionPageCreatedCallback cb
cb'' <- mk_WebExtensionPageCreatedCallback cb'
connectSignalFunPtr obj "page-created" cb'' SignalConnectBefore
{- |
Connect a signal handler for the “@page-created@” signal, to be run after the default handler.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Signals.after' webExtension #pageCreated callback
@
-}
afterWebExtensionPageCreated :: (IsWebExtension a, MonadIO m) => a -> WebExtensionPageCreatedCallback -> m SignalHandlerId
afterWebExtensionPageCreated obj cb = liftIO $ do
let cb' = wrap_WebExtensionPageCreatedCallback cb
cb'' <- mk_WebExtensionPageCreatedCallback cb'
connectSignalFunPtr obj "page-created" cb'' SignalConnectAfter
#if ENABLE_OVERLOADING
instance O.HasAttributeList WebExtension
type instance O.AttributeList WebExtension = WebExtensionAttributeList
type WebExtensionAttributeList = ('[ ] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
#endif
#if ENABLE_OVERLOADING
data WebExtensionPageCreatedSignalInfo
instance SignalInfo WebExtensionPageCreatedSignalInfo where
type HaskellCallbackType WebExtensionPageCreatedSignalInfo = WebExtensionPageCreatedCallback
connectSignal _ obj cb connectMode = do
let cb' = wrap_WebExtensionPageCreatedCallback cb
cb'' <- mk_WebExtensionPageCreatedCallback cb'
connectSignalFunPtr obj "page-created" cb'' connectMode
type instance O.SignalList WebExtension = WebExtensionSignalList
type WebExtensionSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo), '("pageCreated", WebExtensionPageCreatedSignalInfo)] :: [(Symbol, *)])
#endif
-- method WebExtension::get_page
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "extension", argType = TInterface (Name {namespace = "WebKit2WebExtension", name = "WebExtension"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #WebKitWebExtension", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "page_id", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the identifier of the #WebKitWebPage to get", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "WebKit2WebExtension", name = "WebPage"}))
-- throws : False
-- Skip return : False
foreign import ccall "webkit_web_extension_get_page" webkit_web_extension_get_page ::
Ptr WebExtension -> -- extension : TInterface (Name {namespace = "WebKit2WebExtension", name = "WebExtension"})
Word64 -> -- page_id : TBasicType TUInt64
IO (Ptr WebKit2WebExtension.WebPage.WebPage)
{- |
Get the web page of the given /@pageId@/.
-}
webExtensionGetPage ::
(B.CallStack.HasCallStack, MonadIO m, IsWebExtension a) =>
a
{- ^ /@extension@/: a 'GI.WebKit2WebExtension.Objects.WebExtension.WebExtension' -}
-> Word64
{- ^ /@pageId@/: the identifier of the 'GI.WebKit2WebExtension.Objects.WebPage.WebPage' to get -}
-> m (Maybe WebKit2WebExtension.WebPage.WebPage)
{- ^ __Returns:__ the 'GI.WebKit2WebExtension.Objects.WebPage.WebPage' for the given /@pageId@/, or 'Nothing' if the
identifier doesn\'t correspond to an existing web page. -}
webExtensionGetPage extension pageId = liftIO $ do
extension' <- unsafeManagedPtrCastPtr extension
result <- webkit_web_extension_get_page extension' pageId
maybeResult <- convertIfNonNull result $ \result' -> do
result'' <- (newObject WebKit2WebExtension.WebPage.WebPage) result'
return result''
touchManagedPtr extension
return maybeResult
#if ENABLE_OVERLOADING
data WebExtensionGetPageMethodInfo
instance (signature ~ (Word64 -> m (Maybe WebKit2WebExtension.WebPage.WebPage)), MonadIO m, IsWebExtension a) => O.MethodInfo WebExtensionGetPageMethodInfo a signature where
overloadedMethod _ = webExtensionGetPage
#endif