gi-poppler-0.18.17: GI/Poppler/Structs/ActionLayer.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)
Action to perform over a list of layers
-}
#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Poppler.Structs.ActionLayer
(
-- * Exported types
ActionLayer(..) ,
newZeroActionLayer ,
noActionLayer ,
-- * Properties
-- ** action #attr:action#
{- | a 'GI.Poppler.Enums.ActionLayerAction'
-}
#if ENABLE_OVERLOADING
actionLayer_action ,
#endif
getActionLayerAction ,
setActionLayerAction ,
-- ** layers #attr:layers#
{- | list of 'GI.Poppler.Objects.Layer.Layer'\<!-- -->s
-}
#if ENABLE_OVERLOADING
actionLayer_layers ,
#endif
clearActionLayerLayers ,
getActionLayerLayers ,
setActionLayerLayers ,
) 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.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
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 GHC.OverloadedLabels as OL
import {-# SOURCE #-} qualified GI.Poppler.Enums as Poppler.Enums
-- | Memory-managed wrapper type.
newtype ActionLayer = ActionLayer (ManagedPtr ActionLayer)
instance WrappedPtr ActionLayer where
wrappedPtrCalloc = callocBytes 16
wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 16 >=> wrapPtr ActionLayer)
wrappedPtrFree = Just ptr_to_g_free
-- | Construct a `ActionLayer` struct initialized to zero.
newZeroActionLayer :: MonadIO m => m ActionLayer
newZeroActionLayer = liftIO $ wrappedPtrCalloc >>= wrapPtr ActionLayer
instance tag ~ 'AttrSet => Constructible ActionLayer tag where
new _ attrs = do
o <- newZeroActionLayer
GI.Attributes.set o attrs
return o
-- | A convenience alias for `Nothing` :: `Maybe` `ActionLayer`.
noActionLayer :: Maybe ActionLayer
noActionLayer = Nothing
{- |
Get the value of the “@action@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' actionLayer #action
@
-}
getActionLayerAction :: MonadIO m => ActionLayer -> m Poppler.Enums.ActionLayerAction
getActionLayerAction s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO CUInt
let val' = (toEnum . fromIntegral) val
return val'
{- |
Set the value of the “@action@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.set' actionLayer [ #action 'Data.GI.Base.Attributes.:=' value ]
@
-}
setActionLayerAction :: MonadIO m => ActionLayer -> Poppler.Enums.ActionLayerAction -> m ()
setActionLayerAction s val = liftIO $ withManagedPtr s $ \ptr -> do
let val' = (fromIntegral . fromEnum) val
poke (ptr `plusPtr` 0) (val' :: CUInt)
#if ENABLE_OVERLOADING
data ActionLayerActionFieldInfo
instance AttrInfo ActionLayerActionFieldInfo where
type AttrAllowedOps ActionLayerActionFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint ActionLayerActionFieldInfo = (~) Poppler.Enums.ActionLayerAction
type AttrBaseTypeConstraint ActionLayerActionFieldInfo = (~) ActionLayer
type AttrGetType ActionLayerActionFieldInfo = Poppler.Enums.ActionLayerAction
type AttrLabel ActionLayerActionFieldInfo = "action"
type AttrOrigin ActionLayerActionFieldInfo = ActionLayer
attrGet _ = getActionLayerAction
attrSet _ = setActionLayerAction
attrConstruct = undefined
attrClear _ = undefined
actionLayer_action :: AttrLabelProxy "action"
actionLayer_action = AttrLabelProxy
#endif
{- |
Get the value of the “@layers@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.get' actionLayer #layers
@
-}
getActionLayerLayers :: MonadIO m => ActionLayer -> m ([Ptr ()])
getActionLayerLayers s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO (Ptr (GList (Ptr ())))
val' <- unpackGList val
return val'
{- |
Set the value of the “@layers@” field.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.set' actionLayer [ #layers 'Data.GI.Base.Attributes.:=' value ]
@
-}
setActionLayerLayers :: MonadIO m => ActionLayer -> Ptr (GList (Ptr ())) -> m ()
setActionLayerLayers s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 8) (val :: Ptr (GList (Ptr ())))
{- |
Set the value of the “@layers@” field to `Nothing`.
When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
@
'Data.GI.Base.Attributes.clear' #layers
@
-}
clearActionLayerLayers :: MonadIO m => ActionLayer -> m ()
clearActionLayerLayers s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 8) (FP.nullPtr :: Ptr (GList (Ptr ())))
#if ENABLE_OVERLOADING
data ActionLayerLayersFieldInfo
instance AttrInfo ActionLayerLayersFieldInfo where
type AttrAllowedOps ActionLayerLayersFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint ActionLayerLayersFieldInfo = (~) (Ptr (GList (Ptr ())))
type AttrBaseTypeConstraint ActionLayerLayersFieldInfo = (~) ActionLayer
type AttrGetType ActionLayerLayersFieldInfo = [Ptr ()]
type AttrLabel ActionLayerLayersFieldInfo = "layers"
type AttrOrigin ActionLayerLayersFieldInfo = ActionLayer
attrGet _ = getActionLayerLayers
attrSet _ = setActionLayerLayers
attrConstruct = undefined
attrClear _ = clearActionLayerLayers
actionLayer_layers :: AttrLabelProxy "layers"
actionLayer_layers = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList ActionLayer
type instance O.AttributeList ActionLayer = ActionLayerAttributeList
type ActionLayerAttributeList = ('[ '("action", ActionLayerActionFieldInfo), '("layers", ActionLayerLayersFieldInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
type family ResolveActionLayerMethod (t :: Symbol) (o :: *) :: * where
ResolveActionLayerMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveActionLayerMethod t ActionLayer, O.MethodInfo info ActionLayer p) => OL.IsLabel t (ActionLayer -> 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