{- |
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.DOMNodeList
    (

-- * Exported types
    DOMNodeList(..)                         ,
    IsDOMNodeList                           ,
    toDOMNodeList                           ,
    noDOMNodeList                           ,


 -- * Methods
-- ** getLength #method:getLength#

#if ENABLE_OVERLOADING
    DOMNodeListGetLengthMethodInfo          ,
#endif
    dOMNodeListGetLength                    ,


-- ** item #method:item#

#if ENABLE_OVERLOADING
    DOMNodeListItemMethodInfo               ,
#endif
    dOMNodeListItem                         ,




 -- * Properties
-- ** length #attr:length#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    DOMNodeListLengthPropertyInfo           ,
#endif
#if ENABLE_OVERLOADING
    dOMNodeListLength                       ,
#endif
    getDOMNodeListLength                    ,




    ) 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.DOMNode as WebKit2WebExtension.DOMNode
import {-# SOURCE #-} qualified GI.WebKit2WebExtension.Objects.DOMObject as WebKit2WebExtension.DOMObject

-- | Memory-managed wrapper type.
newtype DOMNodeList = DOMNodeList (ManagedPtr DOMNodeList)
foreign import ccall "webkit_dom_node_list_get_type"
    c_webkit_dom_node_list_get_type :: IO GType

instance GObject DOMNodeList where
    gobjectType = c_webkit_dom_node_list_get_type


-- | Type class for types which can be safely cast to `DOMNodeList`, for instance with `toDOMNodeList`.
class (GObject o, O.IsDescendantOf DOMNodeList o) => IsDOMNodeList o
instance (GObject o, O.IsDescendantOf DOMNodeList o) => IsDOMNodeList o

instance O.HasParentTypes DOMNodeList
type instance O.ParentTypes DOMNodeList = '[WebKit2WebExtension.DOMObject.DOMObject, GObject.Object.Object]

-- | Cast to `DOMNodeList`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toDOMNodeList :: (MonadIO m, IsDOMNodeList o) => o -> m DOMNodeList
toDOMNodeList = liftIO . unsafeCastTo DOMNodeList

-- | A convenience alias for `Nothing` :: `Maybe` `DOMNodeList`.
noDOMNodeList :: Maybe DOMNodeList
noDOMNodeList = Nothing

#if ENABLE_OVERLOADING
type family ResolveDOMNodeListMethod (t :: Symbol) (o :: *) :: * where
    ResolveDOMNodeListMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveDOMNodeListMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveDOMNodeListMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveDOMNodeListMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveDOMNodeListMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveDOMNodeListMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveDOMNodeListMethod "item" o = DOMNodeListItemMethodInfo
    ResolveDOMNodeListMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveDOMNodeListMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveDOMNodeListMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveDOMNodeListMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveDOMNodeListMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveDOMNodeListMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveDOMNodeListMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveDOMNodeListMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveDOMNodeListMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveDOMNodeListMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveDOMNodeListMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveDOMNodeListMethod "getLength" o = DOMNodeListGetLengthMethodInfo
    ResolveDOMNodeListMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveDOMNodeListMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveDOMNodeListMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveDOMNodeListMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveDOMNodeListMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveDOMNodeListMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveDOMNodeListMethod t DOMNodeList, O.MethodInfo info DOMNodeList p) => OL.IsLabel t (DOMNodeList -> 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

-- VVV Prop "length"
   -- Type: TBasicType TULong
   -- Flags: [PropertyReadable]
   -- Nullable: (Just False,Nothing)

{- |
Get the value of the “@length@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' dOMNodeList #length
@
-}
getDOMNodeListLength :: (MonadIO m, IsDOMNodeList o) => o -> m CULong
getDOMNodeListLength obj = liftIO $ B.Properties.getObjectPropertyULong obj "length"

#if ENABLE_OVERLOADING
data DOMNodeListLengthPropertyInfo
instance AttrInfo DOMNodeListLengthPropertyInfo where
    type AttrAllowedOps DOMNodeListLengthPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMNodeListLengthPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMNodeListLengthPropertyInfo = IsDOMNodeList
    type AttrGetType DOMNodeListLengthPropertyInfo = CULong
    type AttrLabel DOMNodeListLengthPropertyInfo = "length"
    type AttrOrigin DOMNodeListLengthPropertyInfo = DOMNodeList
    attrGet _ = getDOMNodeListLength
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined
#endif

#if ENABLE_OVERLOADING
instance O.HasAttributeList DOMNodeList
type instance O.AttributeList DOMNodeList = DOMNodeListAttributeList
type DOMNodeListAttributeList = ('[ '("coreObject", WebKit2WebExtension.DOMObject.DOMObjectCoreObjectPropertyInfo), '("length", DOMNodeListLengthPropertyInfo)] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
dOMNodeListLength :: AttrLabelProxy "length"
dOMNodeListLength = AttrLabelProxy

#endif

#if ENABLE_OVERLOADING
type instance O.SignalList DOMNodeList = DOMNodeListSignalList
type DOMNodeListSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method DOMNodeList::get_length
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "WebKit2WebExtension", name = "DOMNodeList"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #WebKitDOMNodeList", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TULong)
-- throws : False
-- Skip return : False

foreign import ccall "webkit_dom_node_list_get_length" webkit_dom_node_list_get_length ::
    Ptr DOMNodeList ->                      -- self : TInterface (Name {namespace = "WebKit2WebExtension", name = "DOMNodeList"})
    IO CULong

{-# DEPRECATED dOMNodeListGetLength ["(Since version 2.22)","Use JavaScriptCore API instead"] #-}
{- |
/No description available in the introspection data./
-}
dOMNodeListGetLength ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMNodeList a) =>
    a
    {- ^ /@self@/: A 'GI.WebKit2WebExtension.Objects.DOMNodeList.DOMNodeList' -}
    -> m CULong
    {- ^ __Returns:__ A @/gulong/@ -}
dOMNodeListGetLength self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- webkit_dom_node_list_get_length self'
    touchManagedPtr self
    return result

#if ENABLE_OVERLOADING
data DOMNodeListGetLengthMethodInfo
instance (signature ~ (m CULong), MonadIO m, IsDOMNodeList a) => O.MethodInfo DOMNodeListGetLengthMethodInfo a signature where
    overloadedMethod _ = dOMNodeListGetLength

#endif

-- method DOMNodeList::item
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "WebKit2WebExtension", name = "DOMNodeList"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #WebKitDOMNodeList", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "index", argType = TBasicType TULong, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #gulong", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "WebKit2WebExtension", name = "DOMNode"}))
-- throws : False
-- Skip return : False

foreign import ccall "webkit_dom_node_list_item" webkit_dom_node_list_item ::
    Ptr DOMNodeList ->                      -- self : TInterface (Name {namespace = "WebKit2WebExtension", name = "DOMNodeList"})
    CULong ->                               -- index : TBasicType TULong
    IO (Ptr WebKit2WebExtension.DOMNode.DOMNode)

{-# DEPRECATED dOMNodeListItem ["(Since version 2.22)","Use JavaScriptCore API instead"] #-}
{- |
/No description available in the introspection data./
-}
dOMNodeListItem ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMNodeList a) =>
    a
    {- ^ /@self@/: A 'GI.WebKit2WebExtension.Objects.DOMNodeList.DOMNodeList' -}
    -> CULong
    {- ^ /@index@/: A @/gulong/@ -}
    -> m (Maybe WebKit2WebExtension.DOMNode.DOMNode)
    {- ^ __Returns:__ A 'GI.WebKit2WebExtension.Objects.DOMNode.DOMNode' -}
dOMNodeListItem self index = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- webkit_dom_node_list_item self' index
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newObject WebKit2WebExtension.DOMNode.DOMNode) result'
        return result''
    touchManagedPtr self
    return maybeResult

#if ENABLE_OVERLOADING
data DOMNodeListItemMethodInfo
instance (signature ~ (CULong -> m (Maybe WebKit2WebExtension.DOMNode.DOMNode)), MonadIO m, IsDOMNodeList a) => O.MethodInfo DOMNodeListItemMethodInfo a signature where
    overloadedMethod _ = dOMNodeListItem

#endif