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

-- * Exported types
    DOMAudioTrack(..)                       ,
    DOMAudioTrackK                          ,
    toDOMAudioTrack                         ,
    noDOMAudioTrack                         ,


 -- * Methods
-- ** dOMAudioTrackGetEnabled
    dOMAudioTrackGetEnabled                 ,


-- ** dOMAudioTrackGetId
    dOMAudioTrackGetId                      ,


-- ** dOMAudioTrackGetKind
    dOMAudioTrackGetKind                    ,


-- ** dOMAudioTrackGetLabel
    dOMAudioTrackGetLabel                   ,


-- ** dOMAudioTrackGetLanguage
    dOMAudioTrackGetLanguage                ,


-- ** dOMAudioTrackSetEnabled
    dOMAudioTrackSetEnabled                 ,




 -- * Properties
-- ** Enabled
    DOMAudioTrackEnabledPropertyInfo        ,
    constructDOMAudioTrackEnabled           ,
    getDOMAudioTrackEnabled                 ,
    setDOMAudioTrackEnabled                 ,


-- ** Id
    DOMAudioTrackIdPropertyInfo             ,
    getDOMAudioTrackId                      ,


-- ** Kind
    DOMAudioTrackKindPropertyInfo           ,
    getDOMAudioTrackKind                    ,


-- ** Label
    DOMAudioTrackLabelPropertyInfo          ,
    getDOMAudioTrackLabel                   ,


-- ** Language
    DOMAudioTrackLanguagePropertyInfo       ,
    getDOMAudioTrackLanguage                ,




    ) 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 DOMAudioTrack = DOMAudioTrack (ForeignPtr DOMAudioTrack)
foreign import ccall "webkit_dom_audio_track_get_type"
    c_webkit_dom_audio_track_get_type :: IO GType

type instance ParentTypes DOMAudioTrack = DOMAudioTrackParentTypes
type DOMAudioTrackParentTypes = '[DOMObject, GObject.Object]

instance GObject DOMAudioTrack where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_webkit_dom_audio_track_get_type
    

class GObject o => DOMAudioTrackK o
instance (GObject o, IsDescendantOf DOMAudioTrack o) => DOMAudioTrackK o

toDOMAudioTrack :: DOMAudioTrackK o => o -> IO DOMAudioTrack
toDOMAudioTrack = unsafeCastTo DOMAudioTrack

noDOMAudioTrack :: Maybe DOMAudioTrack
noDOMAudioTrack = Nothing

-- VVV Prop "enabled"
   -- Type: TBasicType TBoolean
   -- Flags: [PropertyReadable,PropertyWritable]

getDOMAudioTrackEnabled :: (MonadIO m, DOMAudioTrackK o) => o -> m Bool
getDOMAudioTrackEnabled obj = liftIO $ getObjectPropertyBool obj "enabled"

setDOMAudioTrackEnabled :: (MonadIO m, DOMAudioTrackK o) => o -> Bool -> m ()
setDOMAudioTrackEnabled obj val = liftIO $ setObjectPropertyBool obj "enabled" val

constructDOMAudioTrackEnabled :: Bool -> IO ([Char], GValue)
constructDOMAudioTrackEnabled val = constructObjectPropertyBool "enabled" val

data DOMAudioTrackEnabledPropertyInfo
instance AttrInfo DOMAudioTrackEnabledPropertyInfo where
    type AttrAllowedOps DOMAudioTrackEnabledPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint DOMAudioTrackEnabledPropertyInfo = (~) Bool
    type AttrBaseTypeConstraint DOMAudioTrackEnabledPropertyInfo = DOMAudioTrackK
    type AttrGetType DOMAudioTrackEnabledPropertyInfo = Bool
    type AttrLabel DOMAudioTrackEnabledPropertyInfo = "DOMAudioTrack::enabled"
    attrGet _ = getDOMAudioTrackEnabled
    attrSet _ = setDOMAudioTrackEnabled
    attrConstruct _ = constructDOMAudioTrackEnabled

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

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

data DOMAudioTrackIdPropertyInfo
instance AttrInfo DOMAudioTrackIdPropertyInfo where
    type AttrAllowedOps DOMAudioTrackIdPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMAudioTrackIdPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMAudioTrackIdPropertyInfo = DOMAudioTrackK
    type AttrGetType DOMAudioTrackIdPropertyInfo = T.Text
    type AttrLabel DOMAudioTrackIdPropertyInfo = "DOMAudioTrack::id"
    attrGet _ = getDOMAudioTrackId
    attrSet _ = undefined
    attrConstruct _ = undefined

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

getDOMAudioTrackKind :: (MonadIO m, DOMAudioTrackK o) => o -> m T.Text
getDOMAudioTrackKind obj = liftIO $ getObjectPropertyString obj "kind"

data DOMAudioTrackKindPropertyInfo
instance AttrInfo DOMAudioTrackKindPropertyInfo where
    type AttrAllowedOps DOMAudioTrackKindPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMAudioTrackKindPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMAudioTrackKindPropertyInfo = DOMAudioTrackK
    type AttrGetType DOMAudioTrackKindPropertyInfo = T.Text
    type AttrLabel DOMAudioTrackKindPropertyInfo = "DOMAudioTrack::kind"
    attrGet _ = getDOMAudioTrackKind
    attrSet _ = undefined
    attrConstruct _ = undefined

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

getDOMAudioTrackLabel :: (MonadIO m, DOMAudioTrackK o) => o -> m T.Text
getDOMAudioTrackLabel obj = liftIO $ getObjectPropertyString obj "label"

data DOMAudioTrackLabelPropertyInfo
instance AttrInfo DOMAudioTrackLabelPropertyInfo where
    type AttrAllowedOps DOMAudioTrackLabelPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMAudioTrackLabelPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMAudioTrackLabelPropertyInfo = DOMAudioTrackK
    type AttrGetType DOMAudioTrackLabelPropertyInfo = T.Text
    type AttrLabel DOMAudioTrackLabelPropertyInfo = "DOMAudioTrack::label"
    attrGet _ = getDOMAudioTrackLabel
    attrSet _ = undefined
    attrConstruct _ = undefined

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

getDOMAudioTrackLanguage :: (MonadIO m, DOMAudioTrackK o) => o -> m T.Text
getDOMAudioTrackLanguage obj = liftIO $ getObjectPropertyString obj "language"

data DOMAudioTrackLanguagePropertyInfo
instance AttrInfo DOMAudioTrackLanguagePropertyInfo where
    type AttrAllowedOps DOMAudioTrackLanguagePropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMAudioTrackLanguagePropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMAudioTrackLanguagePropertyInfo = DOMAudioTrackK
    type AttrGetType DOMAudioTrackLanguagePropertyInfo = T.Text
    type AttrLabel DOMAudioTrackLanguagePropertyInfo = "DOMAudioTrack::language"
    attrGet _ = getDOMAudioTrackLanguage
    attrSet _ = undefined
    attrConstruct _ = undefined

type instance AttributeList DOMAudioTrack = DOMAudioTrackAttributeList
type DOMAudioTrackAttributeList = ('[ '("core-object", DOMObjectCoreObjectPropertyInfo), '("enabled", DOMAudioTrackEnabledPropertyInfo), '("id", DOMAudioTrackIdPropertyInfo), '("kind", DOMAudioTrackKindPropertyInfo), '("label", DOMAudioTrackLabelPropertyInfo), '("language", DOMAudioTrackLanguagePropertyInfo)] :: [(Symbol, *)])

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

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

foreign import ccall "webkit_dom_audio_track_get_enabled" webkit_dom_audio_track_get_enabled :: 
    Ptr DOMAudioTrack ->                    -- _obj : TInterface "WebKit" "DOMAudioTrack"
    IO CInt


dOMAudioTrackGetEnabled ::
    (MonadIO m, DOMAudioTrackK a) =>
    a ->                                    -- _obj
    m Bool
dOMAudioTrackGetEnabled _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_dom_audio_track_get_enabled _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'

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


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

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


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

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


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

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


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

-- method DOMAudioTrack::set_enabled
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit" "DOMAudioTrack", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "value", argType = TBasicType TBoolean, direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing}]
-- Lengths : []
-- hInArgs : [Arg {argName = "_obj", argType = TInterface "WebKit" "DOMAudioTrack", direction = DirectionIn, mayBeNull = False, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, transfer = TransferNothing},Arg {argName = "value", 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_audio_track_set_enabled" webkit_dom_audio_track_set_enabled :: 
    Ptr DOMAudioTrack ->                    -- _obj : TInterface "WebKit" "DOMAudioTrack"
    CInt ->                                 -- value : TBasicType TBoolean
    IO ()


dOMAudioTrackSetEnabled ::
    (MonadIO m, DOMAudioTrackK a) =>
    a ->                                    -- _obj
    Bool ->                                 -- value
    m ()
dOMAudioTrackSetEnabled _obj value = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    let value' = (fromIntegral . fromEnum) value
    webkit_dom_audio_track_set_enabled _obj' value'
    touchManagedPtr _obj
    return ()