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

-- * Exported types
    DOMVideoTrackList(..)                   ,
    IsDOMVideoTrackList                     ,
    toDOMVideoTrackList                     ,
    noDOMVideoTrackList                     ,


 -- * Methods
-- ** dispatchEvent #method:dispatchEvent#
    DOMVideoTrackListDispatchEventMethodInfo,
    dOMVideoTrackListDispatchEvent          ,


-- ** getLength #method:getLength#
    DOMVideoTrackListGetLengthMethodInfo    ,
    dOMVideoTrackListGetLength              ,


-- ** getTrackById #method:getTrackById#
    DOMVideoTrackListGetTrackByIdMethodInfo ,
    dOMVideoTrackListGetTrackById           ,


-- ** item #method:item#
    DOMVideoTrackListItemMethodInfo         ,
    dOMVideoTrackListItem                   ,




 -- * Properties
-- ** length #attr:length#
    DOMVideoTrackListLengthPropertyInfo     ,
    dOMVideoTrackListLength                 ,
    getDOMVideoTrackListLength              ,




    ) 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.Interfaces.DOMEventTarget as WebKit.DOMEventTarget
import {-# SOURCE #-} qualified GI.WebKit.Objects.DOMEvent as WebKit.DOMEvent
import {-# SOURCE #-} qualified GI.WebKit.Objects.DOMObject as WebKit.DOMObject
import {-# SOURCE #-} qualified GI.WebKit.Objects.DOMVideoTrack as WebKit.DOMVideoTrack

newtype DOMVideoTrackList = DOMVideoTrackList (ManagedPtr DOMVideoTrackList)
foreign import ccall "webkit_dom_video_track_list_get_type"
    c_webkit_dom_video_track_list_get_type :: IO GType

instance GObject DOMVideoTrackList where
    gobjectType _ = c_webkit_dom_video_track_list_get_type
    

class GObject o => IsDOMVideoTrackList o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError DOMVideoTrackList a) =>
    IsDOMVideoTrackList a
#endif
instance IsDOMVideoTrackList DOMVideoTrackList
instance WebKit.DOMObject.IsDOMObject DOMVideoTrackList
instance GObject.Object.IsObject DOMVideoTrackList
instance WebKit.DOMEventTarget.IsDOMEventTarget DOMVideoTrackList

toDOMVideoTrackList :: IsDOMVideoTrackList o => o -> IO DOMVideoTrackList
toDOMVideoTrackList = unsafeCastTo DOMVideoTrackList

noDOMVideoTrackList :: Maybe DOMVideoTrackList
noDOMVideoTrackList = Nothing

type family ResolveDOMVideoTrackListMethod (t :: Symbol) (o :: *) :: * where
    ResolveDOMVideoTrackListMethod "addEventListener" o = WebKit.DOMEventTarget.DOMEventTargetAddEventListenerMethodInfo
    ResolveDOMVideoTrackListMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveDOMVideoTrackListMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveDOMVideoTrackListMethod "dispatchEvent" o = DOMVideoTrackListDispatchEventMethodInfo
    ResolveDOMVideoTrackListMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveDOMVideoTrackListMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveDOMVideoTrackListMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveDOMVideoTrackListMethod "item" o = DOMVideoTrackListItemMethodInfo
    ResolveDOMVideoTrackListMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveDOMVideoTrackListMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveDOMVideoTrackListMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveDOMVideoTrackListMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveDOMVideoTrackListMethod "removeEventListener" o = WebKit.DOMEventTarget.DOMEventTargetRemoveEventListenerMethodInfo
    ResolveDOMVideoTrackListMethod "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
    ResolveDOMVideoTrackListMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
    ResolveDOMVideoTrackListMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveDOMVideoTrackListMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveDOMVideoTrackListMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveDOMVideoTrackListMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveDOMVideoTrackListMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveDOMVideoTrackListMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveDOMVideoTrackListMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveDOMVideoTrackListMethod "getLength" o = DOMVideoTrackListGetLengthMethodInfo
    ResolveDOMVideoTrackListMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveDOMVideoTrackListMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveDOMVideoTrackListMethod "getTrackById" o = DOMVideoTrackListGetTrackByIdMethodInfo
    ResolveDOMVideoTrackListMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveDOMVideoTrackListMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveDOMVideoTrackListMethod l o = O.MethodResolutionFailed l o

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

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

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

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

data DOMVideoTrackListLengthPropertyInfo
instance AttrInfo DOMVideoTrackListLengthPropertyInfo where
    type AttrAllowedOps DOMVideoTrackListLengthPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMVideoTrackListLengthPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMVideoTrackListLengthPropertyInfo = IsDOMVideoTrackList
    type AttrGetType DOMVideoTrackListLengthPropertyInfo = CULong
    type AttrLabel DOMVideoTrackListLengthPropertyInfo = "length"
    type AttrOrigin DOMVideoTrackListLengthPropertyInfo = DOMVideoTrackList
    attrGet _ = getDOMVideoTrackListLength
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

instance O.HasAttributeList DOMVideoTrackList
type instance O.AttributeList DOMVideoTrackList = DOMVideoTrackListAttributeList
type DOMVideoTrackListAttributeList = ('[ '("coreObject", WebKit.DOMObject.DOMObjectCoreObjectPropertyInfo), '("length", DOMVideoTrackListLengthPropertyInfo)] :: [(Symbol, *)])

dOMVideoTrackListLength :: AttrLabelProxy "length"
dOMVideoTrackListLength = AttrLabelProxy

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

-- method DOMVideoTrackList::dispatch_event
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "WebKit", name = "DOMVideoTrackList"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #WebKitDOMVideoTrackList", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "evt", argType = TInterface (Name {namespace = "WebKit", name = "DOMEvent"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #WebKitDOMEvent", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : True
-- Skip return : False

foreign import ccall "webkit_dom_video_track_list_dispatch_event" webkit_dom_video_track_list_dispatch_event :: 
    Ptr DOMVideoTrackList ->                -- self : TInterface (Name {namespace = "WebKit", name = "DOMVideoTrackList"})
    Ptr WebKit.DOMEvent.DOMEvent ->         -- evt : TInterface (Name {namespace = "WebKit", name = "DOMEvent"})
    Ptr (Ptr GError) ->                     -- error
    IO CInt

{-# DEPRECATED dOMVideoTrackListDispatchEvent ["(Since version 2.4)","Use 'GI.WebKit.Interfaces.DOMEventTarget.dOMEventTargetDispatchEvent' instead."] #-}
{- |
/No description available in the introspection data./
-}
dOMVideoTrackListDispatchEvent ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMVideoTrackList a, WebKit.DOMEvent.IsDOMEvent b) =>
    a
    {- ^ /@self@/: A 'GI.WebKit.Objects.DOMVideoTrackList.DOMVideoTrackList' -}
    -> b
    {- ^ /@evt@/: A 'GI.WebKit.Objects.DOMEvent.DOMEvent' -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
dOMVideoTrackListDispatchEvent self evt = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    evt' <- unsafeManagedPtrCastPtr evt
    onException (do
        _ <- propagateGError $ webkit_dom_video_track_list_dispatch_event self' evt'
        touchManagedPtr self
        touchManagedPtr evt
        return ()
     ) (do
        return ()
     )

data DOMVideoTrackListDispatchEventMethodInfo
instance (signature ~ (b -> m ()), MonadIO m, IsDOMVideoTrackList a, WebKit.DOMEvent.IsDOMEvent b) => O.MethodInfo DOMVideoTrackListDispatchEventMethodInfo a signature where
    overloadedMethod _ = dOMVideoTrackListDispatchEvent

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

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

data DOMVideoTrackListGetLengthMethodInfo
instance (signature ~ (m CULong), MonadIO m, IsDOMVideoTrackList a) => O.MethodInfo DOMVideoTrackListGetLengthMethodInfo a signature where
    overloadedMethod _ = dOMVideoTrackListGetLength

-- method DOMVideoTrackList::get_track_by_id
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "WebKit", name = "DOMVideoTrackList"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #WebKitDOMVideoTrackList", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "id", 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 = "WebKit", name = "DOMVideoTrack"}))
-- throws : False
-- Skip return : False

foreign import ccall "webkit_dom_video_track_list_get_track_by_id" webkit_dom_video_track_list_get_track_by_id :: 
    Ptr DOMVideoTrackList ->                -- self : TInterface (Name {namespace = "WebKit", name = "DOMVideoTrackList"})
    CString ->                              -- id : TBasicType TUTF8
    IO (Ptr WebKit.DOMVideoTrack.DOMVideoTrack)

{- |
/No description available in the introspection data./
-}
dOMVideoTrackListGetTrackById ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMVideoTrackList a) =>
    a
    {- ^ /@self@/: A 'GI.WebKit.Objects.DOMVideoTrackList.DOMVideoTrackList' -}
    -> T.Text
    {- ^ /@id@/: A @/gchar/@ -}
    -> m WebKit.DOMVideoTrack.DOMVideoTrack
    {- ^ __Returns:__ A 'GI.WebKit.Objects.DOMVideoTrack.DOMVideoTrack' -}
dOMVideoTrackListGetTrackById self id = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    id' <- textToCString id
    result <- webkit_dom_video_track_list_get_track_by_id self' id'
    checkUnexpectedReturnNULL "dOMVideoTrackListGetTrackById" result
    result' <- (wrapObject WebKit.DOMVideoTrack.DOMVideoTrack) result
    touchManagedPtr self
    freeMem id'
    return result'

data DOMVideoTrackListGetTrackByIdMethodInfo
instance (signature ~ (T.Text -> m WebKit.DOMVideoTrack.DOMVideoTrack), MonadIO m, IsDOMVideoTrackList a) => O.MethodInfo DOMVideoTrackListGetTrackByIdMethodInfo a signature where
    overloadedMethod _ = dOMVideoTrackListGetTrackById

-- method DOMVideoTrackList::item
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "WebKit", name = "DOMVideoTrackList"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #WebKitDOMVideoTrackList", 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 = "DOMVideoTrack"}))
-- throws : False
-- Skip return : False

foreign import ccall "webkit_dom_video_track_list_item" webkit_dom_video_track_list_item :: 
    Ptr DOMVideoTrackList ->                -- self : TInterface (Name {namespace = "WebKit", name = "DOMVideoTrackList"})
    CULong ->                               -- index : TBasicType TULong
    IO (Ptr WebKit.DOMVideoTrack.DOMVideoTrack)

{- |
/No description available in the introspection data./
-}
dOMVideoTrackListItem ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMVideoTrackList a) =>
    a
    {- ^ /@self@/: A 'GI.WebKit.Objects.DOMVideoTrackList.DOMVideoTrackList' -}
    -> CULong
    {- ^ /@index@/: A @/gulong/@ -}
    -> m WebKit.DOMVideoTrack.DOMVideoTrack
    {- ^ __Returns:__ A 'GI.WebKit.Objects.DOMVideoTrack.DOMVideoTrack' -}
dOMVideoTrackListItem self index = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- webkit_dom_video_track_list_item self' index
    checkUnexpectedReturnNULL "dOMVideoTrackListItem" result
    result' <- (wrapObject WebKit.DOMVideoTrack.DOMVideoTrack) result
    touchManagedPtr self
    return result'

data DOMVideoTrackListItemMethodInfo
instance (signature ~ (CULong -> m WebKit.DOMVideoTrack.DOMVideoTrack), MonadIO m, IsDOMVideoTrackList a) => O.MethodInfo DOMVideoTrackListItemMethodInfo a signature where
    overloadedMethod _ = dOMVideoTrackListItem