{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gtk.Structs.RequestedSize
(
RequestedSize(..) ,
newZeroRequestedSize ,
#if defined(ENABLE_OVERLOADING)
ResolveRequestedSizeMethod ,
#endif
clearRequestedSizeData ,
getRequestedSizeData ,
#if defined(ENABLE_OVERLOADING)
requestedSize_data ,
#endif
setRequestedSizeData ,
getRequestedSizeMinimumSize ,
#if defined(ENABLE_OVERLOADING)
requestedSize_minimumSize ,
#endif
setRequestedSizeMinimumSize ,
getRequestedSizeNaturalSize ,
#if defined(ENABLE_OVERLOADING)
requestedSize_naturalSize ,
#endif
setRequestedSizeNaturalSize ,
) 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.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
newtype RequestedSize = RequestedSize (SP.ManagedPtr RequestedSize)
deriving (RequestedSize -> RequestedSize -> Bool
(RequestedSize -> RequestedSize -> Bool)
-> (RequestedSize -> RequestedSize -> Bool) -> Eq RequestedSize
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RequestedSize -> RequestedSize -> Bool
$c/= :: RequestedSize -> RequestedSize -> Bool
== :: RequestedSize -> RequestedSize -> Bool
$c== :: RequestedSize -> RequestedSize -> Bool
Eq)
instance SP.ManagedPtrNewtype RequestedSize where
toManagedPtr :: RequestedSize -> ManagedPtr RequestedSize
toManagedPtr (RequestedSize ManagedPtr RequestedSize
p) = ManagedPtr RequestedSize
p
instance BoxedPtr RequestedSize where
boxedPtrCopy :: RequestedSize -> IO RequestedSize
boxedPtrCopy = \RequestedSize
p -> RequestedSize
-> (Ptr RequestedSize -> IO RequestedSize) -> IO RequestedSize
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr RequestedSize
p (Int -> Ptr RequestedSize -> IO (Ptr RequestedSize)
forall a. (HasCallStack, CallocPtr a) => Int -> Ptr a -> IO (Ptr a)
copyBytes Int
16 (Ptr RequestedSize -> IO (Ptr RequestedSize))
-> (Ptr RequestedSize -> IO RequestedSize)
-> Ptr RequestedSize
-> IO RequestedSize
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> (ManagedPtr RequestedSize -> RequestedSize)
-> Ptr RequestedSize -> IO RequestedSize
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.wrapPtr ManagedPtr RequestedSize -> RequestedSize
RequestedSize)
boxedPtrFree :: RequestedSize -> IO ()
boxedPtrFree = \RequestedSize
x -> RequestedSize -> (Ptr RequestedSize -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
SP.withManagedPtr RequestedSize
x Ptr RequestedSize -> IO ()
forall a. Ptr a -> IO ()
SP.freeMem
instance CallocPtr RequestedSize where
boxedPtrCalloc :: IO (Ptr RequestedSize)
boxedPtrCalloc = Int -> IO (Ptr RequestedSize)
forall a. Int -> IO (Ptr a)
callocBytes Int
16
newZeroRequestedSize :: MonadIO m => m RequestedSize
newZeroRequestedSize :: forall (m :: * -> *). MonadIO m => m RequestedSize
newZeroRequestedSize = IO RequestedSize -> m RequestedSize
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO RequestedSize -> m RequestedSize)
-> IO RequestedSize -> m RequestedSize
forall a b. (a -> b) -> a -> b
$ IO (Ptr RequestedSize)
forall a. CallocPtr a => IO (Ptr a)
boxedPtrCalloc IO (Ptr RequestedSize)
-> (Ptr RequestedSize -> IO RequestedSize) -> IO RequestedSize
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr RequestedSize -> RequestedSize)
-> Ptr RequestedSize -> IO RequestedSize
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr RequestedSize -> RequestedSize
RequestedSize
instance tag ~ 'AttrSet => Constructible RequestedSize tag where
new :: forall (m :: * -> *).
MonadIO m =>
(ManagedPtr RequestedSize -> RequestedSize)
-> [AttrOp RequestedSize tag] -> m RequestedSize
new ManagedPtr RequestedSize -> RequestedSize
_ [AttrOp RequestedSize tag]
attrs = do
RequestedSize
o <- m RequestedSize
forall (m :: * -> *). MonadIO m => m RequestedSize
newZeroRequestedSize
RequestedSize -> [AttrOp RequestedSize 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set RequestedSize
o [AttrOp RequestedSize tag]
[AttrOp RequestedSize 'AttrSet]
attrs
RequestedSize -> m RequestedSize
forall (m :: * -> *) a. Monad m => a -> m a
return RequestedSize
o
getRequestedSizeData :: MonadIO m => RequestedSize -> m (Ptr ())
getRequestedSizeData :: forall (m :: * -> *). MonadIO m => RequestedSize -> m (Ptr ())
getRequestedSizeData RequestedSize
s = IO (Ptr ()) -> m (Ptr ())
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Ptr ()) -> m (Ptr ())) -> IO (Ptr ()) -> m (Ptr ())
forall a b. (a -> b) -> a -> b
$ RequestedSize -> (Ptr RequestedSize -> IO (Ptr ())) -> IO (Ptr ())
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr RequestedSize
s ((Ptr RequestedSize -> IO (Ptr ())) -> IO (Ptr ()))
-> (Ptr RequestedSize -> IO (Ptr ())) -> IO (Ptr ())
forall a b. (a -> b) -> a -> b
$ \Ptr RequestedSize
ptr -> do
Ptr ()
val <- Ptr (Ptr ()) -> IO (Ptr ())
forall a. Storable a => Ptr a -> IO a
peek (Ptr RequestedSize
ptr Ptr RequestedSize -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) :: IO (Ptr ())
Ptr () -> IO (Ptr ())
forall (m :: * -> *) a. Monad m => a -> m a
return Ptr ()
val
setRequestedSizeData :: MonadIO m => RequestedSize -> Ptr () -> m ()
setRequestedSizeData :: forall (m :: * -> *). MonadIO m => RequestedSize -> Ptr () -> m ()
setRequestedSizeData RequestedSize
s Ptr ()
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ RequestedSize -> (Ptr RequestedSize -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr RequestedSize
s ((Ptr RequestedSize -> IO ()) -> IO ())
-> (Ptr RequestedSize -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr RequestedSize
ptr -> do
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr RequestedSize
ptr Ptr RequestedSize -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) (Ptr ()
val :: Ptr ())
clearRequestedSizeData :: MonadIO m => RequestedSize -> m ()
clearRequestedSizeData :: forall (m :: * -> *). MonadIO m => RequestedSize -> m ()
clearRequestedSizeData RequestedSize
s = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ RequestedSize -> (Ptr RequestedSize -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr RequestedSize
s ((Ptr RequestedSize -> IO ()) -> IO ())
-> (Ptr RequestedSize -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr RequestedSize
ptr -> do
Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr RequestedSize
ptr Ptr RequestedSize -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) (Ptr ()
forall a. Ptr a
FP.nullPtr :: Ptr ())
#if defined(ENABLE_OVERLOADING)
data RequestedSizeDataFieldInfo
instance AttrInfo RequestedSizeDataFieldInfo where
type AttrBaseTypeConstraint RequestedSizeDataFieldInfo = (~) RequestedSize
type AttrAllowedOps RequestedSizeDataFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint RequestedSizeDataFieldInfo = (~) (Ptr ())
type AttrTransferTypeConstraint RequestedSizeDataFieldInfo = (~)(Ptr ())
type AttrTransferType RequestedSizeDataFieldInfo = (Ptr ())
type AttrGetType RequestedSizeDataFieldInfo = Ptr ()
type AttrLabel RequestedSizeDataFieldInfo = "data"
type AttrOrigin RequestedSizeDataFieldInfo = RequestedSize
attrGet = getRequestedSizeData
attrSet = setRequestedSizeData
attrConstruct = undefined
attrClear = clearRequestedSizeData
attrTransfer _ v = do
return v
requestedSize_data :: AttrLabelProxy "data"
requestedSize_data = AttrLabelProxy
#endif
getRequestedSizeMinimumSize :: MonadIO m => RequestedSize -> m Int32
getRequestedSizeMinimumSize :: forall (m :: * -> *). MonadIO m => RequestedSize -> m Int32
getRequestedSizeMinimumSize RequestedSize
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
$ RequestedSize -> (Ptr RequestedSize -> IO Int32) -> IO Int32
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr RequestedSize
s ((Ptr RequestedSize -> IO Int32) -> IO Int32)
-> (Ptr RequestedSize -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \Ptr RequestedSize
ptr -> do
Int32
val <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek (Ptr RequestedSize
ptr Ptr RequestedSize -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) :: IO Int32
Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
val
setRequestedSizeMinimumSize :: MonadIO m => RequestedSize -> Int32 -> m ()
setRequestedSizeMinimumSize :: forall (m :: * -> *). MonadIO m => RequestedSize -> Int32 -> m ()
setRequestedSizeMinimumSize RequestedSize
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
$ RequestedSize -> (Ptr RequestedSize -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr RequestedSize
s ((Ptr RequestedSize -> IO ()) -> IO ())
-> (Ptr RequestedSize -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr RequestedSize
ptr -> do
Ptr Int32 -> Int32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr RequestedSize
ptr Ptr RequestedSize -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) (Int32
val :: Int32)
#if defined(ENABLE_OVERLOADING)
data RequestedSizeMinimumSizeFieldInfo
instance AttrInfo RequestedSizeMinimumSizeFieldInfo where
type AttrBaseTypeConstraint RequestedSizeMinimumSizeFieldInfo = (~) RequestedSize
type AttrAllowedOps RequestedSizeMinimumSizeFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint RequestedSizeMinimumSizeFieldInfo = (~) Int32
type AttrTransferTypeConstraint RequestedSizeMinimumSizeFieldInfo = (~)Int32
type AttrTransferType RequestedSizeMinimumSizeFieldInfo = Int32
type AttrGetType RequestedSizeMinimumSizeFieldInfo = Int32
type AttrLabel RequestedSizeMinimumSizeFieldInfo = "minimum_size"
type AttrOrigin RequestedSizeMinimumSizeFieldInfo = RequestedSize
attrGet = getRequestedSizeMinimumSize
attrSet = setRequestedSizeMinimumSize
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
requestedSize_minimumSize :: AttrLabelProxy "minimumSize"
requestedSize_minimumSize = AttrLabelProxy
#endif
getRequestedSizeNaturalSize :: MonadIO m => RequestedSize -> m Int32
getRequestedSizeNaturalSize :: forall (m :: * -> *). MonadIO m => RequestedSize -> m Int32
getRequestedSizeNaturalSize RequestedSize
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
$ RequestedSize -> (Ptr RequestedSize -> IO Int32) -> IO Int32
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr RequestedSize
s ((Ptr RequestedSize -> IO Int32) -> IO Int32)
-> (Ptr RequestedSize -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \Ptr RequestedSize
ptr -> do
Int32
val <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek (Ptr RequestedSize
ptr Ptr RequestedSize -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
12) :: IO Int32
Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
val
setRequestedSizeNaturalSize :: MonadIO m => RequestedSize -> Int32 -> m ()
setRequestedSizeNaturalSize :: forall (m :: * -> *). MonadIO m => RequestedSize -> Int32 -> m ()
setRequestedSizeNaturalSize RequestedSize
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
$ RequestedSize -> (Ptr RequestedSize -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr RequestedSize
s ((Ptr RequestedSize -> IO ()) -> IO ())
-> (Ptr RequestedSize -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr RequestedSize
ptr -> do
Ptr Int32 -> Int32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr RequestedSize
ptr Ptr RequestedSize -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
12) (Int32
val :: Int32)
#if defined(ENABLE_OVERLOADING)
data RequestedSizeNaturalSizeFieldInfo
instance AttrInfo RequestedSizeNaturalSizeFieldInfo where
type AttrBaseTypeConstraint RequestedSizeNaturalSizeFieldInfo = (~) RequestedSize
type AttrAllowedOps RequestedSizeNaturalSizeFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint RequestedSizeNaturalSizeFieldInfo = (~) Int32
type AttrTransferTypeConstraint RequestedSizeNaturalSizeFieldInfo = (~)Int32
type AttrTransferType RequestedSizeNaturalSizeFieldInfo = Int32
type AttrGetType RequestedSizeNaturalSizeFieldInfo = Int32
type AttrLabel RequestedSizeNaturalSizeFieldInfo = "natural_size"
type AttrOrigin RequestedSizeNaturalSizeFieldInfo = RequestedSize
attrGet = getRequestedSizeNaturalSize
attrSet = setRequestedSizeNaturalSize
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
requestedSize_naturalSize :: AttrLabelProxy "naturalSize"
requestedSize_naturalSize = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList RequestedSize
type instance O.AttributeList RequestedSize = RequestedSizeAttributeList
type RequestedSizeAttributeList = ('[ '("data", RequestedSizeDataFieldInfo), '("minimumSize", RequestedSizeMinimumSizeFieldInfo), '("naturalSize", RequestedSizeNaturalSizeFieldInfo)] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveRequestedSizeMethod (t :: Symbol) (o :: *) :: * where
ResolveRequestedSizeMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveRequestedSizeMethod t RequestedSize, O.OverloadedMethod info RequestedSize p) => OL.IsLabel t (RequestedSize -> 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 ~ ResolveRequestedSizeMethod t RequestedSize, O.OverloadedMethod info RequestedSize p, R.HasField t RequestedSize p) => R.HasField t RequestedSize p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveRequestedSizeMethod t RequestedSize, O.OverloadedMethodInfo info RequestedSize) => OL.IsLabel t (O.MethodProxy info RequestedSize) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif