{-# LANGUAGE TypeApplications #-}


-- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
-- License    : LGPL-2.1
-- Maintainer : Iñaki García Etxebarria
-- 
-- The t'GI.Pango.Structs.IncludedModule.IncludedModule' structure for a statically linked module
-- contains the functions that would otherwise be loaded from a dynamically
-- loaded module.

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

module GI.Pango.Structs.IncludedModule
    (

-- * Exported types
    IncludedModule(..)                      ,
    newZeroIncludedModule                   ,
    noIncludedModule                        ,


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

#if defined(ENABLE_OVERLOADING)
    ResolveIncludedModuleMethod             ,
#endif




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

    clearIncludedModuleExit                 ,
    getIncludedModuleExit                   ,
#if defined(ENABLE_OVERLOADING)
    includedModule_exit                     ,
#endif
    setIncludedModuleExit                   ,


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

    clearIncludedModuleInit                 ,
    getIncludedModuleInit                   ,
#if defined(ENABLE_OVERLOADING)
    includedModule_init                     ,
#endif
    setIncludedModuleInit                   ,


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

    clearIncludedModuleList                 ,
    getIncludedModuleList                   ,
#if defined(ENABLE_OVERLOADING)
    includedModule_list                     ,
#endif
    setIncludedModuleList                   ,




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

-- | Memory-managed wrapper type.
newtype IncludedModule = IncludedModule (ManagedPtr IncludedModule)
    deriving (Eq)
instance WrappedPtr IncludedModule where
    wrappedPtrCalloc = callocBytes 16
    wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 16 >=> wrapPtr IncludedModule)
    wrappedPtrFree = Just ptr_to_g_free

-- | Construct a `IncludedModule` struct initialized to zero.
newZeroIncludedModule :: MonadIO m => m IncludedModule
newZeroIncludedModule = liftIO $ wrappedPtrCalloc >>= wrapPtr IncludedModule

instance tag ~ 'AttrSet => Constructible IncludedModule tag where
    new _ attrs = do
        o <- newZeroIncludedModule
        GI.Attributes.set o attrs
        return o


-- | A convenience alias for `Nothing` :: `Maybe` `IncludedModule`.
noIncludedModule :: Maybe IncludedModule
noIncludedModule = Nothing

-- | Get the value of the “@list@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' includedModule #list
-- @
getIncludedModuleList :: MonadIO m => IncludedModule -> m (Maybe Pango.Callbacks.IncludedModuleListFieldCallback)
getIncludedModuleList s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 0) :: IO (FunPtr Pango.Callbacks.C_IncludedModuleListFieldCallback)
    result <- SP.convertFunPtrIfNonNull val $ \val' -> do
        let val'' = Pango.Callbacks.dynamic_IncludedModuleListFieldCallback val'
        return val''
    return result

-- | Set the value of the “@list@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' includedModule [ #list 'Data.GI.Base.Attributes.:=' value ]
-- @
setIncludedModuleList :: MonadIO m => IncludedModule -> FunPtr Pango.Callbacks.C_IncludedModuleListFieldCallback -> m ()
setIncludedModuleList s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 0) (val :: FunPtr Pango.Callbacks.C_IncludedModuleListFieldCallback)

-- | Set the value of the “@list@” 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' #list
-- @
clearIncludedModuleList :: MonadIO m => IncludedModule -> m ()
clearIncludedModuleList s = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 0) (FP.nullFunPtr :: FunPtr Pango.Callbacks.C_IncludedModuleListFieldCallback)

#if defined(ENABLE_OVERLOADING)
data IncludedModuleListFieldInfo
instance AttrInfo IncludedModuleListFieldInfo where
    type AttrBaseTypeConstraint IncludedModuleListFieldInfo = (~) IncludedModule
    type AttrAllowedOps IncludedModuleListFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint IncludedModuleListFieldInfo = (~) (FunPtr Pango.Callbacks.C_IncludedModuleListFieldCallback)
    type AttrTransferTypeConstraint IncludedModuleListFieldInfo = (~)Pango.Callbacks.IncludedModuleListFieldCallback
    type AttrTransferType IncludedModuleListFieldInfo = (FunPtr Pango.Callbacks.C_IncludedModuleListFieldCallback)
    type AttrGetType IncludedModuleListFieldInfo = Maybe Pango.Callbacks.IncludedModuleListFieldCallback
    type AttrLabel IncludedModuleListFieldInfo = "list"
    type AttrOrigin IncludedModuleListFieldInfo = IncludedModule
    attrGet = getIncludedModuleList
    attrSet = setIncludedModuleList
    attrConstruct = undefined
    attrClear = clearIncludedModuleList
    attrTransfer _ v = do
        Pango.Callbacks.mk_IncludedModuleListFieldCallback (Pango.Callbacks.wrap_IncludedModuleListFieldCallback Nothing v)

includedModule_list :: AttrLabelProxy "list"
includedModule_list = AttrLabelProxy

#endif


-- | Get the value of the “@init@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' includedModule #init
-- @
getIncludedModuleInit :: MonadIO m => IncludedModule -> m (Maybe Pango.Callbacks.IncludedModuleInitFieldCallback)
getIncludedModuleInit s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 4) :: IO (FunPtr Pango.Callbacks.C_IncludedModuleInitFieldCallback)
    result <- SP.convertFunPtrIfNonNull val $ \val' -> do
        let val'' = Pango.Callbacks.dynamic_IncludedModuleInitFieldCallback val'
        return val''
    return result

-- | Set the value of the “@init@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' includedModule [ #init 'Data.GI.Base.Attributes.:=' value ]
-- @
setIncludedModuleInit :: MonadIO m => IncludedModule -> FunPtr Pango.Callbacks.C_IncludedModuleInitFieldCallback -> m ()
setIncludedModuleInit s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 4) (val :: FunPtr Pango.Callbacks.C_IncludedModuleInitFieldCallback)

-- | Set the value of the “@init@” 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' #init
-- @
clearIncludedModuleInit :: MonadIO m => IncludedModule -> m ()
clearIncludedModuleInit s = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 4) (FP.nullFunPtr :: FunPtr Pango.Callbacks.C_IncludedModuleInitFieldCallback)

#if defined(ENABLE_OVERLOADING)
data IncludedModuleInitFieldInfo
instance AttrInfo IncludedModuleInitFieldInfo where
    type AttrBaseTypeConstraint IncludedModuleInitFieldInfo = (~) IncludedModule
    type AttrAllowedOps IncludedModuleInitFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint IncludedModuleInitFieldInfo = (~) (FunPtr Pango.Callbacks.C_IncludedModuleInitFieldCallback)
    type AttrTransferTypeConstraint IncludedModuleInitFieldInfo = (~)Pango.Callbacks.IncludedModuleInitFieldCallback
    type AttrTransferType IncludedModuleInitFieldInfo = (FunPtr Pango.Callbacks.C_IncludedModuleInitFieldCallback)
    type AttrGetType IncludedModuleInitFieldInfo = Maybe Pango.Callbacks.IncludedModuleInitFieldCallback
    type AttrLabel IncludedModuleInitFieldInfo = "init"
    type AttrOrigin IncludedModuleInitFieldInfo = IncludedModule
    attrGet = getIncludedModuleInit
    attrSet = setIncludedModuleInit
    attrConstruct = undefined
    attrClear = clearIncludedModuleInit
    attrTransfer _ v = do
        Pango.Callbacks.mk_IncludedModuleInitFieldCallback (Pango.Callbacks.wrap_IncludedModuleInitFieldCallback Nothing v)

includedModule_init :: AttrLabelProxy "init"
includedModule_init = AttrLabelProxy

#endif


-- | Get the value of the “@exit@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.get' includedModule #exit
-- @
getIncludedModuleExit :: MonadIO m => IncludedModule -> m (Maybe Pango.Callbacks.IncludedModuleExitFieldCallback)
getIncludedModuleExit s = liftIO $ withManagedPtr s $ \ptr -> do
    val <- peek (ptr `plusPtr` 8) :: IO (FunPtr Pango.Callbacks.C_IncludedModuleExitFieldCallback)
    result <- SP.convertFunPtrIfNonNull val $ \val' -> do
        let val'' = Pango.Callbacks.dynamic_IncludedModuleExitFieldCallback val'
        return val''
    return result

-- | Set the value of the “@exit@” field.
-- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
-- 
-- @
-- 'Data.GI.Base.Attributes.set' includedModule [ #exit 'Data.GI.Base.Attributes.:=' value ]
-- @
setIncludedModuleExit :: MonadIO m => IncludedModule -> FunPtr Pango.Callbacks.C_IncludedModuleExitFieldCallback -> m ()
setIncludedModuleExit s val = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 8) (val :: FunPtr Pango.Callbacks.C_IncludedModuleExitFieldCallback)

-- | Set the value of the “@exit@” 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' #exit
-- @
clearIncludedModuleExit :: MonadIO m => IncludedModule -> m ()
clearIncludedModuleExit s = liftIO $ withManagedPtr s $ \ptr -> do
    poke (ptr `plusPtr` 8) (FP.nullFunPtr :: FunPtr Pango.Callbacks.C_IncludedModuleExitFieldCallback)

#if defined(ENABLE_OVERLOADING)
data IncludedModuleExitFieldInfo
instance AttrInfo IncludedModuleExitFieldInfo where
    type AttrBaseTypeConstraint IncludedModuleExitFieldInfo = (~) IncludedModule
    type AttrAllowedOps IncludedModuleExitFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
    type AttrSetTypeConstraint IncludedModuleExitFieldInfo = (~) (FunPtr Pango.Callbacks.C_IncludedModuleExitFieldCallback)
    type AttrTransferTypeConstraint IncludedModuleExitFieldInfo = (~)Pango.Callbacks.IncludedModuleExitFieldCallback
    type AttrTransferType IncludedModuleExitFieldInfo = (FunPtr Pango.Callbacks.C_IncludedModuleExitFieldCallback)
    type AttrGetType IncludedModuleExitFieldInfo = Maybe Pango.Callbacks.IncludedModuleExitFieldCallback
    type AttrLabel IncludedModuleExitFieldInfo = "exit"
    type AttrOrigin IncludedModuleExitFieldInfo = IncludedModule
    attrGet = getIncludedModuleExit
    attrSet = setIncludedModuleExit
    attrConstruct = undefined
    attrClear = clearIncludedModuleExit
    attrTransfer _ v = do
        Pango.Callbacks.mk_IncludedModuleExitFieldCallback (Pango.Callbacks.wrap_IncludedModuleExitFieldCallback Nothing v)

includedModule_exit :: AttrLabelProxy "exit"
includedModule_exit = AttrLabelProxy

#endif



#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList IncludedModule
type instance O.AttributeList IncludedModule = IncludedModuleAttributeList
type IncludedModuleAttributeList = ('[ '("list", IncludedModuleListFieldInfo), '("init", IncludedModuleInitFieldInfo), '("exit", IncludedModuleExitFieldInfo)] :: [(Symbol, *)])
#endif

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

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

#endif