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

-- * Exported types
    DOMHTMLCollection(..)                   ,
    IsDOMHTMLCollection                     ,
    toDOMHTMLCollection                     ,
    noDOMHTMLCollection                     ,


 -- * Methods
-- ** getLength #method:getLength#
    DOMHTMLCollectionGetLengthMethodInfo    ,
    dOMHTMLCollectionGetLength              ,


-- ** item #method:item#
    DOMHTMLCollectionItemMethodInfo         ,
    dOMHTMLCollectionItem                   ,


-- ** namedItem #method:namedItem#
    DOMHTMLCollectionNamedItemMethodInfo    ,
    dOMHTMLCollectionNamedItem              ,




 -- * Properties
-- ** length #attr:length#
    DOMHTMLCollectionLengthPropertyInfo     ,
    dOMHTMLCollectionLength                 ,
    getDOMHTMLCollectionLength              ,




    ) 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.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
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 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

newtype DOMHTMLCollection = DOMHTMLCollection (ManagedPtr DOMHTMLCollection)
foreign import ccall "webkit_dom_html_collection_get_type"
    c_webkit_dom_html_collection_get_type :: IO GType

instance GObject DOMHTMLCollection where
    gobjectType _ = c_webkit_dom_html_collection_get_type
    

class GObject o => IsDOMHTMLCollection o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError DOMHTMLCollection a) =>
    IsDOMHTMLCollection a
#endif
instance IsDOMHTMLCollection DOMHTMLCollection
instance WebKit2WebExtension.DOMObject.IsDOMObject DOMHTMLCollection
instance GObject.Object.IsObject DOMHTMLCollection

toDOMHTMLCollection :: IsDOMHTMLCollection o => o -> IO DOMHTMLCollection
toDOMHTMLCollection = unsafeCastTo DOMHTMLCollection

noDOMHTMLCollection :: Maybe DOMHTMLCollection
noDOMHTMLCollection = Nothing

type family ResolveDOMHTMLCollectionMethod (t :: Symbol) (o :: *) :: * where
    ResolveDOMHTMLCollectionMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveDOMHTMLCollectionMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveDOMHTMLCollectionMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveDOMHTMLCollectionMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveDOMHTMLCollectionMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveDOMHTMLCollectionMethod "item" o = DOMHTMLCollectionItemMethodInfo
    ResolveDOMHTMLCollectionMethod "namedItem" o = DOMHTMLCollectionNamedItemMethodInfo
    ResolveDOMHTMLCollectionMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveDOMHTMLCollectionMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveDOMHTMLCollectionMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveDOMHTMLCollectionMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveDOMHTMLCollectionMethod "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
    ResolveDOMHTMLCollectionMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
    ResolveDOMHTMLCollectionMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveDOMHTMLCollectionMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveDOMHTMLCollectionMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveDOMHTMLCollectionMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveDOMHTMLCollectionMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveDOMHTMLCollectionMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveDOMHTMLCollectionMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveDOMHTMLCollectionMethod "getLength" o = DOMHTMLCollectionGetLengthMethodInfo
    ResolveDOMHTMLCollectionMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveDOMHTMLCollectionMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveDOMHTMLCollectionMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveDOMHTMLCollectionMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveDOMHTMLCollectionMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveDOMHTMLCollectionMethod t DOMHTMLCollection, O.MethodInfo info DOMHTMLCollection p) => O.IsLabelProxy t (DOMHTMLCollection -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveDOMHTMLCollectionMethod t DOMHTMLCollection, O.MethodInfo info DOMHTMLCollection p) => O.IsLabel t (DOMHTMLCollection -> p) where
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

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

getDOMHTMLCollectionLength :: (MonadIO m, IsDOMHTMLCollection o) => o -> m CULong
getDOMHTMLCollectionLength obj = liftIO $ getObjectPropertyULong obj "length"

data DOMHTMLCollectionLengthPropertyInfo
instance AttrInfo DOMHTMLCollectionLengthPropertyInfo where
    type AttrAllowedOps DOMHTMLCollectionLengthPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMHTMLCollectionLengthPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMHTMLCollectionLengthPropertyInfo = IsDOMHTMLCollection
    type AttrGetType DOMHTMLCollectionLengthPropertyInfo = CULong
    type AttrLabel DOMHTMLCollectionLengthPropertyInfo = "length"
    type AttrOrigin DOMHTMLCollectionLengthPropertyInfo = DOMHTMLCollection
    attrGet _ = getDOMHTMLCollectionLength
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

instance O.HasAttributeList DOMHTMLCollection
type instance O.AttributeList DOMHTMLCollection = DOMHTMLCollectionAttributeList
type DOMHTMLCollectionAttributeList = ('[ '("coreObject", WebKit2WebExtension.DOMObject.DOMObjectCoreObjectPropertyInfo), '("length", DOMHTMLCollectionLengthPropertyInfo)] :: [(Symbol, *)])

dOMHTMLCollectionLength :: AttrLabelProxy "length"
dOMHTMLCollectionLength = AttrLabelProxy

type instance O.SignalList DOMHTMLCollection = DOMHTMLCollectionSignalList
type DOMHTMLCollectionSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method DOMHTMLCollection::get_length
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "WebKit2WebExtension", name = "DOMHTMLCollection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #WebKitDOMHTMLCollection", 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_html_collection_get_length" webkit_dom_html_collection_get_length :: 
    Ptr DOMHTMLCollection ->                -- self : TInterface (Name {namespace = "WebKit2WebExtension", name = "DOMHTMLCollection"})
    IO CULong

{- |
/No description available in the introspection data./
-}
dOMHTMLCollectionGetLength ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMHTMLCollection a) =>
    a
    {- ^ /@self@/: A 'GI.WebKit2WebExtension.Objects.DOMHTMLCollection.DOMHTMLCollection' -}
    -> m CULong
    {- ^ __Returns:__ A @/gulong/@ -}
dOMHTMLCollectionGetLength self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- webkit_dom_html_collection_get_length self'
    touchManagedPtr self
    return result

data DOMHTMLCollectionGetLengthMethodInfo
instance (signature ~ (m CULong), MonadIO m, IsDOMHTMLCollection a) => O.MethodInfo DOMHTMLCollectionGetLengthMethodInfo a signature where
    overloadedMethod _ = dOMHTMLCollectionGetLength

-- method DOMHTMLCollection::item
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "WebKit2WebExtension", name = "DOMHTMLCollection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #WebKitDOMHTMLCollection", 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_html_collection_item" webkit_dom_html_collection_item :: 
    Ptr DOMHTMLCollection ->                -- self : TInterface (Name {namespace = "WebKit2WebExtension", name = "DOMHTMLCollection"})
    CULong ->                               -- index : TBasicType TULong
    IO (Ptr WebKit2WebExtension.DOMNode.DOMNode)

{- |
/No description available in the introspection data./
-}
dOMHTMLCollectionItem ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMHTMLCollection a) =>
    a
    {- ^ /@self@/: A 'GI.WebKit2WebExtension.Objects.DOMHTMLCollection.DOMHTMLCollection' -}
    -> CULong
    {- ^ /@index@/: A @/gulong/@ -}
    -> m WebKit2WebExtension.DOMNode.DOMNode
    {- ^ __Returns:__ A 'GI.WebKit2WebExtension.Objects.DOMNode.DOMNode' -}
dOMHTMLCollectionItem self index = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- webkit_dom_html_collection_item self' index
    checkUnexpectedReturnNULL "dOMHTMLCollectionItem" result
    result' <- (newObject WebKit2WebExtension.DOMNode.DOMNode) result
    touchManagedPtr self
    return result'

data DOMHTMLCollectionItemMethodInfo
instance (signature ~ (CULong -> m WebKit2WebExtension.DOMNode.DOMNode), MonadIO m, IsDOMHTMLCollection a) => O.MethodInfo DOMHTMLCollectionItemMethodInfo a signature where
    overloadedMethod _ = dOMHTMLCollectionItem

-- method DOMHTMLCollection::named_item
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "WebKit2WebExtension", name = "DOMHTMLCollection"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #WebKitDOMHTMLCollection", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "name", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #gchar", 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_html_collection_named_item" webkit_dom_html_collection_named_item :: 
    Ptr DOMHTMLCollection ->                -- self : TInterface (Name {namespace = "WebKit2WebExtension", name = "DOMHTMLCollection"})
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr WebKit2WebExtension.DOMNode.DOMNode)

{- |
/No description available in the introspection data./
-}
dOMHTMLCollectionNamedItem ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMHTMLCollection a) =>
    a
    {- ^ /@self@/: A 'GI.WebKit2WebExtension.Objects.DOMHTMLCollection.DOMHTMLCollection' -}
    -> T.Text
    {- ^ /@name@/: A @/gchar/@ -}
    -> m WebKit2WebExtension.DOMNode.DOMNode
    {- ^ __Returns:__ A 'GI.WebKit2WebExtension.Objects.DOMNode.DOMNode' -}
dOMHTMLCollectionNamedItem self name = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    name' <- textToCString name
    result <- webkit_dom_html_collection_named_item self' name'
    checkUnexpectedReturnNULL "dOMHTMLCollectionNamedItem" result
    result' <- (newObject WebKit2WebExtension.DOMNode.DOMNode) result
    touchManagedPtr self
    freeMem name'
    return result'

data DOMHTMLCollectionNamedItemMethodInfo
instance (signature ~ (T.Text -> m WebKit2WebExtension.DOMNode.DOMNode), MonadIO m, IsDOMHTMLCollection a) => O.MethodInfo DOMHTMLCollectionNamedItemMethodInfo a signature where
    overloadedMethod _ = dOMHTMLCollectionNamedItem