{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- A t'GI.Poppler.Structs.Rectangle.Rectangle' is used to describe
-- locations on a page and bounding boxes

#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif

module GI.Poppler.Structs.Rectangle
    ( 

-- * Exported types
    Rectangle(..)                           ,
    newZeroRectangle                        ,


 -- * Methods
-- | 
-- 
--  === __Click to display all available methods, including inherited ones__
-- ==== Methods
-- [copy]("GI.Poppler.Structs.Rectangle#g:method:copy"), [findGetIgnoredHyphen]("GI.Poppler.Structs.Rectangle#g:method:findGetIgnoredHyphen"), [findGetMatchContinued]("GI.Poppler.Structs.Rectangle#g:method:findGetMatchContinued"), [free]("GI.Poppler.Structs.Rectangle#g:method:free").
-- 
-- ==== Getters
-- /None/.
-- 
-- ==== Setters
-- /None/.

#if defined(ENABLE_OVERLOADING)
    ResolveRectangleMethod                  ,
#endif

-- ** copy #method:copy#

#if defined(ENABLE_OVERLOADING)
    RectangleCopyMethodInfo                 ,
#endif
    rectangleCopy                           ,


-- ** findGetIgnoredHyphen #method:findGetIgnoredHyphen#

#if defined(ENABLE_OVERLOADING)
    RectangleFindGetIgnoredHyphenMethodInfo ,
#endif
    rectangleFindGetIgnoredHyphen           ,


-- ** findGetMatchContinued #method:findGetMatchContinued#

#if defined(ENABLE_OVERLOADING)
    RectangleFindGetMatchContinuedMethodInfo,
#endif
    rectangleFindGetMatchContinued          ,


-- ** free #method:free#

#if defined(ENABLE_OVERLOADING)
    RectangleFreeMethodInfo                 ,
#endif
    rectangleFree                           ,


-- ** new #method:new#

    rectangleNew                            ,




 -- * Properties


-- ** x1 #attr:x1#
-- | x coordinate of lower left corner

    getRectangleX1                          ,
#if defined(ENABLE_OVERLOADING)
    rectangle_x1                            ,
#endif
    setRectangleX1                          ,


-- ** x2 #attr:x2#
-- | x coordinate of upper right corner

    getRectangleX2                          ,
#if defined(ENABLE_OVERLOADING)
    rectangle_x2                            ,
#endif
    setRectangleX2                          ,


-- ** y1 #attr:y1#
-- | y coordinate of lower left corner

    getRectangleY1                          ,
#if defined(ENABLE_OVERLOADING)
    rectangle_y1                            ,
#endif
    setRectangleY1                          ,


-- ** y2 #attr:y2#
-- | y coordinate of upper right corner

    getRectangleY2                          ,
#if defined(ENABLE_OVERLOADING)
    rectangle_y2                            ,
#endif
    setRectangleY2                          ,




    ) 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.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


-- | Memory-managed wrapper type.
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 "poppler_rectangle_get_type" c_poppler_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_poppler_rectangle_get_type

instance B.Types.GBoxed Rectangle

-- | Convert 'Rectangle' to and from 'Data.GI.Base.GValue.GValue'. See 'Data.GI.Base.GValue.toGValue' and 'Data.GI.Base.GValue.fromGValue'.
instance B.GValue.IsGValue (Maybe Rectangle) where
    gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_poppler_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 Rectangle
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 Rectangle
ptr Ptr Rectangle -> Ptr Rectangle -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr Rectangle
forall a. Ptr a
FP.nullPtr
        then Rectangle -> Maybe Rectangle
forall a. a -> Maybe a
P.Just (Rectangle -> Maybe Rectangle)
-> IO Rectangle -> IO (Maybe Rectangle)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr Rectangle -> Rectangle)
-> Ptr Rectangle -> IO Rectangle
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr Rectangle -> Rectangle
Rectangle Ptr Rectangle
ptr
        else Maybe Rectangle -> IO (Maybe Rectangle)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Rectangle
forall a. Maybe a
P.Nothing
        
    

-- | Construct a `Rectangle` struct initialized to zero.
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
32 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
        Rectangle
o <- m Rectangle
forall (m :: * -> *). MonadIO m => m Rectangle
newZeroRectangle
        Rectangle -> [AttrOp Rectangle 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set Rectangle
o [AttrOp Rectangle tag]
[AttrOp Rectangle 'AttrSet]
attrs
        Rectangle -> m Rectangle
forall a. a -> m a
forall (m :: * -> *) a. Monad m => a -> m a
return Rectangle
o


-- | Get the value of the “@x1@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' rectangle #x1
-- @
getRectangleX1 :: MonadIO m => Rectangle -> m Double
getRectangleX1 :: forall (m :: * -> *). MonadIO m => Rectangle -> m Double
getRectangleX1 Rectangle
s = IO Double -> m Double
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Double -> m Double) -> IO Double -> m Double
forall a b. (a -> b) -> a -> b
$ Rectangle -> (Ptr Rectangle -> IO Double) -> IO Double
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Rectangle
s ((Ptr Rectangle -> IO Double) -> IO Double)
-> (Ptr Rectangle -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \Ptr Rectangle
ptr -> do
    CDouble
val <- Ptr CDouble -> IO CDouble
forall a. Storable a => Ptr a -> IO a
peek (Ptr Rectangle
ptr Ptr Rectangle -> Int -> Ptr CDouble
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) :: IO CDouble
    let val' :: Double
val' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
val
    Double -> IO Double
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Double
val'

-- | Set the value of the “@x1@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' rectangle [ #x1 'Data.GI.Base.Attributes.:=' value ]
-- @
setRectangleX1 :: MonadIO m => Rectangle -> Double -> m ()
setRectangleX1 :: forall (m :: * -> *). MonadIO m => Rectangle -> Double -> m ()
setRectangleX1 Rectangle
s Double
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
    let val' :: CDouble
val' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
val
    Ptr CDouble -> CDouble -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Rectangle
ptr Ptr Rectangle -> Int -> Ptr CDouble
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) (CDouble
val' :: CDouble)

#if defined(ENABLE_OVERLOADING)
data RectangleX1FieldInfo
instance AttrInfo RectangleX1FieldInfo where
    type AttrBaseTypeConstraint RectangleX1FieldInfo = (~) Rectangle
    type AttrAllowedOps RectangleX1FieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint RectangleX1FieldInfo = (~) Double
    type AttrTransferTypeConstraint RectangleX1FieldInfo = (~)Double
    type AttrTransferType RectangleX1FieldInfo = Double
    type AttrGetType RectangleX1FieldInfo = Double
    type AttrLabel RectangleX1FieldInfo = "x1"
    type AttrOrigin RectangleX1FieldInfo = Rectangle
    attrGet = getRectangleX1
    attrSet = setRectangleX1
    attrConstruct = undefined
    attrClear = undefined
    attrTransfer _ v = do
        return v
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Poppler.Structs.Rectangle.x1"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-poppler-0.18.27/docs/GI-Poppler-Structs-Rectangle.html#g:attr:x1"
        })

rectangle_x1 :: AttrLabelProxy "x1"
rectangle_x1 = AttrLabelProxy

#endif


-- | Get the value of the “@y1@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' rectangle #y1
-- @
getRectangleY1 :: MonadIO m => Rectangle -> m Double
getRectangleY1 :: forall (m :: * -> *). MonadIO m => Rectangle -> m Double
getRectangleY1 Rectangle
s = IO Double -> m Double
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Double -> m Double) -> IO Double -> m Double
forall a b. (a -> b) -> a -> b
$ Rectangle -> (Ptr Rectangle -> IO Double) -> IO Double
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Rectangle
s ((Ptr Rectangle -> IO Double) -> IO Double)
-> (Ptr Rectangle -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \Ptr Rectangle
ptr -> do
    CDouble
val <- Ptr CDouble -> IO CDouble
forall a. Storable a => Ptr a -> IO a
peek (Ptr Rectangle
ptr Ptr Rectangle -> Int -> Ptr CDouble
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) :: IO CDouble
    let val' :: Double
val' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
val
    Double -> IO Double
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Double
val'

-- | Set the value of the “@y1@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' rectangle [ #y1 'Data.GI.Base.Attributes.:=' value ]
-- @
setRectangleY1 :: MonadIO m => Rectangle -> Double -> m ()
setRectangleY1 :: forall (m :: * -> *). MonadIO m => Rectangle -> Double -> m ()
setRectangleY1 Rectangle
s Double
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
    let val' :: CDouble
val' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
val
    Ptr CDouble -> CDouble -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Rectangle
ptr Ptr Rectangle -> Int -> Ptr CDouble
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) (CDouble
val' :: CDouble)

#if defined(ENABLE_OVERLOADING)
data RectangleY1FieldInfo
instance AttrInfo RectangleY1FieldInfo where
    type AttrBaseTypeConstraint RectangleY1FieldInfo = (~) Rectangle
    type AttrAllowedOps RectangleY1FieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint RectangleY1FieldInfo = (~) Double
    type AttrTransferTypeConstraint RectangleY1FieldInfo = (~)Double
    type AttrTransferType RectangleY1FieldInfo = Double
    type AttrGetType RectangleY1FieldInfo = Double
    type AttrLabel RectangleY1FieldInfo = "y1"
    type AttrOrigin RectangleY1FieldInfo = Rectangle
    attrGet = getRectangleY1
    attrSet = setRectangleY1
    attrConstruct = undefined
    attrClear = undefined
    attrTransfer _ v = do
        return v
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Poppler.Structs.Rectangle.y1"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-poppler-0.18.27/docs/GI-Poppler-Structs-Rectangle.html#g:attr:y1"
        })

rectangle_y1 :: AttrLabelProxy "y1"
rectangle_y1 = AttrLabelProxy

#endif


-- | Get the value of the “@x2@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' rectangle #x2
-- @
getRectangleX2 :: MonadIO m => Rectangle -> m Double
getRectangleX2 :: forall (m :: * -> *). MonadIO m => Rectangle -> m Double
getRectangleX2 Rectangle
s = IO Double -> m Double
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Double -> m Double) -> IO Double -> m Double
forall a b. (a -> b) -> a -> b
$ Rectangle -> (Ptr Rectangle -> IO Double) -> IO Double
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Rectangle
s ((Ptr Rectangle -> IO Double) -> IO Double)
-> (Ptr Rectangle -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \Ptr Rectangle
ptr -> do
    CDouble
val <- Ptr CDouble -> IO CDouble
forall a. Storable a => Ptr a -> IO a
peek (Ptr Rectangle
ptr Ptr Rectangle -> Int -> Ptr CDouble
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16) :: IO CDouble
    let val' :: Double
val' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
val
    Double -> IO Double
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Double
val'

-- | Set the value of the “@x2@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' rectangle [ #x2 'Data.GI.Base.Attributes.:=' value ]
-- @
setRectangleX2 :: MonadIO m => Rectangle -> Double -> m ()
setRectangleX2 :: forall (m :: * -> *). MonadIO m => Rectangle -> Double -> m ()
setRectangleX2 Rectangle
s Double
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
    let val' :: CDouble
val' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
val
    Ptr CDouble -> CDouble -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Rectangle
ptr Ptr Rectangle -> Int -> Ptr CDouble
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
16) (CDouble
val' :: CDouble)

#if defined(ENABLE_OVERLOADING)
data RectangleX2FieldInfo
instance AttrInfo RectangleX2FieldInfo where
    type AttrBaseTypeConstraint RectangleX2FieldInfo = (~) Rectangle
    type AttrAllowedOps RectangleX2FieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint RectangleX2FieldInfo = (~) Double
    type AttrTransferTypeConstraint RectangleX2FieldInfo = (~)Double
    type AttrTransferType RectangleX2FieldInfo = Double
    type AttrGetType RectangleX2FieldInfo = Double
    type AttrLabel RectangleX2FieldInfo = "x2"
    type AttrOrigin RectangleX2FieldInfo = Rectangle
    attrGet = getRectangleX2
    attrSet = setRectangleX2
    attrConstruct = undefined
    attrClear = undefined
    attrTransfer _ v = do
        return v
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Poppler.Structs.Rectangle.x2"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-poppler-0.18.27/docs/GI-Poppler-Structs-Rectangle.html#g:attr:x2"
        })

rectangle_x2 :: AttrLabelProxy "x2"
rectangle_x2 = AttrLabelProxy

#endif


-- | Get the value of the “@y2@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' rectangle #y2
-- @
getRectangleY2 :: MonadIO m => Rectangle -> m Double
getRectangleY2 :: forall (m :: * -> *). MonadIO m => Rectangle -> m Double
getRectangleY2 Rectangle
s = IO Double -> m Double
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Double -> m Double) -> IO Double -> m Double
forall a b. (a -> b) -> a -> b
$ Rectangle -> (Ptr Rectangle -> IO Double) -> IO Double
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Rectangle
s ((Ptr Rectangle -> IO Double) -> IO Double)
-> (Ptr Rectangle -> IO Double) -> IO Double
forall a b. (a -> b) -> a -> b
$ \Ptr Rectangle
ptr -> do
    CDouble
val <- Ptr CDouble -> IO CDouble
forall a. Storable a => Ptr a -> IO a
peek (Ptr Rectangle
ptr Ptr Rectangle -> Int -> Ptr CDouble
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24) :: IO CDouble
    let val' :: Double
val' = CDouble -> Double
forall a b. (Real a, Fractional b) => a -> b
realToFrac CDouble
val
    Double -> IO Double
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Double
val'

-- | Set the value of the “@y2@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' rectangle [ #y2 'Data.GI.Base.Attributes.:=' value ]
-- @
setRectangleY2 :: MonadIO m => Rectangle -> Double -> m ()
setRectangleY2 :: forall (m :: * -> *). MonadIO m => Rectangle -> Double -> m ()
setRectangleY2 Rectangle
s Double
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
    let val' :: CDouble
val' = Double -> CDouble
forall a b. (Real a, Fractional b) => a -> b
realToFrac Double
val
    Ptr CDouble -> CDouble -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Rectangle
ptr Ptr Rectangle -> Int -> Ptr CDouble
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
24) (CDouble
val' :: CDouble)

#if defined(ENABLE_OVERLOADING)
data RectangleY2FieldInfo
instance AttrInfo RectangleY2FieldInfo where
    type AttrBaseTypeConstraint RectangleY2FieldInfo = (~) Rectangle
    type AttrAllowedOps RectangleY2FieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint RectangleY2FieldInfo = (~) Double
    type AttrTransferTypeConstraint RectangleY2FieldInfo = (~)Double
    type AttrTransferType RectangleY2FieldInfo = Double
    type AttrGetType RectangleY2FieldInfo = Double
    type AttrLabel RectangleY2FieldInfo = "y2"
    type AttrOrigin RectangleY2FieldInfo = Rectangle
    attrGet = getRectangleY2
    attrSet = setRectangleY2
    attrConstruct = undefined
    attrClear = undefined
    attrTransfer _ v = do
        return v
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Poppler.Structs.Rectangle.y2"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-poppler-0.18.27/docs/GI-Poppler-Structs-Rectangle.html#g:attr:y2"
        })

rectangle_y2 :: AttrLabelProxy "y2"
rectangle_y2 = AttrLabelProxy

#endif



#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Rectangle
type instance O.AttributeList Rectangle = RectangleAttributeList
type RectangleAttributeList = ('[ '("x1", RectangleX1FieldInfo), '("y1", RectangleY1FieldInfo), '("x2", RectangleX2FieldInfo), '("y2", RectangleY2FieldInfo)] :: [(Symbol, *)])
#endif

-- method Rectangle::new
-- method type : Constructor
-- Args: []
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Poppler" , name = "Rectangle" })
-- throws : False
-- Skip return : False

foreign import ccall "poppler_rectangle_new" poppler_rectangle_new :: 
    IO (Ptr Rectangle)

-- | Creates a new t'GI.Poppler.Structs.Rectangle.Rectangle'
rectangleNew ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Rectangle
    -- ^ __Returns:__ a new t'GI.Poppler.Structs.Rectangle.Rectangle', use 'GI.Poppler.Structs.Rectangle.rectangleFree' to free it
rectangleNew :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Rectangle
rectangleNew  = 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
    Ptr Rectangle
result <- IO (Ptr Rectangle)
poppler_rectangle_new
    Text -> Ptr Rectangle -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"rectangleNew" Ptr Rectangle
result
    Rectangle
result' <- ((ManagedPtr Rectangle -> Rectangle)
-> Ptr Rectangle -> IO Rectangle
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Rectangle -> Rectangle
Rectangle) Ptr Rectangle
result
    Rectangle -> IO Rectangle
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Rectangle
result'

#if defined(ENABLE_OVERLOADING)
#endif

-- method Rectangle::copy
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "rectangle"
--           , argType =
--               TInterface Name { namespace = "Poppler" , name = "Rectangle" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #PopplerRectangle to copy"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just
--               (TInterface Name { namespace = "Poppler" , name = "Rectangle" })
-- throws : False
-- Skip return : False

foreign import ccall "poppler_rectangle_copy" poppler_rectangle_copy :: 
    Ptr Rectangle ->                        -- rectangle : TInterface (Name {namespace = "Poppler", name = "Rectangle"})
    IO (Ptr Rectangle)

-- | Creates a copy of /@rectangle@/.
-- 
-- Note that you must only use this function on an allocated PopplerRectangle, as
-- returned by 'GI.Poppler.Structs.Rectangle.rectangleNew', 'GI.Poppler.Structs.Rectangle.rectangleCopy', or the list elements
-- returned from 'GI.Poppler.Objects.Page.pageFindText' or 'GI.Poppler.Objects.Page.pageFindTextWithOptions'.
rectangleCopy ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Rectangle
    -- ^ /@rectangle@/: a t'GI.Poppler.Structs.Rectangle.Rectangle' to copy
    -> m Rectangle
    -- ^ __Returns:__ a new allocated copy of /@rectangle@/
rectangleCopy :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Rectangle -> m Rectangle
rectangleCopy Rectangle
rectangle = 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
    Ptr Rectangle
rectangle' <- Rectangle -> IO (Ptr Rectangle)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Rectangle
rectangle
    Ptr Rectangle
result <- Ptr Rectangle -> IO (Ptr Rectangle)
poppler_rectangle_copy Ptr Rectangle
rectangle'
    Text -> Ptr Rectangle -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"rectangleCopy" Ptr Rectangle
result
    Rectangle
result' <- ((ManagedPtr Rectangle -> Rectangle)
-> Ptr Rectangle -> IO Rectangle
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Rectangle -> Rectangle
Rectangle) Ptr Rectangle
result
    Rectangle -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Rectangle
rectangle
    Rectangle -> IO Rectangle
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Rectangle
result'

#if defined(ENABLE_OVERLOADING)
data RectangleCopyMethodInfo
instance (signature ~ (m Rectangle), MonadIO m) => O.OverloadedMethod RectangleCopyMethodInfo Rectangle signature where
    overloadedMethod = rectangleCopy

instance O.OverloadedMethodInfo RectangleCopyMethodInfo Rectangle where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Poppler.Structs.Rectangle.rectangleCopy",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-poppler-0.18.27/docs/GI-Poppler-Structs-Rectangle.html#v:rectangleCopy"
        })


#endif

-- method Rectangle::find_get_ignored_hyphen
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "rectangle"
--           , argType =
--               TInterface Name { namespace = "Poppler" , name = "Rectangle" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #PopplerRectangle"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "poppler_rectangle_find_get_ignored_hyphen" poppler_rectangle_find_get_ignored_hyphen :: 
    Ptr Rectangle ->                        -- rectangle : TInterface (Name {namespace = "Poppler", name = "Rectangle"})
    IO CInt

-- | When using 'GI.Poppler.Objects.Page.pageFindTextWithOptions' with the
-- 'GI.Poppler.Flags.FindFlagsMultiline' flag, a match may span more than one line,
-- and may have been formed by ignoring a hyphen at the end of the line.
-- When this happens at the end of the line corresponding to /@rectangle@/,
-- this function returns 'P.True' (and then 'GI.Poppler.Structs.Rectangle.rectangleFindGetMatchContinued'
-- will also return 'P.True'); otherwise it returns 'P.False'.
-- 
-- Note that you must only call this function on a t'GI.Poppler.Structs.Rectangle.Rectangle'
-- returned in the list from 'GI.Poppler.Objects.Page.pageFindText' or
-- 'GI.Poppler.Objects.Page.pageFindTextWithOptions'.
-- 
-- /Since: 21.05.0/
rectangleFindGetIgnoredHyphen ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Rectangle
    -- ^ /@rectangle@/: a t'GI.Poppler.Structs.Rectangle.Rectangle'
    -> m Bool
    -- ^ __Returns:__ whether a hyphen was ignored at the end of the line corresponding to /@rectangle@/.
rectangleFindGetIgnoredHyphen :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Rectangle -> m Bool
rectangleFindGetIgnoredHyphen Rectangle
rectangle = 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
    Ptr Rectangle
rectangle' <- Rectangle -> IO (Ptr Rectangle)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Rectangle
rectangle
    CInt
result <- Ptr Rectangle -> IO CInt
poppler_rectangle_find_get_ignored_hyphen Ptr Rectangle
rectangle'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    Rectangle -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Rectangle
rectangle
    Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if defined(ENABLE_OVERLOADING)
data RectangleFindGetIgnoredHyphenMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.OverloadedMethod RectangleFindGetIgnoredHyphenMethodInfo Rectangle signature where
    overloadedMethod = rectangleFindGetIgnoredHyphen

instance O.OverloadedMethodInfo RectangleFindGetIgnoredHyphenMethodInfo Rectangle where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Poppler.Structs.Rectangle.rectangleFindGetIgnoredHyphen",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-poppler-0.18.27/docs/GI-Poppler-Structs-Rectangle.html#v:rectangleFindGetIgnoredHyphen"
        })


#endif

-- method Rectangle::find_get_match_continued
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "rectangle"
--           , argType =
--               TInterface Name { namespace = "Poppler" , name = "Rectangle" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #PopplerRectangle"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "poppler_rectangle_find_get_match_continued" poppler_rectangle_find_get_match_continued :: 
    Ptr Rectangle ->                        -- rectangle : TInterface (Name {namespace = "Poppler", name = "Rectangle"})
    IO CInt

-- | When using 'GI.Poppler.Objects.Page.pageFindTextWithOptions' with the
-- 'GI.Poppler.Flags.FindFlagsMultiline' flag, a match may span more than one line
-- and thus consist of more than one rectangle. Every rectangle belonging
-- to the same match will return 'P.True' from this function, except for
-- the last rectangle, where this function will return 'P.False'.
-- 
-- Note that you must only call this function on a t'GI.Poppler.Structs.Rectangle.Rectangle'
-- returned in the list from 'GI.Poppler.Objects.Page.pageFindText' or
-- 'GI.Poppler.Objects.Page.pageFindTextWithOptions'.
-- 
-- /Since: 21.05.0/
rectangleFindGetMatchContinued ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Rectangle
    -- ^ /@rectangle@/: a t'GI.Poppler.Structs.Rectangle.Rectangle'
    -> m Bool
    -- ^ __Returns:__ whether there are more rectangles belonging to the same match
rectangleFindGetMatchContinued :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Rectangle -> m Bool
rectangleFindGetMatchContinued Rectangle
rectangle = 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
    Ptr Rectangle
rectangle' <- Rectangle -> IO (Ptr Rectangle)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Rectangle
rectangle
    CInt
result <- Ptr Rectangle -> IO CInt
poppler_rectangle_find_get_match_continued Ptr Rectangle
rectangle'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    Rectangle -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Rectangle
rectangle
    Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if defined(ENABLE_OVERLOADING)
data RectangleFindGetMatchContinuedMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.OverloadedMethod RectangleFindGetMatchContinuedMethodInfo Rectangle signature where
    overloadedMethod = rectangleFindGetMatchContinued

instance O.OverloadedMethodInfo RectangleFindGetMatchContinuedMethodInfo Rectangle where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Poppler.Structs.Rectangle.rectangleFindGetMatchContinued",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-poppler-0.18.27/docs/GI-Poppler-Structs-Rectangle.html#v:rectangleFindGetMatchContinued"
        })


#endif

-- method Rectangle::free
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "rectangle"
--           , argType =
--               TInterface Name { namespace = "Poppler" , name = "Rectangle" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #PopplerRectangle"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Nothing
-- throws : False
-- Skip return : False

foreign import ccall "poppler_rectangle_free" poppler_rectangle_free :: 
    Ptr Rectangle ->                        -- rectangle : TInterface (Name {namespace = "Poppler", name = "Rectangle"})
    IO ()

-- | Frees the given t'GI.Poppler.Structs.Rectangle.Rectangle'.
-- 
-- Note that you must only use this function on an allocated PopplerRectangle, as
-- returned by 'GI.Poppler.Structs.Rectangle.rectangleNew', 'GI.Poppler.Structs.Rectangle.rectangleCopy', or the list elements
-- returned from 'GI.Poppler.Objects.Page.pageFindText' or 'GI.Poppler.Objects.Page.pageFindTextWithOptions'.
rectangleFree ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Rectangle
    -- ^ /@rectangle@/: a t'GI.Poppler.Structs.Rectangle.Rectangle'
    -> m ()
rectangleFree :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Rectangle -> m ()
rectangleFree Rectangle
rectangle = 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
$ do
    Ptr Rectangle
rectangle' <- Rectangle -> IO (Ptr Rectangle)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Rectangle
rectangle
    Ptr Rectangle -> IO ()
poppler_rectangle_free Ptr Rectangle
rectangle'
    Rectangle -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Rectangle
rectangle
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data RectangleFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod RectangleFreeMethodInfo Rectangle signature where
    overloadedMethod = rectangleFree

instance O.OverloadedMethodInfo RectangleFreeMethodInfo Rectangle where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Poppler.Structs.Rectangle.rectangleFree",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-poppler-0.18.27/docs/GI-Poppler-Structs-Rectangle.html#v:rectangleFree"
        })


#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveRectangleMethod (t :: Symbol) (o :: *) :: * where
    ResolveRectangleMethod "copy" o = RectangleCopyMethodInfo
    ResolveRectangleMethod "findGetIgnoredHyphen" o = RectangleFindGetIgnoredHyphenMethodInfo
    ResolveRectangleMethod "findGetMatchContinued" o = RectangleFindGetMatchContinuedMethodInfo
    ResolveRectangleMethod "free" o = RectangleFreeMethodInfo
    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