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

-- * Exported types
    DOMTextTrackCueList(..)                 ,
    DOMTextTrackCueListK                    ,
    toDOMTextTrackCueList                   ,
    noDOMTextTrackCueList                   ,


 -- * Methods
-- ** dOMTextTrackCueListGetCueById
    dOMTextTrackCueListGetCueById           ,


-- ** dOMTextTrackCueListGetLength
    dOMTextTrackCueListGetLength            ,


-- ** dOMTextTrackCueListItem
    dOMTextTrackCueListItem                 ,




 -- * Properties
-- ** Length
    DOMTextTrackCueListLengthPropertyInfo   ,
    getDOMTextTrackCueListLength            ,




    ) where

import Prelude ()
import Data.GI.Base.ShortPrelude

import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map

import GI.WebKit.Types
import GI.WebKit.Callbacks
import qualified GI.GObject as GObject

newtype DOMTextTrackCueList = DOMTextTrackCueList (ForeignPtr DOMTextTrackCueList)
foreign import ccall "webkit_dom_text_track_cue_list_get_type"
    c_webkit_dom_text_track_cue_list_get_type :: IO GType

type instance ParentTypes DOMTextTrackCueList = DOMTextTrackCueListParentTypes
type DOMTextTrackCueListParentTypes = '[DOMObject, GObject.Object]

instance GObject DOMTextTrackCueList where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_webkit_dom_text_track_cue_list_get_type
    

class GObject o => DOMTextTrackCueListK o
instance (GObject o, IsDescendantOf DOMTextTrackCueList o) => DOMTextTrackCueListK o

toDOMTextTrackCueList :: DOMTextTrackCueListK o => o -> IO DOMTextTrackCueList
toDOMTextTrackCueList = unsafeCastTo DOMTextTrackCueList

noDOMTextTrackCueList :: Maybe DOMTextTrackCueList
noDOMTextTrackCueList = Nothing

-- VVV Prop "length"
   -- Type: TBasicType TUInt64
   -- Flags: [PropertyReadable]

getDOMTextTrackCueListLength :: (MonadIO m, DOMTextTrackCueListK o) => o -> m Word64
getDOMTextTrackCueListLength obj = liftIO $ getObjectPropertyUInt64 obj "length"

data DOMTextTrackCueListLengthPropertyInfo
instance AttrInfo DOMTextTrackCueListLengthPropertyInfo where
    type AttrAllowedOps DOMTextTrackCueListLengthPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMTextTrackCueListLengthPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMTextTrackCueListLengthPropertyInfo = DOMTextTrackCueListK
    type AttrGetType DOMTextTrackCueListLengthPropertyInfo = Word64
    type AttrLabel DOMTextTrackCueListLengthPropertyInfo = "DOMTextTrackCueList::length"
    attrGet _ = getDOMTextTrackCueListLength
    attrSet _ = undefined
    attrConstruct _ = undefined

type instance AttributeList DOMTextTrackCueList = DOMTextTrackCueListAttributeList
type DOMTextTrackCueListAttributeList = ('[ '("core-object", DOMObjectCoreObjectPropertyInfo), '("length", DOMTextTrackCueListLengthPropertyInfo)] :: [(Symbol, *)])

type instance SignalList DOMTextTrackCueList = DOMTextTrackCueListSignalList
type DOMTextTrackCueListSignalList = ('[ '("notify", GObject.ObjectNotifySignalInfo), '("notify::[property]", GObjectNotifySignalInfo)] :: [(Symbol, *)])

-- method DOMTextTrackCueList::get_cue_by_id
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit" "DOMTextTrackCueList", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "id", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit" "DOMTextTrackCueList", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "id", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "WebKit" "DOMTextTrackCue"
-- throws : False
-- Skip return : False

foreign import ccall "webkit_dom_text_track_cue_list_get_cue_by_id" webkit_dom_text_track_cue_list_get_cue_by_id :: 
    Ptr DOMTextTrackCueList ->              -- _obj : TInterface "WebKit" "DOMTextTrackCueList"
    CString ->                              -- id : TBasicType TUTF8
    IO (Ptr DOMTextTrackCue)


dOMTextTrackCueListGetCueById ::
    (MonadIO m, DOMTextTrackCueListK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- id
    m DOMTextTrackCue
dOMTextTrackCueListGetCueById _obj id = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    id' <- textToCString id
    result <- webkit_dom_text_track_cue_list_get_cue_by_id _obj' id'
    checkUnexpectedReturnNULL "webkit_dom_text_track_cue_list_get_cue_by_id" result
    result' <- (newObject DOMTextTrackCue) result
    touchManagedPtr _obj
    freeMem id'
    return result'

-- method DOMTextTrackCueList::get_length
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit" "DOMTextTrackCueList", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit" "DOMTextTrackCueList", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TBasicType TUInt64
-- throws : False
-- Skip return : False

foreign import ccall "webkit_dom_text_track_cue_list_get_length" webkit_dom_text_track_cue_list_get_length :: 
    Ptr DOMTextTrackCueList ->              -- _obj : TInterface "WebKit" "DOMTextTrackCueList"
    IO Word64


dOMTextTrackCueListGetLength ::
    (MonadIO m, DOMTextTrackCueListK a) =>
    a ->                                    -- _obj
    m Word64
dOMTextTrackCueListGetLength _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_dom_text_track_cue_list_get_length _obj'
    touchManagedPtr _obj
    return result

-- method DOMTextTrackCueList::item
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit" "DOMTextTrackCueList", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "index", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit" "DOMTextTrackCueList", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "index", argType = TBasicType TUInt64, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- returnType : TInterface "WebKit" "DOMTextTrackCue"
-- throws : False
-- Skip return : False

foreign import ccall "webkit_dom_text_track_cue_list_item" webkit_dom_text_track_cue_list_item :: 
    Ptr DOMTextTrackCueList ->              -- _obj : TInterface "WebKit" "DOMTextTrackCueList"
    Word64 ->                               -- index : TBasicType TUInt64
    IO (Ptr DOMTextTrackCue)


dOMTextTrackCueListItem ::
    (MonadIO m, DOMTextTrackCueListK a) =>
    a ->                                    -- _obj
    Word64 ->                               -- index
    m DOMTextTrackCue
dOMTextTrackCueListItem _obj index = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_dom_text_track_cue_list_item _obj' index
    checkUnexpectedReturnNULL "webkit_dom_text_track_cue_list_item" result
    result' <- (newObject DOMTextTrackCue) result
    touchManagedPtr _obj
    return result'