#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Pango.Structs.AttrClass
(
AttrClass(..) ,
newZeroAttrClass ,
noAttrClass ,
#if ENABLE_OVERLOADING
attrClass_destroy ,
#endif
clearAttrClassDestroy ,
getAttrClassDestroy ,
setAttrClassDestroy ,
#if ENABLE_OVERLOADING
attrClass_equal ,
#endif
clearAttrClassEqual ,
getAttrClassEqual ,
setAttrClassEqual ,
#if ENABLE_OVERLOADING
attrClass_type ,
#endif
getAttrClassType ,
setAttrClassType ,
) 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 qualified GI.Pango.Callbacks as Pango.Callbacks
import {-# SOURCE #-} qualified GI.Pango.Enums as Pango.Enums
newtype AttrClass = AttrClass (ManagedPtr AttrClass)
instance WrappedPtr AttrClass where
wrappedPtrCalloc = callocBytes 32
wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 32 >=> wrapPtr AttrClass)
wrappedPtrFree = Just ptr_to_g_free
newZeroAttrClass :: MonadIO m => m AttrClass
newZeroAttrClass = liftIO $ wrappedPtrCalloc >>= wrapPtr AttrClass
instance tag ~ 'AttrSet => Constructible AttrClass tag where
new _ attrs = do
o <- newZeroAttrClass
GI.Attributes.set o attrs
return o
noAttrClass :: Maybe AttrClass
noAttrClass = Nothing
getAttrClassType :: MonadIO m => AttrClass -> m Pango.Enums.AttrType
getAttrClassType s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO CUInt
let val' = (toEnum . fromIntegral) val
return val'
setAttrClassType :: MonadIO m => AttrClass -> Pango.Enums.AttrType -> m ()
setAttrClassType s val = liftIO $ withManagedPtr s $ \ptr -> do
let val' = (fromIntegral . fromEnum) val
poke (ptr `plusPtr` 0) (val' :: CUInt)
#if ENABLE_OVERLOADING
data AttrClassTypeFieldInfo
instance AttrInfo AttrClassTypeFieldInfo where
type AttrAllowedOps AttrClassTypeFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint AttrClassTypeFieldInfo = (~) Pango.Enums.AttrType
type AttrBaseTypeConstraint AttrClassTypeFieldInfo = (~) AttrClass
type AttrGetType AttrClassTypeFieldInfo = Pango.Enums.AttrType
type AttrLabel AttrClassTypeFieldInfo = "type"
type AttrOrigin AttrClassTypeFieldInfo = AttrClass
attrGet _ = getAttrClassType
attrSet _ = setAttrClassType
attrConstruct = undefined
attrClear _ = undefined
attrClass_type :: AttrLabelProxy "type"
attrClass_type = AttrLabelProxy
#endif
getAttrClassDestroy :: MonadIO m => AttrClass -> m (Maybe Pango.Callbacks.AttrClassDestroyFieldCallback)
getAttrClassDestroy s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 16) :: IO (FunPtr Pango.Callbacks.C_AttrClassDestroyFieldCallback)
result <- SP.convertFunPtrIfNonNull val $ \val' -> do
let val'' = Pango.Callbacks.dynamic_AttrClassDestroyFieldCallback val'
return val''
return result
setAttrClassDestroy :: MonadIO m => AttrClass -> FunPtr Pango.Callbacks.C_AttrClassDestroyFieldCallback -> m ()
setAttrClassDestroy s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 16) (val :: FunPtr Pango.Callbacks.C_AttrClassDestroyFieldCallback)
clearAttrClassDestroy :: MonadIO m => AttrClass -> m ()
clearAttrClassDestroy s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 16) (FP.nullFunPtr :: FunPtr Pango.Callbacks.C_AttrClassDestroyFieldCallback)
#if ENABLE_OVERLOADING
data AttrClassDestroyFieldInfo
instance AttrInfo AttrClassDestroyFieldInfo where
type AttrAllowedOps AttrClassDestroyFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint AttrClassDestroyFieldInfo = (~) (FunPtr Pango.Callbacks.C_AttrClassDestroyFieldCallback)
type AttrBaseTypeConstraint AttrClassDestroyFieldInfo = (~) AttrClass
type AttrGetType AttrClassDestroyFieldInfo = Maybe Pango.Callbacks.AttrClassDestroyFieldCallback
type AttrLabel AttrClassDestroyFieldInfo = "destroy"
type AttrOrigin AttrClassDestroyFieldInfo = AttrClass
attrGet _ = getAttrClassDestroy
attrSet _ = setAttrClassDestroy
attrConstruct = undefined
attrClear _ = clearAttrClassDestroy
attrClass_destroy :: AttrLabelProxy "destroy"
attrClass_destroy = AttrLabelProxy
#endif
getAttrClassEqual :: MonadIO m => AttrClass -> m (Maybe Pango.Callbacks.AttrClassEqualFieldCallback)
getAttrClassEqual s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 24) :: IO (FunPtr Pango.Callbacks.C_AttrClassEqualFieldCallback)
result <- SP.convertFunPtrIfNonNull val $ \val' -> do
let val'' = Pango.Callbacks.dynamic_AttrClassEqualFieldCallback val'
return val''
return result
setAttrClassEqual :: MonadIO m => AttrClass -> FunPtr Pango.Callbacks.C_AttrClassEqualFieldCallback -> m ()
setAttrClassEqual s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 24) (val :: FunPtr Pango.Callbacks.C_AttrClassEqualFieldCallback)
clearAttrClassEqual :: MonadIO m => AttrClass -> m ()
clearAttrClassEqual s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 24) (FP.nullFunPtr :: FunPtr Pango.Callbacks.C_AttrClassEqualFieldCallback)
#if ENABLE_OVERLOADING
data AttrClassEqualFieldInfo
instance AttrInfo AttrClassEqualFieldInfo where
type AttrAllowedOps AttrClassEqualFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint AttrClassEqualFieldInfo = (~) (FunPtr Pango.Callbacks.C_AttrClassEqualFieldCallback)
type AttrBaseTypeConstraint AttrClassEqualFieldInfo = (~) AttrClass
type AttrGetType AttrClassEqualFieldInfo = Maybe Pango.Callbacks.AttrClassEqualFieldCallback
type AttrLabel AttrClassEqualFieldInfo = "equal"
type AttrOrigin AttrClassEqualFieldInfo = AttrClass
attrGet _ = getAttrClassEqual
attrSet _ = setAttrClassEqual
attrConstruct = undefined
attrClear _ = clearAttrClassEqual
attrClass_equal :: AttrLabelProxy "equal"
attrClass_equal = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList AttrClass
type instance O.AttributeList AttrClass = AttrClassAttributeList
type AttrClassAttributeList = ('[ '("type", AttrClassTypeFieldInfo), '("destroy", AttrClassDestroyFieldInfo), '("equal", AttrClassEqualFieldInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
type family ResolveAttrClassMethod (t :: Symbol) (o :: *) :: * where
ResolveAttrClassMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveAttrClassMethod t AttrClass, O.MethodInfo info AttrClass p) => OL.IsLabel t (AttrClass -> 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