#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Pango.Structs.AttrSize
(
AttrSize(..) ,
newZeroAttrSize ,
noAttrSize ,
attrSizeNew ,
#if ENABLE_OVERLOADING
attrSize_absolute ,
#endif
getAttrSizeAbsolute ,
setAttrSizeAbsolute ,
#if ENABLE_OVERLOADING
attrSize_attr ,
#endif
getAttrSizeAttr ,
#if ENABLE_OVERLOADING
attrSize_size ,
#endif
getAttrSizeSize ,
setAttrSizeSize ,
) 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 {-# SOURCE #-} qualified GI.Pango.Structs.Attribute as Pango.Attribute
newtype AttrSize = AttrSize (ManagedPtr AttrSize)
instance WrappedPtr AttrSize where
wrappedPtrCalloc = callocBytes 24
wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 24 >=> wrapPtr AttrSize)
wrappedPtrFree = Just ptr_to_g_free
newZeroAttrSize :: MonadIO m => m AttrSize
newZeroAttrSize = liftIO $ wrappedPtrCalloc >>= wrapPtr AttrSize
instance tag ~ 'AttrSet => Constructible AttrSize tag where
new _ attrs = do
o <- newZeroAttrSize
GI.Attributes.set o attrs
return o
noAttrSize :: Maybe AttrSize
noAttrSize = Nothing
getAttrSizeAttr :: MonadIO m => AttrSize -> m Pango.Attribute.Attribute
getAttrSizeAttr s = liftIO $ withManagedPtr s $ \ptr -> do
let val = ptr `plusPtr` 0 :: (Ptr Pango.Attribute.Attribute)
val' <- (newPtr Pango.Attribute.Attribute) val
return val'
#if ENABLE_OVERLOADING
data AttrSizeAttrFieldInfo
instance AttrInfo AttrSizeAttrFieldInfo where
type AttrAllowedOps AttrSizeAttrFieldInfo = '[ 'AttrGet]
type AttrSetTypeConstraint AttrSizeAttrFieldInfo = (~) (Ptr Pango.Attribute.Attribute)
type AttrBaseTypeConstraint AttrSizeAttrFieldInfo = (~) AttrSize
type AttrGetType AttrSizeAttrFieldInfo = Pango.Attribute.Attribute
type AttrLabel AttrSizeAttrFieldInfo = "attr"
type AttrOrigin AttrSizeAttrFieldInfo = AttrSize
attrGet _ = getAttrSizeAttr
attrSet _ = undefined
attrConstruct = undefined
attrClear _ = undefined
attrSize_attr :: AttrLabelProxy "attr"
attrSize_attr = AttrLabelProxy
#endif
getAttrSizeSize :: MonadIO m => AttrSize -> m Int32
getAttrSizeSize s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 16) :: IO Int32
return val
setAttrSizeSize :: MonadIO m => AttrSize -> Int32 -> m ()
setAttrSizeSize s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 16) (val :: Int32)
#if ENABLE_OVERLOADING
data AttrSizeSizeFieldInfo
instance AttrInfo AttrSizeSizeFieldInfo where
type AttrAllowedOps AttrSizeSizeFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint AttrSizeSizeFieldInfo = (~) Int32
type AttrBaseTypeConstraint AttrSizeSizeFieldInfo = (~) AttrSize
type AttrGetType AttrSizeSizeFieldInfo = Int32
type AttrLabel AttrSizeSizeFieldInfo = "size"
type AttrOrigin AttrSizeSizeFieldInfo = AttrSize
attrGet _ = getAttrSizeSize
attrSet _ = setAttrSizeSize
attrConstruct = undefined
attrClear _ = undefined
attrSize_size :: AttrLabelProxy "size"
attrSize_size = AttrLabelProxy
#endif
getAttrSizeAbsolute :: MonadIO m => AttrSize -> m Word32
getAttrSizeAbsolute s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 20) :: IO Word32
return val
setAttrSizeAbsolute :: MonadIO m => AttrSize -> Word32 -> m ()
setAttrSizeAbsolute s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 20) (val :: Word32)
#if ENABLE_OVERLOADING
data AttrSizeAbsoluteFieldInfo
instance AttrInfo AttrSizeAbsoluteFieldInfo where
type AttrAllowedOps AttrSizeAbsoluteFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint AttrSizeAbsoluteFieldInfo = (~) Word32
type AttrBaseTypeConstraint AttrSizeAbsoluteFieldInfo = (~) AttrSize
type AttrGetType AttrSizeAbsoluteFieldInfo = Word32
type AttrLabel AttrSizeAbsoluteFieldInfo = "absolute"
type AttrOrigin AttrSizeAbsoluteFieldInfo = AttrSize
attrGet _ = getAttrSizeAbsolute
attrSet _ = setAttrSizeAbsolute
attrConstruct = undefined
attrClear _ = undefined
attrSize_absolute :: AttrLabelProxy "absolute"
attrSize_absolute = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList AttrSize
type instance O.AttributeList AttrSize = AttrSizeAttributeList
type AttrSizeAttributeList = ('[ '("attr", AttrSizeAttrFieldInfo), '("size", AttrSizeSizeFieldInfo), '("absolute", AttrSizeAbsoluteFieldInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "pango_attr_size_new" pango_attr_size_new ::
Int32 ->
IO (Ptr Pango.Attribute.Attribute)
attrSizeNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
Int32
-> m Pango.Attribute.Attribute
attrSizeNew size = liftIO $ do
result <- pango_attr_size_new size
checkUnexpectedReturnNULL "attrSizeNew" result
result' <- (wrapPtr Pango.Attribute.Attribute) result
return result'
#if ENABLE_OVERLOADING
#endif
#if ENABLE_OVERLOADING
type family ResolveAttrSizeMethod (t :: Symbol) (o :: *) :: * where
ResolveAttrSizeMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveAttrSizeMethod t AttrSize, O.MethodInfo info AttrSize p) => OL.IsLabel t (AttrSize -> 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