{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)

/No description available in the introspection data./
-}

#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
       && !defined(__HADDOCK_VERSION__))

module GI.WebKit2WebExtension.Objects.DOMFileList
    (

-- * Exported types
    DOMFileList(..)                         ,
    IsDOMFileList                           ,
    toDOMFileList                           ,
    noDOMFileList                           ,


 -- * Methods
-- ** getLength #method:getLength#

#if ENABLE_OVERLOADING
    DOMFileListGetLengthMethodInfo          ,
#endif
    dOMFileListGetLength                    ,


-- ** item #method:item#

#if ENABLE_OVERLOADING
    DOMFileListItemMethodInfo               ,
#endif
    dOMFileListItem                         ,




 -- * Properties
-- ** length #attr:length#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    DOMFileListLengthPropertyInfo           ,
#endif
#if ENABLE_OVERLOADING
    dOMFileListLength                       ,
#endif
    getDOMFileListLength                    ,




    ) 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.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
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 GHC.OverloadedLabels as OL

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

-- | Memory-managed wrapper type.
newtype DOMFileList = DOMFileList (ManagedPtr DOMFileList)
foreign import ccall "webkit_dom_file_list_get_type"
    c_webkit_dom_file_list_get_type :: IO GType

instance GObject DOMFileList where
    gobjectType = c_webkit_dom_file_list_get_type


-- | Type class for types which can be safely cast to `DOMFileList`, for instance with `toDOMFileList`.
class (GObject o, O.IsDescendantOf DOMFileList o) => IsDOMFileList o
instance (GObject o, O.IsDescendantOf DOMFileList o) => IsDOMFileList o

instance O.HasParentTypes DOMFileList
type instance O.ParentTypes DOMFileList = '[WebKit2WebExtension.DOMObject.DOMObject, GObject.Object.Object]

-- | Cast to `DOMFileList`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toDOMFileList :: (MonadIO m, IsDOMFileList o) => o -> m DOMFileList
toDOMFileList = liftIO . unsafeCastTo DOMFileList

-- | A convenience alias for `Nothing` :: `Maybe` `DOMFileList`.
noDOMFileList :: Maybe DOMFileList
noDOMFileList = Nothing

#if ENABLE_OVERLOADING
type family ResolveDOMFileListMethod (t :: Symbol) (o :: *) :: * where
    ResolveDOMFileListMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveDOMFileListMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveDOMFileListMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveDOMFileListMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveDOMFileListMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
    ResolveDOMFileListMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveDOMFileListMethod "item" o = DOMFileListItemMethodInfo
    ResolveDOMFileListMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveDOMFileListMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveDOMFileListMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveDOMFileListMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveDOMFileListMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveDOMFileListMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveDOMFileListMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveDOMFileListMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveDOMFileListMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveDOMFileListMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveDOMFileListMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveDOMFileListMethod "getLength" o = DOMFileListGetLengthMethodInfo
    ResolveDOMFileListMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveDOMFileListMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveDOMFileListMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveDOMFileListMethod "setDataFull" o = GObject.Object.ObjectSetDataFullMethodInfo
    ResolveDOMFileListMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveDOMFileListMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveDOMFileListMethod t DOMFileList, O.MethodInfo info DOMFileList p) => OL.IsLabel t (DOMFileList -> 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

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

{- |
Get the value of the “@length@” property.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to

@
'Data.GI.Base.Attributes.get' dOMFileList #length
@
-}
getDOMFileListLength :: (MonadIO m, IsDOMFileList o) => o -> m CULong
getDOMFileListLength obj = liftIO $ B.Properties.getObjectPropertyULong obj "length"

#if ENABLE_OVERLOADING
data DOMFileListLengthPropertyInfo
instance AttrInfo DOMFileListLengthPropertyInfo where
    type AttrAllowedOps DOMFileListLengthPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMFileListLengthPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMFileListLengthPropertyInfo = IsDOMFileList
    type AttrGetType DOMFileListLengthPropertyInfo = CULong
    type AttrLabel DOMFileListLengthPropertyInfo = "length"
    type AttrOrigin DOMFileListLengthPropertyInfo = DOMFileList
    attrGet _ = getDOMFileListLength
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined
#endif

#if ENABLE_OVERLOADING
instance O.HasAttributeList DOMFileList
type instance O.AttributeList DOMFileList = DOMFileListAttributeList
type DOMFileListAttributeList = ('[ '("coreObject", WebKit2WebExtension.DOMObject.DOMObjectCoreObjectPropertyInfo), '("length", DOMFileListLengthPropertyInfo)] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
dOMFileListLength :: AttrLabelProxy "length"
dOMFileListLength = AttrLabelProxy

#endif

#if ENABLE_OVERLOADING
type instance O.SignalList DOMFileList = DOMFileListSignalList
type DOMFileListSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

#endif

-- method DOMFileList::get_length
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "WebKit2WebExtension", name = "DOMFileList"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #WebKitDOMFileList", 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_file_list_get_length" webkit_dom_file_list_get_length ::
    Ptr DOMFileList ->                      -- self : TInterface (Name {namespace = "WebKit2WebExtension", name = "DOMFileList"})
    IO CULong

{-# DEPRECATED dOMFileListGetLength ["(Since version 2.22)","Use JavaScriptCore API instead"] #-}
{- |
/No description available in the introspection data./
-}
dOMFileListGetLength ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMFileList a) =>
    a
    {- ^ /@self@/: A 'GI.WebKit2WebExtension.Objects.DOMFileList.DOMFileList' -}
    -> m CULong
    {- ^ __Returns:__ A @/gulong/@ -}
dOMFileListGetLength self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- webkit_dom_file_list_get_length self'
    touchManagedPtr self
    return result

#if ENABLE_OVERLOADING
data DOMFileListGetLengthMethodInfo
instance (signature ~ (m CULong), MonadIO m, IsDOMFileList a) => O.MethodInfo DOMFileListGetLengthMethodInfo a signature where
    overloadedMethod _ = dOMFileListGetLength

#endif

-- method DOMFileList::item
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "WebKit2WebExtension", name = "DOMFileList"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #WebKitDOMFileList", 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 (TInterface (Name {namespace = "WebKit2WebExtension", name = "DOMFile"}))
-- throws : False
-- Skip return : False

foreign import ccall "webkit_dom_file_list_item" webkit_dom_file_list_item ::
    Ptr DOMFileList ->                      -- self : TInterface (Name {namespace = "WebKit2WebExtension", name = "DOMFileList"})
    CULong ->                               -- index : TBasicType TULong
    IO (Ptr WebKit2WebExtension.DOMFile.DOMFile)

{-# DEPRECATED dOMFileListItem ["(Since version 2.22)","Use JavaScriptCore API instead"] #-}
{- |
/No description available in the introspection data./
-}
dOMFileListItem ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMFileList a) =>
    a
    {- ^ /@self@/: A 'GI.WebKit2WebExtension.Objects.DOMFileList.DOMFileList' -}
    -> CULong
    {- ^ /@index@/: A @/gulong/@ -}
    -> m WebKit2WebExtension.DOMFile.DOMFile
    {- ^ __Returns:__ A 'GI.WebKit2WebExtension.Objects.DOMFile.DOMFile' -}
dOMFileListItem self index = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- webkit_dom_file_list_item self' index
    checkUnexpectedReturnNULL "dOMFileListItem" result
    result' <- (wrapObject WebKit2WebExtension.DOMFile.DOMFile) result
    touchManagedPtr self
    return result'

#if ENABLE_OVERLOADING
data DOMFileListItemMethodInfo
instance (signature ~ (CULong -> m WebKit2WebExtension.DOMFile.DOMFile), MonadIO m, IsDOMFileList a) => O.MethodInfo DOMFileListItemMethodInfo a signature where
    overloadedMethod _ = dOMFileListItem

#endif