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

-- * Exported types
    ActionGotoRemote(..)                    ,
    newZeroActionGotoRemote                 ,
    noActionGotoRemote                      ,


 -- * Properties
-- ** dest #attr:dest#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    actionGotoRemote_dest                   ,
#endif
    clearActionGotoRemoteDest               ,
    getActionGotoRemoteDest                 ,
    setActionGotoRemoteDest                 ,


-- ** fileName #attr:fileName#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    actionGotoRemote_fileName               ,
#endif
    clearActionGotoRemoteFileName           ,
    getActionGotoRemoteFileName             ,
    setActionGotoRemoteFileName             ,


-- ** title #attr:title#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    actionGotoRemote_title                  ,
#endif
    clearActionGotoRemoteTitle              ,
    getActionGotoRemoteTitle                ,
    setActionGotoRemoteTitle                ,


-- ** type #attr:type#
#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
    actionGotoRemote_type                   ,
#endif
    getActionGotoRemoteType                 ,
    setActionGotoRemoteType                 ,




    ) 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 {-# SOURCE #-} qualified GI.Poppler.Enums as Poppler.Enums
import {-# SOURCE #-} qualified GI.Poppler.Structs.Dest as Poppler.Dest

newtype ActionGotoRemote = ActionGotoRemote (ManagedPtr ActionGotoRemote)
instance WrappedPtr ActionGotoRemote where
    wrappedPtrCalloc = callocBytes 32
    wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 32 >=> wrapPtr ActionGotoRemote)
    wrappedPtrFree = Just ptr_to_g_free

-- | Construct a `ActionGotoRemote` struct initialized to zero.
newZeroActionGotoRemote :: MonadIO m => m ActionGotoRemote
newZeroActionGotoRemote = liftIO $ wrappedPtrCalloc >>= wrapPtr ActionGotoRemote

instance tag ~ 'AttrSet => Constructible ActionGotoRemote tag where
    new _ attrs = do
        o <- newZeroActionGotoRemote
        GI.Attributes.set o attrs
        return o


noActionGotoRemote :: Maybe ActionGotoRemote
noActionGotoRemote = Nothing

getActionGotoRemoteType :: MonadIO m => ActionGotoRemote -> m Poppler.Enums.ActionType
getActionGotoRemoteType s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 0) :: IO CUInt
    let val' = (toEnum . fromIntegral) val
    return val'

setActionGotoRemoteType :: MonadIO m => ActionGotoRemote -> Poppler.Enums.ActionType -> m ()
setActionGotoRemoteType s val = liftIO $ withManagedPtr s $ \ptr -> do
    let val' = (fromIntegral . fromEnum) val
    poke (ptr `plusPtr` 0) (val' :: CUInt)

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ActionGotoRemoteTypeFieldInfo
instance AttrInfo ActionGotoRemoteTypeFieldInfo where
    type AttrAllowedOps ActionGotoRemoteTypeFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint ActionGotoRemoteTypeFieldInfo = (~) Poppler.Enums.ActionType
    type AttrBaseTypeConstraint ActionGotoRemoteTypeFieldInfo = (~) ActionGotoRemote
    type AttrGetType ActionGotoRemoteTypeFieldInfo = Poppler.Enums.ActionType
    type AttrLabel ActionGotoRemoteTypeFieldInfo = "type"
    type AttrOrigin ActionGotoRemoteTypeFieldInfo = ActionGotoRemote
    attrGet _ = getActionGotoRemoteType
    attrSet _ = setActionGotoRemoteType
    attrConstruct = undefined
    attrClear _ = undefined

actionGotoRemote_type :: AttrLabelProxy "type"
actionGotoRemote_type = AttrLabelProxy

#endif


getActionGotoRemoteTitle :: MonadIO m => ActionGotoRemote -> m (Maybe T.Text)
getActionGotoRemoteTitle s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 8) :: IO CString
    result <- SP.convertIfNonNull val $ \val' -> do
        val'' <- cstringToText val'
        return val''
    return result

setActionGotoRemoteTitle :: MonadIO m => ActionGotoRemote -> CString -> m ()
setActionGotoRemoteTitle s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 8) (val :: CString)

clearActionGotoRemoteTitle :: MonadIO m => ActionGotoRemote -> m ()
clearActionGotoRemoteTitle s = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 8) (FP.nullPtr :: CString)

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ActionGotoRemoteTitleFieldInfo
instance AttrInfo ActionGotoRemoteTitleFieldInfo where
    type AttrAllowedOps ActionGotoRemoteTitleFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint ActionGotoRemoteTitleFieldInfo = (~) CString
    type AttrBaseTypeConstraint ActionGotoRemoteTitleFieldInfo = (~) ActionGotoRemote
    type AttrGetType ActionGotoRemoteTitleFieldInfo = Maybe T.Text
    type AttrLabel ActionGotoRemoteTitleFieldInfo = "title"
    type AttrOrigin ActionGotoRemoteTitleFieldInfo = ActionGotoRemote
    attrGet _ = getActionGotoRemoteTitle
    attrSet _ = setActionGotoRemoteTitle
    attrConstruct = undefined
    attrClear _ = clearActionGotoRemoteTitle

actionGotoRemote_title :: AttrLabelProxy "title"
actionGotoRemote_title = AttrLabelProxy

#endif


getActionGotoRemoteFileName :: MonadIO m => ActionGotoRemote -> m (Maybe T.Text)
getActionGotoRemoteFileName s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 16) :: IO CString
    result <- SP.convertIfNonNull val $ \val' -> do
        val'' <- cstringToText val'
        return val''
    return result

setActionGotoRemoteFileName :: MonadIO m => ActionGotoRemote -> CString -> m ()
setActionGotoRemoteFileName s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 16) (val :: CString)

clearActionGotoRemoteFileName :: MonadIO m => ActionGotoRemote -> m ()
clearActionGotoRemoteFileName s = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 16) (FP.nullPtr :: CString)

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ActionGotoRemoteFileNameFieldInfo
instance AttrInfo ActionGotoRemoteFileNameFieldInfo where
    type AttrAllowedOps ActionGotoRemoteFileNameFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint ActionGotoRemoteFileNameFieldInfo = (~) CString
    type AttrBaseTypeConstraint ActionGotoRemoteFileNameFieldInfo = (~) ActionGotoRemote
    type AttrGetType ActionGotoRemoteFileNameFieldInfo = Maybe T.Text
    type AttrLabel ActionGotoRemoteFileNameFieldInfo = "file_name"
    type AttrOrigin ActionGotoRemoteFileNameFieldInfo = ActionGotoRemote
    attrGet _ = getActionGotoRemoteFileName
    attrSet _ = setActionGotoRemoteFileName
    attrConstruct = undefined
    attrClear _ = clearActionGotoRemoteFileName

actionGotoRemote_fileName :: AttrLabelProxy "fileName"
actionGotoRemote_fileName = AttrLabelProxy

#endif


getActionGotoRemoteDest :: MonadIO m => ActionGotoRemote -> m (Maybe Poppler.Dest.Dest)
getActionGotoRemoteDest s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 24) :: IO (Ptr Poppler.Dest.Dest)
    result <- SP.convertIfNonNull val $ \val' -> do
        val'' <- (newBoxed Poppler.Dest.Dest) val'
        return val''
    return result

setActionGotoRemoteDest :: MonadIO m => ActionGotoRemote -> Ptr Poppler.Dest.Dest -> m ()
setActionGotoRemoteDest s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 24) (val :: Ptr Poppler.Dest.Dest)

clearActionGotoRemoteDest :: MonadIO m => ActionGotoRemote -> m ()
clearActionGotoRemoteDest s = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 24) (FP.nullPtr :: Ptr Poppler.Dest.Dest)

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
data ActionGotoRemoteDestFieldInfo
instance AttrInfo ActionGotoRemoteDestFieldInfo where
    type AttrAllowedOps ActionGotoRemoteDestFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint ActionGotoRemoteDestFieldInfo = (~) (Ptr Poppler.Dest.Dest)
    type AttrBaseTypeConstraint ActionGotoRemoteDestFieldInfo = (~) ActionGotoRemote
    type AttrGetType ActionGotoRemoteDestFieldInfo = Maybe Poppler.Dest.Dest
    type AttrLabel ActionGotoRemoteDestFieldInfo = "dest"
    type AttrOrigin ActionGotoRemoteDestFieldInfo = ActionGotoRemote
    attrGet _ = getActionGotoRemoteDest
    attrSet _ = setActionGotoRemoteDest
    attrConstruct = undefined
    attrClear _ = clearActionGotoRemoteDest

actionGotoRemote_dest :: AttrLabelProxy "dest"
actionGotoRemote_dest = AttrLabelProxy

#endif



#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
instance O.HasAttributeList ActionGotoRemote
type instance O.AttributeList ActionGotoRemote = ActionGotoRemoteAttributeList
type ActionGotoRemoteAttributeList = ('[ '("type", ActionGotoRemoteTypeFieldInfo), '("title", ActionGotoRemoteTitleFieldInfo), '("fileName", ActionGotoRemoteFileNameFieldInfo), '("dest", ActionGotoRemoteDestFieldInfo)] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING) && !defined(__HADDOCK_VERSION__)
type family ResolveActionGotoRemoteMethod (t :: Symbol) (o :: *) :: * where
    ResolveActionGotoRemoteMethod l o = O.MethodResolutionFailed l o

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

#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveActionGotoRemoteMethod t ActionGotoRemote, O.MethodInfo info ActionGotoRemote p) => O.IsLabel t (ActionGotoRemote -> 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

#endif