#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gdk.Structs.KeymapKey
(
KeymapKey(..) ,
newZeroKeymapKey ,
noKeymapKey ,
getKeymapKeyGroup ,
#if ENABLE_OVERLOADING
keymapKey_group ,
#endif
setKeymapKeyGroup ,
getKeymapKeyKeycode ,
#if ENABLE_OVERLOADING
keymapKey_keycode ,
#endif
setKeymapKeyKeycode ,
getKeymapKeyLevel ,
#if ENABLE_OVERLOADING
keymapKey_level ,
#endif
setKeymapKeyLevel ,
) 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
newtype KeymapKey = KeymapKey (ManagedPtr KeymapKey)
instance WrappedPtr KeymapKey where
wrappedPtrCalloc = callocBytes 12
wrappedPtrCopy = \p -> withManagedPtr p (copyBytes 12 >=> wrapPtr KeymapKey)
wrappedPtrFree = Just ptr_to_g_free
newZeroKeymapKey :: MonadIO m => m KeymapKey
newZeroKeymapKey = liftIO $ wrappedPtrCalloc >>= wrapPtr KeymapKey
instance tag ~ 'AttrSet => Constructible KeymapKey tag where
new _ attrs = do
o <- newZeroKeymapKey
GI.Attributes.set o attrs
return o
noKeymapKey :: Maybe KeymapKey
noKeymapKey = Nothing
getKeymapKeyKeycode :: MonadIO m => KeymapKey -> m Word32
getKeymapKeyKeycode s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 0) :: IO Word32
return val
setKeymapKeyKeycode :: MonadIO m => KeymapKey -> Word32 -> m ()
setKeymapKeyKeycode s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 0) (val :: Word32)
#if ENABLE_OVERLOADING
data KeymapKeyKeycodeFieldInfo
instance AttrInfo KeymapKeyKeycodeFieldInfo where
type AttrAllowedOps KeymapKeyKeycodeFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint KeymapKeyKeycodeFieldInfo = (~) Word32
type AttrBaseTypeConstraint KeymapKeyKeycodeFieldInfo = (~) KeymapKey
type AttrGetType KeymapKeyKeycodeFieldInfo = Word32
type AttrLabel KeymapKeyKeycodeFieldInfo = "keycode"
type AttrOrigin KeymapKeyKeycodeFieldInfo = KeymapKey
attrGet _ = getKeymapKeyKeycode
attrSet _ = setKeymapKeyKeycode
attrConstruct = undefined
attrClear _ = undefined
keymapKey_keycode :: AttrLabelProxy "keycode"
keymapKey_keycode = AttrLabelProxy
#endif
getKeymapKeyGroup :: MonadIO m => KeymapKey -> m Int32
getKeymapKeyGroup s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 4) :: IO Int32
return val
setKeymapKeyGroup :: MonadIO m => KeymapKey -> Int32 -> m ()
setKeymapKeyGroup s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 4) (val :: Int32)
#if ENABLE_OVERLOADING
data KeymapKeyGroupFieldInfo
instance AttrInfo KeymapKeyGroupFieldInfo where
type AttrAllowedOps KeymapKeyGroupFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint KeymapKeyGroupFieldInfo = (~) Int32
type AttrBaseTypeConstraint KeymapKeyGroupFieldInfo = (~) KeymapKey
type AttrGetType KeymapKeyGroupFieldInfo = Int32
type AttrLabel KeymapKeyGroupFieldInfo = "group"
type AttrOrigin KeymapKeyGroupFieldInfo = KeymapKey
attrGet _ = getKeymapKeyGroup
attrSet _ = setKeymapKeyGroup
attrConstruct = undefined
attrClear _ = undefined
keymapKey_group :: AttrLabelProxy "group"
keymapKey_group = AttrLabelProxy
#endif
getKeymapKeyLevel :: MonadIO m => KeymapKey -> m Int32
getKeymapKeyLevel s = liftIO $ withManagedPtr s $ \ptr -> do
val <- peek (ptr `plusPtr` 8) :: IO Int32
return val
setKeymapKeyLevel :: MonadIO m => KeymapKey -> Int32 -> m ()
setKeymapKeyLevel s val = liftIO $ withManagedPtr s $ \ptr -> do
poke (ptr `plusPtr` 8) (val :: Int32)
#if ENABLE_OVERLOADING
data KeymapKeyLevelFieldInfo
instance AttrInfo KeymapKeyLevelFieldInfo where
type AttrAllowedOps KeymapKeyLevelFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint KeymapKeyLevelFieldInfo = (~) Int32
type AttrBaseTypeConstraint KeymapKeyLevelFieldInfo = (~) KeymapKey
type AttrGetType KeymapKeyLevelFieldInfo = Int32
type AttrLabel KeymapKeyLevelFieldInfo = "level"
type AttrOrigin KeymapKeyLevelFieldInfo = KeymapKey
attrGet _ = getKeymapKeyLevel
attrSet _ = setKeymapKeyLevel
attrConstruct = undefined
attrClear _ = undefined
keymapKey_level :: AttrLabelProxy "level"
keymapKey_level = AttrLabelProxy
#endif
#if ENABLE_OVERLOADING
instance O.HasAttributeList KeymapKey
type instance O.AttributeList KeymapKey = KeymapKeyAttributeList
type KeymapKeyAttributeList = ('[ '("keycode", KeymapKeyKeycodeFieldInfo), '("group", KeymapKeyGroupFieldInfo), '("level", KeymapKeyLevelFieldInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
type family ResolveKeymapKeyMethod (t :: Symbol) (o :: *) :: * where
ResolveKeymapKeyMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveKeymapKeyMethod t KeymapKey, O.MethodInfo info KeymapKey p) => OL.IsLabel t (KeymapKey -> 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