gi-pango-0.1.38.13: GI/Pango/Structs/AttrFontDesc.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 #PangoAttrFontDesc structure is used to store an attribute that
sets all aspects of the font description at once.
-}
module GI.Pango.Structs.AttrFontDesc
(
-- * Exported types
AttrFontDesc(..) ,
newZeroAttrFontDesc ,
noAttrFontDesc ,
-- * Properties
-- ** Attr
attrFontDescReadAttr ,
-- ** Desc
attrFontDescReadDesc ,
) 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 AttrFontDesc = AttrFontDesc (ForeignPtr AttrFontDesc)
-- | Construct a `AttrFontDesc` struct initialized to zero.
newZeroAttrFontDesc :: MonadIO m => m AttrFontDesc
newZeroAttrFontDesc = liftIO $ callocBytes 24 >>= wrapPtr AttrFontDesc
noAttrFontDesc :: Maybe AttrFontDesc
noAttrFontDesc = Nothing
attrFontDescReadAttr :: AttrFontDesc -> IO Attribute
attrFontDescReadAttr s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO (Ptr Attribute)
val' <- (newPtr 16 Attribute) val
return val'
attrFontDescReadDesc :: AttrFontDesc -> IO FontDescription
attrFontDescReadDesc s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 16) :: IO (Ptr FontDescription)
val' <- (newBoxed FontDescription) val
return val'
type family ResolveAttrFontDescMethod (t :: Symbol) (o :: *) :: * where
ResolveAttrFontDescMethod l o = MethodResolutionFailed l o
instance (info ~ ResolveAttrFontDescMethod t AttrFontDesc, MethodInfo info AttrFontDesc p) => IsLabelProxy t (AttrFontDesc -> p) where
fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveAttrFontDescMethod t AttrFontDesc, MethodInfo info AttrFontDesc p) => IsLabel t (AttrFontDesc -> p) where
fromLabel _ = overloadedMethod (MethodProxy :: MethodProxy info)
#endif