gi-poppler-0.0.34.13: GI/Poppler/Structs/ActionLaunch.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.ActionLaunch
(
-- * Exported types
ActionLaunch(..) ,
newZeroActionLaunch ,
noActionLaunch ,
-- * Properties
-- ** FileName
actionLaunchReadFileName ,
-- ** Params
actionLaunchReadParams ,
-- ** Title
actionLaunchReadTitle ,
-- ** Type
actionLaunchReadType ,
) 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 ActionLaunch = ActionLaunch (ForeignPtr ActionLaunch)
-- | Construct a `ActionLaunch` struct initialized to zero.
newZeroActionLaunch :: MonadIO m => m ActionLaunch
newZeroActionLaunch = liftIO $ callocBytes 32 >>= wrapPtr ActionLaunch
noActionLaunch :: Maybe ActionLaunch
noActionLaunch = Nothing
actionLaunchReadType :: ActionLaunch -> IO ActionType
actionLaunchReadType s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO CUInt
let val' = (toEnum . fromIntegral) val
return val'
actionLaunchReadTitle :: ActionLaunch -> IO T.Text
actionLaunchReadTitle s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO CString
val' <- cstringToText val
return val'
actionLaunchReadFileName :: ActionLaunch -> IO T.Text
actionLaunchReadFileName s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 16) :: IO CString
val' <- cstringToText val
return val'
actionLaunchReadParams :: ActionLaunch -> IO T.Text
actionLaunchReadParams s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 24) :: IO CString
val' <- cstringToText val
return val'
type family ResolveActionLaunchMethod (t :: Symbol) (o :: *) :: * where
ResolveActionLaunchMethod l o = MethodResolutionFailed l o
instance (info ~ ResolveActionLaunchMethod t ActionLaunch, MethodInfo info ActionLaunch p) => IsLabelProxy t (ActionLaunch -> p) where
fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveActionLaunchMethod t ActionLaunch, MethodInfo info ActionLaunch p) => IsLabel t (ActionLaunch -> p) where
fromLabel _ = overloadedMethod (MethodProxy :: MethodProxy info)
#endif