gi-pango-0.1.38.13: GI/Pango/Structs/AttrColor.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 #PangoAttrColor structure is used to represent attributes that
are colors.
-}
module GI.Pango.Structs.AttrColor
(
-- * Exported types
AttrColor(..) ,
newZeroAttrColor ,
noAttrColor ,
-- * Properties
-- ** Attr
attrColorReadAttr ,
-- ** Color
attrColorReadColor ,
) 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 AttrColor = AttrColor (ForeignPtr AttrColor)
-- | Construct a `AttrColor` struct initialized to zero.
newZeroAttrColor :: MonadIO m => m AttrColor
newZeroAttrColor = liftIO $ callocBytes 24 >>= wrapPtr AttrColor
noAttrColor :: Maybe AttrColor
noAttrColor = Nothing
attrColorReadAttr :: AttrColor -> IO Attribute
attrColorReadAttr s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO (Ptr Attribute)
val' <- (newPtr 16 Attribute) val
return val'
attrColorReadColor :: AttrColor -> IO Color
attrColorReadColor s = withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 16) :: IO (Ptr Color)
val' <- (newBoxed Color) val
return val'
type family ResolveAttrColorMethod (t :: Symbol) (o :: *) :: * where
ResolveAttrColorMethod l o = MethodResolutionFailed l o
instance (info ~ ResolveAttrColorMethod t AttrColor, MethodInfo info AttrColor p) => IsLabelProxy t (AttrColor -> p) where
fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveAttrColorMethod t AttrColor, MethodInfo info AttrColor p) => IsLabel t (AttrColor -> p) where
fromLabel _ = overloadedMethod (MethodProxy :: MethodProxy info)
#endif