{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (garetxe@gmail.com)

/No description available in the introspection data./
-}

#define ENABLE_OVERLOADING \
       (!defined(__HADDOCK_VERSION__))

module GI.GObject.Structs.ClosureNotifyData
    ( 

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


 -- * Properties
-- ** data #attr:data#
{- | /No description available in the introspection data./
-}
    clearClosureNotifyDataData              ,
#if ENABLE_OVERLOADING
    closureNotifyData_data                  ,
#endif
    getClosureNotifyDataData                ,
    setClosureNotifyDataData                ,


-- ** notify #attr:notify#
{- | /No description available in the introspection data./
-}
    clearClosureNotifyDataNotify            ,
#if 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.ManagedPtr as B.ManagedPtr
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.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP

import qualified GI.GObject.Callbacks as GObject.Callbacks

-- | Memory-managed wrapper type.
newtype ClosureNotifyData = ClosureNotifyData (ManagedPtr ClosureNotifyData)
instance WrappedPtr ClosureNotifyData where
    wrappedPtrCalloc :: IO (Ptr ClosureNotifyData)
wrappedPtrCalloc = Int -> IO (Ptr ClosureNotifyData)
forall a. Int -> IO (Ptr a)
callocBytes 16
    wrappedPtrCopy :: ClosureNotifyData -> IO ClosureNotifyData
wrappedPtrCopy = \p :: ClosureNotifyData
p -> ClosureNotifyData
-> (Ptr ClosureNotifyData -> IO ClosureNotifyData)
-> IO ClosureNotifyData
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr ClosureNotifyData
p (Int -> Ptr ClosureNotifyData -> IO (Ptr ClosureNotifyData)
forall a. WrappedPtr a => Int -> Ptr a -> IO (Ptr a)
copyBytes 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, WrappedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr ClosureNotifyData -> ClosureNotifyData
ClosureNotifyData)
    wrappedPtrFree :: Maybe (FunPtr (Ptr ClosureNotifyData -> IO ()))
wrappedPtrFree = FunPtr (Ptr ClosureNotifyData -> IO ())
-> Maybe (FunPtr (Ptr ClosureNotifyData -> IO ()))
forall a. a -> Maybe a
Just FunPtr (Ptr ClosureNotifyData -> IO ())
forall a. FunPtr (Ptr a -> IO ())
ptr_to_g_free

-- | 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. WrappedPtr a => IO (Ptr a)
wrappedPtrCalloc 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, WrappedPtr 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 _ attrs :: [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


-- | A convenience alias for `Nothing` :: `Maybe` `ClosureNotifyData`.
noClosureNotifyData :: Maybe ClosureNotifyData
noClosureNotifyData :: Maybe ClosureNotifyData
noClosureNotifyData = Maybe ClosureNotifyData
forall a. Maybe a
Nothing

{- |
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 s :: 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 :: 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` 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 s :: ClosureNotifyData
s val :: 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 :: 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` 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 s :: 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 :: 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` 0) (Ptr ()
forall a. Ptr a
FP.nullPtr :: Ptr ())

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

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 s :: 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 :: 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` 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
$ \val' :: FunPtr C_ClosureNotify
val' -> do
        let val'' :: ClosureNotify
val'' = FunPtr C_ClosureNotify -> ClosureNotify
forall (m :: * -> *).
(HasCallStack, MonadIO m) =>
FunPtr C_ClosureNotify -> Ptr () -> Closure -> 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 s :: ClosureNotifyData
s val :: 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 :: 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` 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 s :: 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 :: 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` 8) (FunPtr C_ClosureNotify
forall a. FunPtr a
FP.nullFunPtr :: FunPtr GObject.Callbacks.C_ClosureNotify)

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

closureNotifyData_notify :: AttrLabelProxy "notify"
closureNotifyData_notify = AttrLabelProxy

#endif



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

#if 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) => O.IsLabelProxy t (ClosureNotifyData -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

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

#endif