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

    The 'GI.Pango.Structs.IncludedModule.IncludedModule' structure for a statically linked module
    contains the functions that would otherwise be loaded from a dynamically
    loaded module.
    -}

    #define ENABLE_OVERLOADING \
           (!defined(__HADDOCK_VERSION__))

    module GI.Pango.Structs.IncludedModule
        (

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

     -- * Properties
    -- ** exit #attr:exit#
    {- | /No description available in the introspection data./
    -}
        clearIncludedModuleExit                 ,
        getIncludedModuleExit                   ,
    #if ENABLE_OVERLOADING
        includedModule_exit                     ,
    #endif
        setIncludedModuleExit                   ,

    -- ** init #attr:init#
    {- | /No description available in the introspection data./
    -}
        clearIncludedModuleInit                 ,
        getIncludedModuleInit                   ,
    #if ENABLE_OVERLOADING
        includedModule_init                     ,
    #endif
        setIncludedModuleInit                   ,

    -- ** list #attr:list#
    {- | /No description available in the introspection data./
    -}
        clearIncludedModuleList                 ,
        getIncludedModuleList                   ,
    #if 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.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.Pango.Callbacks as Pango.Callbacks

    -- | Memory-managed wrapper type.
    newtype IncludedModule = IncludedModule (ManagedPtr IncludedModule)
    instance WrappedPtr IncludedModule where
        wrappedPtrCalloc = callocBytes 32
        wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 32 >=> 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 ENABLE_OVERLOADING
    data IncludedModuleListFieldInfo
    instance AttrInfo IncludedModuleListFieldInfo where
        type AttrAllowedOps IncludedModuleListFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
        type AttrSetTypeConstraint IncludedModuleListFieldInfo = (~) (FunPtr Pango.Callbacks.C_IncludedModuleListFieldCallback)
        type AttrBaseTypeConstraint IncludedModuleListFieldInfo = (~) IncludedModule
        type AttrGetType IncludedModuleListFieldInfo = Maybe Pango.Callbacks.IncludedModuleListFieldCallback
        type AttrLabel IncludedModuleListFieldInfo = "list"
        type AttrOrigin IncludedModuleListFieldInfo = IncludedModule
        attrGet _ = getIncludedModuleList
        attrSet _ = setIncludedModuleList
        attrConstruct = undefined
        attrClear _ = clearIncludedModuleList

    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` 8) :: 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` 8) (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` 8) (FP.nullFunPtr :: FunPtr Pango.Callbacks.C_IncludedModuleInitFieldCallback)

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

    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` 16) :: 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` 16) (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` 16) (FP.nullFunPtr :: FunPtr Pango.Callbacks.C_IncludedModuleExitFieldCallback)

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

    includedModule_exit :: AttrLabelProxy "exit"
    includedModule_exit = AttrLabelProxy

    #endif

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

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

    #if MIN_VERSION_base(4,9,0)
    instance (info ~ ResolveIncludedModuleMethod t IncludedModule, O.MethodInfo info IncludedModule p) => O.IsLabel t (IncludedModule -> 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