{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Atk.Structs.PropertyValues
(
PropertyValues(..) ,
newZeroPropertyValues ,
noPropertyValues ,
#if defined(ENABLE_OVERLOADING)
ResolvePropertyValuesMethod ,
#endif
getPropertyValuesNewValue ,
#if defined(ENABLE_OVERLOADING)
propertyValues_newValue ,
#endif
getPropertyValuesOldValue ,
#if defined(ENABLE_OVERLOADING)
propertyValues_oldValue ,
#endif
clearPropertyValuesPropertyName ,
getPropertyValuesPropertyName ,
#if defined(ENABLE_OVERLOADING)
propertyValues_propertyName ,
#endif
setPropertyValuesPropertyName ,
) 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
newtype PropertyValues = PropertyValues (ManagedPtr PropertyValues)
deriving (Eq)
instance WrappedPtr PropertyValues where
wrappedPtrCalloc = callocBytes 56
wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 56 >=> wrapPtr PropertyValues)
wrappedPtrFree = Just ptr_to_g_free
newZeroPropertyValues :: MonadIO m => m PropertyValues
newZeroPropertyValues = liftIO $ wrappedPtrCalloc >>= wrapPtr PropertyValues
instance tag ~ 'AttrSet => Constructible PropertyValues tag where
new _ attrs = do
o <- newZeroPropertyValues
GI.Attributes.set o attrs
return o
noPropertyValues :: Maybe PropertyValues
noPropertyValues = Nothing
getPropertyValuesPropertyName :: MonadIO m => PropertyValues -> m (Maybe T.Text)
getPropertyValuesPropertyName s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO CString
result <- SP.convertIfNonNull val $ \val' -> do
val'' <- cstringToText val'
return val''
return result
setPropertyValuesPropertyName :: MonadIO m => PropertyValues -> CString -> m ()
setPropertyValuesPropertyName s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 0) (val :: CString)
clearPropertyValuesPropertyName :: MonadIO m => PropertyValues -> m ()
clearPropertyValuesPropertyName s = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 0) (FP.nullPtr :: CString)
#if defined(ENABLE_OVERLOADING)
data PropertyValuesPropertyNameFieldInfo
instance AttrInfo PropertyValuesPropertyNameFieldInfo where
type AttrBaseTypeConstraint PropertyValuesPropertyNameFieldInfo = (~) PropertyValues
type AttrAllowedOps PropertyValuesPropertyNameFieldInfo = '[ 'AttrSet, 'AttrGet, 'AttrClear]
type AttrSetTypeConstraint PropertyValuesPropertyNameFieldInfo = (~) CString
type AttrTransferTypeConstraint PropertyValuesPropertyNameFieldInfo = (~)CString
type AttrTransferType PropertyValuesPropertyNameFieldInfo = CString
type AttrGetType PropertyValuesPropertyNameFieldInfo = Maybe T.Text
type AttrLabel PropertyValuesPropertyNameFieldInfo = "property_name"
type AttrOrigin PropertyValuesPropertyNameFieldInfo = PropertyValues
attrGet = getPropertyValuesPropertyName
attrSet = setPropertyValuesPropertyName
attrConstruct = undefined
attrClear = clearPropertyValuesPropertyName
attrTransfer _ v = do
return v
propertyValues_propertyName :: AttrLabelProxy "propertyName"
propertyValues_propertyName = AttrLabelProxy
#endif
getPropertyValuesOldValue :: MonadIO m => PropertyValues -> m GValue
getPropertyValuesOldValue s = liftIO $ withManagedPtr s $ \ptr -> do
let val = ptr `plusPtr` 8 :: (Ptr GValue)
val' <- (newBoxed GValue) val
return val'
#if defined(ENABLE_OVERLOADING)
data PropertyValuesOldValueFieldInfo
instance AttrInfo PropertyValuesOldValueFieldInfo where
type AttrBaseTypeConstraint PropertyValuesOldValueFieldInfo = (~) PropertyValues
type AttrAllowedOps PropertyValuesOldValueFieldInfo = '[ 'AttrGet]
type AttrSetTypeConstraint PropertyValuesOldValueFieldInfo = (~) (Ptr GValue)
type AttrTransferTypeConstraint PropertyValuesOldValueFieldInfo = (~)(Ptr GValue)
type AttrTransferType PropertyValuesOldValueFieldInfo = (Ptr GValue)
type AttrGetType PropertyValuesOldValueFieldInfo = GValue
type AttrLabel PropertyValuesOldValueFieldInfo = "old_value"
type AttrOrigin PropertyValuesOldValueFieldInfo = PropertyValues
attrGet = getPropertyValuesOldValue
attrSet = undefined
attrConstruct = undefined
attrClear = undefined
attrTransfer = undefined
propertyValues_oldValue :: AttrLabelProxy "oldValue"
propertyValues_oldValue = AttrLabelProxy
#endif
getPropertyValuesNewValue :: MonadIO m => PropertyValues -> m GValue
getPropertyValuesNewValue s = liftIO $ withManagedPtr s $ \ptr -> do
let val = ptr `plusPtr` 32 :: (Ptr GValue)
val' <- (newBoxed GValue) val
return val'
#if defined(ENABLE_OVERLOADING)
data PropertyValuesNewValueFieldInfo
instance AttrInfo PropertyValuesNewValueFieldInfo where
type AttrBaseTypeConstraint PropertyValuesNewValueFieldInfo = (~) PropertyValues
type AttrAllowedOps PropertyValuesNewValueFieldInfo = '[ 'AttrGet]
type AttrSetTypeConstraint PropertyValuesNewValueFieldInfo = (~) (Ptr GValue)
type AttrTransferTypeConstraint PropertyValuesNewValueFieldInfo = (~)(Ptr GValue)
type AttrTransferType PropertyValuesNewValueFieldInfo = (Ptr GValue)
type AttrGetType PropertyValuesNewValueFieldInfo = GValue
type AttrLabel PropertyValuesNewValueFieldInfo = "new_value"
type AttrOrigin PropertyValuesNewValueFieldInfo = PropertyValues
attrGet = getPropertyValuesNewValue
attrSet = undefined
attrConstruct = undefined
attrClear = undefined
attrTransfer = undefined
propertyValues_newValue :: AttrLabelProxy "newValue"
propertyValues_newValue = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList PropertyValues
type instance O.AttributeList PropertyValues = PropertyValuesAttributeList
type PropertyValuesAttributeList = ('[ '("propertyName", PropertyValuesPropertyNameFieldInfo), '("oldValue", PropertyValuesOldValueFieldInfo), '("newValue", PropertyValuesNewValueFieldInfo)] :: [(Symbol, *)])
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolvePropertyValuesMethod (t :: Symbol) (o :: *) :: * where
ResolvePropertyValuesMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolvePropertyValuesMethod t PropertyValues, O.MethodInfo info PropertyValues p) => OL.IsLabel t (PropertyValues -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif