#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.GObject.Structs.EnumClass
(
EnumClass(..) ,
newZeroEnumClass ,
noEnumClass ,
#if ENABLE_OVERLOADING
enumClass_gTypeClass ,
#endif
getEnumClassGTypeClass ,
#if ENABLE_OVERLOADING
enumClass_maximum ,
#endif
getEnumClassMaximum ,
setEnumClassMaximum ,
#if ENABLE_OVERLOADING
enumClass_minimum ,
#endif
getEnumClassMinimum ,
setEnumClassMinimum ,
#if ENABLE_OVERLOADING
enumClass_nValues ,
#endif
getEnumClassNValues ,
setEnumClassNValues ,
clearEnumClassValues ,
#if ENABLE_OVERLOADING
enumClass_values ,
#endif
getEnumClassValues ,
setEnumClassValues ,
) 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.GObject.Structs.EnumValue as GObject.EnumValue
import {-# SOURCE #-} qualified GI.GObject.Structs.TypeClass as GObject.TypeClass
newtype EnumClass = EnumClass (ManagedPtr EnumClass)
instance WrappedPtr EnumClass where
wrappedPtrCalloc = callocBytes 32
wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 32 >=> wrapPtr EnumClass)
wrappedPtrFree = Just ptr_to_g_free
newZeroEnumClass :: MonadIO m => m EnumClass
newZeroEnumClass = liftIO $ wrappedPtrCalloc >>= wrapPtr EnumClass
instance tag ~ 'AttrSet => Constructible EnumClass tag where
new _ attrs = do
o <- newZeroEnumClass
GI.Attributes.set o attrs
return o
noEnumClass :: Maybe EnumClass
noEnumClass = Nothing
getEnumClassGTypeClass :: MonadIO m => EnumClass -> m GObject.TypeClass.TypeClass
getEnumClassGTypeClass s = liftIO $ withManagedPtr s $ \ptr -> do
let val = ptr `plusPtr` 0 :: (Ptr GObject.TypeClass.TypeClass)
val' <- (newPtr GObject.TypeClass.TypeClass) val
return val'
#if ENABLE_OVERLOADING
data EnumClassGTypeClassFieldInfo
instance AttrInfo EnumClassGTypeClassFieldInfo where
type AttrAllowedOps EnumClassGTypeClassFieldInfo = '[ 'AttrGet]
type AttrSetTypeConstraint EnumClassGTypeClassFieldInfo = (~) (Ptr GObject.TypeClass.TypeClass)
type AttrBaseTypeConstraint EnumClassGTypeClassFieldInfo = (~) EnumClass
type AttrGetType EnumClassGTypeClassFieldInfo = GObject.TypeClass.TypeClass
type AttrLabel EnumClassGTypeClassFieldInfo = "g_type_class"
type AttrOrigin EnumClassGTypeClassFieldInfo = EnumClass
attrGet _ = getEnumClassGTypeClass
attrSet _ = undefined
attrConstruct = undefined
attrClear _ = undefined
enumClass_gTypeClass :: AttrLabelProxy "gTypeClass"
enumClass_gTypeClass = AttrLabelProxy
#endif
getEnumClassMinimum :: MonadIO m => EnumClass -> m Int32
getEnumClassMinimum s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO Int32
return val
setEnumClassMinimum :: MonadIO m => EnumClass -> Int32 -> m ()
setEnumClassMinimum s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 8) (val :: Int32)
#if ENABLE_OVERLOADING
data EnumClassMinimumFieldInfo
instance AttrInfo EnumClassMinimumFieldInfo where
type AttrAllowedOps EnumClassMinimumFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint EnumClassMinimumFieldInfo = (~) Int32
type AttrBaseTypeConstraint EnumClassMinimumFieldInfo = (~) EnumClass
type AttrGetType EnumClassMinimumFieldInfo = Int32
type AttrLabel EnumClassMinimumFieldInfo = "minimum"
type AttrOrigin EnumClassMinimumFieldInfo = EnumClass
attrGet _ = getEnumClassMinimum
attrSet _ = setEnumClassMinimum
attrConstruct = undefined
attrClear _ = undefined
enumClass_minimum :: AttrLabelProxy "minimum"
enumClass_minimum = AttrLabelProxy
#endif
getEnumClassMaximum :: MonadIO m => EnumClass -> m Int32
getEnumClassMaximum s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 12) :: IO Int32
return val
setEnumClassMaximum :: MonadIO m => EnumClass -> Int32 -> m ()
setEnumClassMaximum s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 12) (val :: Int32)
#if ENABLE_OVERLOADING
data EnumClassMaximumFieldInfo
instance AttrInfo EnumClassMaximumFieldInfo where
type AttrAllowedOps EnumClassMaximumFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint EnumClassMaximumFieldInfo = (~) Int32
type AttrBaseTypeConstraint EnumClassMaximumFieldInfo = (~) EnumClass
type AttrGetType EnumClassMaximumFieldInfo = Int32
type AttrLabel EnumClassMaximumFieldInfo = "maximum"
type AttrOrigin EnumClassMaximumFieldInfo = EnumClass
attrGet _ = getEnumClassMaximum
attrSet _ = setEnumClassMaximum
attrConstruct = undefined
attrClear _ = undefined
enumClass_maximum :: AttrLabelProxy "maximum"
enumClass_maximum = AttrLabelProxy
#endif
getEnumClassNValues :: MonadIO m => EnumClass -> m Word32
getEnumClassNValues s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 16) :: IO Word32
return val
setEnumClassNValues :: MonadIO m => EnumClass -> Word32 -> m ()
setEnumClassNValues s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 16) (val :: Word32)
#if ENABLE_OVERLOADING
data EnumClassNValuesFieldInfo
instance AttrInfo EnumClassNValuesFieldInfo where
type AttrAllowedOps EnumClassNValuesFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint EnumClassNValuesFieldInfo = (~) Word32
type AttrBaseTypeConstraint EnumClassNValuesFieldInfo = (~) EnumClass
type AttrGetType EnumClassNValuesFieldInfo = Word32
type AttrLabel EnumClassNValuesFieldInfo = "n_values"
type AttrOrigin EnumClassNValuesFieldInfo = EnumClass
attrGet _ = getEnumClassNValues
attrSet _ = setEnumClassNValues
attrConstruct = undefined
attrClear _ = undefined
enumClass_nValues :: AttrLabelProxy "nValues"
enumClass_nValues = AttrLabelProxy
#endif
getEnumClassValues :: MonadIO m => EnumClass -> m (Maybe GObject.EnumValue.EnumValue)
getEnumClassValues s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 24) :: IO (Ptr GObject.EnumValue.EnumValue)
result <- SP.convertIfNonNull val $ \val' -> do
val'' <- (newPtr GObject.EnumValue.EnumValue) val'
return val''
return result
setEnumClassValues :: MonadIO m => EnumClass -> Ptr GObject.EnumValue.EnumValue -> m ()
setEnumClassValues s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 24) (val :: Ptr GObject.EnumValue.EnumValue)
clearEnumClassValues :: MonadIO m => EnumClass -> m ()
clearEnumClassValues s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 24) (FP.nullPtr :: Ptr GObject.EnumValue.EnumValue)
#if ENABLE_OVERLOADING
data EnumClassValuesFieldInfo
instance AttrInfo EnumClassValuesFieldInfo where
type AttrAllowedOps EnumClassValuesFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint EnumClassValuesFieldInfo = (~) (Ptr GObject.EnumValue.EnumValue)
type AttrBaseTypeConstraint EnumClassValuesFieldInfo = (~) EnumClass
type AttrGetType EnumClassValuesFieldInfo = Maybe GObject.EnumValue.EnumValue
type AttrLabel EnumClassValuesFieldInfo = "values"
type AttrOrigin EnumClassValuesFieldInfo = EnumClass
attrGet _ = getEnumClassValues
attrSet _ = setEnumClassValues
attrConstruct = undefined
attrClear _ = clearEnumClassValues
enumClass_values :: AttrLabelProxy "values"
enumClass_values = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList EnumClass
type instance O.AttributeList EnumClass = EnumClassAttributeList
type EnumClassAttributeList = ('[ '("gTypeClass", EnumClassGTypeClassFieldInfo), '("minimum", EnumClassMinimumFieldInfo), '("maximum", EnumClassMaximumFieldInfo), '("nValues", EnumClassNValuesFieldInfo), '("values", EnumClassValuesFieldInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
type family ResolveEnumClassMethod (t :: Symbol) (o :: *) :: * where
ResolveEnumClassMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveEnumClassMethod t EnumClass, O.MethodInfo info EnumClass p) => OL.IsLabel t (EnumClass -> 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