{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gdk.Structs.Rectangle
(
Rectangle(..) ,
newZeroRectangle ,
#if defined(ENABLE_OVERLOADING)
ResolveRectangleMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
RectangleContainsPointMethodInfo ,
#endif
rectangleContainsPoint ,
#if defined(ENABLE_OVERLOADING)
RectangleEqualMethodInfo ,
#endif
rectangleEqual ,
#if defined(ENABLE_OVERLOADING)
RectangleIntersectMethodInfo ,
#endif
rectangleIntersect ,
#if defined(ENABLE_OVERLOADING)
RectangleUnionMethodInfo ,
#endif
rectangleUnion ,
getRectangleHeight ,
#if defined(ENABLE_OVERLOADING)
rectangle_height ,
#endif
setRectangleHeight ,
getRectangleWidth ,
#if defined(ENABLE_OVERLOADING)
rectangle_width ,
#endif
setRectangleWidth ,
getRectangleX ,
#if defined(ENABLE_OVERLOADING)
rectangle_x ,
#endif
setRectangleX ,
getRectangleY ,
#if defined(ENABLE_OVERLOADING)
rectangle_y ,
#endif
setRectangleY ,
) 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.GHashTable as B.GHT
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.Kind as DK
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 qualified Data.Word as DW
import qualified Data.Int as DI
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT
#if MIN_VERSION_base(4,18,0)
#else
#endif
newtype Rectangle = Rectangle (SP.ManagedPtr Rectangle)
deriving (Rectangle -> Rectangle -> Bool
(Rectangle -> Rectangle -> Bool)
-> (Rectangle -> Rectangle -> Bool) -> Eq Rectangle
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Rectangle -> Rectangle -> Bool
== :: Rectangle -> Rectangle -> Bool
$c/= :: Rectangle -> Rectangle -> Bool
/= :: Rectangle -> Rectangle -> Bool
Eq)
instance SP.ManagedPtrNewtype Rectangle where
toManagedPtr :: Rectangle -> ManagedPtr Rectangle
toManagedPtr (Rectangle ManagedPtr Rectangle
p) = ManagedPtr Rectangle
p
foreign import ccall "gdk_rectangle_get_type" c_gdk_rectangle_get_type ::
IO GType
type instance O.ParentTypes Rectangle = '[]
instance O.HasParentTypes Rectangle
instance B.Types.TypedObject Rectangle where
glibType :: IO GType
glibType = IO GType
c_gdk_rectangle_get_type
instance B.Types.GBoxed Rectangle
instance B.GValue.IsGValue (Maybe Rectangle) where
gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_gdk_rectangle_get_type
gvalueSet_ :: Ptr GValue -> Maybe Rectangle -> IO ()
gvalueSet_ Ptr GValue
gv Maybe Rectangle
P.Nothing = Ptr GValue -> Ptr Rectangle -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv (Ptr Rectangle
forall a. Ptr a
FP.nullPtr :: FP.Ptr Rectangle)
gvalueSet_ Ptr GValue
gv (P.Just Rectangle
obj) = Rectangle -> (Ptr Rectangle -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Rectangle
obj (Ptr GValue -> Ptr Rectangle -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv)
gvalueGet_ :: Ptr GValue -> IO (Maybe Rectangle)
gvalueGet_ Ptr GValue
gv = do
ptr <- Ptr GValue -> IO (Ptr Rectangle)
forall b. Ptr GValue -> IO (Ptr b)
B.GValue.get_boxed Ptr GValue
gv :: IO (Ptr Rectangle)
if ptr /= FP.nullPtr
then P.Just <$> B.ManagedPtr.newBoxed Rectangle ptr
else return P.Nothing
newZeroRectangle :: MonadIO m => m Rectangle
newZeroRectangle :: forall (m :: * -> *). MonadIO m => m Rectangle
newZeroRectangle = IO Rectangle -> m Rectangle
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Rectangle -> m Rectangle) -> IO Rectangle -> m Rectangle
forall a b. (a -> b) -> a -> b
$ Int -> IO (Ptr Rectangle)
forall a. GBoxed a => Int -> IO (Ptr a)
callocBoxedBytes Int
16 IO (Ptr Rectangle)
-> (Ptr Rectangle -> IO Rectangle) -> IO Rectangle
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr Rectangle -> Rectangle)
-> Ptr Rectangle -> IO Rectangle
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Rectangle -> Rectangle
Rectangle
instance tag ~ 'AttrSet => Constructible Rectangle tag where
new :: forall (m :: * -> *).
MonadIO m =>
(ManagedPtr Rectangle -> Rectangle)
-> [AttrOp Rectangle tag] -> m Rectangle
new ManagedPtr Rectangle -> Rectangle
_ [AttrOp Rectangle tag]
attrs = do
o <- m Rectangle
forall (m :: * -> *). MonadIO m => m Rectangle
newZeroRectangle
GI.Attributes.set o attrs
return o
getRectangleX :: MonadIO m => Rectangle -> m Int32
getRectangleX :: forall (m :: * -> *). MonadIO m => Rectangle -> m Int32
getRectangleX Rectangle
s = IO Int32 -> m Int32
forall a. IO a -> m a
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
$ Rectangle -> (Ptr Rectangle -> IO Int32) -> IO Int32
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Rectangle
s ((Ptr Rectangle -> IO Int32) -> IO Int32)
-> (Ptr Rectangle -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \Ptr Rectangle
ptr -> do
val <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek (Ptr Rectangle
ptr Ptr Rectangle -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) :: IO Int32
return val
setRectangleX :: MonadIO m => Rectangle -> Int32 -> m ()
setRectangleX :: forall (m :: * -> *). MonadIO m => Rectangle -> Int32 -> m ()
setRectangleX Rectangle
s Int32
val = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ Rectangle -> (Ptr Rectangle -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Rectangle
s ((Ptr Rectangle -> IO ()) -> IO ())
-> (Ptr Rectangle -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Rectangle
ptr -> do
Ptr Int32 -> Int32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Rectangle
ptr Ptr Rectangle -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) (Int32
val :: Int32)
#if defined(ENABLE_OVERLOADING)
data RectangleXFieldInfo
instance AttrInfo RectangleXFieldInfo where
type AttrBaseTypeConstraint RectangleXFieldInfo = (~) Rectangle
type AttrAllowedOps RectangleXFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint RectangleXFieldInfo = (~) Int32
type AttrTransferTypeConstraint RectangleXFieldInfo = (~)Int32
type AttrTransferType RectangleXFieldInfo = Int32
type AttrGetType RectangleXFieldInfo = Int32
type AttrLabel RectangleXFieldInfo = "x"
type AttrOrigin RectangleXFieldInfo = Rectangle
attrGet = getRectangleX
attrSet = setRectangleX
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gdk.Structs.Rectangle.x"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk-4.0.9/docs/GI-Gdk-Structs-Rectangle.html#g:attr:x"
})
rectangle_x :: AttrLabelProxy "x"
rectangle_x = AttrLabelProxy
#endif
getRectangleY :: MonadIO m => Rectangle -> m Int32
getRectangleY :: forall (m :: * -> *). MonadIO m => Rectangle -> m Int32
getRectangleY Rectangle
s = IO Int32 -> m Int32
forall a. IO a -> m a
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
$ Rectangle -> (Ptr Rectangle -> IO Int32) -> IO Int32
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Rectangle
s ((Ptr Rectangle -> IO Int32) -> IO Int32)
-> (Ptr Rectangle -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \Ptr Rectangle
ptr -> do
val <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek (Ptr Rectangle
ptr Ptr Rectangle -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4) :: IO Int32
return val
setRectangleY :: MonadIO m => Rectangle -> Int32 -> m ()
setRectangleY :: forall (m :: * -> *). MonadIO m => Rectangle -> Int32 -> m ()
setRectangleY Rectangle
s Int32
val = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ Rectangle -> (Ptr Rectangle -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Rectangle
s ((Ptr Rectangle -> IO ()) -> IO ())
-> (Ptr Rectangle -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Rectangle
ptr -> do
Ptr Int32 -> Int32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Rectangle
ptr Ptr Rectangle -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4) (Int32
val :: Int32)
#if defined(ENABLE_OVERLOADING)
data RectangleYFieldInfo
instance AttrInfo RectangleYFieldInfo where
type AttrBaseTypeConstraint RectangleYFieldInfo = (~) Rectangle
type AttrAllowedOps RectangleYFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint RectangleYFieldInfo = (~) Int32
type AttrTransferTypeConstraint RectangleYFieldInfo = (~)Int32
type AttrTransferType RectangleYFieldInfo = Int32
type AttrGetType RectangleYFieldInfo = Int32
type AttrLabel RectangleYFieldInfo = "y"
type AttrOrigin RectangleYFieldInfo = Rectangle
attrGet = getRectangleY
attrSet = setRectangleY
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gdk.Structs.Rectangle.y"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk-4.0.9/docs/GI-Gdk-Structs-Rectangle.html#g:attr:y"
})
rectangle_y :: AttrLabelProxy "y"
rectangle_y = AttrLabelProxy
#endif
getRectangleWidth :: MonadIO m => Rectangle -> m Int32
getRectangleWidth :: forall (m :: * -> *). MonadIO m => Rectangle -> m Int32
getRectangleWidth Rectangle
s = IO Int32 -> m Int32
forall a. IO a -> m a
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
$ Rectangle -> (Ptr Rectangle -> IO Int32) -> IO Int32
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Rectangle
s ((Ptr Rectangle -> IO Int32) -> IO Int32)
-> (Ptr Rectangle -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \Ptr Rectangle
ptr -> do
val <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek (Ptr Rectangle
ptr Ptr Rectangle -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) :: IO Int32
return val
setRectangleWidth :: MonadIO m => Rectangle -> Int32 -> m ()
setRectangleWidth :: forall (m :: * -> *). MonadIO m => Rectangle -> Int32 -> m ()
setRectangleWidth Rectangle
s Int32
val = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ Rectangle -> (Ptr Rectangle -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Rectangle
s ((Ptr Rectangle -> IO ()) -> IO ())
-> (Ptr Rectangle -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Rectangle
ptr -> do
Ptr Int32 -> Int32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Rectangle
ptr Ptr Rectangle -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) (Int32
val :: Int32)
#if defined(ENABLE_OVERLOADING)
data RectangleWidthFieldInfo
instance AttrInfo RectangleWidthFieldInfo where
type AttrBaseTypeConstraint RectangleWidthFieldInfo = (~) Rectangle
type AttrAllowedOps RectangleWidthFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint RectangleWidthFieldInfo = (~) Int32
type AttrTransferTypeConstraint RectangleWidthFieldInfo = (~)Int32
type AttrTransferType RectangleWidthFieldInfo = Int32
type AttrGetType RectangleWidthFieldInfo = Int32
type AttrLabel RectangleWidthFieldInfo = "width"
type AttrOrigin RectangleWidthFieldInfo = Rectangle
attrGet = getRectangleWidth
attrSet = setRectangleWidth
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gdk.Structs.Rectangle.width"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk-4.0.9/docs/GI-Gdk-Structs-Rectangle.html#g:attr:width"
})
rectangle_width :: AttrLabelProxy "width"
rectangle_width = AttrLabelProxy
#endif
getRectangleHeight :: MonadIO m => Rectangle -> m Int32
getRectangleHeight :: forall (m :: * -> *). MonadIO m => Rectangle -> m Int32
getRectangleHeight Rectangle
s = IO Int32 -> m Int32
forall a. IO a -> m a
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
$ Rectangle -> (Ptr Rectangle -> IO Int32) -> IO Int32
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Rectangle
s ((Ptr Rectangle -> IO Int32) -> IO Int32)
-> (Ptr Rectangle -> IO Int32) -> IO Int32
forall a b. (a -> b) -> a -> b
$ \Ptr Rectangle
ptr -> do
val <- Ptr Int32 -> IO Int32
forall a. Storable a => Ptr a -> IO a
peek (Ptr Rectangle
ptr Ptr Rectangle -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
12) :: IO Int32
return val
setRectangleHeight :: MonadIO m => Rectangle -> Int32 -> m ()
setRectangleHeight :: forall (m :: * -> *). MonadIO m => Rectangle -> Int32 -> m ()
setRectangleHeight Rectangle
s Int32
val = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ Rectangle -> (Ptr Rectangle -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Rectangle
s ((Ptr Rectangle -> IO ()) -> IO ())
-> (Ptr Rectangle -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Rectangle
ptr -> do
Ptr Int32 -> Int32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Rectangle
ptr Ptr Rectangle -> Int -> Ptr Int32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
12) (Int32
val :: Int32)
#if defined(ENABLE_OVERLOADING)
data RectangleHeightFieldInfo
instance AttrInfo RectangleHeightFieldInfo where
type AttrBaseTypeConstraint RectangleHeightFieldInfo = (~) Rectangle
type AttrAllowedOps RectangleHeightFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint RectangleHeightFieldInfo = (~) Int32
type AttrTransferTypeConstraint RectangleHeightFieldInfo = (~)Int32
type AttrTransferType RectangleHeightFieldInfo = Int32
type AttrGetType RectangleHeightFieldInfo = Int32
type AttrLabel RectangleHeightFieldInfo = "height"
type AttrOrigin RectangleHeightFieldInfo = Rectangle
attrGet = getRectangleHeight
attrSet = setRectangleHeight
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gdk.Structs.Rectangle.height"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk-4.0.9/docs/GI-Gdk-Structs-Rectangle.html#g:attr:height"
})
rectangle_height :: AttrLabelProxy "height"
rectangle_height = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Rectangle
type instance O.AttributeList Rectangle = RectangleAttributeList
type RectangleAttributeList = ('[ '("x", RectangleXFieldInfo), '("y", RectangleYFieldInfo), '("width", RectangleWidthFieldInfo), '("height", RectangleHeightFieldInfo)] :: [(Symbol, DK.Type)])
#endif
foreign import ccall "gdk_rectangle_contains_point" gdk_rectangle_contains_point ::
Ptr Rectangle ->
Int32 ->
Int32 ->
IO CInt
rectangleContainsPoint ::
(B.CallStack.HasCallStack, MonadIO m) =>
Rectangle
-> Int32
-> Int32
-> m Bool
rectangleContainsPoint :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Rectangle -> Int32 -> Int32 -> m Bool
rectangleContainsPoint Rectangle
rect Int32
x Int32
y = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
rect' <- Rectangle -> IO (Ptr Rectangle)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Rectangle
rect
result <- gdk_rectangle_contains_point rect' x y
let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
touchManagedPtr rect
return result'
#if defined(ENABLE_OVERLOADING)
data RectangleContainsPointMethodInfo
instance (signature ~ (Int32 -> Int32 -> m Bool), MonadIO m) => O.OverloadedMethod RectangleContainsPointMethodInfo Rectangle signature where
overloadedMethod = rectangleContainsPoint
instance O.OverloadedMethodInfo RectangleContainsPointMethodInfo Rectangle where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gdk.Structs.Rectangle.rectangleContainsPoint",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk-4.0.9/docs/GI-Gdk-Structs-Rectangle.html#v:rectangleContainsPoint"
})
#endif
foreign import ccall "gdk_rectangle_equal" gdk_rectangle_equal ::
Ptr Rectangle ->
Ptr Rectangle ->
IO CInt
rectangleEqual ::
(B.CallStack.HasCallStack, MonadIO m) =>
Rectangle
-> Rectangle
-> m Bool
rectangleEqual :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Rectangle -> Rectangle -> m Bool
rectangleEqual Rectangle
rect1 Rectangle
rect2 = IO Bool -> m Bool
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Bool -> m Bool) -> IO Bool -> m Bool
forall a b. (a -> b) -> a -> b
$ do
rect1' <- Rectangle -> IO (Ptr Rectangle)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Rectangle
rect1
rect2' <- unsafeManagedPtrGetPtr rect2
result <- gdk_rectangle_equal rect1' rect2'
let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
touchManagedPtr rect1
touchManagedPtr rect2
return result'
#if defined(ENABLE_OVERLOADING)
data RectangleEqualMethodInfo
instance (signature ~ (Rectangle -> m Bool), MonadIO m) => O.OverloadedMethod RectangleEqualMethodInfo Rectangle signature where
overloadedMethod = rectangleEqual
instance O.OverloadedMethodInfo RectangleEqualMethodInfo Rectangle where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gdk.Structs.Rectangle.rectangleEqual",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk-4.0.9/docs/GI-Gdk-Structs-Rectangle.html#v:rectangleEqual"
})
#endif
foreign import ccall "gdk_rectangle_intersect" gdk_rectangle_intersect ::
Ptr Rectangle ->
Ptr Rectangle ->
Ptr Rectangle ->
IO CInt
rectangleIntersect ::
(B.CallStack.HasCallStack, MonadIO m) =>
Rectangle
-> Rectangle
-> m ((Bool, Rectangle))
rectangleIntersect :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Rectangle -> Rectangle -> m (Bool, Rectangle)
rectangleIntersect Rectangle
src1 Rectangle
src2 = IO (Bool, Rectangle) -> m (Bool, Rectangle)
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Bool, Rectangle) -> m (Bool, Rectangle))
-> IO (Bool, Rectangle) -> m (Bool, Rectangle)
forall a b. (a -> b) -> a -> b
$ do
src1' <- Rectangle -> IO (Ptr Rectangle)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Rectangle
src1
src2' <- unsafeManagedPtrGetPtr src2
dest <- SP.callocBoxedBytes 16 :: IO (Ptr Rectangle)
result <- gdk_rectangle_intersect src1' src2' dest
let result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
dest' <- (wrapBoxed Rectangle) dest
touchManagedPtr src1
touchManagedPtr src2
return (result', dest')
#if defined(ENABLE_OVERLOADING)
data RectangleIntersectMethodInfo
instance (signature ~ (Rectangle -> m ((Bool, Rectangle))), MonadIO m) => O.OverloadedMethod RectangleIntersectMethodInfo Rectangle signature where
overloadedMethod = rectangleIntersect
instance O.OverloadedMethodInfo RectangleIntersectMethodInfo Rectangle where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gdk.Structs.Rectangle.rectangleIntersect",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk-4.0.9/docs/GI-Gdk-Structs-Rectangle.html#v:rectangleIntersect"
})
#endif
foreign import ccall "gdk_rectangle_union" gdk_rectangle_union ::
Ptr Rectangle ->
Ptr Rectangle ->
Ptr Rectangle ->
IO ()
rectangleUnion ::
(B.CallStack.HasCallStack, MonadIO m) =>
Rectangle
-> Rectangle
-> m (Rectangle)
rectangleUnion :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Rectangle -> Rectangle -> m Rectangle
rectangleUnion Rectangle
src1 Rectangle
src2 = IO Rectangle -> m Rectangle
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Rectangle -> m Rectangle) -> IO Rectangle -> m Rectangle
forall a b. (a -> b) -> a -> b
$ do
src1' <- Rectangle -> IO (Ptr Rectangle)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Rectangle
src1
src2' <- unsafeManagedPtrGetPtr src2
dest <- SP.callocBoxedBytes 16 :: IO (Ptr Rectangle)
gdk_rectangle_union src1' src2' dest
dest' <- (wrapBoxed Rectangle) dest
touchManagedPtr src1
touchManagedPtr src2
return dest'
#if defined(ENABLE_OVERLOADING)
data RectangleUnionMethodInfo
instance (signature ~ (Rectangle -> m (Rectangle)), MonadIO m) => O.OverloadedMethod RectangleUnionMethodInfo Rectangle signature where
overloadedMethod = rectangleUnion
instance O.OverloadedMethodInfo RectangleUnionMethodInfo Rectangle where
overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gdk.Structs.Rectangle.rectangleUnion",
O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gdk-4.0.9/docs/GI-Gdk-Structs-Rectangle.html#v:rectangleUnion"
})
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveRectangleMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveRectangleMethod "containsPoint" o = RectangleContainsPointMethodInfo
ResolveRectangleMethod "equal" o = RectangleEqualMethodInfo
ResolveRectangleMethod "intersect" o = RectangleIntersectMethodInfo
ResolveRectangleMethod "union" o = RectangleUnionMethodInfo
ResolveRectangleMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveRectangleMethod t Rectangle, O.OverloadedMethod info Rectangle p) => OL.IsLabel t (Rectangle -> 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 ~ ResolveRectangleMethod t Rectangle, O.OverloadedMethod info Rectangle p, R.HasField t Rectangle p) => R.HasField t Rectangle p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveRectangleMethod t Rectangle, O.OverloadedMethodInfo info Rectangle) => OL.IsLabel t (O.MethodProxy info Rectangle) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif