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

-- * Exported types
    DOMStyleSheet(..)                       ,
    DOMStyleSheetK                          ,
    toDOMStyleSheet                         ,
    noDOMStyleSheet                         ,


 -- * Methods
-- ** dOMStyleSheetGetDisabled
    dOMStyleSheetGetDisabled                ,


-- ** dOMStyleSheetGetHref
    dOMStyleSheetGetHref                    ,


-- ** dOMStyleSheetGetMedia
    dOMStyleSheetGetMedia                   ,


-- ** dOMStyleSheetGetOwnerNode
    dOMStyleSheetGetOwnerNode               ,


-- ** dOMStyleSheetGetParentStyleSheet
    dOMStyleSheetGetParentStyleSheet        ,


-- ** dOMStyleSheetGetTitle
    dOMStyleSheetGetTitle                   ,


-- ** dOMStyleSheetSetDisabled
    dOMStyleSheetSetDisabled                ,




 -- * Properties
-- ** Disabled
    DOMStyleSheetDisabledPropertyInfo       ,
    constructDOMStyleSheetDisabled          ,
    getDOMStyleSheetDisabled                ,
    setDOMStyleSheetDisabled                ,


-- ** Href
    DOMStyleSheetHrefPropertyInfo           ,
    getDOMStyleSheetHref                    ,


-- ** Media
    DOMStyleSheetMediaPropertyInfo          ,
    getDOMStyleSheetMedia                   ,


-- ** OwnerNode
    DOMStyleSheetOwnerNodePropertyInfo      ,
    getDOMStyleSheetOwnerNode               ,


-- ** ParentStyleSheet
    DOMStyleSheetParentStyleSheetPropertyInfo,
    getDOMStyleSheetParentStyleSheet        ,


-- ** Title
    DOMStyleSheetTitlePropertyInfo          ,
    getDOMStyleSheetTitle                   ,


-- ** Type
    DOMStyleSheetTypePropertyInfo           ,
    getDOMStyleSheetType                    ,




    ) 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 DOMStyleSheet = DOMStyleSheet (ForeignPtr DOMStyleSheet)
foreign import ccall "webkit_dom_style_sheet_get_type"
    c_webkit_dom_style_sheet_get_type :: IO GType

type instance ParentTypes DOMStyleSheet = DOMStyleSheetParentTypes
type DOMStyleSheetParentTypes = '[DOMObject, GObject.Object]

instance GObject DOMStyleSheet where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_webkit_dom_style_sheet_get_type
    

class GObject o => DOMStyleSheetK o
instance (GObject o, IsDescendantOf DOMStyleSheet o) => DOMStyleSheetK o

toDOMStyleSheet :: DOMStyleSheetK o => o -> IO DOMStyleSheet
toDOMStyleSheet = unsafeCastTo DOMStyleSheet

noDOMStyleSheet :: Maybe DOMStyleSheet
noDOMStyleSheet = Nothing

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

getDOMStyleSheetDisabled :: (MonadIO m, DOMStyleSheetK o) => o -> m Bool
getDOMStyleSheetDisabled obj = liftIO $ getObjectPropertyBool obj "disabled"

setDOMStyleSheetDisabled :: (MonadIO m, DOMStyleSheetK o) => o -> Bool -> m ()
setDOMStyleSheetDisabled obj val = liftIO $ setObjectPropertyBool obj "disabled" val

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

data DOMStyleSheetDisabledPropertyInfo
instance AttrInfo DOMStyleSheetDisabledPropertyInfo where
    type AttrAllowedOps DOMStyleSheetDisabledPropertyInfo = '[ 'AttrSet, 'AttrConstruct, 'AttrGet]
    type AttrSetTypeConstraint DOMStyleSheetDisabledPropertyInfo = (~) Bool
    type AttrBaseTypeConstraint DOMStyleSheetDisabledPropertyInfo = DOMStyleSheetK
    type AttrGetType DOMStyleSheetDisabledPropertyInfo = Bool
    type AttrLabel DOMStyleSheetDisabledPropertyInfo = "DOMStyleSheet::disabled"
    attrGet _ = getDOMStyleSheetDisabled
    attrSet _ = setDOMStyleSheetDisabled
    attrConstruct _ = constructDOMStyleSheetDisabled

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

getDOMStyleSheetHref :: (MonadIO m, DOMStyleSheetK o) => o -> m T.Text
getDOMStyleSheetHref obj = liftIO $ getObjectPropertyString obj "href"

data DOMStyleSheetHrefPropertyInfo
instance AttrInfo DOMStyleSheetHrefPropertyInfo where
    type AttrAllowedOps DOMStyleSheetHrefPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMStyleSheetHrefPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMStyleSheetHrefPropertyInfo = DOMStyleSheetK
    type AttrGetType DOMStyleSheetHrefPropertyInfo = T.Text
    type AttrLabel DOMStyleSheetHrefPropertyInfo = "DOMStyleSheet::href"
    attrGet _ = getDOMStyleSheetHref
    attrSet _ = undefined
    attrConstruct _ = undefined

-- VVV Prop "media"
   -- Type: TInterface "WebKit" "DOMMediaList"
   -- Flags: [PropertyReadable]

getDOMStyleSheetMedia :: (MonadIO m, DOMStyleSheetK o) => o -> m DOMMediaList
getDOMStyleSheetMedia obj = liftIO $ getObjectPropertyObject obj "media" DOMMediaList

data DOMStyleSheetMediaPropertyInfo
instance AttrInfo DOMStyleSheetMediaPropertyInfo where
    type AttrAllowedOps DOMStyleSheetMediaPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMStyleSheetMediaPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMStyleSheetMediaPropertyInfo = DOMStyleSheetK
    type AttrGetType DOMStyleSheetMediaPropertyInfo = DOMMediaList
    type AttrLabel DOMStyleSheetMediaPropertyInfo = "DOMStyleSheet::media"
    attrGet _ = getDOMStyleSheetMedia
    attrSet _ = undefined
    attrConstruct _ = undefined

-- VVV Prop "owner-node"
   -- Type: TInterface "WebKit" "DOMNode"
   -- Flags: [PropertyReadable]

getDOMStyleSheetOwnerNode :: (MonadIO m, DOMStyleSheetK o) => o -> m DOMNode
getDOMStyleSheetOwnerNode obj = liftIO $ getObjectPropertyObject obj "owner-node" DOMNode

data DOMStyleSheetOwnerNodePropertyInfo
instance AttrInfo DOMStyleSheetOwnerNodePropertyInfo where
    type AttrAllowedOps DOMStyleSheetOwnerNodePropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMStyleSheetOwnerNodePropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMStyleSheetOwnerNodePropertyInfo = DOMStyleSheetK
    type AttrGetType DOMStyleSheetOwnerNodePropertyInfo = DOMNode
    type AttrLabel DOMStyleSheetOwnerNodePropertyInfo = "DOMStyleSheet::owner-node"
    attrGet _ = getDOMStyleSheetOwnerNode
    attrSet _ = undefined
    attrConstruct _ = undefined

-- VVV Prop "parent-style-sheet"
   -- Type: TInterface "WebKit" "DOMStyleSheet"
   -- Flags: [PropertyReadable]

getDOMStyleSheetParentStyleSheet :: (MonadIO m, DOMStyleSheetK o) => o -> m DOMStyleSheet
getDOMStyleSheetParentStyleSheet obj = liftIO $ getObjectPropertyObject obj "parent-style-sheet" DOMStyleSheet

data DOMStyleSheetParentStyleSheetPropertyInfo
instance AttrInfo DOMStyleSheetParentStyleSheetPropertyInfo where
    type AttrAllowedOps DOMStyleSheetParentStyleSheetPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMStyleSheetParentStyleSheetPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMStyleSheetParentStyleSheetPropertyInfo = DOMStyleSheetK
    type AttrGetType DOMStyleSheetParentStyleSheetPropertyInfo = DOMStyleSheet
    type AttrLabel DOMStyleSheetParentStyleSheetPropertyInfo = "DOMStyleSheet::parent-style-sheet"
    attrGet _ = getDOMStyleSheetParentStyleSheet
    attrSet _ = undefined
    attrConstruct _ = undefined

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

getDOMStyleSheetTitle :: (MonadIO m, DOMStyleSheetK o) => o -> m T.Text
getDOMStyleSheetTitle obj = liftIO $ getObjectPropertyString obj "title"

data DOMStyleSheetTitlePropertyInfo
instance AttrInfo DOMStyleSheetTitlePropertyInfo where
    type AttrAllowedOps DOMStyleSheetTitlePropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMStyleSheetTitlePropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMStyleSheetTitlePropertyInfo = DOMStyleSheetK
    type AttrGetType DOMStyleSheetTitlePropertyInfo = T.Text
    type AttrLabel DOMStyleSheetTitlePropertyInfo = "DOMStyleSheet::title"
    attrGet _ = getDOMStyleSheetTitle
    attrSet _ = undefined
    attrConstruct _ = undefined

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

getDOMStyleSheetType :: (MonadIO m, DOMStyleSheetK o) => o -> m T.Text
getDOMStyleSheetType obj = liftIO $ getObjectPropertyString obj "type"

data DOMStyleSheetTypePropertyInfo
instance AttrInfo DOMStyleSheetTypePropertyInfo where
    type AttrAllowedOps DOMStyleSheetTypePropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMStyleSheetTypePropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMStyleSheetTypePropertyInfo = DOMStyleSheetK
    type AttrGetType DOMStyleSheetTypePropertyInfo = T.Text
    type AttrLabel DOMStyleSheetTypePropertyInfo = "DOMStyleSheet::type"
    attrGet _ = getDOMStyleSheetType
    attrSet _ = undefined
    attrConstruct _ = undefined

type instance AttributeList DOMStyleSheet = DOMStyleSheetAttributeList
type DOMStyleSheetAttributeList = ('[ '("core-object", DOMObjectCoreObjectPropertyInfo), '("disabled", DOMStyleSheetDisabledPropertyInfo), '("href", DOMStyleSheetHrefPropertyInfo), '("media", DOMStyleSheetMediaPropertyInfo), '("owner-node", DOMStyleSheetOwnerNodePropertyInfo), '("parent-style-sheet", DOMStyleSheetParentStyleSheetPropertyInfo), '("title", DOMStyleSheetTitlePropertyInfo), '("type", DOMStyleSheetTypePropertyInfo)] :: [(Symbol, *)])

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

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


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

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


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

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

foreign import ccall "webkit_dom_style_sheet_get_media" webkit_dom_style_sheet_get_media :: 
    Ptr DOMStyleSheet ->                    -- _obj : TInterface "WebKit" "DOMStyleSheet"
    IO (Ptr DOMMediaList)


dOMStyleSheetGetMedia ::
    (MonadIO m, DOMStyleSheetK a) =>
    a ->                                    -- _obj
    m DOMMediaList
dOMStyleSheetGetMedia _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_dom_style_sheet_get_media _obj'
    checkUnexpectedReturnNULL "webkit_dom_style_sheet_get_media" result
    result' <- (wrapObject DOMMediaList) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "webkit_dom_style_sheet_get_owner_node" webkit_dom_style_sheet_get_owner_node :: 
    Ptr DOMStyleSheet ->                    -- _obj : TInterface "WebKit" "DOMStyleSheet"
    IO (Ptr DOMNode)


dOMStyleSheetGetOwnerNode ::
    (MonadIO m, DOMStyleSheetK a) =>
    a ->                                    -- _obj
    m DOMNode
dOMStyleSheetGetOwnerNode _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_dom_style_sheet_get_owner_node _obj'
    checkUnexpectedReturnNULL "webkit_dom_style_sheet_get_owner_node" result
    result' <- (newObject DOMNode) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "webkit_dom_style_sheet_get_parent_style_sheet" webkit_dom_style_sheet_get_parent_style_sheet :: 
    Ptr DOMStyleSheet ->                    -- _obj : TInterface "WebKit" "DOMStyleSheet"
    IO (Ptr DOMStyleSheet)


dOMStyleSheetGetParentStyleSheet ::
    (MonadIO m, DOMStyleSheetK a) =>
    a ->                                    -- _obj
    m DOMStyleSheet
dOMStyleSheetGetParentStyleSheet _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_dom_style_sheet_get_parent_style_sheet _obj'
    checkUnexpectedReturnNULL "webkit_dom_style_sheet_get_parent_style_sheet" result
    result' <- (wrapObject DOMStyleSheet) result
    touchManagedPtr _obj
    return result'

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


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

-- method DOMStyleSheet::set_disabled
-- method type : OrdinaryMethod
-- Args : [Arg {argName = "_obj", argType = TInterface "WebKit" "DOMStyleSheet", 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" "DOMStyleSheet", 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_style_sheet_set_disabled" webkit_dom_style_sheet_set_disabled :: 
    Ptr DOMStyleSheet ->                    -- _obj : TInterface "WebKit" "DOMStyleSheet"
    CInt ->                                 -- value : TBasicType TBoolean
    IO ()


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