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

-- * Exported types
    DOMHistory(..)                          ,
    IsDOMHistory                            ,
    toDOMHistory                            ,
    noDOMHistory                            ,


 -- * Methods
-- ** back #method:back#
    DOMHistoryBackMethodInfo                ,
    dOMHistoryBack                          ,


-- ** forward #method:forward#
    DOMHistoryForwardMethodInfo             ,
    dOMHistoryForward                       ,


-- ** getLength #method:getLength#
    DOMHistoryGetLengthMethodInfo           ,
    dOMHistoryGetLength                     ,


-- ** go #method:go#
    DOMHistoryGoMethodInfo                  ,
    dOMHistoryGo                            ,




 -- * Properties
-- ** length #attr:length#
    DOMHistoryLengthPropertyInfo            ,
    dOMHistoryLength                        ,
    getDOMHistoryLength                     ,




    ) 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.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
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 GI.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.WebKit.Objects.DOMObject as WebKit.DOMObject

newtype DOMHistory = DOMHistory (ManagedPtr DOMHistory)
foreign import ccall "webkit_dom_history_get_type"
    c_webkit_dom_history_get_type :: IO GType

instance GObject DOMHistory where
    gobjectType _ = c_webkit_dom_history_get_type
    

class GObject o => IsDOMHistory o
#if MIN_VERSION_base(4,9,0)
instance {-# OVERLAPPABLE #-} (GObject a, O.UnknownAncestorError DOMHistory a) =>
    IsDOMHistory a
#endif
instance IsDOMHistory DOMHistory
instance WebKit.DOMObject.IsDOMObject DOMHistory
instance GObject.Object.IsObject DOMHistory

toDOMHistory :: IsDOMHistory o => o -> IO DOMHistory
toDOMHistory = unsafeCastTo DOMHistory

noDOMHistory :: Maybe DOMHistory
noDOMHistory = Nothing

type family ResolveDOMHistoryMethod (t :: Symbol) (o :: *) :: * where
    ResolveDOMHistoryMethod "back" o = DOMHistoryBackMethodInfo
    ResolveDOMHistoryMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
    ResolveDOMHistoryMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
    ResolveDOMHistoryMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
    ResolveDOMHistoryMethod "forward" o = DOMHistoryForwardMethodInfo
    ResolveDOMHistoryMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
    ResolveDOMHistoryMethod "go" o = DOMHistoryGoMethodInfo
    ResolveDOMHistoryMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
    ResolveDOMHistoryMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
    ResolveDOMHistoryMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
    ResolveDOMHistoryMethod "ref" o = GObject.Object.ObjectRefMethodInfo
    ResolveDOMHistoryMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
    ResolveDOMHistoryMethod "replaceData" o = GObject.Object.ObjectReplaceDataMethodInfo
    ResolveDOMHistoryMethod "replaceQdata" o = GObject.Object.ObjectReplaceQdataMethodInfo
    ResolveDOMHistoryMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
    ResolveDOMHistoryMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
    ResolveDOMHistoryMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
    ResolveDOMHistoryMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
    ResolveDOMHistoryMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
    ResolveDOMHistoryMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
    ResolveDOMHistoryMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
    ResolveDOMHistoryMethod "getLength" o = DOMHistoryGetLengthMethodInfo
    ResolveDOMHistoryMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
    ResolveDOMHistoryMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
    ResolveDOMHistoryMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
    ResolveDOMHistoryMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
    ResolveDOMHistoryMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveDOMHistoryMethod t DOMHistory, O.MethodInfo info DOMHistory p) => O.IsLabelProxy t (DOMHistory -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveDOMHistoryMethod t DOMHistory, O.MethodInfo info DOMHistory p) => O.IsLabel t (DOMHistory -> p) where
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

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

getDOMHistoryLength :: (MonadIO m, IsDOMHistory o) => o -> m CULong
getDOMHistoryLength obj = liftIO $ getObjectPropertyULong obj "length"

data DOMHistoryLengthPropertyInfo
instance AttrInfo DOMHistoryLengthPropertyInfo where
    type AttrAllowedOps DOMHistoryLengthPropertyInfo = '[ 'AttrGet]
    type AttrSetTypeConstraint DOMHistoryLengthPropertyInfo = (~) ()
    type AttrBaseTypeConstraint DOMHistoryLengthPropertyInfo = IsDOMHistory
    type AttrGetType DOMHistoryLengthPropertyInfo = CULong
    type AttrLabel DOMHistoryLengthPropertyInfo = "length"
    type AttrOrigin DOMHistoryLengthPropertyInfo = DOMHistory
    attrGet _ = getDOMHistoryLength
    attrSet _ = undefined
    attrConstruct _ = undefined
    attrClear _ = undefined

instance O.HasAttributeList DOMHistory
type instance O.AttributeList DOMHistory = DOMHistoryAttributeList
type DOMHistoryAttributeList = ('[ '("coreObject", WebKit.DOMObject.DOMObjectCoreObjectPropertyInfo), '("length", DOMHistoryLengthPropertyInfo)] :: [(Symbol, *)])

dOMHistoryLength :: AttrLabelProxy "length"
dOMHistoryLength = AttrLabelProxy

type instance O.SignalList DOMHistory = DOMHistorySignalList
type DOMHistorySignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)])

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

foreign import ccall "webkit_dom_history_back" webkit_dom_history_back :: 
    Ptr DOMHistory ->                       -- self : TInterface (Name {namespace = "WebKit", name = "DOMHistory"})
    IO ()

{- |
/No description available in the introspection data./
-}
dOMHistoryBack ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMHistory a) =>
    a
    {- ^ /@self@/: A 'GI.WebKit.Objects.DOMHistory.DOMHistory' -}
    -> m ()
dOMHistoryBack self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    webkit_dom_history_back self'
    touchManagedPtr self
    return ()

data DOMHistoryBackMethodInfo
instance (signature ~ (m ()), MonadIO m, IsDOMHistory a) => O.MethodInfo DOMHistoryBackMethodInfo a signature where
    overloadedMethod _ = dOMHistoryBack

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

foreign import ccall "webkit_dom_history_forward" webkit_dom_history_forward :: 
    Ptr DOMHistory ->                       -- self : TInterface (Name {namespace = "WebKit", name = "DOMHistory"})
    IO ()

{- |
/No description available in the introspection data./
-}
dOMHistoryForward ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMHistory a) =>
    a
    {- ^ /@self@/: A 'GI.WebKit.Objects.DOMHistory.DOMHistory' -}
    -> m ()
dOMHistoryForward self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    webkit_dom_history_forward self'
    touchManagedPtr self
    return ()

data DOMHistoryForwardMethodInfo
instance (signature ~ (m ()), MonadIO m, IsDOMHistory a) => O.MethodInfo DOMHistoryForwardMethodInfo a signature where
    overloadedMethod _ = dOMHistoryForward

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

{- |
/No description available in the introspection data./
-}
dOMHistoryGetLength ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMHistory a) =>
    a
    {- ^ /@self@/: A 'GI.WebKit.Objects.DOMHistory.DOMHistory' -}
    -> m CULong
    {- ^ __Returns:__ A @/gulong/@ -}
dOMHistoryGetLength self = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    result <- webkit_dom_history_get_length self'
    touchManagedPtr self
    return result

data DOMHistoryGetLengthMethodInfo
instance (signature ~ (m CULong), MonadIO m, IsDOMHistory a) => O.MethodInfo DOMHistoryGetLengthMethodInfo a signature where
    overloadedMethod _ = dOMHistoryGetLength

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

foreign import ccall "webkit_dom_history_go" webkit_dom_history_go :: 
    Ptr DOMHistory ->                       -- self : TInterface (Name {namespace = "WebKit", name = "DOMHistory"})
    CLong ->                                -- distance : TBasicType TLong
    IO ()

{- |
/No description available in the introspection data./
-}
dOMHistoryGo ::
    (B.CallStack.HasCallStack, MonadIO m, IsDOMHistory a) =>
    a
    {- ^ /@self@/: A 'GI.WebKit.Objects.DOMHistory.DOMHistory' -}
    -> CLong
    {- ^ /@distance@/: A @/glong/@ -}
    -> m ()
dOMHistoryGo self distance = liftIO $ do
    self' <- unsafeManagedPtrCastPtr self
    webkit_dom_history_go self' distance
    touchManagedPtr self
    return ()

data DOMHistoryGoMethodInfo
instance (signature ~ (CLong -> m ()), MonadIO m, IsDOMHistory a) => O.MethodInfo DOMHistoryGoMethodInfo a signature where
    overloadedMethod _ = dOMHistoryGo