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

-- * Exported types
    DOMCSSValue(..)                         ,
    IsDOMCSSValue                           ,
    toDOMCSSValue                           ,
    noDOMCSSValue                           ,


 -- * Methods
-- ** getCssText #method:getCssText#

#if ENABLE_OVERLOADING
    DOMCSSValueGetCssTextMethodInfo         ,
#endif
    dOMCSSValueGetCssText                   ,


-- ** getCssValueType #method:getCssValueType#

#if ENABLE_OVERLOADING
    DOMCSSValueGetCssValueTypeMethodInfo    ,
#endif
    dOMCSSValueGetCssValueType              ,


-- ** setCssText #method:setCssText#

#if ENABLE_OVERLOADING
    DOMCSSValueSetCssTextMethodInfo         ,
#endif
    dOMCSSValueSetCssText                   ,




 -- * Properties
-- ** cssText #attr:cssText#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    DOMCSSValueCssTextPropertyInfo          ,
#endif
    clearDOMCSSValueCssText                 ,
    constructDOMCSSValueCssText             ,
#if ENABLE_OVERLOADING
    dOMCSSValueCssText                      ,
#endif
    getDOMCSSValueCssText                   ,
    setDOMCSSValueCssText                   ,


-- ** cssValueType #attr:cssValueType#
{- | /No description available in the introspection data./
-}
#if ENABLE_OVERLOADING
    DOMCSSValueCssValueTypePropertyInfo     ,
#endif
#if ENABLE_OVERLOADING
    dOMCSSValueCssValueType                 ,
#endif
    getDOMCSSValueCssValueType              ,




    ) 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.DOMObject as WebKit2WebExtension.DOMObject

-- | Memory-managed wrapper type.
newtype DOMCSSValue = DOMCSSValue (ManagedPtr DOMCSSValue)
foreign import ccall "webkit_dom_css_value_get_type"
    c_webkit_dom_css_value_get_type :: IO GType

instance GObject DOMCSSValue where
    gobjectType = c_webkit_dom_css_value_get_type


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

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

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

-- | A convenience alias for `Nothing` :: `Maybe` `DOMCSSValue`.
noDOMCSSValue :: Maybe DOMCSSValue
noDOMCSSValue = Nothing

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

instance (info ~ ResolveDOMCSSValueMethod t DOMCSSValue, O.MethodInfo info DOMCSSValue p) => OL.IsLabel t (DOMCSSValue -> 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 "css-text"
   -- Type: TBasicType TUTF8
   -- Flags: [PropertyReadable,PropertyWritable]
   -- Nullable: (Nothing,Nothing)

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

@
'Data.GI.Base.Attributes.get' dOMCSSValue #cssText
@
-}
getDOMCSSValueCssText :: (MonadIO m, IsDOMCSSValue o) => o -> m (Maybe T.Text)
getDOMCSSValueCssText obj = liftIO $ B.Properties.getObjectPropertyString obj "css-text"

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

@
'Data.GI.Base.Attributes.set' dOMCSSValue [ #cssText 'Data.GI.Base.Attributes.:=' value ]
@
-}
setDOMCSSValueCssText :: (MonadIO m, IsDOMCSSValue o) => o -> T.Text -> m ()
setDOMCSSValueCssText obj val = liftIO $ B.Properties.setObjectPropertyString obj "css-text" (Just val)

{- |
Construct a `GValueConstruct` with valid value for the “@css-text@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`.
-}
constructDOMCSSValueCssText :: (IsDOMCSSValue o) => T.Text -> IO (GValueConstruct o)
constructDOMCSSValueCssText val = B.Properties.constructObjectPropertyString "css-text" (Just val)

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

@
'Data.GI.Base.Attributes.clear' #cssText
@
-}
clearDOMCSSValueCssText :: (MonadIO m, IsDOMCSSValue o) => o -> m ()
clearDOMCSSValueCssText obj = liftIO $ B.Properties.setObjectPropertyString obj "css-text" (Nothing :: Maybe T.Text)

#if ENABLE_OVERLOADING
data DOMCSSValueCssTextPropertyInfo
instance AttrInfo DOMCSSValueCssTextPropertyInfo where
    type AttrAllowedOps DOMCSSValueCssTextPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint DOMCSSValueCssTextPropertyInfo = (~) T.Text
    type AttrBaseTypeConstraint DOMCSSValueCssTextPropertyInfo = IsDOMCSSValue
    type AttrGetType DOMCSSValueCssTextPropertyInfo = (Maybe T.Text)
    type AttrLabel DOMCSSValueCssTextPropertyInfo = "css-text"
    type AttrOrigin DOMCSSValueCssTextPropertyInfo = DOMCSSValue
    attrGet _ = getDOMCSSValueCssText
    attrSet _ = setDOMCSSValueCssText
    attrConstruct _ = constructDOMCSSValueCssText
    attrClear _ = clearDOMCSSValueCssText
#endif

-- VVV Prop "css-value-type"
   -- Type: TBasicType TUInt
   -- Flags: [PropertyReadable]
   -- Nullable: (Nothing,Nothing)

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

@
'Data.GI.Base.Attributes.get' dOMCSSValue #cssValueType
@
-}
getDOMCSSValueCssValueType :: (MonadIO m, IsDOMCSSValue o) => o -> m Word32
getDOMCSSValueCssValueType obj = liftIO $ B.Properties.getObjectPropertyUInt32 obj "css-value-type"

#if ENABLE_OVERLOADING
data DOMCSSValueCssValueTypePropertyInfo
instance AttrInfo DOMCSSValueCssValueTypePropertyInfo where
    type AttrAllowedOps DOMCSSValueCssValueTypePropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMCSSValueCssValueTypePropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMCSSValueCssValueTypePropertyInfo = IsDOMCSSValue
    type AttrGetType DOMCSSValueCssValueTypePropertyInfo = Word32
    type AttrLabel DOMCSSValueCssValueTypePropertyInfo = "css-value-type"
    type AttrOrigin DOMCSSValueCssValueTypePropertyInfo = DOMCSSValue
    attrGet _ = getDOMCSSValueCssValueType
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined
#endif

#if ENABLE_OVERLOADING
instance O.HasAttributeList DOMCSSValue
type instance O.AttributeList DOMCSSValue = DOMCSSValueAttributeList
type DOMCSSValueAttributeList = ('[ '("coreObject", WebKit2WebExtension.DOMObject.DOMObjectCoreObjectPropertyInfo), '("cssText", DOMCSSValueCssTextPropertyInfo), '("cssValueType", DOMCSSValueCssValueTypePropertyInfo)] :: [(Symbol, *)])
#endif

#if ENABLE_OVERLOADING
dOMCSSValueCssText :: AttrLabelProxy "cssText"
dOMCSSValueCssText = AttrLabelProxy

dOMCSSValueCssValueType :: AttrLabelProxy "cssValueType"
dOMCSSValueCssValueType = AttrLabelProxy

#endif

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

#endif

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

foreign import ccall "webkit_dom_css_value_get_css_text" webkit_dom_css_value_get_css_text ::
    Ptr DOMCSSValue ->                      -- self : TInterface (Name {namespace = "WebKit2WebExtension", name = "DOMCSSValue"})
    IO CString

{-# DEPRECATED dOMCSSValueGetCssText ["(Since version 2.22)","Use JavaScriptCore API instead"] #-}
{- |
/No description available in the introspection data./
-}
dOMCSSValueGetCssText ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMCSSValue a) =>
    a
    {- ^ /@self@/: A 'GI.WebKit2WebExtension.Objects.DOMCSSValue.DOMCSSValue' -}
    -> m T.Text
    {- ^ __Returns:__ A @/gchar/@ -}
dOMCSSValueGetCssText self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- webkit_dom_css_value_get_css_text self'
    checkUnexpectedReturnNULL "dOMCSSValueGetCssText" result
    result' <- cstringToText result
    freeMem result
    touchManagedPtr self
    return result'

#if ENABLE_OVERLOADING
data DOMCSSValueGetCssTextMethodInfo
instance (signature ~ (m T.Text), MonadIO m, IsDOMCSSValue a) => O.MethodInfo DOMCSSValueGetCssTextMethodInfo a signature where
    overloadedMethod _ = dOMCSSValueGetCssText

#endif

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

foreign import ccall "webkit_dom_css_value_get_css_value_type" webkit_dom_css_value_get_css_value_type ::
    Ptr DOMCSSValue ->                      -- self : TInterface (Name {namespace = "WebKit2WebExtension", name = "DOMCSSValue"})
    IO Word16

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

#if ENABLE_OVERLOADING
data DOMCSSValueGetCssValueTypeMethodInfo
instance (signature ~ (m Word16), MonadIO m, IsDOMCSSValue a) => O.MethodInfo DOMCSSValueGetCssValueTypeMethodInfo a signature where
    overloadedMethod _ = dOMCSSValueGetCssValueType

#endif

-- method DOMCSSValue::set_css_text
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "self", argType = TInterface (Name {namespace = "WebKit2WebExtension", name = "DOMCSSValue"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #WebKitDOMCSSValue", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "value", argType = TBasicType TUTF8, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "A #gchar", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : True
-- Skip return : False

foreign import ccall "webkit_dom_css_value_set_css_text" webkit_dom_css_value_set_css_text ::
    Ptr DOMCSSValue ->                      -- self : TInterface (Name {namespace = "WebKit2WebExtension", name = "DOMCSSValue"})
    CString ->                              -- value : TBasicType TUTF8
    Ptr (Ptr GError) ->                     -- error
    IO ()

{-# DEPRECATED dOMCSSValueSetCssText ["(Since version 2.22)","Use JavaScriptCore API instead"] #-}
{- |
/No description available in the introspection data./
-}
dOMCSSValueSetCssText ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMCSSValue a) =>
    a
    {- ^ /@self@/: A 'GI.WebKit2WebExtension.Objects.DOMCSSValue.DOMCSSValue' -}
    -> T.Text
    {- ^ /@value@/: A @/gchar/@ -}
    -> m ()
    {- ^ /(Can throw 'Data.GI.Base.GError.GError')/ -}
dOMCSSValueSetCssText self value = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    value' <- textToCString value
    onException (do
        propagateGError $ webkit_dom_css_value_set_css_text self' value'
        touchManagedPtr self
        freeMem value'
        return ()
     ) (do
        freeMem value'
     )

#if ENABLE_OVERLOADING
data DOMCSSValueSetCssTextMethodInfo
instance (signature ~ (T.Text -> m ()), MonadIO m, IsDOMCSSValue a) => O.MethodInfo DOMCSSValueSetCssTextMethodInfo a signature where
    overloadedMethod _ = dOMCSSValueSetCssText

#endif