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

-- * Exported types
    DOMStyleSheetList(..)                   ,
    DOMStyleSheetListK                      ,
    toDOMStyleSheetList                     ,
    noDOMStyleSheetList                     ,


 -- * Methods
-- ** dOMStyleSheetListGetLength
    dOMStyleSheetListGetLength              ,


-- ** dOMStyleSheetListItem
    dOMStyleSheetListItem                   ,




 -- * Properties
-- ** Length
    DOMStyleSheetListLengthPropertyInfo     ,
    getDOMStyleSheetListLength              ,




    ) 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 DOMStyleSheetList = DOMStyleSheetList (ForeignPtr DOMStyleSheetList)
foreign import ccall "webkit_dom_style_sheet_list_get_type"
    c_webkit_dom_style_sheet_list_get_type :: IO GType

type instance ParentTypes DOMStyleSheetList = DOMStyleSheetListParentTypes
type DOMStyleSheetListParentTypes = '[DOMObject, GObject.Object]

instance GObject DOMStyleSheetList where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_webkit_dom_style_sheet_list_get_type
    

class GObject o => DOMStyleSheetListK o
instance (GObject o, IsDescendantOf DOMStyleSheetList o) => DOMStyleSheetListK o

toDOMStyleSheetList :: DOMStyleSheetListK o => o -> IO DOMStyleSheetList
toDOMStyleSheetList = unsafeCastTo DOMStyleSheetList

noDOMStyleSheetList :: Maybe DOMStyleSheetList
noDOMStyleSheetList = Nothing

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

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

data DOMStyleSheetListLengthPropertyInfo
instance AttrInfo DOMStyleSheetListLengthPropertyInfo where
    type AttrAllowedOps DOMStyleSheetListLengthPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMStyleSheetListLengthPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMStyleSheetListLengthPropertyInfo = DOMStyleSheetListK
    type AttrGetType DOMStyleSheetListLengthPropertyInfo = Word64
    type AttrLabel DOMStyleSheetListLengthPropertyInfo = "DOMStyleSheetList::length"
    attrGet _ = getDOMStyleSheetListLength
    attrSet _ = undefined
    attrConstruct _ = undefined

type instance AttributeList DOMStyleSheetList = DOMStyleSheetListAttributeList
type DOMStyleSheetListAttributeList = ('[ '("core-object", DOMObjectCoreObjectPropertyInfo), '("length", DOMStyleSheetListLengthPropertyInfo)] :: [(Symbol, *)])

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

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


dOMStyleSheetListGetLength ::
    (MonadIO m, DOMStyleSheetListK a) =>
    a ->                                    -- _obj
    m Word64
dOMStyleSheetListGetLength _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_dom_style_sheet_list_get_length _obj'
    touchManagedPtr _obj
    return result

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

foreign import ccall "webkit_dom_style_sheet_list_item" webkit_dom_style_sheet_list_item :: 
    Ptr DOMStyleSheetList ->                -- _obj : TInterface "WebKit2WebExtension" "DOMStyleSheetList"
    Word64 ->                               -- index : TBasicType TUInt64
    IO (Ptr DOMStyleSheet)


dOMStyleSheetListItem ::
    (MonadIO m, DOMStyleSheetListK a) =>
    a ->                                    -- _obj
    Word64 ->                               -- index
    m DOMStyleSheet
dOMStyleSheetListItem _obj index = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_dom_style_sheet_list_item _obj' index
    checkUnexpectedReturnNULL "webkit_dom_style_sheet_list_item" result
    result' <- (wrapObject DOMStyleSheet) result
    touchManagedPtr _obj
    return result'