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

-- * Exported types
    DOMDOMPluginArray(..)                   ,
    DOMDOMPluginArrayK                      ,
    toDOMDOMPluginArray                     ,
    noDOMDOMPluginArray                     ,


 -- * Methods
-- ** dOMDOMPluginArrayGetLength
    dOMDOMPluginArrayGetLength              ,


-- ** dOMDOMPluginArrayItem
    dOMDOMPluginArrayItem                   ,


-- ** dOMDOMPluginArrayNamedItem
    dOMDOMPluginArrayNamedItem              ,


-- ** dOMDOMPluginArrayRefresh
    dOMDOMPluginArrayRefresh                ,




 -- * Properties
-- ** Length
    DOMDOMPluginArrayLengthPropertyInfo     ,
    getDOMDOMPluginArrayLength              ,




    ) 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 DOMDOMPluginArray = DOMDOMPluginArray (ForeignPtr DOMDOMPluginArray)
foreign import ccall "webkit_dom_dom_plugin_array_get_type"
    c_webkit_dom_dom_plugin_array_get_type :: IO GType

type instance ParentTypes DOMDOMPluginArray = DOMDOMPluginArrayParentTypes
type DOMDOMPluginArrayParentTypes = '[DOMObject, GObject.Object]

instance GObject DOMDOMPluginArray where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_webkit_dom_dom_plugin_array_get_type
    

class GObject o => DOMDOMPluginArrayK o
instance (GObject o, IsDescendantOf DOMDOMPluginArray o) => DOMDOMPluginArrayK o

toDOMDOMPluginArray :: DOMDOMPluginArrayK o => o -> IO DOMDOMPluginArray
toDOMDOMPluginArray = unsafeCastTo DOMDOMPluginArray

noDOMDOMPluginArray :: Maybe DOMDOMPluginArray
noDOMDOMPluginArray = Nothing

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

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

data DOMDOMPluginArrayLengthPropertyInfo
instance AttrInfo DOMDOMPluginArrayLengthPropertyInfo where
    type AttrAllowedOps DOMDOMPluginArrayLengthPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMDOMPluginArrayLengthPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMDOMPluginArrayLengthPropertyInfo = DOMDOMPluginArrayK
    type AttrGetType DOMDOMPluginArrayLengthPropertyInfo = Word64
    type AttrLabel DOMDOMPluginArrayLengthPropertyInfo = "DOMDOMPluginArray::length"
    attrGet _ = getDOMDOMPluginArrayLength
    attrSet _ = undefined
    attrConstruct _ = undefined

type instance AttributeList DOMDOMPluginArray = DOMDOMPluginArrayAttributeList
type DOMDOMPluginArrayAttributeList = ('[ '("core-object", DOMObjectCoreObjectPropertyInfo), '("length", DOMDOMPluginArrayLengthPropertyInfo)] :: [(Symbol, *)])

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

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


dOMDOMPluginArrayGetLength ::
    (MonadIO m, DOMDOMPluginArrayK a) =>
    a ->                                    -- _obj
    m Word64
dOMDOMPluginArrayGetLength _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_dom_dom_plugin_array_get_length _obj'
    touchManagedPtr _obj
    return result

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

foreign import ccall "webkit_dom_dom_plugin_array_item" webkit_dom_dom_plugin_array_item :: 
    Ptr DOMDOMPluginArray ->                -- _obj : TInterface "WebKit" "DOMDOMPluginArray"
    Word64 ->                               -- index : TBasicType TUInt64
    IO (Ptr DOMDOMPlugin)


dOMDOMPluginArrayItem ::
    (MonadIO m, DOMDOMPluginArrayK a) =>
    a ->                                    -- _obj
    Word64 ->                               -- index
    m DOMDOMPlugin
dOMDOMPluginArrayItem _obj index = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_dom_dom_plugin_array_item _obj' index
    checkUnexpectedReturnNULL "webkit_dom_dom_plugin_array_item" result
    result' <- (wrapObject DOMDOMPlugin) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "webkit_dom_dom_plugin_array_named_item" webkit_dom_dom_plugin_array_named_item :: 
    Ptr DOMDOMPluginArray ->                -- _obj : TInterface "WebKit" "DOMDOMPluginArray"
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr DOMDOMPlugin)


dOMDOMPluginArrayNamedItem ::
    (MonadIO m, DOMDOMPluginArrayK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- name
    m DOMDOMPlugin
dOMDOMPluginArrayNamedItem _obj name = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    name' <- textToCString name
    result <- webkit_dom_dom_plugin_array_named_item _obj' name'
    checkUnexpectedReturnNULL "webkit_dom_dom_plugin_array_named_item" result
    result' <- (wrapObject DOMDOMPlugin) result
    touchManagedPtr _obj
    freeMem name'
    return result'

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

foreign import ccall "webkit_dom_dom_plugin_array_refresh" webkit_dom_dom_plugin_array_refresh :: 
    Ptr DOMDOMPluginArray ->                -- _obj : TInterface "WebKit" "DOMDOMPluginArray"
    CInt ->                                 -- reload : TBasicType TBoolean
    IO ()


dOMDOMPluginArrayRefresh ::
    (MonadIO m, DOMDOMPluginArrayK a) =>
    a ->                                    -- _obj
    Bool ->                                 -- reload
    m ()
dOMDOMPluginArrayRefresh _obj reload = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let reload' = (fromIntegral . fromEnum) reload
    webkit_dom_dom_plugin_array_refresh _obj' reload'
    touchManagedPtr _obj
    return ()