{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gtk.Structs.Requisition
(
Requisition(..) ,
newZeroRequisition ,
noRequisition ,
#if defined(ENABLE_OVERLOADING)
ResolveRequisitionMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
RequisitionCopyMethodInfo ,
#endif
requisitionCopy ,
#if defined(ENABLE_OVERLOADING)
RequisitionFreeMethodInfo ,
#endif
requisitionFree ,
requisitionNew ,
getRequisitionHeight ,
#if defined(ENABLE_OVERLOADING)
requisition_height ,
#endif
setRequisitionHeight ,
getRequisitionWidth ,
#if defined(ENABLE_OVERLOADING)
requisition_width ,
#endif
setRequisitionWidth ,
) 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.GI.Base.Signals as B.Signals
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
newtype Requisition = Requisition (ManagedPtr Requisition)
deriving (Requisition -> Requisition -> Bool
(Requisition -> Requisition -> Bool)
-> (Requisition -> Requisition -> Bool) -> Eq Requisition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Requisition -> Requisition -> Bool
$c/= :: Requisition -> Requisition -> Bool
== :: Requisition -> Requisition -> Bool
$c== :: Requisition -> Requisition -> Bool
Eq)
foreign import ccall "gtk_requisition_get_type" c_gtk_requisition_get_type ::
IO GType
instance BoxedObject Requisition where
boxedType :: Requisition -> IO GType
boxedType _ = IO GType
c_gtk_requisition_get_type
instance B.GValue.IsGValue Requisition where
toGValue :: Requisition -> IO GValue
toGValue o :: Requisition
o = do
GType
gtype <- IO GType
c_gtk_requisition_get_type
Requisition -> (Ptr Requisition -> IO GValue) -> IO GValue
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Requisition
o (GType
-> (GValue -> Ptr Requisition -> IO ())
-> Ptr Requisition
-> IO GValue
forall a. GType -> (GValue -> a -> IO ()) -> a -> IO GValue
B.GValue.buildGValue GType
gtype GValue -> Ptr Requisition -> IO ()
forall a. GValue -> Ptr a -> IO ()
B.GValue.set_boxed)
fromGValue :: GValue -> IO Requisition
fromGValue gv :: GValue
gv = do
Ptr Requisition
ptr <- GValue -> IO (Ptr Requisition)
forall b. GValue -> IO (Ptr b)
B.GValue.get_boxed GValue
gv :: IO (Ptr Requisition)
(ManagedPtr Requisition -> Requisition)
-> Ptr Requisition -> IO Requisition
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr Requisition -> Requisition
Requisition Ptr Requisition
ptr
newZeroRequisition :: MonadIO m => m Requisition
newZeroRequisition :: m Requisition
newZeroRequisition = IO Requisition -> m Requisition
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Requisition -> m Requisition)
-> IO Requisition -> m Requisition
forall a b. (a -> b) -> a -> b
$ Int -> IO (Ptr Requisition)
forall a. BoxedObject a => Int -> IO (Ptr a)
callocBoxedBytes 8 IO (Ptr Requisition)
-> (Ptr Requisition -> IO Requisition) -> IO Requisition
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr Requisition -> Requisition)
-> Ptr Requisition -> IO Requisition
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Requisition -> Requisition
Requisition
instance tag ~ 'AttrSet => Constructible Requisition tag where
new :: (ManagedPtr Requisition -> Requisition)
-> [AttrOp Requisition tag] -> m Requisition
new _ attrs :: [AttrOp Requisition tag]
attrs = do
Requisition
o <- m Requisition
forall (m :: * -> *). MonadIO m => m Requisition
newZeroRequisition
Requisition -> [AttrOp Requisition 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set Requisition
o [AttrOp Requisition tag]
[AttrOp Requisition 'AttrSet]
attrs
Requisition -> m Requisition
forall (m :: * -> *) a. Monad m => a -> m a
return Requisition
o
noRequisition :: Maybe Requisition
noRequisition :: Maybe Requisition
noRequisition = Maybe Requisition
forall a. Maybe a
Nothing
getRequisitionWidth :: MonadIO m => Requisition -> m Int32
getRequisitionWidth :: Requisition -> m Int32
getRequisitionWidth s :: Requisition
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
$ Requisition -> (Ptr Requisition -> IO Int32) -> IO Int32
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Requisition
s ((Ptr Requisition -> IO Int32) -> IO Int32)
-> (Ptr Requisition -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr Requisition
ptr -> do
Int32
val <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek (Ptr Requisition
ptr Ptr Requisition -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0) :: IO Int32
Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
val
setRequisitionWidth :: MonadIO m => Requisition -> Int32 -> m ()
setRequisitionWidth :: Requisition -> Int32 -> m ()
setRequisitionWidth s :: Requisition
s val :: 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
$ Requisition -> (Ptr Requisition -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Requisition
s ((Ptr Requisition -> IO ()) -> IO ())
-> (Ptr Requisition -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr Requisition
ptr -> do
Ptr Int32 -> Int32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Requisition
ptr Ptr Requisition -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 0) (Int32
val :: Int32)
#if defined(ENABLE_OVERLOADING)
data RequisitionWidthFieldInfo
instance AttrInfo RequisitionWidthFieldInfo where
type AttrBaseTypeConstraint RequisitionWidthFieldInfo = (~) Requisition
type AttrAllowedOps RequisitionWidthFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint RequisitionWidthFieldInfo = (~) Int32
type AttrTransferTypeConstraint RequisitionWidthFieldInfo = (~)Int32
type AttrTransferType RequisitionWidthFieldInfo = Int32
type AttrGetType RequisitionWidthFieldInfo = Int32
type AttrLabel RequisitionWidthFieldInfo = "width"
type AttrOrigin RequisitionWidthFieldInfo = Requisition
attrGet = getRequisitionWidth
attrSet = setRequisitionWidth
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
requisition_width :: AttrLabelProxy "width"
requisition_width = AttrLabelProxy
#endif
getRequisitionHeight :: MonadIO m => Requisition -> m Int32
getRequisitionHeight :: Requisition -> m Int32
getRequisitionHeight s :: Requisition
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
$ Requisition -> (Ptr Requisition -> IO Int32) -> IO Int32
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Requisition
s ((Ptr Requisition -> IO Int32) -> IO Int32)
-> (Ptr Requisition -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr Requisition
ptr -> do
Int32
val <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek (Ptr Requisition
ptr Ptr Requisition -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4) :: IO Int32
Int32 -> IO Int32
forall (m :: * -> *) a. Monad m => a -> m a
return Int32
val
setRequisitionHeight :: MonadIO m => Requisition -> Int32 -> m ()
setRequisitionHeight :: Requisition -> Int32 -> m ()
setRequisitionHeight s :: Requisition
s val :: 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
$ Requisition -> (Ptr Requisition -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Requisition
s ((Ptr Requisition -> IO ()) -> IO ())
-> (Ptr Requisition -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \ptr :: Ptr Requisition
ptr -> do
Ptr Int32 -> Int32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Requisition
ptr Ptr Requisition -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` 4) (Int32
val :: Int32)
#if defined(ENABLE_OVERLOADING)
data RequisitionHeightFieldInfo
instance AttrInfo RequisitionHeightFieldInfo where
type AttrBaseTypeConstraint RequisitionHeightFieldInfo = (~) Requisition
type AttrAllowedOps RequisitionHeightFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint RequisitionHeightFieldInfo = (~) Int32
type AttrTransferTypeConstraint RequisitionHeightFieldInfo = (~)Int32
type AttrTransferType RequisitionHeightFieldInfo = Int32
type AttrGetType RequisitionHeightFieldInfo = Int32
type AttrLabel RequisitionHeightFieldInfo = "height"
type AttrOrigin RequisitionHeightFieldInfo = Requisition
attrGet = getRequisitionHeight
attrSet = setRequisitionHeight
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
requisition_height :: AttrLabelProxy "height"
requisition_height = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Requisition
type instance O.AttributeList Requisition = RequisitionAttributeList
type RequisitionAttributeList = ('[ '("width", RequisitionWidthFieldInfo), '("height", RequisitionHeightFieldInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "gtk_requisition_new" gtk_requisition_new ::
IO (Ptr Requisition)
requisitionNew ::
(B.CallStack.HasCallStack, MonadIO m) =>
m Requisition
requisitionNew :: m Requisition
requisitionNew = IO Requisition -> m Requisition
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Requisition -> m Requisition)
-> IO Requisition -> m Requisition
forall a b. (a -> b) -> a -> b
$ do
Ptr Requisition
result <- IO (Ptr Requisition)
gtk_requisition_new
Text -> Ptr Requisition -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "requisitionNew" Ptr Requisition
result
Requisition
result' <- ((ManagedPtr Requisition -> Requisition)
-> Ptr Requisition -> IO Requisition
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Requisition -> Requisition
Requisition) Ptr Requisition
result
Requisition -> IO Requisition
forall (m :: * -> *) a. Monad m => a -> m a
return Requisition
result'
#if defined(ENABLE_OVERLOADING)
#endif
foreign import ccall "gtk_requisition_copy" gtk_requisition_copy ::
Ptr Requisition ->
IO (Ptr Requisition)
requisitionCopy ::
(B.CallStack.HasCallStack, MonadIO m) =>
Requisition
-> m Requisition
requisitionCopy :: Requisition -> m Requisition
requisitionCopy requisition :: Requisition
requisition = IO Requisition -> m Requisition
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Requisition -> m Requisition)
-> IO Requisition -> m Requisition
forall a b. (a -> b) -> a -> b
$ do
Ptr Requisition
requisition' <- Requisition -> IO (Ptr Requisition)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Requisition
requisition
Ptr Requisition
result <- Ptr Requisition -> IO (Ptr Requisition)
gtk_requisition_copy Ptr Requisition
requisition'
Text -> Ptr Requisition -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL "requisitionCopy" Ptr Requisition
result
Requisition
result' <- ((ManagedPtr Requisition -> Requisition)
-> Ptr Requisition -> IO Requisition
forall a.
(HasCallStack, BoxedObject a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Requisition -> Requisition
Requisition) Ptr Requisition
result
Requisition -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Requisition
requisition
Requisition -> IO Requisition
forall (m :: * -> *) a. Monad m => a -> m a
return Requisition
result'
#if defined(ENABLE_OVERLOADING)
data RequisitionCopyMethodInfo
instance (signature ~ (m Requisition), MonadIO m) => O.MethodInfo RequisitionCopyMethodInfo Requisition signature where
overloadedMethod = requisitionCopy
#endif
foreign import ccall "gtk_requisition_free" gtk_requisition_free ::
Ptr Requisition ->
IO ()
requisitionFree ::
(B.CallStack.HasCallStack, MonadIO m) =>
Requisition
-> m ()
requisitionFree :: Requisition -> m ()
requisitionFree requisition :: Requisition
requisition = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ do
Ptr Requisition
requisition' <- Requisition -> IO (Ptr Requisition)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Requisition
requisition
Ptr Requisition -> IO ()
gtk_requisition_free Ptr Requisition
requisition'
Requisition -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Requisition
requisition
() -> IO ()
forall (m :: * -> *) a. Monad m => a -> m a
return ()
#if defined(ENABLE_OVERLOADING)
data RequisitionFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo RequisitionFreeMethodInfo Requisition signature where
overloadedMethod = requisitionFree
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveRequisitionMethod (t :: Symbol) (o :: *) :: * where
ResolveRequisitionMethod "copy" o = RequisitionCopyMethodInfo
ResolveRequisitionMethod "free" o = RequisitionFreeMethodInfo
ResolveRequisitionMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveRequisitionMethod t Requisition, O.MethodInfo info Requisition p) => OL.IsLabel t (Requisition -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif