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

-- * Exported types
    DOMGamepad(..)                          ,
    DOMGamepadK                             ,
    toDOMGamepad                            ,
    noDOMGamepad                            ,


 -- * Methods
-- ** dOMGamepadGetId
    dOMGamepadGetId                         ,


-- ** dOMGamepadGetIndex
    dOMGamepadGetIndex                      ,


-- ** dOMGamepadGetTimestamp
    dOMGamepadGetTimestamp                  ,




 -- * Properties
-- ** Id
    DOMGamepadIdPropertyInfo                ,
    getDOMGamepadId                         ,


-- ** Index
    DOMGamepadIndexPropertyInfo             ,
    getDOMGamepadIndex                      ,


-- ** Timestamp
    DOMGamepadTimestampPropertyInfo         ,
    getDOMGamepadTimestamp                  ,




    ) 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 DOMGamepad = DOMGamepad (ForeignPtr DOMGamepad)
foreign import ccall "webkit_dom_gamepad_get_type"
    c_webkit_dom_gamepad_get_type :: IO GType

type instance ParentTypes DOMGamepad = DOMGamepadParentTypes
type DOMGamepadParentTypes = '[DOMObject, GObject.Object]

instance GObject DOMGamepad where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_webkit_dom_gamepad_get_type
    

class GObject o => DOMGamepadK o
instance (GObject o, IsDescendantOf DOMGamepad o) => DOMGamepadK o

toDOMGamepad :: DOMGamepadK o => o -> IO DOMGamepad
toDOMGamepad = unsafeCastTo DOMGamepad

noDOMGamepad :: Maybe DOMGamepad
noDOMGamepad = Nothing

-- VVV Prop "id"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable]

getDOMGamepadId :: (MonadIO m, DOMGamepadK o) => o -> m T.Text
getDOMGamepadId obj = liftIO $ getObjectPropertyString obj "id"

data DOMGamepadIdPropertyInfo
instance AttrInfo DOMGamepadIdPropertyInfo where
    type AttrAllowedOps DOMGamepadIdPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMGamepadIdPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMGamepadIdPropertyInfo = DOMGamepadK
    type AttrGetType DOMGamepadIdPropertyInfo = T.Text
    type AttrLabel DOMGamepadIdPropertyInfo = "DOMGamepad::id"
    attrGet _ = getDOMGamepadId
    attrSet _ = undefined
    attrConstruct _ = undefined

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

getDOMGamepadIndex :: (MonadIO m, DOMGamepadK o) => o -> m Word64
getDOMGamepadIndex obj = liftIO $ getObjectPropertyUInt64 obj "index"

data DOMGamepadIndexPropertyInfo
instance AttrInfo DOMGamepadIndexPropertyInfo where
    type AttrAllowedOps DOMGamepadIndexPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMGamepadIndexPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMGamepadIndexPropertyInfo = DOMGamepadK
    type AttrGetType DOMGamepadIndexPropertyInfo = Word64
    type AttrLabel DOMGamepadIndexPropertyInfo = "DOMGamepad::index"
    attrGet _ = getDOMGamepadIndex
    attrSet _ = undefined
    attrConstruct _ = undefined

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

getDOMGamepadTimestamp :: (MonadIO m, DOMGamepadK o) => o -> m Word64
getDOMGamepadTimestamp obj = liftIO $ getObjectPropertyUInt64 obj "timestamp"

data DOMGamepadTimestampPropertyInfo
instance AttrInfo DOMGamepadTimestampPropertyInfo where
    type AttrAllowedOps DOMGamepadTimestampPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMGamepadTimestampPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMGamepadTimestampPropertyInfo = DOMGamepadK
    type AttrGetType DOMGamepadTimestampPropertyInfo = Word64
    type AttrLabel DOMGamepadTimestampPropertyInfo = "DOMGamepad::timestamp"
    attrGet _ = getDOMGamepadTimestamp
    attrSet _ = undefined
    attrConstruct _ = undefined

type instance AttributeList DOMGamepad = DOMGamepadAttributeList
type DOMGamepadAttributeList = ('[ '("core-object", DOMObjectCoreObjectPropertyInfo), '("id", DOMGamepadIdPropertyInfo), '("index", DOMGamepadIndexPropertyInfo), '("timestamp", DOMGamepadTimestampPropertyInfo)] :: [(Symbol, *)])

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

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

foreign import ccall "webkit_dom_gamepad_get_id" webkit_dom_gamepad_get_id :: 
    Ptr DOMGamepad ->                       -- _obj : TInterface "WebKit" "DOMGamepad"
    IO CString


dOMGamepadGetId ::
    (MonadIO m, DOMGamepadK a) =>
    a ->                                    -- _obj
    m T.Text
dOMGamepadGetId _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_dom_gamepad_get_id _obj'
    checkUnexpectedReturnNULL "webkit_dom_gamepad_get_id" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr _obj
    return result'

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


dOMGamepadGetIndex ::
    (MonadIO m, DOMGamepadK a) =>
    a ->                                    -- _obj
    m Word64
dOMGamepadGetIndex _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_dom_gamepad_get_index _obj'
    touchManagedPtr _obj
    return result

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


dOMGamepadGetTimestamp ::
    (MonadIO m, DOMGamepadK a) =>
    a ->                                    -- _obj
    m Word64
dOMGamepadGetTimestamp _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_dom_gamepad_get_timestamp _obj'
    touchManagedPtr _obj
    return result