#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gtk.Structs.RequestedSize
(
RequestedSize(..) ,
newZeroRequestedSize ,
noRequestedSize ,
clearRequestedSizeData ,
getRequestedSizeData ,
#if ENABLE_OVERLOADING
requestedSize_data ,
#endif
setRequestedSizeData ,
getRequestedSizeMinimumSize ,
#if ENABLE_OVERLOADING
requestedSize_minimumSize ,
#endif
setRequestedSizeMinimumSize ,
getRequestedSizeNaturalSize ,
#if 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.ManagedPtr as B.ManagedPtr
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.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
newtype RequestedSize = RequestedSize (ManagedPtr RequestedSize)
instance WrappedPtr RequestedSize where
wrappedPtrCalloc = callocBytes 16
wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 16 >=> wrapPtr RequestedSize)
wrappedPtrFree = Just ptr_to_g_free
newZeroRequestedSize :: MonadIO m => m RequestedSize
newZeroRequestedSize = liftIO $ wrappedPtrCalloc >>= wrapPtr RequestedSize
instance tag ~ 'AttrSet => Constructible RequestedSize tag where
new _ attrs = do
o <- newZeroRequestedSize
GI.Attributes.set o attrs
return o
noRequestedSize :: Maybe RequestedSize
noRequestedSize = Nothing
getRequestedSizeData :: MonadIO m => RequestedSize -> m (Ptr ())
getRequestedSizeData s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO (Ptr ())
return val
setRequestedSizeData :: MonadIO m => RequestedSize -> Ptr () -> m ()
setRequestedSizeData s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 0) (val :: Ptr ())
clearRequestedSizeData :: MonadIO m => RequestedSize -> m ()
clearRequestedSizeData s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 0) (FP.nullPtr :: Ptr ())
#if ENABLE_OVERLOADING
data RequestedSizeDataFieldInfo
instance AttrInfo RequestedSizeDataFieldInfo where
type AttrAllowedOps RequestedSizeDataFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint RequestedSizeDataFieldInfo = (~) (Ptr ())
type AttrBaseTypeConstraint RequestedSizeDataFieldInfo = (~) RequestedSize
type AttrGetType RequestedSizeDataFieldInfo = Ptr ()
type AttrLabel RequestedSizeDataFieldInfo = "data"
type AttrOrigin RequestedSizeDataFieldInfo = RequestedSize
attrGet _ = getRequestedSizeData
attrSet _ = setRequestedSizeData
attrConstruct = undefined
attrClear _ = clearRequestedSizeData
requestedSize_data :: AttrLabelProxy "data"
requestedSize_data = AttrLabelProxy
#endif
getRequestedSizeMinimumSize :: MonadIO m => RequestedSize -> m Int32
getRequestedSizeMinimumSize s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO Int32
return val
setRequestedSizeMinimumSize :: MonadIO m => RequestedSize -> Int32 -> m ()
setRequestedSizeMinimumSize s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 8) (val :: Int32)
#if ENABLE_OVERLOADING
data RequestedSizeMinimumSizeFieldInfo
instance AttrInfo RequestedSizeMinimumSizeFieldInfo where
type AttrAllowedOps RequestedSizeMinimumSizeFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint RequestedSizeMinimumSizeFieldInfo = (~) Int32
type AttrBaseTypeConstraint RequestedSizeMinimumSizeFieldInfo = (~) RequestedSize
type AttrGetType RequestedSizeMinimumSizeFieldInfo = Int32
type AttrLabel RequestedSizeMinimumSizeFieldInfo = "minimum_size"
type AttrOrigin RequestedSizeMinimumSizeFieldInfo = RequestedSize
attrGet _ = getRequestedSizeMinimumSize
attrSet _ = setRequestedSizeMinimumSize
attrConstruct = undefined
attrClear _ = undefined
requestedSize_minimumSize :: AttrLabelProxy "minimumSize"
requestedSize_minimumSize = AttrLabelProxy
#endif
getRequestedSizeNaturalSize :: MonadIO m => RequestedSize -> m Int32
getRequestedSizeNaturalSize s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 12) :: IO Int32
return val
setRequestedSizeNaturalSize :: MonadIO m => RequestedSize -> Int32 -> m ()
setRequestedSizeNaturalSize s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 12) (val :: Int32)
#if ENABLE_OVERLOADING
data RequestedSizeNaturalSizeFieldInfo
instance AttrInfo RequestedSizeNaturalSizeFieldInfo where
type AttrAllowedOps RequestedSizeNaturalSizeFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint RequestedSizeNaturalSizeFieldInfo = (~) Int32
type AttrBaseTypeConstraint RequestedSizeNaturalSizeFieldInfo = (~) RequestedSize
type AttrGetType RequestedSizeNaturalSizeFieldInfo = Int32
type AttrLabel RequestedSizeNaturalSizeFieldInfo = "natural_size"
type AttrOrigin RequestedSizeNaturalSizeFieldInfo = RequestedSize
attrGet _ = getRequestedSizeNaturalSize
attrSet _ = setRequestedSizeNaturalSize
attrConstruct = undefined
attrClear _ = undefined
requestedSize_naturalSize :: AttrLabelProxy "naturalSize"
requestedSize_naturalSize = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList RequestedSize
type instance O.AttributeList RequestedSize = RequestedSizeAttributeList
type RequestedSizeAttributeList = ('[ '("data", RequestedSizeDataFieldInfo), '("minimumSize", RequestedSizeMinimumSizeFieldInfo), '("naturalSize", RequestedSizeNaturalSizeFieldInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
type family ResolveRequestedSizeMethod (t :: Symbol) (o :: *) :: * where
ResolveRequestedSizeMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveRequestedSizeMethod t RequestedSize, O.MethodInfo info RequestedSize p) => O.IsLabelProxy t (RequestedSize -> p) where
fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#if MIN_VERSION_base(4,9,0)
instance (info ~ ResolveRequestedSizeMethod t RequestedSize, O.MethodInfo info RequestedSize p) => O.IsLabel t (RequestedSize -> 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
#endif