#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Pango.Structs.AttrColor
(
AttrColor(..) ,
newZeroAttrColor ,
noAttrColor ,
#if ENABLE_OVERLOADING
attrColor_attr ,
#endif
getAttrColorAttr ,
#if ENABLE_OVERLOADING
attrColor_color ,
#endif
getAttrColorColor ,
) 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.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 {-# SOURCE #-} qualified GI.Pango.Structs.Attribute as Pango.Attribute
import {-# SOURCE #-} qualified GI.Pango.Structs.Color as Pango.Color
newtype AttrColor = AttrColor (ManagedPtr AttrColor)
instance WrappedPtr AttrColor where
wrappedPtrCalloc = callocBytes 24
wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 24 >=> wrapPtr AttrColor)
wrappedPtrFree = Just ptr_to_g_free
newZeroAttrColor :: MonadIO m => m AttrColor
newZeroAttrColor = liftIO $ wrappedPtrCalloc >>= wrapPtr AttrColor
instance tag ~ 'AttrSet => Constructible AttrColor tag where
new _ attrs = do
o <- newZeroAttrColor
GI.Attributes.set o attrs
return o
noAttrColor :: Maybe AttrColor
noAttrColor = Nothing
getAttrColorAttr :: MonadIO m => AttrColor -> m Pango.Attribute.Attribute
getAttrColorAttr s = liftIO $ withManagedPtr s $ \ptr -> do
let val = ptr `plusPtr` 0 :: (Ptr Pango.Attribute.Attribute)
val' <- (newPtr Pango.Attribute.Attribute) val
return val'
#if ENABLE_OVERLOADING
data AttrColorAttrFieldInfo
instance AttrInfo AttrColorAttrFieldInfo where
type AttrAllowedOps AttrColorAttrFieldInfo = '[ 'AttrGet]
type AttrSetTypeConstraint AttrColorAttrFieldInfo = (~) (Ptr Pango.Attribute.Attribute)
type AttrBaseTypeConstraint AttrColorAttrFieldInfo = (~) AttrColor
type AttrGetType AttrColorAttrFieldInfo = Pango.Attribute.Attribute
type AttrLabel AttrColorAttrFieldInfo = "attr"
type AttrOrigin AttrColorAttrFieldInfo = AttrColor
attrGet _ = getAttrColorAttr
attrSet _ = undefined
attrConstruct = undefined
attrClear _ = undefined
attrColor_attr :: AttrLabelProxy "attr"
attrColor_attr = AttrLabelProxy
#endif
getAttrColorColor :: MonadIO m => AttrColor -> m Pango.Color.Color
getAttrColorColor s = liftIO $ withManagedPtr s $ \ptr -> do
let val = ptr `plusPtr` 16 :: (Ptr Pango.Color.Color)
val' <- (newBoxed Pango.Color.Color) val
return val'
#if ENABLE_OVERLOADING
data AttrColorColorFieldInfo
instance AttrInfo AttrColorColorFieldInfo where
type AttrAllowedOps AttrColorColorFieldInfo = '[ 'AttrGet]
type AttrSetTypeConstraint AttrColorColorFieldInfo = (~) (Ptr Pango.Color.Color)
type AttrBaseTypeConstraint AttrColorColorFieldInfo = (~) AttrColor
type AttrGetType AttrColorColorFieldInfo = Pango.Color.Color
type AttrLabel AttrColorColorFieldInfo = "color"
type AttrOrigin AttrColorColorFieldInfo = AttrColor
attrGet _ = getAttrColorColor
attrSet _ = undefined
attrConstruct = undefined
attrClear _ = undefined
attrColor_color :: AttrLabelProxy "color"
attrColor_color = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList AttrColor
type instance O.AttributeList AttrColor = AttrColorAttributeList
type AttrColorAttributeList = ('[ '("attr", AttrColorAttrFieldInfo), '("color", AttrColorColorFieldInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
type family ResolveAttrColorMethod (t :: Symbol) (o :: *) :: * where
ResolveAttrColorMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveAttrColorMethod t AttrColor, O.MethodInfo info AttrColor p) => OL.IsLabel t (AttrColor -> 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