{- | 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 #PangoAttrClass structure stores the type and operations for a particular type of attribute. The functions in this structure should not be called directly. Instead, one should use the wrapper functions provided for #PangoAttribute. -} module GI.Pango.Structs.AttrClass ( -- * Exported types AttrClass(..) , newZeroAttrClass , noAttrClass , -- * Properties -- ** Type attrClassReadType , ) 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 AttrClass = AttrClass (ForeignPtr AttrClass) -- | Construct a `AttrClass` struct initialized to zero. newZeroAttrClass :: MonadIO m => m AttrClass newZeroAttrClass = liftIO $ callocBytes 32 >>= wrapPtr AttrClass noAttrClass :: Maybe AttrClass noAttrClass = Nothing attrClassReadType :: AttrClass -> IO AttrType attrClassReadType s = withManagedPtr s $ \ptr -> do val <- peek (ptr `plusPtr` 0) :: IO CUInt let val' = (toEnum . fromIntegral) val return val' -- XXX Skipped getter for "AttrClass:destroy" :: Not implemented: "Wrapping foreign callbacks is not supported yet" -- XXX Skipped getter for "AttrClass:equal" :: Not implemented: "Wrapping foreign callbacks is not supported yet" type family ResolveAttrClassMethod (t :: Symbol) (o :: *) :: * where ResolveAttrClassMethod l o = MethodResolutionFailed l o instance (info ~ ResolveAttrClassMethod t AttrClass, MethodInfo info AttrClass p) => IsLabelProxy t (AttrClass -> p) where fromLabelProxy _ = overloadedMethod (MethodProxy :: MethodProxy info) #if MIN_VERSION_base(4,9,0) instance (info ~ ResolveAttrClassMethod t AttrClass, MethodInfo info AttrClass p) => IsLabel t (AttrClass -> p) where fromLabel _ = overloadedMethod (MethodProxy :: MethodProxy info) #endif