{- |
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 (MIN_VERSION_haskell_gi_overloading(1,0,0) \
       && !defined(__HADDOCK_VERSION__))

module GI.Vte.Structs.CharAttributes
    (

-- * Exported types
    CharAttributes(..)                      ,
    newZeroCharAttributes                   ,
    noCharAttributes                        ,


    ) 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


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

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

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


-- | A convenience alias for `Nothing` :: `Maybe` `CharAttributes`.
noCharAttributes :: Maybe CharAttributes
noCharAttributes = Nothing


#if ENABLE_OVERLOADING
instance O.HasAttributeList CharAttributes
type instance O.AttributeList CharAttributes = CharAttributesAttributeList
type CharAttributesAttributeList = ('[ ] :: [(Symbol, *)])
#endif

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

instance (info ~ ResolveCharAttributesMethod t CharAttributes, O.MethodInfo info CharAttributes p) => O.IsLabelProxy t (CharAttributes -> p) where
    fromLabelProxy _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)

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