{- |
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.Structs.NavigationAction
    ( 

-- * Exported types
    NavigationAction(..)                    ,
    noNavigationAction                      ,


 -- * Methods
-- ** navigationActionCopy
    navigationActionCopy                    ,


-- ** navigationActionFree
    navigationActionFree                    ,


-- ** navigationActionGetModifiers
    navigationActionGetModifiers            ,


-- ** navigationActionGetMouseButton
    navigationActionGetMouseButton          ,


-- ** navigationActionGetNavigationType
    navigationActionGetNavigationType       ,


-- ** navigationActionGetRequest
    navigationActionGetRequest              ,


-- ** navigationActionIsUserGesture
    navigationActionIsUserGesture           ,




    ) 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

newtype NavigationAction = NavigationAction (ForeignPtr NavigationAction)
foreign import ccall "webkit_navigation_action_get_type" c_webkit_navigation_action_get_type :: 
    IO GType

instance BoxedObject NavigationAction where
    boxedType _ = c_webkit_navigation_action_get_type

noNavigationAction :: Maybe NavigationAction
noNavigationAction = Nothing

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

foreign import ccall "webkit_navigation_action_copy" webkit_navigation_action_copy :: 
    Ptr NavigationAction ->                 -- _obj : TInterface "WebKit2" "NavigationAction"
    IO (Ptr NavigationAction)


navigationActionCopy ::
    (MonadIO m) =>
    NavigationAction ->                     -- _obj
    m NavigationAction
navigationActionCopy _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- webkit_navigation_action_copy _obj'
    checkUnexpectedReturnNULL "webkit_navigation_action_copy" result
    result' <- (wrapBoxed NavigationAction) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "webkit_navigation_action_free" webkit_navigation_action_free :: 
    Ptr NavigationAction ->                 -- _obj : TInterface "WebKit2" "NavigationAction"
    IO ()


navigationActionFree ::
    (MonadIO m) =>
    NavigationAction ->                     -- _obj
    m ()
navigationActionFree _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    webkit_navigation_action_free _obj'
    touchManagedPtr _obj
    return ()

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

foreign import ccall "webkit_navigation_action_get_modifiers" webkit_navigation_action_get_modifiers :: 
    Ptr NavigationAction ->                 -- _obj : TInterface "WebKit2" "NavigationAction"
    IO Word32


navigationActionGetModifiers ::
    (MonadIO m) =>
    NavigationAction ->                     -- _obj
    m Word32
navigationActionGetModifiers _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- webkit_navigation_action_get_modifiers _obj'
    touchManagedPtr _obj
    return result

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

foreign import ccall "webkit_navigation_action_get_mouse_button" webkit_navigation_action_get_mouse_button :: 
    Ptr NavigationAction ->                 -- _obj : TInterface "WebKit2" "NavigationAction"
    IO Word32


navigationActionGetMouseButton ::
    (MonadIO m) =>
    NavigationAction ->                     -- _obj
    m Word32
navigationActionGetMouseButton _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- webkit_navigation_action_get_mouse_button _obj'
    touchManagedPtr _obj
    return result

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

foreign import ccall "webkit_navigation_action_get_navigation_type" webkit_navigation_action_get_navigation_type :: 
    Ptr NavigationAction ->                 -- _obj : TInterface "WebKit2" "NavigationAction"
    IO CUInt


navigationActionGetNavigationType ::
    (MonadIO m) =>
    NavigationAction ->                     -- _obj
    m NavigationType
navigationActionGetNavigationType _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- webkit_navigation_action_get_navigation_type _obj'
    let result' = (toEnum . fromIntegral) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "webkit_navigation_action_get_request" webkit_navigation_action_get_request :: 
    Ptr NavigationAction ->                 -- _obj : TInterface "WebKit2" "NavigationAction"
    IO (Ptr URIRequest)


navigationActionGetRequest ::
    (MonadIO m) =>
    NavigationAction ->                     -- _obj
    m URIRequest
navigationActionGetRequest _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- webkit_navigation_action_get_request _obj'
    checkUnexpectedReturnNULL "webkit_navigation_action_get_request" result
    result' <- (newObject URIRequest) result
    touchManagedPtr _obj
    return result'

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

foreign import ccall "webkit_navigation_action_is_user_gesture" webkit_navigation_action_is_user_gesture :: 
    Ptr NavigationAction ->                 -- _obj : TInterface "WebKit2" "NavigationAction"
    IO CInt


navigationActionIsUserGesture ::
    (MonadIO m) =>
    NavigationAction ->                     -- _obj
    m Bool
navigationActionIsUserGesture _obj = liftIO $ do
    let _obj' = unsafeManagedPtrGetPtr _obj
    result <- webkit_navigation_action_is_user_gesture _obj'
    let result' = (/= 0) result
    touchManagedPtr _obj
    return result'