gi-pango-0.1.38.13: GI/Pango/Structs/AttrSize.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)
The #PangoAttrSize structure is used to represent attributes which
set font size.
-}
module GI.Pango.Structs.AttrSize
(
-- * Exported types
AttrSize(..) ,
newZeroAttrSize ,
noAttrSize ,
-- * Properties
-- ** Absolute
attrSizeReadAbsolute ,
-- ** Attr
attrSizeReadAttr ,
-- ** Size
attrSizeReadSize ,
) 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.Pango.Types
import GI.Pango.Callbacks
newtype AttrSize = AttrSize (ForeignPtr AttrSize)
-- | Construct a `AttrSize` struct initialized to zero.
newZeroAttrSize :: MonadIO m => m AttrSize
newZeroAttrSize = liftIO $ callocBytes 24 >>= wrapPtr AttrSize
noAttrSize :: Maybe AttrSize
noAttrSize = Nothing
attrSizeReadAttr :: AttrSize -> IO Attribute
attrSizeReadAttr s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO (Ptr Attribute)
val' <- (newPtr 16 Attribute) val
return val'
attrSizeReadSize :: AttrSize -> IO Int32
attrSizeReadSize s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 16) :: IO Int32
return val
attrSizeReadAbsolute :: AttrSize -> IO Word32
attrSizeReadAbsolute s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 20) :: IO Word32
return val
type family ResolveAttrSizeMethod (t :: Symbol) (o :: *) :: * where
ResolveAttrSizeMethod l o = MethodResolutionFailed l o
instance (info ~ ResolveAttrSizeMethod t AttrSize, MethodInfo info AttrSize p) => IsLabelProxy t (AttrSize -> p) where
fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveAttrSizeMethod t AttrSize, MethodInfo info AttrSize p) => IsLabel t (AttrSize -> p) where
fromLabel _ = overloadedMethod (MethodProxy :: MethodProxy info)
#endif