{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Pango.Structs.AttrSize
(
AttrSize(..) ,
newZeroAttrSize ,
#if defined(ENABLE_OVERLOADING)
ResolveAttrSizeMethod ,
#endif
attrSizeNew ,
attrSizeNewAbsolute ,
#if defined(ENABLE_OVERLOADING)
attrSize_absolute ,
#endif
getAttrSizeAbsolute ,
setAttrSizeAbsolute ,
#if defined(ENABLE_OVERLOADING)
attrSize_attr ,
#endif
getAttrSizeAttr ,
#if defined(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.BasicTypes as B.Types
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GArray as B.GArray
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.GI.Base.Signals as B.Signals
import qualified Control.Monad.IO.Class as MIO
import qualified Data.Coerce as Coerce
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 GHC.Records as R
import {-# SOURCE #-} qualified GI.Pango.Structs.Attribute as Pango.Attribute
newtype AttrSize = AttrSize (SP.ManagedPtr AttrSize)
deriving (AttrSize -> AttrSize -> Bool
(AttrSize -> AttrSize -> Bool)
-> (AttrSize -> AttrSize -> Bool) -> Eq AttrSize
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AttrSize -> AttrSize -> Bool
$c/= :: AttrSize -> AttrSize -> Bool
== :: AttrSize -> AttrSize -> Bool
$c== :: AttrSize -> AttrSize -> Bool
Eq)
instance SP.ManagedPtrNewtype AttrSize where
toManagedPtr :: AttrSize -> ManagedPtr AttrSize
toManagedPtr (AttrSize ManagedPtr AttrSize
p) = ManagedPtr AttrSize
p
instance BoxedPtr AttrSize where
boxedPtrCopy :: AttrSize -> IO AttrSize
boxedPtrCopy = \AttrSize
p -> AttrSize -> (Ptr AttrSize -> IO AttrSize) -> IO AttrSize
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr AttrSize
p (Int -> Ptr AttrSize -> IO (Ptr AttrSize)
forall a. (HasCallStack, CallocPtr a) => Int -> Ptr a -> IO (Ptr a)
copyBytes Int
24 (Ptr AttrSize -> IO (Ptr AttrSize))
-> (Ptr AttrSize -> IO AttrSize) -> Ptr AttrSize -> IO AttrSize
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> (ManagedPtr AttrSize -> AttrSize) -> Ptr AttrSize -> IO AttrSize
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.wrapPtr ManagedPtr AttrSize -> AttrSize
AttrSize)
boxedPtrFree :: AttrSize -> IO ()
boxedPtrFree = \AttrSize
x -> AttrSize -> (Ptr AttrSize -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
SP.withManagedPtr AttrSize
x Ptr AttrSize -> IO ()
forall a. Ptr a -> IO ()
SP.freeMem
instance CallocPtr AttrSize where
boxedPtrCalloc :: IO (Ptr AttrSize)
boxedPtrCalloc = Int -> IO (Ptr AttrSize)
forall a. Int -> IO (Ptr a)
callocBytes Int
24
newZeroAttrSize :: MonadIO m => m AttrSize
newZeroAttrSize :: forall (m :: * -> *). MonadIO m => m AttrSize
newZeroAttrSize = IO AttrSize -> m AttrSize
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO AttrSize -> m AttrSize) -> IO AttrSize -> m AttrSize
forall a b. (a -> b) -> a -> b
$ IO (Ptr AttrSize)
forall a. CallocPtr a => IO (Ptr a)
boxedPtrCalloc IO (Ptr AttrSize) -> (Ptr AttrSize -> IO AttrSize) -> IO AttrSize
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr AttrSize -> AttrSize) -> Ptr AttrSize -> IO AttrSize
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr AttrSize -> AttrSize
AttrSize
instance tag ~ 'AttrSet => Constructible AttrSize tag where
new :: forall (m :: * -> *).
MonadIO m =>
(ManagedPtr AttrSize -> AttrSize)
-> [AttrOp AttrSize tag] -> m AttrSize
new ManagedPtr AttrSize -> AttrSize
_ [AttrOp AttrSize tag]
attrs = do
AttrSize
o <- m AttrSize
forall (m :: * -> *). MonadIO m => m AttrSize
newZeroAttrSize
AttrSize -> [AttrOp AttrSize 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set AttrSize
o [AttrOp AttrSize tag]
[AttrOp AttrSize 'AttrSet]
attrs
AttrSize -> m AttrSize
forall (m :: * -> *) a. Monad m => a -> m a
return AttrSize
o
getAttrSizeAttr :: MonadIO m => AttrSize -> m Pango.Attribute.Attribute
getAttrSizeAttr :: forall (m :: * -> *). MonadIO m => AttrSize -> m Attribute
getAttrSizeAttr AttrSize
s = IO Attribute -> m Attribute
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Attribute -> m Attribute) -> IO Attribute -> m Attribute
forall a b. (a -> b) -> a -> b
$ AttrSize -> (Ptr AttrSize -> IO Attribute) -> IO Attribute
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr AttrSize
s ((Ptr AttrSize -> IO Attribute) -> IO Attribute)
-> (Ptr AttrSize -> IO Attribute) -> IO Attribute
forall a b. (a -> b) -> a -> b
$ \Ptr AttrSize
ptr -> do
let val :: Ptr Attribute
val = Ptr AttrSize
ptr Ptr AttrSize -> Int -> Ptr Attribute
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0 :: (Ptr Pango.Attribute.Attribute)
Attribute
val' <- ((ManagedPtr Attribute -> Attribute)
-> Ptr Attribute -> IO Attribute
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Attribute -> Attribute
Pango.Attribute.Attribute) Ptr Attribute
val
Attribute -> IO Attribute
forall (m :: * -> *) a. Monad m => a -> m a
return Attribute
val'
#if defined(ENABLE_OVERLOADING)
data AttrSizeAttrFieldInfo
instance AttrInfo AttrSizeAttrFieldInfo where
type AttrBaseTypeConstraint AttrSizeAttrFieldInfo = (~) AttrSize
type AttrAllowedOps AttrSizeAttrFieldInfo = '[ 'AttrGet]
type AttrSetTypeConstraint AttrSizeAttrFieldInfo = (~) (Ptr Pango.Attribute.Attribute)
type AttrTransferTypeConstraint AttrSizeAttrFieldInfo = (~)(Ptr Pango.Attribute.Attribute)
type AttrTransferType AttrSizeAttrFieldInfo = (Ptr Pango.Attribute.Attribute)
type AttrGetType AttrSizeAttrFieldInfo = Pango.Attribute.Attribute
type AttrLabel AttrSizeAttrFieldInfo = "attr"
type AttrOrigin AttrSizeAttrFieldInfo = AttrSize
attrGet = getAttrSizeAttr
attrSet = undefined
attrConstruct = undefined
attrClear = undefined
attrTransfer = undefined
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Structs.AttrSize.attr"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.25/docs/GI-Pango-Structs-AttrSize.html#g:attr:attr"
})
attrSize_attr :: AttrLabelProxy "attr"
attrSize_attr = AttrLabelProxy
#endif
getAttrSizeSize :: MonadIO m => AttrSize -> m Int32
getAttrSizeSize :: forall (m :: * -> *). MonadIO m => AttrSize -> m Int32
getAttrSizeSize AttrSize
s = IO Int32 -> m Int32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
forall a b. (a -> b) -> a -> b
$ AttrSize -> (Ptr AttrSize -> IO Int32) -> IO Int32
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr AttrSize
s ((Ptr AttrSize -> IO Int32) -> IO Int32)
-> (Ptr AttrSize -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \Ptr AttrSize
ptr -> do
Int32
val <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek (Ptr AttrSize
ptr Ptr AttrSize -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16) :: IO Int32
Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
val
setAttrSizeSize :: MonadIO m => AttrSize -> Int32 -> m ()
setAttrSizeSize :: forall (m :: * -> *). MonadIO m => AttrSize -> Int32 -> m ()
setAttrSizeSize AttrSize
s Int32
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ AttrSize -> (Ptr AttrSize -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr AttrSize
s ((Ptr AttrSize -> IO ()) -> IO ())
-> (Ptr AttrSize -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr AttrSize
ptr -> do
Ptr Int32 -> Int32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr AttrSize
ptr Ptr AttrSize -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16) (Int32
val :: Int32)
#if defined(ENABLE_OVERLOADING)
data AttrSizeSizeFieldInfo
instance AttrInfo AttrSizeSizeFieldInfo where
type AttrBaseTypeConstraint AttrSizeSizeFieldInfo = (~) AttrSize
type AttrAllowedOps AttrSizeSizeFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint AttrSizeSizeFieldInfo = (~) Int32
type AttrTransferTypeConstraint AttrSizeSizeFieldInfo = (~)Int32
type AttrTransferType AttrSizeSizeFieldInfo = Int32
type AttrGetType AttrSizeSizeFieldInfo = Int32
type AttrLabel AttrSizeSizeFieldInfo = "size"
type AttrOrigin AttrSizeSizeFieldInfo = AttrSize
attrGet = getAttrSizeSize
attrSet = setAttrSizeSize
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Structs.AttrSize.size"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.25/docs/GI-Pango-Structs-AttrSize.html#g:attr:size"
})
attrSize_size :: AttrLabelProxy "size"
attrSize_size = AttrLabelProxy
#endif
getAttrSizeAbsolute :: MonadIO m => AttrSize -> m Word32
getAttrSizeAbsolute :: forall (m :: * -> *). MonadIO m => AttrSize -> m Word32
getAttrSizeAbsolute AttrSize
s = IO Word32 -> m Word32
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
forall a b. (a -> b) -> a -> b
$ AttrSize -> (Ptr AttrSize -> IO Word32) -> IO Word32
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr AttrSize
s ((Ptr AttrSize -> IO Word32) -> IO Word32)
-> (Ptr AttrSize -> IO Word32) -> IO Word32
forall a b. (a -> b) -> a -> b
$ \Ptr AttrSize
ptr -> do
Word32
val <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek (Ptr AttrSize
ptr Ptr AttrSize -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20) :: IO Word32
Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
val
setAttrSizeAbsolute :: MonadIO m => AttrSize -> Word32 -> m ()
setAttrSizeAbsolute :: forall (m :: * -> *). MonadIO m => AttrSize -> Word32 -> m ()
setAttrSizeAbsolute AttrSize
s Word32
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ AttrSize -> (Ptr AttrSize -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr AttrSize
s ((Ptr AttrSize -> IO ()) -> IO ())
-> (Ptr AttrSize -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr AttrSize
ptr -> do
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr AttrSize
ptr Ptr AttrSize -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
20) (Word32
val :: Word32)
#if defined(ENABLE_OVERLOADING)
data AttrSizeAbsoluteFieldInfo
instance AttrInfo AttrSizeAbsoluteFieldInfo where
type AttrBaseTypeConstraint AttrSizeAbsoluteFieldInfo = (~) AttrSize
type AttrAllowedOps AttrSizeAbsoluteFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint AttrSizeAbsoluteFieldInfo = (~) Word32
type AttrTransferTypeConstraint AttrSizeAbsoluteFieldInfo = (~)Word32
type AttrTransferType AttrSizeAbsoluteFieldInfo = Word32
type AttrGetType AttrSizeAbsoluteFieldInfo = Word32
type AttrLabel AttrSizeAbsoluteFieldInfo = "absolute"
type AttrOrigin AttrSizeAbsoluteFieldInfo = AttrSize
attrGet = getAttrSizeAbsolute
attrSet = setAttrSizeAbsolute
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Pango.Structs.AttrSize.absolute"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-pango-1.0.25/docs/GI-Pango-Structs-AttrSize.html#g:attr:absolute"
})
attrSize_absolute :: AttrLabelProxy "absolute"
attrSize_absolute = AttrLabelProxy
#endif
#if defined(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 :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Int32 -> m Attribute
attrSizeNew Int32
size = IO Attribute -> m Attribute
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Attribute -> m Attribute) -> IO Attribute -> m Attribute
forall a b. (a -> b) -> a -> b
$ do
Ptr Attribute
result <- Int32 -> IO (Ptr Attribute)
pango_attr_size_new Int32
size
Text -> Ptr Attribute -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"attrSizeNew" Ptr Attribute
result
Attribute
result' <- ((ManagedPtr Attribute -> Attribute)
-> Ptr Attribute -> IO Attribute
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Attribute -> Attribute
Pango.Attribute.Attribute) Ptr Attribute
result
Attribute -> IO Attribute
forall (m :: * -> *) a. Monad m => a -> m a
return Attribute
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "pango_attr_size_new_absolute" pango_attr_size_new_absolute ::
Int32 ->
IO (Ptr Pango.Attribute.Attribute)
attrSizeNewAbsolute ::
(B.CallStack.HasCallStack, MonadIO m) =>
Int32
-> m Pango.Attribute.Attribute
attrSizeNewAbsolute :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Int32 -> m Attribute
attrSizeNewAbsolute Int32
size = IO Attribute -> m Attribute
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Attribute -> m Attribute) -> IO Attribute -> m Attribute
forall a b. (a -> b) -> a -> b
$ do
Ptr Attribute
result <- Int32 -> IO (Ptr Attribute)
pango_attr_size_new_absolute Int32
size
Text -> Ptr Attribute -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"attrSizeNewAbsolute" Ptr Attribute
result
Attribute
result' <- ((ManagedPtr Attribute -> Attribute)
-> Ptr Attribute -> IO Attribute
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Attribute -> Attribute
Pango.Attribute.Attribute) Ptr Attribute
result
Attribute -> IO Attribute
forall (m :: * -> *) a. Monad m => a -> m a
return Attribute
result'
#if defined(ENABLE_OVERLOADING)
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveAttrSizeMethod (t :: Symbol) (o :: *) :: * where
ResolveAttrSizeMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveAttrSizeMethod t AttrSize, O.OverloadedMethod info AttrSize p) => OL.IsLabel t (AttrSize -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveAttrSizeMethod t AttrSize, O.OverloadedMethod info AttrSize p, R.HasField t AttrSize p) => R.HasField t AttrSize p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveAttrSizeMethod t AttrSize, O.OverloadedMethodInfo info AttrSize) => OL.IsLabel t (O.MethodProxy info AttrSize) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif