{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson and Iñaki García Etxebarria
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- A size, in 2D space.
-- 
-- /Since: 1.12/

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

module GI.Clutter.Structs.Size
    ( 

-- * Exported types
    Size(..)                                ,
    newZeroSize                             ,


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

#if defined(ENABLE_OVERLOADING)
    ResolveSizeMethod                       ,
#endif

-- ** alloc #method:alloc#

    sizeAlloc                               ,


-- ** copy #method:copy#

#if defined(ENABLE_OVERLOADING)
    SizeCopyMethodInfo                      ,
#endif
    sizeCopy                                ,


-- ** equals #method:equals#

#if defined(ENABLE_OVERLOADING)
    SizeEqualsMethodInfo                    ,
#endif
    sizeEquals                              ,


-- ** free #method:free#

#if defined(ENABLE_OVERLOADING)
    SizeFreeMethodInfo                      ,
#endif
    sizeFree                                ,


-- ** init #method:init#

#if defined(ENABLE_OVERLOADING)
    SizeInitMethodInfo                      ,
#endif
    sizeInit                                ,




 -- * Properties


-- ** height #attr:height#
-- | the height, in pixels

    getSizeHeight                           ,
    setSizeHeight                           ,
#if defined(ENABLE_OVERLOADING)
    size_height                             ,
#endif


-- ** width #attr:width#
-- | the width, in pixels

    getSizeWidth                            ,
    setSizeWidth                            ,
#if defined(ENABLE_OVERLOADING)
    size_width                              ,
#endif




    ) 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 Size = Size (SP.ManagedPtr Size)
    deriving (Size -> Size -> Bool
(Size -> Size -> Bool) -> (Size -> Size -> Bool) -> Eq Size
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: Size -> Size -> Bool
== :: Size -> Size -> Bool
$c/= :: Size -> Size -> Bool
/= :: Size -> Size -> Bool
Eq)

instance SP.ManagedPtrNewtype Size where
    toManagedPtr :: Size -> ManagedPtr Size
toManagedPtr (Size ManagedPtr Size
p) = ManagedPtr Size
p

foreign import ccall "clutter_size_get_type" c_clutter_size_get_type :: 
    IO GType

type instance O.ParentTypes Size = '[]
instance O.HasParentTypes Size

instance B.Types.TypedObject Size where
    glibType :: IO GType
glibType = IO GType
c_clutter_size_get_type

instance B.Types.GBoxed Size

-- | Convert 'Size' 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 Size) where
    gvalueGType_ :: IO GType
gvalueGType_ = IO GType
c_clutter_size_get_type
    gvalueSet_ :: Ptr GValue -> Maybe Size -> IO ()
gvalueSet_ Ptr GValue
gv Maybe Size
P.Nothing = Ptr GValue -> Ptr Size -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv (Ptr Size
forall a. Ptr a
FP.nullPtr :: FP.Ptr Size)
    gvalueSet_ Ptr GValue
gv (P.Just Size
obj) = Size -> (Ptr Size -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr Size
obj (Ptr GValue -> Ptr Size -> IO ()
forall a. Ptr GValue -> Ptr a -> IO ()
B.GValue.set_boxed Ptr GValue
gv)
    gvalueGet_ :: Ptr GValue -> IO (Maybe Size)
gvalueGet_ Ptr GValue
gv = do
        Ptr Size
ptr <- Ptr GValue -> IO (Ptr Size)
forall b. Ptr GValue -> IO (Ptr b)
B.GValue.get_boxed Ptr GValue
gv :: IO (Ptr Size)
        if Ptr Size
ptr Ptr Size -> Ptr Size -> Bool
forall a. Eq a => a -> a -> Bool
/= Ptr Size
forall a. Ptr a
FP.nullPtr
        then Size -> Maybe Size
forall a. a -> Maybe a
P.Just (Size -> Maybe Size) -> IO Size -> IO (Maybe Size)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
<$> (ManagedPtr Size -> Size) -> Ptr Size -> IO Size
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.newBoxed ManagedPtr Size -> Size
Size Ptr Size
ptr
        else Maybe Size -> IO (Maybe Size)
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe Size
forall a. Maybe a
P.Nothing
        
    

-- | Construct a `Size` struct initialized to zero.
newZeroSize :: MonadIO m => m Size
newZeroSize :: forall (m :: * -> *). MonadIO m => m Size
newZeroSize = IO Size -> m Size
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Size -> m Size) -> IO Size -> m Size
forall a b. (a -> b) -> a -> b
$ Int -> IO (Ptr Size)
forall a. GBoxed a => Int -> IO (Ptr a)
callocBoxedBytes Int
8 IO (Ptr Size) -> (Ptr Size -> IO Size) -> IO Size
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr Size -> Size) -> Ptr Size -> IO Size
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Size -> Size
Size

instance tag ~ 'AttrSet => Constructible Size tag where
    new :: forall (m :: * -> *).
MonadIO m =>
(ManagedPtr Size -> Size) -> [AttrOp Size tag] -> m Size
new ManagedPtr Size -> Size
_ [AttrOp Size tag]
attrs = do
        Size
o <- m Size
forall (m :: * -> *). MonadIO m => m Size
newZeroSize
        Size -> [AttrOp Size 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set Size
o [AttrOp Size tag]
[AttrOp Size 'AttrSet]
attrs
        Size -> m Size
forall a. a -> m a
forall (m :: * -> *) a. Monad m => a -> m a
return Size
o


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

-- | Set the value of the “@width@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' size [ #width 'Data.GI.Base.Attributes.:=' value ]
-- @
setSizeWidth :: MonadIO m => Size -> Float -> m ()
setSizeWidth :: forall (m :: * -> *). MonadIO m => Size -> Float -> m ()
setSizeWidth Size
s Float
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
$ Size -> (Ptr Size -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Size
s ((Ptr Size -> IO ()) -> IO ()) -> (Ptr Size -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Size
ptr -> do
    let val' :: CFloat
val' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
val
    Ptr CFloat -> CFloat -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Size
ptr Ptr Size -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) (CFloat
val' :: CFloat)

#if defined(ENABLE_OVERLOADING)
data SizeWidthFieldInfo
instance AttrInfo SizeWidthFieldInfo where
    type AttrBaseTypeConstraint SizeWidthFieldInfo = (~) Size
    type AttrAllowedOps SizeWidthFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint SizeWidthFieldInfo = (~) Float
    type AttrTransferTypeConstraint SizeWidthFieldInfo = (~)Float
    type AttrTransferType SizeWidthFieldInfo = Float
    type AttrGetType SizeWidthFieldInfo = Float
    type AttrLabel SizeWidthFieldInfo = "width"
    type AttrOrigin SizeWidthFieldInfo = Size
    attrGet = getSizeWidth
    attrSet = setSizeWidth
    attrConstruct = undefined
    attrClear = undefined
    attrTransfer _ v = do
        return v
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Clutter.Structs.Size.width"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-clutter-1.0.3/docs/GI-Clutter-Structs-Size.html#g:attr:width"
        })

size_width :: AttrLabelProxy "width"
size_width = AttrLabelProxy

#endif


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

-- | Set the value of the “@height@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' size [ #height 'Data.GI.Base.Attributes.:=' value ]
-- @
setSizeHeight :: MonadIO m => Size -> Float -> m ()
setSizeHeight :: forall (m :: * -> *). MonadIO m => Size -> Float -> m ()
setSizeHeight Size
s Float
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
$ Size -> (Ptr Size -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr Size
s ((Ptr Size -> IO ()) -> IO ()) -> (Ptr Size -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr Size
ptr -> do
    let val' :: CFloat
val' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
val
    Ptr CFloat -> CFloat -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr Size
ptr Ptr Size -> Int -> Ptr CFloat
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4) (CFloat
val' :: CFloat)

#if defined(ENABLE_OVERLOADING)
data SizeHeightFieldInfo
instance AttrInfo SizeHeightFieldInfo where
    type AttrBaseTypeConstraint SizeHeightFieldInfo = (~) Size
    type AttrAllowedOps SizeHeightFieldInfo = '[ 'AttrSet, 'AttrGet]
    type AttrSetTypeConstraint SizeHeightFieldInfo = (~) Float
    type AttrTransferTypeConstraint SizeHeightFieldInfo = (~)Float
    type AttrTransferType SizeHeightFieldInfo = Float
    type AttrGetType SizeHeightFieldInfo = Float
    type AttrLabel SizeHeightFieldInfo = "height"
    type AttrOrigin SizeHeightFieldInfo = Size
    attrGet = getSizeHeight
    attrSet = setSizeHeight
    attrConstruct = undefined
    attrClear = undefined
    attrTransfer _ v = do
        return v
    dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Clutter.Structs.Size.height"
        , O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-clutter-1.0.3/docs/GI-Clutter-Structs-Size.html#g:attr:height"
        })

size_height :: AttrLabelProxy "height"
size_height = AttrLabelProxy

#endif



#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList Size
type instance O.AttributeList Size = SizeAttributeList
type SizeAttributeList = ('[ '("width", SizeWidthFieldInfo), '("height", SizeHeightFieldInfo)] :: [(Symbol, *)])
#endif

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

foreign import ccall "clutter_size_alloc" clutter_size_alloc :: 
    IO (Ptr Size)

-- | Allocates a new t'GI.Clutter.Structs.Size.Size'.
-- 
-- /Since: 1.12/
sizeAlloc ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    m Size
    -- ^ __Returns:__ the newly allocated t'GI.Clutter.Structs.Size.Size'.
    --   Use 'GI.Clutter.Structs.Size.sizeFree' to free its resources.
sizeAlloc :: forall (m :: * -> *). (HasCallStack, MonadIO m) => m Size
sizeAlloc  = IO Size -> m Size
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Size -> m Size) -> IO Size -> m Size
forall a b. (a -> b) -> a -> b
$ do
    Ptr Size
result <- IO (Ptr Size)
clutter_size_alloc
    Text -> Ptr Size -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"sizeAlloc" Ptr Size
result
    Size
result' <- ((ManagedPtr Size -> Size) -> Ptr Size -> IO Size
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Size -> Size
Size) Ptr Size
result
    Size -> IO Size
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Size
result'

#if defined(ENABLE_OVERLOADING)
#endif

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

foreign import ccall "clutter_size_copy" clutter_size_copy :: 
    Ptr Size ->                             -- size : TInterface (Name {namespace = "Clutter", name = "Size"})
    IO (Ptr Size)

-- | Creates a new t'GI.Clutter.Structs.Size.Size' and duplicates /@size@/.
-- 
-- /Since: 1.12/
sizeCopy ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Size
    -- ^ /@size@/: a t'GI.Clutter.Structs.Size.Size'
    -> m Size
    -- ^ __Returns:__ the newly allocated t'GI.Clutter.Structs.Size.Size'.
    --   Use 'GI.Clutter.Structs.Size.sizeFree' to free its resources.
sizeCopy :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Size -> m Size
sizeCopy Size
size = IO Size -> m Size
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Size -> m Size) -> IO Size -> m Size
forall a b. (a -> b) -> a -> b
$ do
    Ptr Size
size' <- Size -> IO (Ptr Size)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Size
size
    Ptr Size
result <- Ptr Size -> IO (Ptr Size)
clutter_size_copy Ptr Size
size'
    Text -> Ptr Size -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"sizeCopy" Ptr Size
result
    Size
result' <- ((ManagedPtr Size -> Size) -> Ptr Size -> IO Size
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapBoxed ManagedPtr Size -> Size
Size) Ptr Size
result
    Size -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Size
size
    Size -> IO Size
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Size
result'

#if defined(ENABLE_OVERLOADING)
data SizeCopyMethodInfo
instance (signature ~ (m Size), MonadIO m) => O.OverloadedMethod SizeCopyMethodInfo Size signature where
    overloadedMethod = sizeCopy

instance O.OverloadedMethodInfo SizeCopyMethodInfo Size where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Clutter.Structs.Size.sizeCopy",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-clutter-1.0.3/docs/GI-Clutter-Structs-Size.html#v:sizeCopy"
        })


#endif

-- method Size::equals
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "a"
--           , argType =
--               TInterface Name { namespace = "Clutter" , name = "Size" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #ClutterSize to compare"
--                 , sinceVersion = Nothing
--                 }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "b"
--           , argType =
--               TInterface Name { namespace = "Clutter" , name = "Size" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #ClutterSize to compare"
--                 , 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 "clutter_size_equals" clutter_size_equals :: 
    Ptr Size ->                             -- a : TInterface (Name {namespace = "Clutter", name = "Size"})
    Ptr Size ->                             -- b : TInterface (Name {namespace = "Clutter", name = "Size"})
    IO CInt

-- | Compares two t'GI.Clutter.Structs.Size.Size' for equality.
-- 
-- /Since: 1.12/
sizeEquals ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Size
    -- ^ /@a@/: a t'GI.Clutter.Structs.Size.Size' to compare
    -> Size
    -- ^ /@b@/: a t'GI.Clutter.Structs.Size.Size' to compare
    -> m Bool
    -- ^ __Returns:__ 'P.True' if the two t'GI.Clutter.Structs.Size.Size' are equal
sizeEquals :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Size -> Size -> m Bool
sizeEquals Size
a Size
b = 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 Size
a' <- Size -> IO (Ptr Size)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Size
a
    Ptr Size
b' <- Size -> IO (Ptr Size)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Size
b
    CInt
result <- Ptr Size -> Ptr Size -> IO CInt
clutter_size_equals Ptr Size
a' Ptr Size
b'
    let result' :: Bool
result' = (CInt -> CInt -> Bool
forall a. Eq a => a -> a -> Bool
/= CInt
0) CInt
result
    Size -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Size
a
    Size -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Size
b
    Bool -> IO Bool
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Bool
result'

#if defined(ENABLE_OVERLOADING)
data SizeEqualsMethodInfo
instance (signature ~ (Size -> m Bool), MonadIO m) => O.OverloadedMethod SizeEqualsMethodInfo Size signature where
    overloadedMethod = sizeEquals

instance O.OverloadedMethodInfo SizeEqualsMethodInfo Size where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Clutter.Structs.Size.sizeEquals",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-clutter-1.0.3/docs/GI-Clutter-Structs-Size.html#v:sizeEquals"
        })


#endif

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

foreign import ccall "clutter_size_free" clutter_size_free :: 
    Ptr Size ->                             -- size : TInterface (Name {namespace = "Clutter", name = "Size"})
    IO ()

-- | Frees the resources allocated for /@size@/.
-- 
-- /Since: 1.12/
sizeFree ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Size
    -- ^ /@size@/: a t'GI.Clutter.Structs.Size.Size'
    -> m ()
sizeFree :: forall (m :: * -> *). (HasCallStack, MonadIO m) => Size -> m ()
sizeFree Size
size = 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 Size
size' <- Size -> IO (Ptr Size)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Size
size
    Ptr Size -> IO ()
clutter_size_free Ptr Size
size'
    Size -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Size
size
    () -> IO ()
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return ()

#if defined(ENABLE_OVERLOADING)
data SizeFreeMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.OverloadedMethod SizeFreeMethodInfo Size signature where
    overloadedMethod = sizeFree

instance O.OverloadedMethodInfo SizeFreeMethodInfo Size where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Clutter.Structs.Size.sizeFree",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-clutter-1.0.3/docs/GI-Clutter-Structs-Size.html#v:sizeFree"
        })


#endif

-- method Size::init
-- method type : OrdinaryMethod
-- Args: [ Arg
--           { argCName = "size"
--           , argType =
--               TInterface Name { namespace = "Clutter" , name = "Size" }
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "a #ClutterSize" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "width"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the width" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       , Arg
--           { argCName = "height"
--           , argType = TBasicType TFloat
--           , direction = DirectionIn
--           , mayBeNull = False
--           , argDoc =
--               Documentation
--                 { rawDocText = Just "the height" , sinceVersion = Nothing }
--           , argScope = ScopeTypeInvalid
--           , argClosure = -1
--           , argDestroy = -1
--           , argCallerAllocates = False
--           , transfer = TransferNothing
--           }
--       ]
-- Lengths: []
-- returnType: Just (TInterface Name { namespace = "Clutter" , name = "Size" })
-- throws : False
-- Skip return : False

foreign import ccall "clutter_size_init" clutter_size_init :: 
    Ptr Size ->                             -- size : TInterface (Name {namespace = "Clutter", name = "Size"})
    CFloat ->                               -- width : TBasicType TFloat
    CFloat ->                               -- height : TBasicType TFloat
    IO (Ptr Size)

-- | Initializes a t'GI.Clutter.Structs.Size.Size' with the given dimensions.
-- 
-- /Since: 1.12/
sizeInit ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    Size
    -- ^ /@size@/: a t'GI.Clutter.Structs.Size.Size'
    -> Float
    -- ^ /@width@/: the width
    -> Float
    -- ^ /@height@/: the height
    -> m Size
    -- ^ __Returns:__ the initialized t'GI.Clutter.Structs.Size.Size'
sizeInit :: forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
Size -> Float -> Float -> m Size
sizeInit Size
size Float
width Float
height = IO Size -> m Size
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO Size -> m Size) -> IO Size -> m Size
forall a b. (a -> b) -> a -> b
$ do
    Ptr Size
size' <- Size -> IO (Ptr Size)
forall a. (HasCallStack, ManagedPtrNewtype a) => a -> IO (Ptr a)
unsafeManagedPtrGetPtr Size
size
    let width' :: CFloat
width' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
width
    let height' :: CFloat
height' = Float -> CFloat
forall a b. (Real a, Fractional b) => a -> b
realToFrac Float
height
    Ptr Size
result <- Ptr Size -> CFloat -> CFloat -> IO (Ptr Size)
clutter_size_init Ptr Size
size' CFloat
width' CFloat
height'
    Text -> Ptr Size -> IO ()
forall a. HasCallStack => Text -> Ptr a -> IO ()
checkUnexpectedReturnNULL Text
"sizeInit" Ptr Size
result
    Size
result' <- ((ManagedPtr Size -> Size) -> Ptr Size -> IO Size
forall a.
(HasCallStack, GBoxed a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
newBoxed ManagedPtr Size -> Size
Size) Ptr Size
result
    Size -> IO ()
forall a. ManagedPtrNewtype a => a -> IO ()
touchManagedPtr Size
size
    Size -> IO Size
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Size
result'

#if defined(ENABLE_OVERLOADING)
data SizeInitMethodInfo
instance (signature ~ (Float -> Float -> m Size), MonadIO m) => O.OverloadedMethod SizeInitMethodInfo Size signature where
    overloadedMethod = sizeInit

instance O.OverloadedMethodInfo SizeInitMethodInfo Size where
    overloadedMethodInfo = P.Just (O.ResolvedSymbolInfo {
        O.resolvedSymbolName = "GI.Clutter.Structs.Size.sizeInit",
        O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-clutter-1.0.3/docs/GI-Clutter-Structs-Size.html#v:sizeInit"
        })


#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveSizeMethod (t :: Symbol) (o :: *) :: * where
    ResolveSizeMethod "copy" o = SizeCopyMethodInfo
    ResolveSizeMethod "equals" o = SizeEqualsMethodInfo
    ResolveSizeMethod "free" o = SizeFreeMethodInfo
    ResolveSizeMethod "init" o = SizeInitMethodInfo
    ResolveSizeMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveSizeMethod t Size, O.OverloadedMethod info Size p) => OL.IsLabel t (Size -> 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 ~ ResolveSizeMethod t Size, O.OverloadedMethod info Size p, R.HasField t Size p) => R.HasField t Size p where
    getField = O.overloadedMethod @info

#endif

instance (info ~ ResolveSizeMethod t Size, O.OverloadedMethodInfo info Size) => OL.IsLabel t (O.MethodProxy info Size) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.MethodProxy
#else
    fromLabel _ = O.MethodProxy
#endif

#endif