#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gtk.Structs.AccelKey
(
AccelKey(..) ,
newZeroAccelKey ,
noAccelKey ,
#if ENABLE_OVERLOADING
accelKey_accelFlags ,
#endif
getAccelKeyAccelFlags ,
setAccelKeyAccelFlags ,
#if ENABLE_OVERLOADING
accelKey_accelKey ,
#endif
getAccelKeyAccelKey ,
setAccelKeyAccelKey ,
#if ENABLE_OVERLOADING
accelKey_accelMods ,
#endif
getAccelKeyAccelMods ,
setAccelKeyAccelMods ,
) 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 qualified GI.Gdk.Flags as Gdk.Flags
newtype AccelKey = AccelKey (ManagedPtr AccelKey)
instance WrappedPtr AccelKey where
wrappedPtrCalloc = callocBytes 12
wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 12 >=> wrapPtr AccelKey)
wrappedPtrFree = Just ptr_to_g_free
newZeroAccelKey :: MonadIO m => m AccelKey
newZeroAccelKey = liftIO $ wrappedPtrCalloc >>= wrapPtr AccelKey
instance tag ~ 'AttrSet => Constructible AccelKey tag where
new _ attrs = do
o <- newZeroAccelKey
GI.Attributes.set o attrs
return o
noAccelKey :: Maybe AccelKey
noAccelKey = Nothing
getAccelKeyAccelKey :: MonadIO m => AccelKey -> m Word32
getAccelKeyAccelKey s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO Word32
return val
setAccelKeyAccelKey :: MonadIO m => AccelKey -> Word32 -> m ()
setAccelKeyAccelKey s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 0) (val :: Word32)
#if ENABLE_OVERLOADING
data AccelKeyAccelKeyFieldInfo
instance AttrInfo AccelKeyAccelKeyFieldInfo where
type AttrAllowedOps AccelKeyAccelKeyFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint AccelKeyAccelKeyFieldInfo = (~) Word32
type AttrBaseTypeConstraint AccelKeyAccelKeyFieldInfo = (~) AccelKey
type AttrGetType AccelKeyAccelKeyFieldInfo = Word32
type AttrLabel AccelKeyAccelKeyFieldInfo = "accel_key"
type AttrOrigin AccelKeyAccelKeyFieldInfo = AccelKey
attrGet _ = getAccelKeyAccelKey
attrSet _ = setAccelKeyAccelKey
attrConstruct = undefined
attrClear _ = undefined
accelKey_accelKey :: AttrLabelProxy "accelKey"
accelKey_accelKey = AttrLabelProxy
#endif
getAccelKeyAccelMods :: MonadIO m => AccelKey -> m [Gdk.Flags.ModifierType]
getAccelKeyAccelMods s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 4) :: IO CUInt
let val' = wordToGFlags val
return val'
setAccelKeyAccelMods :: MonadIO m => AccelKey -> [Gdk.Flags.ModifierType] -> m ()
setAccelKeyAccelMods s val = liftIO $ withManagedPtr s $ \ptr -> do
let val' = gflagsToWord val
poke (ptr `plusPtr` 4) (val' :: CUInt)
#if ENABLE_OVERLOADING
data AccelKeyAccelModsFieldInfo
instance AttrInfo AccelKeyAccelModsFieldInfo where
type AttrAllowedOps AccelKeyAccelModsFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint AccelKeyAccelModsFieldInfo = (~) [Gdk.Flags.ModifierType]
type AttrBaseTypeConstraint AccelKeyAccelModsFieldInfo = (~) AccelKey
type AttrGetType AccelKeyAccelModsFieldInfo = [Gdk.Flags.ModifierType]
type AttrLabel AccelKeyAccelModsFieldInfo = "accel_mods"
type AttrOrigin AccelKeyAccelModsFieldInfo = AccelKey
attrGet _ = getAccelKeyAccelMods
attrSet _ = setAccelKeyAccelMods
attrConstruct = undefined
attrClear _ = undefined
accelKey_accelMods :: AttrLabelProxy "accelMods"
accelKey_accelMods = AttrLabelProxy
#endif
getAccelKeyAccelFlags :: MonadIO m => AccelKey -> m Word32
getAccelKeyAccelFlags s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO Word32
return val
setAccelKeyAccelFlags :: MonadIO m => AccelKey -> Word32 -> m ()
setAccelKeyAccelFlags s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 8) (val :: Word32)
#if ENABLE_OVERLOADING
data AccelKeyAccelFlagsFieldInfo
instance AttrInfo AccelKeyAccelFlagsFieldInfo where
type AttrAllowedOps AccelKeyAccelFlagsFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint AccelKeyAccelFlagsFieldInfo = (~) Word32
type AttrBaseTypeConstraint AccelKeyAccelFlagsFieldInfo = (~) AccelKey
type AttrGetType AccelKeyAccelFlagsFieldInfo = Word32
type AttrLabel AccelKeyAccelFlagsFieldInfo = "accel_flags"
type AttrOrigin AccelKeyAccelFlagsFieldInfo = AccelKey
attrGet _ = getAccelKeyAccelFlags
attrSet _ = setAccelKeyAccelFlags
attrConstruct = undefined
attrClear _ = undefined
accelKey_accelFlags :: AttrLabelProxy "accelFlags"
accelKey_accelFlags = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList AccelKey
type instance O.AttributeList AccelKey = AccelKeyAttributeList
type AccelKeyAttributeList = ('[ '("accelKey", AccelKeyAccelKeyFieldInfo), '("accelMods", AccelKeyAccelModsFieldInfo), '("accelFlags", AccelKeyAccelFlagsFieldInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
type family ResolveAccelKeyMethod (t :: Symbol) (o :: *) :: * where
ResolveAccelKeyMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveAccelKeyMethod t AccelKey, O.MethodInfo info AccelKey p) => OL.IsLabel t (AccelKey -> 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