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

-- * Exported types
    DOMGamepadList(..)                      ,
    DOMGamepadListK                         ,
    toDOMGamepadList                        ,
    noDOMGamepadList                        ,


 -- * Methods
-- ** dOMGamepadListGetLength
    dOMGamepadListGetLength                 ,


-- ** dOMGamepadListItem
    dOMGamepadListItem                      ,




 -- * Properties
-- ** Length
    DOMGamepadListLengthPropertyInfo        ,
    getDOMGamepadListLength                 ,




    ) 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 DOMGamepadList = DOMGamepadList (ForeignPtr DOMGamepadList)
foreign import ccall "webkit_dom_gamepad_list_get_type"
    c_webkit_dom_gamepad_list_get_type :: IO GType

type instance ParentTypes DOMGamepadList = DOMGamepadListParentTypes
type DOMGamepadListParentTypes = '[DOMObject, GObject.Object]

instance GObject DOMGamepadList where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_webkit_dom_gamepad_list_get_type
    

class GObject o => DOMGamepadListK o
instance (GObject o, IsDescendantOf DOMGamepadList o) => DOMGamepadListK o

toDOMGamepadList :: DOMGamepadListK o => o -> IO DOMGamepadList
toDOMGamepadList = unsafeCastTo DOMGamepadList

noDOMGamepadList :: Maybe DOMGamepadList
noDOMGamepadList = Nothing

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

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

data DOMGamepadListLengthPropertyInfo
instance AttrInfo DOMGamepadListLengthPropertyInfo where
    type AttrAllowedOps DOMGamepadListLengthPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMGamepadListLengthPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMGamepadListLengthPropertyInfo = DOMGamepadListK
    type AttrGetType DOMGamepadListLengthPropertyInfo = Word64
    type AttrLabel DOMGamepadListLengthPropertyInfo = "DOMGamepadList::length"
    attrGet _ = getDOMGamepadListLength
    attrSet _ = undefined
    attrConstruct _ = undefined

type instance AttributeList DOMGamepadList = DOMGamepadListAttributeList
type DOMGamepadListAttributeList = ('[ '("core-object", DOMObjectCoreObjectPropertyInfo), '("length", DOMGamepadListLengthPropertyInfo)] :: [(Symbol, *)])

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

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


dOMGamepadListGetLength ::
    (MonadIO m, DOMGamepadListK a) =>
    a ->                                    -- _obj
    m Word64
dOMGamepadListGetLength _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_dom_gamepad_list_get_length _obj'
    touchManagedPtr _obj
    return result

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

foreign import ccall "webkit_dom_gamepad_list_item" webkit_dom_gamepad_list_item :: 
    Ptr DOMGamepadList ->                   -- _obj : TInterface "WebKit" "DOMGamepadList"
    Word64 ->                               -- index : TBasicType TUInt64
    IO (Ptr DOMGamepad)


dOMGamepadListItem ::
    (MonadIO m, DOMGamepadListK a) =>
    a ->                                    -- _obj
    Word64 ->                               -- index
    m DOMGamepad
dOMGamepadListItem _obj index = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_dom_gamepad_list_item _obj' index
    checkUnexpectedReturnNULL "webkit_dom_gamepad_list_item" result
    result' <- (wrapObject DOMGamepad) result
    touchManagedPtr _obj
    return result'