packages feed

gi-poppler-0.0.34.13: GI/Poppler/Structs/ActionGotoDest.hs


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

-- * Exported types
    ActionGotoDest(..)                      ,
    newZeroActionGotoDest                   ,
    noActionGotoDest                        ,


 -- * Properties
-- ** Dest
    actionGotoDestReadDest                  ,


-- ** Title
    actionGotoDestReadTitle                 ,


-- ** Type
    actionGotoDestReadType                  ,




    ) 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.Poppler.Types
import GI.Poppler.Callbacks

newtype ActionGotoDest = ActionGotoDest (ForeignPtr ActionGotoDest)
-- | Construct a `ActionGotoDest` struct initialized to zero.
newZeroActionGotoDest :: MonadIO m => m ActionGotoDest
newZeroActionGotoDest = liftIO $ callocBytes 24 >>= wrapPtr ActionGotoDest

noActionGotoDest :: Maybe ActionGotoDest
noActionGotoDest = Nothing

actionGotoDestReadType :: ActionGotoDest -> IO ActionType
actionGotoDestReadType s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 0) :: IO CUInt
    let val' = (toEnum . fromIntegral) val
    return val'

actionGotoDestReadTitle :: ActionGotoDest -> IO T.Text
actionGotoDestReadTitle s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 8) :: IO CString
    val' <- cstringToText val
    return val'

actionGotoDestReadDest :: ActionGotoDest -> IO Dest
actionGotoDestReadDest s = withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 16) :: IO (Ptr Dest)
    val' <- (newBoxed Dest) val
    return val'

type family ResolveActionGotoDestMethod (t :: Symbol) (o :: *) :: * where
    ResolveActionGotoDestMethod l o = MethodResolutionFailed l o

instance (info ~ ResolveActionGotoDestMethod t ActionGotoDest, MethodInfo info ActionGotoDest p) => IsLabelProxy t (ActionGotoDest -> p) where
    fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info)

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