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

-- * Exported types
    DOMFileList(..)                         ,
    DOMFileListK                            ,
    toDOMFileList                           ,
    noDOMFileList                           ,


 -- * Methods
-- ** dOMFileListGetLength
    dOMFileListGetLength                    ,


-- ** dOMFileListItem
    dOMFileListItem                         ,




 -- * Properties
-- ** Length
    DOMFileListLengthPropertyInfo           ,
    getDOMFileListLength                    ,




    ) 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.WebKit2WebExtension.Types
import GI.WebKit2WebExtension.Callbacks
import qualified GI.GObject as GObject

newtype DOMFileList = DOMFileList (ForeignPtr DOMFileList)
foreign import ccall "webkit_dom_file_list_get_type"
    c_webkit_dom_file_list_get_type :: IO GType

type instance ParentTypes DOMFileList = DOMFileListParentTypes
type DOMFileListParentTypes = '[DOMObject, GObject.Object]

instance GObject DOMFileList where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_webkit_dom_file_list_get_type
    

class GObject o => DOMFileListK o
instance (GObject o, IsDescendantOf DOMFileList o) => DOMFileListK o

toDOMFileList :: DOMFileListK o => o -> IO DOMFileList
toDOMFileList = unsafeCastTo DOMFileList

noDOMFileList :: Maybe DOMFileList
noDOMFileList = Nothing

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

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

data DOMFileListLengthPropertyInfo
instance AttrInfo DOMFileListLengthPropertyInfo where
    type AttrAllowedOps DOMFileListLengthPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMFileListLengthPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMFileListLengthPropertyInfo = DOMFileListK
    type AttrGetType DOMFileListLengthPropertyInfo = Word64
    type AttrLabel DOMFileListLengthPropertyInfo = "DOMFileList::length"
    attrGet _ = getDOMFileListLength
    attrSet _ = undefined
    attrConstruct _ = undefined

type instance AttributeList DOMFileList = DOMFileListAttributeList
type DOMFileListAttributeList = ('[ '("core-object", DOMObjectCoreObjectPropertyInfo), '("length", DOMFileListLengthPropertyInfo)] :: [(Symbol, *)])

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

-- method DOMFileList::get_length
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2WebExtension" "DOMFileList", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit2WebExtension" "DOMFileList", 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_file_list_get_length" webkit_dom_file_list_get_length :: 
    Ptr DOMFileList ->                      -- _obj : TInterface "WebKit2WebExtension" "DOMFileList"
    IO Word64


dOMFileListGetLength ::
    (MonadIO m, DOMFileListK a) =>
    a ->                                    -- _obj
    m Word64
dOMFileListGetLength _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_dom_file_list_get_length _obj'
    touchManagedPtr _obj
    return result

-- method DOMFileList::item
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit2WebExtension" "DOMFileList", 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 "WebKit2WebExtension" "DOMFileList", 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 "WebKit2WebExtension" "DOMFile"
-- throws : False
-- Skip return : False

foreign import ccall "webkit_dom_file_list_item" webkit_dom_file_list_item :: 
    Ptr DOMFileList ->                      -- _obj : TInterface "WebKit2WebExtension" "DOMFileList"
    Word64 ->                               -- index : TBasicType TUInt64
    IO (Ptr DOMFile)


dOMFileListItem ::
    (MonadIO m, DOMFileListK a) =>
    a ->                                    -- _obj
    Word64 ->                               -- index
    m DOMFile
dOMFileListItem _obj index = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_dom_file_list_item _obj' index
    checkUnexpectedReturnNULL "webkit_dom_file_list_item" result
    result' <- (wrapObject DOMFile) result
    touchManagedPtr _obj
    return result'