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

-- * Exported types
    DOMHTMLOptionsCollection(..)            ,
    DOMHTMLOptionsCollectionK               ,
    toDOMHTMLOptionsCollection              ,
    noDOMHTMLOptionsCollection              ,


 -- * Methods
-- ** dOMHTMLOptionsCollectionGetLength
    dOMHTMLOptionsCollectionGetLength       ,


-- ** dOMHTMLOptionsCollectionGetSelectedIndex
    dOMHTMLOptionsCollectionGetSelectedIndex,


-- ** dOMHTMLOptionsCollectionNamedItem
    dOMHTMLOptionsCollectionNamedItem       ,


-- ** dOMHTMLOptionsCollectionSetSelectedIndex
    dOMHTMLOptionsCollectionSetSelectedIndex,




 -- * Properties
-- ** Length
    DOMHTMLOptionsCollectionLengthPropertyInfo,
    getDOMHTMLOptionsCollectionLength       ,


-- ** SelectedIndex
    DOMHTMLOptionsCollectionSelectedIndexPropertyInfo,
    constructDOMHTMLOptionsCollectionSelectedIndex,
    getDOMHTMLOptionsCollectionSelectedIndex,
    setDOMHTMLOptionsCollectionSelectedIndex,




    ) 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 DOMHTMLOptionsCollection = DOMHTMLOptionsCollection (ForeignPtr DOMHTMLOptionsCollection)
foreign import ccall "webkit_dom_html_options_collection_get_type"
    c_webkit_dom_html_options_collection_get_type :: IO GType

type instance ParentTypes DOMHTMLOptionsCollection = DOMHTMLOptionsCollectionParentTypes
type DOMHTMLOptionsCollectionParentTypes = '[DOMHTMLCollection, DOMObject, GObject.Object]

instance GObject DOMHTMLOptionsCollection where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_webkit_dom_html_options_collection_get_type
    

class GObject o => DOMHTMLOptionsCollectionK o
instance (GObject o, IsDescendantOf DOMHTMLOptionsCollection o) => DOMHTMLOptionsCollectionK o

toDOMHTMLOptionsCollection :: DOMHTMLOptionsCollectionK o => o -> IO DOMHTMLOptionsCollection
toDOMHTMLOptionsCollection = unsafeCastTo DOMHTMLOptionsCollection

noDOMHTMLOptionsCollection :: Maybe DOMHTMLOptionsCollection
noDOMHTMLOptionsCollection = Nothing

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

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

data DOMHTMLOptionsCollectionLengthPropertyInfo
instance AttrInfo DOMHTMLOptionsCollectionLengthPropertyInfo where
    type AttrAllowedOps DOMHTMLOptionsCollectionLengthPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMHTMLOptionsCollectionLengthPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMHTMLOptionsCollectionLengthPropertyInfo = DOMHTMLOptionsCollectionK
    type AttrGetType DOMHTMLOptionsCollectionLengthPropertyInfo = Word64
    type AttrLabel DOMHTMLOptionsCollectionLengthPropertyInfo = "DOMHTMLOptionsCollection::length"
    attrGet _ = getDOMHTMLOptionsCollectionLength
    attrSet _ = undefined
    attrConstruct _ = undefined

-- VVV Prop "selected-index"
   -- Type: TBasicType TInt64
   -- Flags: [PropertyReadable,PropertyWritable]

getDOMHTMLOptionsCollectionSelectedIndex :: (MonadIO m, DOMHTMLOptionsCollectionK o) => o -> m Int64
getDOMHTMLOptionsCollectionSelectedIndex obj = liftIO $ getObjectPropertyInt64 obj "selected-index"

setDOMHTMLOptionsCollectionSelectedIndex :: (MonadIO m, DOMHTMLOptionsCollectionK o) => o -> Int64 -> m ()
setDOMHTMLOptionsCollectionSelectedIndex obj val = liftIO $ setObjectPropertyInt64 obj "selected-index" val

constructDOMHTMLOptionsCollectionSelectedIndex :: Int64 -> IO ([Char], GValue)
constructDOMHTMLOptionsCollectionSelectedIndex val = constructObjectPropertyInt64 "selected-index" val

data DOMHTMLOptionsCollectionSelectedIndexPropertyInfo
instance AttrInfo DOMHTMLOptionsCollectionSelectedIndexPropertyInfo where
    type AttrAllowedOps DOMHTMLOptionsCollectionSelectedIndexPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint DOMHTMLOptionsCollectionSelectedIndexPropertyInfo = (~) Int64
    type AttrBaseTypeConstraint DOMHTMLOptionsCollectionSelectedIndexPropertyInfo = DOMHTMLOptionsCollectionK
    type AttrGetType DOMHTMLOptionsCollectionSelectedIndexPropertyInfo = Int64
    type AttrLabel DOMHTMLOptionsCollectionSelectedIndexPropertyInfo = "DOMHTMLOptionsCollection::selected-index"
    attrGet _ = getDOMHTMLOptionsCollectionSelectedIndex
    attrSet _ = setDOMHTMLOptionsCollectionSelectedIndex
    attrConstruct _ = constructDOMHTMLOptionsCollectionSelectedIndex

type instance AttributeList DOMHTMLOptionsCollection = DOMHTMLOptionsCollectionAttributeList
type DOMHTMLOptionsCollectionAttributeList = ('[ '("core-object", DOMObjectCoreObjectPropertyInfo), '("length", DOMHTMLOptionsCollectionLengthPropertyInfo), '("selected-index", DOMHTMLOptionsCollectionSelectedIndexPropertyInfo)] :: [(Symbol, *)])

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

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


dOMHTMLOptionsCollectionGetLength ::
    (MonadIO m, DOMHTMLOptionsCollectionK a) =>
    a ->                                    -- _obj
    m Word64
dOMHTMLOptionsCollectionGetLength _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_dom_html_options_collection_get_length _obj'
    touchManagedPtr _obj
    return result

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

foreign import ccall "webkit_dom_html_options_collection_get_selected_index" webkit_dom_html_options_collection_get_selected_index :: 
    Ptr DOMHTMLOptionsCollection ->         -- _obj : TInterface "WebKit" "DOMHTMLOptionsCollection"
    IO Int64


dOMHTMLOptionsCollectionGetSelectedIndex ::
    (MonadIO m, DOMHTMLOptionsCollectionK a) =>
    a ->                                    -- _obj
    m Int64
dOMHTMLOptionsCollectionGetSelectedIndex _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_dom_html_options_collection_get_selected_index _obj'
    touchManagedPtr _obj
    return result

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

foreign import ccall "webkit_dom_html_options_collection_named_item" webkit_dom_html_options_collection_named_item :: 
    Ptr DOMHTMLOptionsCollection ->         -- _obj : TInterface "WebKit" "DOMHTMLOptionsCollection"
    CString ->                              -- name : TBasicType TUTF8
    IO (Ptr DOMNode)


dOMHTMLOptionsCollectionNamedItem ::
    (MonadIO m, DOMHTMLOptionsCollectionK a) =>
    a ->                                    -- _obj
    T.Text ->                               -- name
    m DOMNode
dOMHTMLOptionsCollectionNamedItem _obj name = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    name' <- textToCString name
    result <- webkit_dom_html_options_collection_named_item _obj' name'
    checkUnexpectedReturnNULL "webkit_dom_html_options_collection_named_item" result
    result' <- (newObject DOMNode) result
    touchManagedPtr _obj
    freeMem name'
    return result'

-- method DOMHTMLOptionsCollection::set_selected_index
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit" "DOMHTMLOptionsCollection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "value", argType = TBasicType TInt64, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit" "DOMHTMLOptionsCollection", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "value", argType = TBasicType TInt64, 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_html_options_collection_set_selected_index" webkit_dom_html_options_collection_set_selected_index :: 
    Ptr DOMHTMLOptionsCollection ->         -- _obj : TInterface "WebKit" "DOMHTMLOptionsCollection"
    Int64 ->                                -- value : TBasicType TInt64
    IO ()


dOMHTMLOptionsCollectionSetSelectedIndex ::
    (MonadIO m, DOMHTMLOptionsCollectionK a) =>
    a ->                                    -- _obj
    Int64 ->                                -- value
    m ()
dOMHTMLOptionsCollectionSetSelectedIndex _obj value = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    webkit_dom_html_options_collection_set_selected_index _obj' value
    touchManagedPtr _obj
    return ()