{- |
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.WebKit2.Objects.EditorState
    ( 

-- * Exported types
    EditorState(..)                         ,
    EditorStateK                            ,
    toEditorState                           ,
    noEditorState                           ,


 -- * Methods
-- ** editorStateGetTypingAttributes
    editorStateGetTypingAttributes          ,




 -- * Properties
-- ** TypingAttributes
    EditorStateTypingAttributesPropertyInfo ,
    getEditorStateTypingAttributes          ,




    ) 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.WebKit2.Types
import GI.WebKit2.Callbacks
import qualified GI.GObject as GObject

newtype EditorState = EditorState (ForeignPtr EditorState)
foreign import ccall "webkit_editor_state_get_type"
    c_webkit_editor_state_get_type :: IO GType

type instance ParentTypes EditorState = EditorStateParentTypes
type EditorStateParentTypes = '[GObject.Object]

instance GObject EditorState where
    gobjectIsInitiallyUnowned _ = False
    gobjectType _ = c_webkit_editor_state_get_type
    

class GObject o => EditorStateK o
instance (GObject o, IsDescendantOf EditorState o) => EditorStateK o

toEditorState :: EditorStateK o => o -> IO EditorState
toEditorState = unsafeCastTo EditorState

noEditorState :: Maybe EditorState
noEditorState = Nothing

-- VVV Prop "typing-attributes"
   -- Type: TBasicType TUInt32
   -- Flags: [PropertyReadable]

getEditorStateTypingAttributes :: (MonadIO m, EditorStateK o) => o -> m Word32
getEditorStateTypingAttributes obj = liftIO $ getObjectPropertyCUInt obj "typing-attributes"

data EditorStateTypingAttributesPropertyInfo
instance AttrInfo EditorStateTypingAttributesPropertyInfo where
    type AttrAllowedOps EditorStateTypingAttributesPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint EditorStateTypingAttributesPropertyInfo = (~) ()
    type AttrBaseTypeConstraint EditorStateTypingAttributesPropertyInfo = EditorStateK
    type AttrGetType EditorStateTypingAttributesPropertyInfo = Word32
    type AttrLabel EditorStateTypingAttributesPropertyInfo = "EditorState::typing-attributes"
    attrGet _ = getEditorStateTypingAttributes
    attrSet _ = undefined
    attrConstruct _ = undefined

type instance AttributeList EditorState = EditorStateAttributeList
type EditorStateAttributeList = ('[ '("typing-attributes", EditorStateTypingAttributesPropertyInfo)] :: [(Symbol, *)])

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

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

foreign import ccall "webkit_editor_state_get_typing_attributes" webkit_editor_state_get_typing_attributes :: 
    Ptr EditorState ->                      -- _obj : TInterface "WebKit2" "EditorState"
    IO Word32


editorStateGetTypingAttributes ::
    (MonadIO m, EditorStateK a) =>
    a ->                                    -- _obj
    m Word32
editorStateGetTypingAttributes _obj = liftIO $ do
    let _obj' = unsafeManagedPtrCastPtr _obj
    result <- webkit_editor_state_get_typing_attributes _obj'
    touchManagedPtr _obj
    return result