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

-- * Exported types
    DOMTimeRanges(..)                       ,
    IsDOMTimeRanges                         ,
    toDOMTimeRanges                         ,
    noDOMTimeRanges                         ,


 -- * Methods
-- ** end #method:end#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DOMTimeRangesEndMethodInfo              ,
#endif
    dOMTimeRangesEnd                        ,


-- ** getLength #method:getLength#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DOMTimeRangesGetLengthMethodInfo        ,
#endif
    dOMTimeRangesGetLength                  ,


-- ** start #method:start#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DOMTimeRangesStartMethodInfo            ,
#endif
    dOMTimeRangesStart                      ,




 -- * Properties
-- ** length #attr:length#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    DOMTimeRangesLengthPropertyInfo         ,
#endif
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    dOMTimeRangesLength                     ,
#endif
    getDOMTimeRangesLength                  ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP

import qualified GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.WebKit.Objects.DOMObject as WebKit.DOMObject

newtype DOMTimeRanges = DOMTimeRanges (ManagedPtr DOMTimeRanges)
foreign import ccall "webkit_dom_time_ranges_get_type"
    c_webkit_dom_time_ranges_get_type :: IO GType

instance GObject DOMTimeRanges where
    gobjectType _ = c_webkit_dom_time_ranges_get_type
    

class GObject o => IsDOMTimeRanges o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError DOMTimeRanges a) =>
    IsDOMTimeRanges a
#endif
instance IsDOMTimeRanges DOMTimeRanges
instance WebKit.DOMObject.IsDOMObject DOMTimeRanges
instance GObject.Object.IsObject DOMTimeRanges

toDOMTimeRanges :: (MonadIO m, IsDOMTimeRanges o) => o -> m DOMTimeRanges
toDOMTimeRanges = liftIO . unsafeCastTo DOMTimeRanges

noDOMTimeRanges :: Maybe DOMTimeRanges
noDOMTimeRanges = Nothing

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
type family ResolveDOMTimeRangesMethod (t :: Symbol) (o :: *) :: * where
    ResolveDOMTimeRangesMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveDOMTimeRangesMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveDOMTimeRangesMethod "end" o = DOMTimeRangesEndMethodInfo
    ResolveDOMTimeRangesMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveDOMTimeRangesMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveDOMTimeRangesMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveDOMTimeRangesMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveDOMTimeRangesMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveDOMTimeRangesMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveDOMTimeRangesMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveDOMTimeRangesMethod "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
    ResolveDOMTimeRangesMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
    ResolveDOMTimeRangesMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveDOMTimeRangesMethod "start" o = DOMTimeRangesStartMethodInfo
    ResolveDOMTimeRangesMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveDOMTimeRangesMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveDOMTimeRangesMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveDOMTimeRangesMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveDOMTimeRangesMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveDOMTimeRangesMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveDOMTimeRangesMethod "getLength" o = DOMTimeRangesGetLengthMethodInfo
    ResolveDOMTimeRangesMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveDOMTimeRangesMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveDOMTimeRangesMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveDOMTimeRangesMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveDOMTimeRangesMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveDOMTimeRangesMethod t DOMTimeRanges, O.MethodInfo info DOMTimeRanges p) => O.IsLabelProxy t (DOMTimeRanges -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveDOMTimeRangesMethod t DOMTimeRanges, O.MethodInfo info DOMTimeRanges p) => O.IsLabel t (DOMTimeRanges -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif
#endif

#endif

-- VVV Prop "length"
   -- Type: TBasicType TULong
   -- Flags: [PropertyReadable]
   -- Nullable: (Just False,Nothing)

getDOMTimeRangesLength :: (MonadIO m, IsDOMTimeRanges o) => o -> m CULong
getDOMTimeRangesLength obj = liftIO $ getObjectPropertyULong obj "length"

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data DOMTimeRangesLengthPropertyInfo
instance AttrInfo DOMTimeRangesLengthPropertyInfo where
    type AttrAllowedOps DOMTimeRangesLengthPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMTimeRangesLengthPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMTimeRangesLengthPropertyInfo = IsDOMTimeRanges
    type AttrGetType DOMTimeRangesLengthPropertyInfo = CULong
    type AttrLabel DOMTimeRangesLengthPropertyInfo = "length"
    type AttrOrigin DOMTimeRangesLengthPropertyInfo = DOMTimeRanges
    attrGet _ = getDOMTimeRangesLength
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined
#endif

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
instance O.HasAttributeList DOMTimeRanges
type instance O.AttributeList DOMTimeRanges = DOMTimeRangesAttributeList
type DOMTimeRangesAttributeList = ('[ '("coreObject", WebKit.DOMObject.DOMObjectCoreObjectPropertyInfo), '("length", DOMTimeRangesLengthPropertyInfo)] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
dOMTimeRangesLength :: AttrLabelProxy "length"
dOMTimeRangesLength = AttrLabelProxy

#endif

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
type instance O.SignalList DOMTimeRanges = DOMTimeRangesSignalList
type DOMTimeRangesSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method DOMTimeRanges::end
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "WebKit", name = "DOMTimeRanges"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #WebKitDOMTimeRanges", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "index", argType = TBasicType TULong, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #gulong", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TDouble)
-- throws : True
-- Skip return : False

foreign import ccall "webkit_dom_time_ranges_end" webkit_dom_time_ranges_end :: 
    Ptr DOMTimeRanges ->                    -- self : TInterface (Name {namespace = "WebKit", name = "DOMTimeRanges"})
    CULong ->                               -- index : TBasicType TULong
    Ptr (Ptr GError) ->                     -- error
    IO CDouble

{- |
/No description available in the introspection data./
-}
dOMTimeRangesEnd ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMTimeRanges a) =>
    a
    {- ^ /@self@/: A 'GI.WebKit.Objects.DOMTimeRanges.DOMTimeRanges' -}
    -> CULong
    {- ^ /@index@/: A @/gulong/@ -}
    -> m Double
    {- ^ __Returns:__ A @/gdouble/@ /(Can throw 'Data.GI.Base.GError.GError')/ -}
dOMTimeRangesEnd self index = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    onException (do
        result <- propagateGError $ webkit_dom_time_ranges_end self' index
        let result' = realToFrac result
        touchManagedPtr self
        return result'
     ) (do
        return ()
     )

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data DOMTimeRangesEndMethodInfo
instance (signature ~ (CULong -> m Double), MonadIO m, IsDOMTimeRanges a) => O.MethodInfo DOMTimeRangesEndMethodInfo a signature where
    overloadedMethod _ = dOMTimeRangesEnd

#endif

-- method DOMTimeRanges::get_length
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "WebKit", name = "DOMTimeRanges"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #WebKitDOMTimeRanges", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TULong)
-- throws : False
-- Skip return : False

foreign import ccall "webkit_dom_time_ranges_get_length" webkit_dom_time_ranges_get_length :: 
    Ptr DOMTimeRanges ->                    -- self : TInterface (Name {namespace = "WebKit", name = "DOMTimeRanges"})
    IO CULong

{- |
/No description available in the introspection data./
-}
dOMTimeRangesGetLength ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMTimeRanges a) =>
    a
    {- ^ /@self@/: A 'GI.WebKit.Objects.DOMTimeRanges.DOMTimeRanges' -}
    -> m CULong
    {- ^ __Returns:__ A @/gulong/@ -}
dOMTimeRangesGetLength self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- webkit_dom_time_ranges_get_length self'
    touchManagedPtr self
    return result

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data DOMTimeRangesGetLengthMethodInfo
instance (signature ~ (m CULong), MonadIO m, IsDOMTimeRanges a) => O.MethodInfo DOMTimeRangesGetLengthMethodInfo a signature where
    overloadedMethod _ = dOMTimeRangesGetLength

#endif

-- method DOMTimeRanges::start
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "WebKit", name = "DOMTimeRanges"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #WebKitDOMTimeRanges", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "index", argType = TBasicType TULong, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #gulong", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TDouble)
-- throws : True
-- Skip return : False

foreign import ccall "webkit_dom_time_ranges_start" webkit_dom_time_ranges_start :: 
    Ptr DOMTimeRanges ->                    -- self : TInterface (Name {namespace = "WebKit", name = "DOMTimeRanges"})
    CULong ->                               -- index : TBasicType TULong
    Ptr (Ptr GError) ->                     -- error
    IO CDouble

{- |
/No description available in the introspection data./
-}
dOMTimeRangesStart ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMTimeRanges a) =>
    a
    {- ^ /@self@/: A 'GI.WebKit.Objects.DOMTimeRanges.DOMTimeRanges' -}
    -> CULong
    {- ^ /@index@/: A @/gulong/@ -}
    -> m Double
    {- ^ __Returns:__ A @/gdouble/@ /(Can throw 'Data.GI.Base.GError.GError')/ -}
dOMTimeRangesStart self index = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    onException (do
        result <- propagateGError $ webkit_dom_time_ranges_start self' index
        let result' = realToFrac result
        touchManagedPtr self
        return result'
     ) (do
        return ()
     )

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data DOMTimeRangesStartMethodInfo
instance (signature ~ (CULong -> m Double), MonadIO m, IsDOMTimeRanges a) => O.MethodInfo DOMTimeRangesStartMethodInfo a signature where
    overloadedMethod _ = dOMTimeRangesStart

#endif