{- |
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.WebKit.Objects.DOMHTMLPropertiesCollection
    ( 

-- * Exported types
    DOMHTMLPropertiesCollection(..)         ,
    IsDOMHTMLPropertiesCollection           ,
    toDOMHTMLPropertiesCollection           ,
    noDOMHTMLPropertiesCollection           ,


 -- * Methods
-- ** getLength #method:getLength#
    dOMHTMLPropertiesCollectionGetLength    ,


-- ** getNames #method:getNames#
    dOMHTMLPropertiesCollectionGetNames     ,


-- ** item #method:item#
    dOMHTMLPropertiesCollectionItem         ,


-- ** namedItem #method:namedItem#
    dOMHTMLPropertiesCollectionNamedItem    ,




 -- * Properties
-- ** length #attr:length#
    DOMHTMLPropertiesCollectionLengthPropertyInfo,
    dOMHTMLPropertiesCollectionLength       ,
    getDOMHTMLPropertiesCollectionLength    ,


-- ** names #attr:names#
    DOMHTMLPropertiesCollectionNamesPropertyInfo,
    dOMHTMLPropertiesCollectionNames        ,
    getDOMHTMLPropertiesCollectionNames     ,




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

newtype DOMHTMLPropertiesCollection = DOMHTMLPropertiesCollection (ManagedPtr DOMHTMLPropertiesCollection)
foreign import ccall "webkit_dom_html_properties_collection_get_type"
    c_webkit_dom_html_properties_collection_get_type :: IO GType

instance GObject DOMHTMLPropertiesCollection where
    gobjectType _ = c_webkit_dom_html_properties_collection_get_type
    

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

toDOMHTMLPropertiesCollection :: IsDOMHTMLPropertiesCollection o => o -> IO DOMHTMLPropertiesCollection
toDOMHTMLPropertiesCollection = unsafeCastTo DOMHTMLPropertiesCollection

noDOMHTMLPropertiesCollection :: Maybe DOMHTMLPropertiesCollection
noDOMHTMLPropertiesCollection = Nothing

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

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

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

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

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

data DOMHTMLPropertiesCollectionLengthPropertyInfo
instance AttrInfo DOMHTMLPropertiesCollectionLengthPropertyInfo where
    type AttrAllowedOps DOMHTMLPropertiesCollectionLengthPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMHTMLPropertiesCollectionLengthPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMHTMLPropertiesCollectionLengthPropertyInfo = IsDOMHTMLPropertiesCollection
    type AttrGetType DOMHTMLPropertiesCollectionLengthPropertyInfo = CULong
    type AttrLabel DOMHTMLPropertiesCollectionLengthPropertyInfo = "length"
    type AttrOrigin DOMHTMLPropertiesCollectionLengthPropertyInfo = DOMHTMLPropertiesCollection
    attrGet _ = getDOMHTMLPropertiesCollectionLength
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

-- VVV Prop "names"
   -- Type: TInterface (Name {namespace = "WebKit", name = "DOMDOMStringList"})
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

getDOMHTMLPropertiesCollectionNames :: (MonadIO m, IsDOMHTMLPropertiesCollection o) => o -> m (Maybe WebKit.DOMDOMStringList.DOMDOMStringList)
getDOMHTMLPropertiesCollectionNames obj = liftIO $ getObjectPropertyObject obj "names" WebKit.DOMDOMStringList.DOMDOMStringList

data DOMHTMLPropertiesCollectionNamesPropertyInfo
instance AttrInfo DOMHTMLPropertiesCollectionNamesPropertyInfo where
    type AttrAllowedOps DOMHTMLPropertiesCollectionNamesPropertyInfo = '[ 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint DOMHTMLPropertiesCollectionNamesPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMHTMLPropertiesCollectionNamesPropertyInfo = IsDOMHTMLPropertiesCollection
    type AttrGetType DOMHTMLPropertiesCollectionNamesPropertyInfo = (Maybe WebKit.DOMDOMStringList.DOMDOMStringList)
    type AttrLabel DOMHTMLPropertiesCollectionNamesPropertyInfo = "names"
    type AttrOrigin DOMHTMLPropertiesCollectionNamesPropertyInfo = DOMHTMLPropertiesCollection
    attrGet _ = getDOMHTMLPropertiesCollectionNames
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

instance O.HasAttributeList DOMHTMLPropertiesCollection
type instance O.AttributeList DOMHTMLPropertiesCollection = DOMHTMLPropertiesCollectionAttributeList
type DOMHTMLPropertiesCollectionAttributeList = ('[ '("coreObject", WebKit.DOMObject.DOMObjectCoreObjectPropertyInfo), '("length", DOMHTMLPropertiesCollectionLengthPropertyInfo), '("names", DOMHTMLPropertiesCollectionNamesPropertyInfo)] :: [(Symbol, *)])

dOMHTMLPropertiesCollectionLength :: AttrLabelProxy "length"
dOMHTMLPropertiesCollectionLength = AttrLabelProxy

dOMHTMLPropertiesCollectionNames :: AttrLabelProxy "names"
dOMHTMLPropertiesCollectionNames = AttrLabelProxy

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

-- method DOMHTMLPropertiesCollection::get_length
-- method type : MemberFunction
-- Args : [Arg {argCName = "self", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "A #WebKitDOMHTMLPropertiesCollection", 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_properties_collection_get_length" webkit_dom_html_properties_collection_get_length :: 
    Ptr () ->                               -- self : TBasicType TPtr
    IO CULong

{-# DEPRECATED dOMHTMLPropertiesCollectionGetLength ["(Since version 2.2)"] #-}
{- |
The PropertiesCollection object has been removed from WebKit, this function does nothing.
-}
dOMHTMLPropertiesCollectionGetLength ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Ptr ()
    {- ^ /@self@/: A @/WebKitDOMHTMLPropertiesCollection/@ -}
    -> m CULong
    {- ^ __Returns:__ A @/gulong/@ -}
dOMHTMLPropertiesCollectionGetLength self = liftIO $ do
    result <- webkit_dom_html_properties_collection_get_length self
    return result

-- method DOMHTMLPropertiesCollection::get_names
-- method type : MemberFunction
-- Args : [Arg {argCName = "self", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "A #WebKitDOMHTMLPropertiesCollection", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "WebKit", name = "DOMDOMStringList"}))
-- throws : False
-- Skip return : False

foreign import ccall "webkit_dom_html_properties_collection_get_names" webkit_dom_html_properties_collection_get_names :: 
    Ptr () ->                               -- self : TBasicType TPtr
    IO (Ptr WebKit.DOMDOMStringList.DOMDOMStringList)

{-# DEPRECATED dOMHTMLPropertiesCollectionGetNames ["(Since version 2.2)"] #-}
{- |
The PropertiesCollection object has been removed from WebKit, this function does nothing.
-}
dOMHTMLPropertiesCollectionGetNames ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Ptr ()
    {- ^ /@self@/: A @/WebKitDOMHTMLPropertiesCollection/@ -}
    -> m WebKit.DOMDOMStringList.DOMDOMStringList
    {- ^ __Returns:__ a 'GI.WebKit.Objects.DOMDOMStringList.DOMDOMStringList' -}
dOMHTMLPropertiesCollectionGetNames self = liftIO $ do
    result <- webkit_dom_html_properties_collection_get_names self
    checkUnexpectedReturnNULL "dOMHTMLPropertiesCollectionGetNames" result
    result' <- (newObject WebKit.DOMDOMStringList.DOMDOMStringList) result
    return result'

-- method DOMHTMLPropertiesCollection::item
-- method type : MemberFunction
-- Args : [Arg {argCName = "self", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "A #WebKitDOMHTMLPropertiesCollection", 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 = "WebKit", name = "DOMNode"}))
-- throws : False
-- Skip return : False

foreign import ccall "webkit_dom_html_properties_collection_item" webkit_dom_html_properties_collection_item :: 
    Ptr () ->                               -- self : TBasicType TPtr
    CULong ->                               -- index : TBasicType TULong
    IO (Ptr WebKit.DOMNode.DOMNode)

{-# DEPRECATED dOMHTMLPropertiesCollectionItem ["(Since version 2.2)"] #-}
{- |
The PropertiesCollection object has been removed from WebKit, this function does nothing.
-}
dOMHTMLPropertiesCollectionItem ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Ptr ()
    {- ^ /@self@/: A @/WebKitDOMHTMLPropertiesCollection/@ -}
    -> CULong
    {- ^ /@index@/: A @/gulong/@ -}
    -> m WebKit.DOMNode.DOMNode
    {- ^ __Returns:__ a 'GI.WebKit.Objects.DOMNode.DOMNode' -}
dOMHTMLPropertiesCollectionItem self index = liftIO $ do
    result <- webkit_dom_html_properties_collection_item self index
    checkUnexpectedReturnNULL "dOMHTMLPropertiesCollectionItem" result
    result' <- (newObject WebKit.DOMNode.DOMNode) result
    return result'

-- method DOMHTMLPropertiesCollection::named_item
-- method type : MemberFunction
-- Args : [Arg {argCName = "self", argType = TBasicType TPtr, direction = DirectionIn, mayBeNull = True, argDoc = Documentation {rawDocText = Just "A #WebKitDOMHTMLPropertiesCollection", 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 (TBasicType TPtr)
-- throws : False
-- Skip return : False

foreign import ccall "webkit_dom_html_properties_collection_named_item" webkit_dom_html_properties_collection_named_item :: 
    Ptr () ->                               -- self : TBasicType TPtr
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr ())

{-# DEPRECATED dOMHTMLPropertiesCollectionNamedItem ["(Since version 2.2)"] #-}
{- |
The PropertiesCollection object has been removed from WebKit, this function does nothing.
-}
dOMHTMLPropertiesCollectionNamedItem ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Ptr ()
    {- ^ /@self@/: A @/WebKitDOMHTMLPropertiesCollection/@ -}
    -> T.Text
    {- ^ /@name@/: A @/gchar/@ -}
    -> m (Ptr ())
dOMHTMLPropertiesCollectionNamedItem self name = liftIO $ do
    name' <- textToCString name
    result <- webkit_dom_html_properties_collection_named_item self name'
    freeMem name'
    return result