{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- /No description available in the introspection data./

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

module GI.GObject.Structs.ClosureNotifyData
    ( 

-- * Exported types
    ClosureNotifyData(..)                   ,
    newZeroClosureNotifyData                ,


 -- * Methods
-- ** Overloaded methods #method:Overloaded methods#

#if defined(ENABLE_OVERLOADING)
    ResolveClosureNotifyDataMethod          ,
#endif




 -- * Properties
-- ** data #attr:data#
-- | /No description available in the introspection data./

    clearClosureNotifyDataData              ,
#if defined(ENABLE_OVERLOADING)
    closureNotifyData_data                  ,
#endif
    getClosureNotifyDataData                ,
    setClosureNotifyDataData                ,


-- ** notify #attr:notify#
-- | /No description available in the introspection data./

    clearClosureNotifyDataNotify            ,
#if defined(ENABLE_OVERLOADING)
    closureNotifyData_notify                ,
#endif
    getClosureNotifyDataNotify              ,
    setClosureNotifyDataNotify              ,




    ) 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.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.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 GI.GObject.Callbacks as GObject.Callbacks

-- | Memory-managed wrapper type.
newtype ClosureNotifyData = ClosureNotifyData (SP.ManagedPtr ClosureNotifyData)
    deriving (ClosureNotifyData -> ClosureNotifyData -> Bool
(ClosureNotifyData -> ClosureNotifyData -> Bool)
-> (ClosureNotifyData -> ClosureNotifyData -> Bool)
-> Eq ClosureNotifyData
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ClosureNotifyData -> ClosureNotifyData -> Bool
$c/= :: ClosureNotifyData -> ClosureNotifyData -> Bool
== :: ClosureNotifyData -> ClosureNotifyData -> Bool
$c== :: ClosureNotifyData -> ClosureNotifyData -> Bool
Eq)

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

instance BoxedPtr ClosureNotifyData where
    boxedPtrCopy :: ClosureNotifyData -> IO ClosureNotifyData
boxedPtrCopy = \ClosureNotifyData
p -> ClosureNotifyData
-> (Ptr ClosureNotifyData -> IO ClosureNotifyData)
-> IO ClosureNotifyData
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr ClosureNotifyData
p (Int -> Ptr ClosureNotifyData -> IO (Ptr ClosureNotifyData)
forall a. (HasCallStack, CallocPtr a) => Int -> Ptr a -> IO (Ptr a)
copyBytes Int
16 (Ptr ClosureNotifyData -> IO (Ptr ClosureNotifyData))
-> (Ptr ClosureNotifyData -> IO ClosureNotifyData)
-> Ptr ClosureNotifyData
-> IO ClosureNotifyData
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> (ManagedPtr ClosureNotifyData -> ClosureNotifyData)
-> Ptr ClosureNotifyData -> IO ClosureNotifyData
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.wrapPtr ManagedPtr ClosureNotifyData -> ClosureNotifyData
ClosureNotifyData)
    boxedPtrFree :: ClosureNotifyData -> IO ()
boxedPtrFree = \ClosureNotifyData
x -> ClosureNotifyData -> (Ptr ClosureNotifyData -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
SP.withManagedPtr ClosureNotifyData
x Ptr ClosureNotifyData -> IO ()
forall a. Ptr a -> IO ()
SP.freeMem
instance CallocPtr ClosureNotifyData where
    boxedPtrCalloc :: IO (Ptr ClosureNotifyData)
boxedPtrCalloc = Int -> IO (Ptr ClosureNotifyData)
forall a. Int -> IO (Ptr a)
callocBytes Int
16


-- | Construct a `ClosureNotifyData` struct initialized to zero.
newZeroClosureNotifyData :: MonadIO m => m ClosureNotifyData
newZeroClosureNotifyData :: m ClosureNotifyData
newZeroClosureNotifyData = IO ClosureNotifyData -> m ClosureNotifyData
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO ClosureNotifyData -> m ClosureNotifyData)
-> IO ClosureNotifyData -> m ClosureNotifyData
forall a b. (a -> b) -> a -> b
$ IO (Ptr ClosureNotifyData)
forall a. CallocPtr a => IO (Ptr a)
boxedPtrCalloc IO (Ptr ClosureNotifyData)
-> (Ptr ClosureNotifyData -> IO ClosureNotifyData)
-> IO ClosureNotifyData
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr ClosureNotifyData -> ClosureNotifyData)
-> Ptr ClosureNotifyData -> IO ClosureNotifyData
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr ClosureNotifyData -> ClosureNotifyData
ClosureNotifyData

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


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

-- | Set the value of the “@data@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' closureNotifyData [ #data 'Data.GI.Base.Attributes.:=' value ]
-- @
setClosureNotifyDataData :: MonadIO m => ClosureNotifyData -> Ptr () -> m ()
setClosureNotifyDataData :: ClosureNotifyData -> Ptr () -> m ()
setClosureNotifyDataData ClosureNotifyData
s Ptr ()
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ ClosureNotifyData -> (Ptr ClosureNotifyData -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr ClosureNotifyData
s ((Ptr ClosureNotifyData -> IO ()) -> IO ())
-> (Ptr ClosureNotifyData -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr ClosureNotifyData
ptr -> do
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr ClosureNotifyData
ptr Ptr ClosureNotifyData -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) (Ptr ()
val :: Ptr ())

-- | Set the value of the “@data@” field to `Nothing`.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.clear' #data
-- @
clearClosureNotifyDataData :: MonadIO m => ClosureNotifyData -> m ()
clearClosureNotifyDataData :: ClosureNotifyData -> m ()
clearClosureNotifyDataData ClosureNotifyData
s = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ ClosureNotifyData -> (Ptr ClosureNotifyData -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr ClosureNotifyData
s ((Ptr ClosureNotifyData -> IO ()) -> IO ())
-> (Ptr ClosureNotifyData -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr ClosureNotifyData
ptr -> do
    Ptr (Ptr ()) -> Ptr () -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr ClosureNotifyData
ptr Ptr ClosureNotifyData -> Int -> Ptr (Ptr ())
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) (Ptr ()
forall a. Ptr a
FP.nullPtr :: Ptr ())

#if defined(ENABLE_OVERLOADING)
data ClosureNotifyDataDataFieldInfo
instance AttrInfo ClosureNotifyDataDataFieldInfo where
    type AttrBaseTypeConstraint ClosureNotifyDataDataFieldInfo = (~) ClosureNotifyData
    type AttrAllowedOps ClosureNotifyDataDataFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint ClosureNotifyDataDataFieldInfo = (~) (Ptr ())
    type AttrTransferTypeConstraint ClosureNotifyDataDataFieldInfo = (~)(Ptr ())
    type AttrTransferType ClosureNotifyDataDataFieldInfo = (Ptr ())
    type AttrGetType ClosureNotifyDataDataFieldInfo = Ptr ()
    type AttrLabel ClosureNotifyDataDataFieldInfo = "data"
    type AttrOrigin ClosureNotifyDataDataFieldInfo = ClosureNotifyData
    attrGet = getClosureNotifyDataData
    attrSet = setClosureNotifyDataData
    attrConstruct = undefined
    attrClear = clearClosureNotifyDataData
    attrTransfer _ v = do
        return v

closureNotifyData_data :: AttrLabelProxy "data"
closureNotifyData_data = AttrLabelProxy

#endif


-- | Get the value of the “@notify@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' closureNotifyData #notify
-- @
getClosureNotifyDataNotify :: MonadIO m => ClosureNotifyData -> m (Maybe GObject.Callbacks.ClosureNotify)
getClosureNotifyDataNotify :: ClosureNotifyData -> m (Maybe ClosureNotify)
getClosureNotifyDataNotify ClosureNotifyData
s = IO (Maybe ClosureNotify) -> m (Maybe ClosureNotify)
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO (Maybe ClosureNotify) -> m (Maybe ClosureNotify))
-> IO (Maybe ClosureNotify) -> m (Maybe ClosureNotify)
forall a b. (a -> b) -> a -> b
$ ClosureNotifyData
-> (Ptr ClosureNotifyData -> IO (Maybe ClosureNotify))
-> IO (Maybe ClosureNotify)
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr ClosureNotifyData
s ((Ptr ClosureNotifyData -> IO (Maybe ClosureNotify))
 -> IO (Maybe ClosureNotify))
-> (Ptr ClosureNotifyData -> IO (Maybe ClosureNotify))
-> IO (Maybe ClosureNotify)
forall a b. (a -> b) -> a -> b
$ \Ptr ClosureNotifyData
ptr -> do
    FunPtr C_ClosureNotify
val <- Ptr (FunPtr C_ClosureNotify) -> IO (FunPtr C_ClosureNotify)
forall a. Storable a => Ptr a -> IO a
peek (Ptr ClosureNotifyData
ptr Ptr ClosureNotifyData -> Int -> Ptr (FunPtr C_ClosureNotify)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) :: IO (FunPtr GObject.Callbacks.C_ClosureNotify)
    Maybe ClosureNotify
result <- FunPtr C_ClosureNotify
-> (FunPtr C_ClosureNotify -> IO ClosureNotify)
-> IO (Maybe ClosureNotify)
forall a b. FunPtr a -> (FunPtr a -> IO b) -> IO (Maybe b)
SP.convertFunPtrIfNonNull FunPtr C_ClosureNotify
val ((FunPtr C_ClosureNotify -> IO ClosureNotify)
 -> IO (Maybe ClosureNotify))
-> (FunPtr C_ClosureNotify -> IO ClosureNotify)
-> IO (Maybe ClosureNotify)
forall a b. (a -> b) -> a -> b
$ \FunPtr C_ClosureNotify
val' -> do
        let val'' :: ClosureNotify
val'' = FunPtr C_ClosureNotify -> ClosureNotify
forall (m :: * -> *) a.
(HasCallStack, MonadIO m) =>
FunPtr C_ClosureNotify -> Ptr () -> GClosure a -> m ()
GObject.Callbacks.dynamic_ClosureNotify FunPtr C_ClosureNotify
val'
        ClosureNotify -> IO ClosureNotify
forall (m :: * -> *) a. Monad m => a -> m a
return ClosureNotify
val''
    Maybe ClosureNotify -> IO (Maybe ClosureNotify)
forall (m :: * -> *) a. Monad m => a -> m a
return Maybe ClosureNotify
result

-- | Set the value of the “@notify@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' closureNotifyData [ #notify 'Data.GI.Base.Attributes.:=' value ]
-- @
setClosureNotifyDataNotify :: MonadIO m => ClosureNotifyData -> FunPtr GObject.Callbacks.C_ClosureNotify -> m ()
setClosureNotifyDataNotify :: ClosureNotifyData -> FunPtr C_ClosureNotify -> m ()
setClosureNotifyDataNotify ClosureNotifyData
s FunPtr C_ClosureNotify
val = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ ClosureNotifyData -> (Ptr ClosureNotifyData -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr ClosureNotifyData
s ((Ptr ClosureNotifyData -> IO ()) -> IO ())
-> (Ptr ClosureNotifyData -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr ClosureNotifyData
ptr -> do
    Ptr (FunPtr C_ClosureNotify) -> FunPtr C_ClosureNotify -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr ClosureNotifyData
ptr Ptr ClosureNotifyData -> Int -> Ptr (FunPtr C_ClosureNotify)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) (FunPtr C_ClosureNotify
val :: FunPtr GObject.Callbacks.C_ClosureNotify)

-- | Set the value of the “@notify@” field to `Nothing`.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.clear' #notify
-- @
clearClosureNotifyDataNotify :: MonadIO m => ClosureNotifyData -> m ()
clearClosureNotifyDataNotify :: ClosureNotifyData -> m ()
clearClosureNotifyDataNotify ClosureNotifyData
s = IO () -> m ()
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ ClosureNotifyData -> (Ptr ClosureNotifyData -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr ClosureNotifyData
s ((Ptr ClosureNotifyData -> IO ()) -> IO ())
-> (Ptr ClosureNotifyData -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr ClosureNotifyData
ptr -> do
    Ptr (FunPtr C_ClosureNotify) -> FunPtr C_ClosureNotify -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr ClosureNotifyData
ptr Ptr ClosureNotifyData -> Int -> Ptr (FunPtr C_ClosureNotify)
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) (FunPtr C_ClosureNotify
forall a. FunPtr a
FP.nullFunPtr :: FunPtr GObject.Callbacks.C_ClosureNotify)

#if defined(ENABLE_OVERLOADING)
data ClosureNotifyDataNotifyFieldInfo
instance AttrInfo ClosureNotifyDataNotifyFieldInfo where
    type AttrBaseTypeConstraint ClosureNotifyDataNotifyFieldInfo = (~) ClosureNotifyData
    type AttrAllowedOps ClosureNotifyDataNotifyFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint ClosureNotifyDataNotifyFieldInfo = (~) (FunPtr GObject.Callbacks.C_ClosureNotify)
    type AttrTransferTypeConstraint ClosureNotifyDataNotifyFieldInfo = (~)GObject.Callbacks.ClosureNotify
    type AttrTransferType ClosureNotifyDataNotifyFieldInfo = (FunPtr GObject.Callbacks.C_ClosureNotify)
    type AttrGetType ClosureNotifyDataNotifyFieldInfo = Maybe GObject.Callbacks.ClosureNotify
    type AttrLabel ClosureNotifyDataNotifyFieldInfo = "notify"
    type AttrOrigin ClosureNotifyDataNotifyFieldInfo = ClosureNotifyData
    attrGet = getClosureNotifyDataNotify
    attrSet = setClosureNotifyDataNotify
    attrConstruct = undefined
    attrClear = clearClosureNotifyDataNotify
    attrTransfer _ v = do
        GObject.Callbacks.mk_ClosureNotify (GObject.Callbacks.wrap_ClosureNotify Nothing v)

closureNotifyData_notify :: AttrLabelProxy "notify"
closureNotifyData_notify = AttrLabelProxy

#endif



#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList ClosureNotifyData
type instance O.AttributeList ClosureNotifyData = ClosureNotifyDataAttributeList
type ClosureNotifyDataAttributeList = ('[ '("data", ClosureNotifyDataDataFieldInfo), '("notify", ClosureNotifyDataNotifyFieldInfo)] :: [(Symbol, *)])
#endif

#if defined(ENABLE_OVERLOADING)
type family ResolveClosureNotifyDataMethod (t :: Symbol) (o :: *) :: * where
    ResolveClosureNotifyDataMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveClosureNotifyDataMethod t ClosureNotifyData, O.MethodInfo info ClosureNotifyData p) => OL.IsLabel t (ClosureNotifyData -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod @info
#else
    fromLabel _ = O.overloadedMethod @info
#endif

#endif