{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- /No description available in the introspection data./

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

module GI.WebKit2WebExtension.Objects.DOMCSSRuleList
    ( 

-- * Exported types
    DOMCSSRuleList(..)                      ,
    IsDOMCSSRuleList                        ,
    toDOMCSSRuleList                        ,
    noDOMCSSRuleList                        ,


 -- * Methods
-- ** Overloaded methods #method:Overloaded methods#

#if defined(ENABLE_OVERLOADING)
    ResolveDOMCSSRuleListMethod             ,
#endif


-- ** getLength #method:getLength#

#if defined(ENABLE_OVERLOADING)
    DOMCSSRuleListGetLengthMethodInfo       ,
#endif
    dOMCSSRuleListGetLength                 ,


-- ** item #method:item#

#if defined(ENABLE_OVERLOADING)
    DOMCSSRuleListItemMethodInfo            ,
#endif
    dOMCSSRuleListItem                      ,




 -- * Properties
-- ** length #attr:length#
-- | /No description available in the introspection data./

#if defined(ENABLE_OVERLOADING)
    DOMCSSRuleListLengthPropertyInfo        ,
#endif
#if defined(ENABLE_OVERLOADING)
    dOMCSSRuleListLength                    ,
#endif
    getDOMCSSRuleListLength                 ,




    ) 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.GI.Base.Signals as B.Signals
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.DOMCSSRule as WebKit2WebExtension.DOMCSSRule
import {-# SOURCE #-} qualified GI.WebKit2WebExtension.Objects.DOMObject as WebKit2WebExtension.DOMObject

-- | Memory-managed wrapper type.
newtype DOMCSSRuleList = DOMCSSRuleList (ManagedPtr DOMCSSRuleList)
    deriving (DOMCSSRuleList -> DOMCSSRuleList -> Bool
(DOMCSSRuleList -> DOMCSSRuleList -> Bool)
-> (DOMCSSRuleList -> DOMCSSRuleList -> Bool) -> Eq DOMCSSRuleList
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DOMCSSRuleList -> DOMCSSRuleList -> Bool
$c/= :: DOMCSSRuleList -> DOMCSSRuleList -> Bool
== :: DOMCSSRuleList -> DOMCSSRuleList -> Bool
$c== :: DOMCSSRuleList -> DOMCSSRuleList -> Bool
Eq)
foreign import ccall "webkit_dom_css_rule_list_get_type"
    c_webkit_dom_css_rule_list_get_type :: IO GType

instance GObject DOMCSSRuleList where
    gobjectType :: IO GType
gobjectType = IO GType
c_webkit_dom_css_rule_list_get_type
    

-- | Convert 'DOMCSSRuleList' to and from 'Data.GI.Base.GValue.GValue' with 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue DOMCSSRuleList where
    toGValue :: DOMCSSRuleList -> IO GValue
toGValue o :: DOMCSSRuleList
o = do
        GType
gtype <- IO GType
c_webkit_dom_css_rule_list_get_type
        DOMCSSRuleList -> (Ptr DOMCSSRuleList -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr DOMCSSRuleList
o (GType
-> (GValue -> Ptr DOMCSSRuleList -> IO ())
-> Ptr DOMCSSRuleList
-> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr DOMCSSRuleList -> IO ()
forall a. GObject a => GValue -> Ptr a -> IO ()
B.GValue.set_object)
        
    fromGValue :: GValue -> IO DOMCSSRuleList
fromGValue gv :: GValue
gv = do
        Ptr DOMCSSRuleList
ptr <- GValue -> IO (Ptr DOMCSSRuleList)
forall b. GObject b => GValue -> IO (Ptr b)
B.GValue.get_object GValue
gv :: IO (Ptr DOMCSSRuleList)
        (ManagedPtr DOMCSSRuleList -> DOMCSSRuleList)
-> Ptr DOMCSSRuleList -> IO DOMCSSRuleList
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
B.ManagedPtr.newObject ManagedPtr DOMCSSRuleList -> DOMCSSRuleList
DOMCSSRuleList Ptr DOMCSSRuleList
ptr
        
    

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

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

-- | Cast to `DOMCSSRuleList`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toDOMCSSRuleList :: (MonadIO m, IsDOMCSSRuleList o) => o -> m DOMCSSRuleList
toDOMCSSRuleList :: o -> m DOMCSSRuleList
toDOMCSSRuleList = IO DOMCSSRuleList -> m DOMCSSRuleList
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO DOMCSSRuleList -> m DOMCSSRuleList)
-> (o -> IO DOMCSSRuleList) -> o -> m DOMCSSRuleList
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (ManagedPtr DOMCSSRuleList -> DOMCSSRuleList)
-> o -> IO DOMCSSRuleList
forall o o'.
(HasCallStack, GObject o, GObject o') =>
(ManagedPtr o' -> o') -> o -> IO o'
unsafeCastTo ManagedPtr DOMCSSRuleList -> DOMCSSRuleList
DOMCSSRuleList

-- | A convenience alias for `Nothing` :: `Maybe` `DOMCSSRuleList`.
noDOMCSSRuleList :: Maybe DOMCSSRuleList
noDOMCSSRuleList :: Maybe DOMCSSRuleList
noDOMCSSRuleList = Maybe DOMCSSRuleList
forall a. Maybe a
Nothing

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

instance (info ~ ResolveDOMCSSRuleListMethod t DOMCSSRuleList, O.MethodInfo info DOMCSSRuleList p) => OL.IsLabel t (DOMCSSRuleList -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @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' dOMCSSRuleList #length
-- @
getDOMCSSRuleListLength :: (MonadIO m, IsDOMCSSRuleList o) => o -> m CULong
getDOMCSSRuleListLength :: o -> m CULong
getDOMCSSRuleListLength obj :: o
obj = IO CULong -> m CULong
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO CULong -> m CULong) -> IO CULong -> m CULong
forall a b. (a -> b) -> a -> b
$ o -> String -> IO CULong
forall a. GObject a => a -> String -> IO CULong
B.Properties.getObjectPropertyULong o
obj "length"

#if defined(ENABLE_OVERLOADING)
data DOMCSSRuleListLengthPropertyInfo
instance AttrInfo DOMCSSRuleListLengthPropertyInfo where
    type AttrAllowedOps DOMCSSRuleListLengthPropertyInfo = '[ 'AttrGet]
    type AttrBaseTypeConstraint DOMCSSRuleListLengthPropertyInfo = IsDOMCSSRuleList
    type AttrSetTypeConstraint DOMCSSRuleListLengthPropertyInfo = (~) ()
    type AttrTransferTypeConstraint DOMCSSRuleListLengthPropertyInfo = (~) ()
    type AttrTransferType DOMCSSRuleListLengthPropertyInfo = ()
    type AttrGetType DOMCSSRuleListLengthPropertyInfo = CULong
    type AttrLabel DOMCSSRuleListLengthPropertyInfo = "length"
    type AttrOrigin DOMCSSRuleListLengthPropertyInfo = DOMCSSRuleList
    attrGet = getDOMCSSRuleListLength
    attrSet = undefined
    attrTransfer _ = undefined
    attrConstruct = undefined
    attrClear = undefined
#endif

#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList DOMCSSRuleList
type instance O.AttributeList DOMCSSRuleList = DOMCSSRuleListAttributeList
type DOMCSSRuleListAttributeList = ('[ '("coreObject", WebKit2WebExtension.DOMObject.DOMObjectCoreObjectPropertyInfo), '("length", DOMCSSRuleListLengthPropertyInfo)] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
dOMCSSRuleListLength :: AttrLabelProxy "length"
dOMCSSRuleListLength = AttrLabelProxy

#endif

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

#endif

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

{-# DEPRECATED dOMCSSRuleListGetLength ["(Since version 2.22)","Use JavaScriptCore API instead"] #-}
-- | /No description available in the introspection data./
dOMCSSRuleListGetLength ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMCSSRuleList a) =>
    a
    -- ^ /@self@/: A t'GI.WebKit2WebExtension.Objects.DOMCSSRuleList.DOMCSSRuleList'
    -> m CULong
    -- ^ __Returns:__ A @/gulong/@
dOMCSSRuleListGetLength :: a -> m CULong
dOMCSSRuleListGetLength self :: a
self = IO CULong -> m CULong
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO CULong -> m CULong) -> IO CULong -> m CULong
forall a b. (a -> b) -> a -> b
$ do
    Ptr DOMCSSRuleList
self' <- a -> IO (Ptr DOMCSSRuleList)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
    CULong
result <- Ptr DOMCSSRuleList -> IO CULong
webkit_dom_css_rule_list_get_length Ptr DOMCSSRuleList
self'
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
    CULong -> IO CULong
forall (m :: * -> *) a. Monad m => a -> m a
return CULong
result

#if defined(ENABLE_OVERLOADING)
data DOMCSSRuleListGetLengthMethodInfo
instance (signature ~ (m CULong), MonadIO m, IsDOMCSSRuleList a) => O.MethodInfo DOMCSSRuleListGetLengthMethodInfo a signature where
    overloadedMethod = dOMCSSRuleListGetLength

#endif

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

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

{-# DEPRECATED dOMCSSRuleListItem ["(Since version 2.22)","Use JavaScriptCore API instead"] #-}
-- | /No description available in the introspection data./
dOMCSSRuleListItem ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMCSSRuleList a) =>
    a
    -- ^ /@self@/: A t'GI.WebKit2WebExtension.Objects.DOMCSSRuleList.DOMCSSRuleList'
    -> CULong
    -- ^ /@index@/: A @/gulong/@
    -> m WebKit2WebExtension.DOMCSSRule.DOMCSSRule
    -- ^ __Returns:__ A t'GI.WebKit2WebExtension.Objects.DOMCSSRule.DOMCSSRule'
dOMCSSRuleListItem :: a -> CULong -> m DOMCSSRule
dOMCSSRuleListItem self :: a
self index :: CULong
index = IO DOMCSSRule -> m DOMCSSRule
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO DOMCSSRule -> m DOMCSSRule) -> IO DOMCSSRule -> m DOMCSSRule
forall a b. (a -> b) -> a -> b
$ do
    Ptr DOMCSSRuleList
self' <- a -> IO (Ptr DOMCSSRuleList)
forall a b. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr b)
unsafeManagedPtrCastPtr a
self
    Ptr DOMCSSRule
result <- Ptr DOMCSSRuleList -> CULong -> IO (Ptr DOMCSSRule)
webkit_dom_css_rule_list_item Ptr DOMCSSRuleList
self' CULong
index
    Text -> Ptr DOMCSSRule -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "dOMCSSRuleListItem" Ptr DOMCSSRule
result
    DOMCSSRule
result' <- ((ManagedPtr DOMCSSRule -> DOMCSSRule)
-> Ptr DOMCSSRule -> IO DOMCSSRule
forall a b.
(HasCallStack, GObject a, GObject b) =>
(ManagedPtr a -> a) -> Ptr b -> IO a
wrapObject ManagedPtr DOMCSSRule -> DOMCSSRule
WebKit2WebExtension.DOMCSSRule.DOMCSSRule) Ptr DOMCSSRule
result
    a -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr a
self
    DOMCSSRule -> IO DOMCSSRule
forall (m :: * -> *) a. Monad m => a -> m a
return DOMCSSRule
result'

#if defined(ENABLE_OVERLOADING)
data DOMCSSRuleListItemMethodInfo
instance (signature ~ (CULong -> m WebKit2WebExtension.DOMCSSRule.DOMCSSRule), MonadIO m, IsDOMCSSRuleList a) => O.MethodInfo DOMCSSRuleListItemMethodInfo a signature where
    overloadedMethod = dOMCSSRuleListItem

#endif