    {-# LANGUAGE TypeApplications #-}

    -- | Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
    -- License    : LGPL-2.1
    -- Maintainer : Iñaki García Etxebarria
    --
    -- A t'GI.Gdk.Structs.KeymapKey.KeymapKey' is a hardware key that can be mapped to a keyval.

    #if !defined(__HADDOCK_VERSION__)
    #define ENABLE_OVERLOADING
    #endif

    module GI.Gdk.Structs.KeymapKey
        (

    -- * Exported types
        KeymapKey(..)                           ,
        newZeroKeymapKey                        ,

     -- * Methods
    -- ** Overloaded methods #method:Overloaded methods#

    #if defined(ENABLE_OVERLOADING)
        ResolveKeymapKeyMethod                  ,
    #endif

     -- * Properties
    -- ** group #attr:group#
    -- | indicates movement in a horizontal direction. Usually groups are used
    --   for two different languages. In group 0, a key might have two English
    --   characters, and in group 1 it might have two Hebrew characters. The Hebrew
    --   characters will be printed on the key next to the English characters.

        getKeymapKeyGroup                       ,
    #if defined(ENABLE_OVERLOADING)
        keymapKey_group                         ,
    #endif
        setKeymapKeyGroup                       ,

    -- ** keycode #attr:keycode#
    -- | the hardware keycode. This is an identifying number for a
    --   physical key.

        getKeymapKeyKeycode                     ,
    #if defined(ENABLE_OVERLOADING)
        keymapKey_keycode                       ,
    #endif
        setKeymapKeyKeycode                     ,

    -- ** level #attr:level#
    -- | indicates which symbol on the key will be used, in a vertical direction.
    --   So on a standard US keyboard, the key with the number “1” on it also has the
    --   exclamation point (\"!\") character on it. The level indicates whether to use
    --   the “1” or the “!” symbol. The letter keys are considered to have a lowercase
    --   letter at level 0, and an uppercase letter at level 1, though only the
    --   uppercase letter is printed.

        getKeymapKeyLevel                       ,
    #if defined(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.BasicTypes as B.Types
    import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
    import qualified Data.GI.Base.GArray as B.GArray
    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 Control.Monad.IO.Class as MIO
    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

    -- | Memory-managed wrapper type.
    newtype KeymapKey = KeymapKey (SP.ManagedPtr KeymapKey)
        deriving (KeymapKey -> KeymapKey -> Bool
    (KeymapKey -> KeymapKey -> Bool)
    -> (KeymapKey -> KeymapKey -> Bool) -> Eq KeymapKey
    forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
    /= :: KeymapKey -> KeymapKey -> Bool
    $c/= :: KeymapKey -> KeymapKey -> Bool
    == :: KeymapKey -> KeymapKey -> Bool
    $c== :: KeymapKey -> KeymapKey -> Bool
    Eq)

    instance SP.ManagedPtrNewtype KeymapKey where
        toManagedPtr :: KeymapKey -> ManagedPtr KeymapKey
    toManagedPtr (KeymapKey p :: ManagedPtr KeymapKey
    p) = ManagedPtr KeymapKey
    p

    instance BoxedPtr KeymapKey where
        boxedPtrCopy :: KeymapKey -> IO KeymapKey
    boxedPtrCopy = \p :: KeymapKey
    p -> KeymapKey -> (Ptr KeymapKey -> IO KeymapKey) -> IO KeymapKey
    forall a c.
    (HasCallStack, ManagedPtrNewtype a) =>
    a -> (Ptr a -> IO c) -> IO c
    B.ManagedPtr.withManagedPtr KeymapKey
    p (Int -> Ptr KeymapKey -> IO (Ptr KeymapKey)
    forall a. (HasCallStack, CallocPtr a) => Int -> Ptr a -> IO (Ptr a)
    copyBytes 12 (Ptr KeymapKey -> IO (Ptr KeymapKey))
    -> (Ptr KeymapKey -> IO KeymapKey) -> Ptr KeymapKey -> IO KeymapKey
    forall (m :: * -> *) a b c.
    Monad m =>
    (a -> m b) -> (b -> m c) -> a -> m c
    >=> (ManagedPtr KeymapKey -> KeymapKey)
    -> Ptr KeymapKey -> IO KeymapKey
    forall a.
    (HasCallStack, BoxedPtr a) =>
    (ManagedPtr a -> a) -> Ptr a -> IO a
    B.ManagedPtr.wrapPtr ManagedPtr KeymapKey -> KeymapKey
    KeymapKey)
        boxedPtrFree :: KeymapKey -> IO ()
    boxedPtrFree = \x :: KeymapKey
    x -> KeymapKey -> (Ptr KeymapKey -> IO ()) -> IO ()
    forall a c.
    (HasCallStack, ManagedPtrNewtype a) =>
    a -> (Ptr a -> IO c) -> IO c
    SP.withManagedPtr KeymapKey
    x Ptr KeymapKey -> IO ()
    forall a. Ptr a -> IO ()
    SP.freeMem
    instance CallocPtr KeymapKey where
        boxedPtrCalloc :: IO (Ptr KeymapKey)
    boxedPtrCalloc = Int -> IO (Ptr KeymapKey)
    forall a. Int -> IO (Ptr a)
    callocBytes 12

    -- | Construct a `KeymapKey` struct initialized to zero.
    newZeroKeymapKey :: MonadIO m => m KeymapKey
    newZeroKeymapKey :: m KeymapKey
    newZeroKeymapKey = IO KeymapKey -> m KeymapKey
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO KeymapKey -> m KeymapKey) -> IO KeymapKey -> m KeymapKey
    forall a b. (a -> b) -> a -> b
    $ IO (Ptr KeymapKey)
    forall a. CallocPtr a => IO (Ptr a)
    boxedPtrCalloc IO (Ptr KeymapKey)
    -> (Ptr KeymapKey -> IO KeymapKey) -> IO KeymapKey
    forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
    >>= (ManagedPtr KeymapKey -> KeymapKey)
    -> Ptr KeymapKey -> IO KeymapKey
    forall a.
    (HasCallStack, BoxedPtr a) =>
    (ManagedPtr a -> a) -> Ptr a -> IO a
    wrapPtr ManagedPtr KeymapKey -> KeymapKey
    KeymapKey

    instance tag ~ 'AttrSet => Constructible KeymapKey tag where
        new :: (ManagedPtr KeymapKey -> KeymapKey)
    -> [AttrOp KeymapKey tag] -> m KeymapKey
    new _ attrs :: [AttrOp KeymapKey tag]
    attrs = do
            KeymapKey
    o <- m KeymapKey
    forall (m :: * -> *). MonadIO m => m KeymapKey
    newZeroKeymapKey
            KeymapKey -> [AttrOp KeymapKey 'AttrSet] -> m ()
    forall o (m :: * -> *).
    MonadIO m =>
    o -> [AttrOp o 'AttrSet] -> m ()
    GI.Attributes.set KeymapKey
    o [AttrOp KeymapKey tag]
    [AttrOp KeymapKey 'AttrSet]
    attrs
            KeymapKey -> m KeymapKey
    forall (m :: * -> *) a. Monad m => a -> m a
    return KeymapKey
    o

    -- | Get the value of the “@keycode@” field.
    -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
    --
    -- @
    -- 'Data.GI.Base.Attributes.get' keymapKey #keycode
    -- @
    getKeymapKeyKeycode :: MonadIO m => KeymapKey -> m Word32
    getKeymapKeyKeycode :: KeymapKey -> m Word32
    getKeymapKeyKeycode s :: KeymapKey
    s = IO Word32 -> m Word32
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Word32 -> m Word32) -> IO Word32 -> m Word32
    forall a b. (a -> b) -> a -> b
    $ KeymapKey -> (Ptr KeymapKey -> IO Word32) -> IO Word32
    forall a c.
    (HasCallStack, ManagedPtrNewtype a) =>
    a -> (Ptr a -> IO c) -> IO c
    withManagedPtr KeymapKey
    s ((Ptr KeymapKey -> IO Word32) -> IO Word32)
    -> (Ptr KeymapKey -> IO Word32) -> IO Word32
    forall a b. (a -> b) -> a -> b
    $ \ptr :: Ptr KeymapKey
    ptr -> do
        Word32
    val <- Ptr Word32 -> IO Word32
    forall a. Storable a => Ptr a -> IO a
    peek (Ptr KeymapKey
    ptr Ptr KeymapKey -> Int -> Ptr Word32
    forall a b. Ptr a -> Int -> Ptr b
    `plusPtr` 0) :: IO Word32
        Word32 -> IO Word32
    forall (m :: * -> *) a. Monad m => a -> m a
    return Word32
    val

    -- | Set the value of the “@keycode@” field.
    -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
    --
    -- @
    -- 'Data.GI.Base.Attributes.set' keymapKey [ #keycode 'Data.GI.Base.Attributes.:=' value ]
    -- @
    setKeymapKeyKeycode :: MonadIO m => KeymapKey -> Word32 -> m ()
    setKeymapKeyKeycode :: KeymapKey -> Word32 -> m ()
    setKeymapKeyKeycode s :: KeymapKey
    s val :: Word32
    val = IO () -> m ()
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> m ()) -> IO () -> m ()
    forall a b. (a -> b) -> a -> b
    $ KeymapKey -> (Ptr KeymapKey -> IO ()) -> IO ()
    forall a c.
    (HasCallStack, ManagedPtrNewtype a) =>
    a -> (Ptr a -> IO c) -> IO c
    withManagedPtr KeymapKey
    s ((Ptr KeymapKey -> IO ()) -> IO ())
    -> (Ptr KeymapKey -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \ptr :: Ptr KeymapKey
    ptr -> do
        Ptr Word32 -> Word32 -> IO ()
    forall a. Storable a => Ptr a -> a -> IO ()
    poke (Ptr KeymapKey
    ptr Ptr KeymapKey -> Int -> Ptr Word32
    forall a b. Ptr a -> Int -> Ptr b
    `plusPtr` 0) (Word32
    val :: Word32)

    #if defined(ENABLE_OVERLOADING)
    data KeymapKeyKeycodeFieldInfo
    instance AttrInfo KeymapKeyKeycodeFieldInfo where
        type AttrBaseTypeConstraint KeymapKeyKeycodeFieldInfo = (~) KeymapKey
        type AttrAllowedOps KeymapKeyKeycodeFieldInfo = '[ 'AttrSet, 'AttrGet]
        type AttrSetTypeConstraint KeymapKeyKeycodeFieldInfo = (~) Word32
        type AttrTransferTypeConstraint KeymapKeyKeycodeFieldInfo = (~)Word32
        type AttrTransferType KeymapKeyKeycodeFieldInfo = Word32
        type AttrGetType KeymapKeyKeycodeFieldInfo = Word32
        type AttrLabel KeymapKeyKeycodeFieldInfo = "keycode"
        type AttrOrigin KeymapKeyKeycodeFieldInfo = KeymapKey
        attrGet = getKeymapKeyKeycode
        attrSet = setKeymapKeyKeycode
        attrConstruct = undefined
        attrClear = undefined
        attrTransfer _ v = do
            return v

    keymapKey_keycode :: AttrLabelProxy "keycode"
    keymapKey_keycode = AttrLabelProxy

    #endif

    -- | Get the value of the “@group@” field.
    -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
    --
    -- @
    -- 'Data.GI.Base.Attributes.get' keymapKey #group
    -- @
    getKeymapKeyGroup :: MonadIO m => KeymapKey -> m Int32
    getKeymapKeyGroup :: KeymapKey -> m Int32
    getKeymapKeyGroup s :: KeymapKey
    s = IO Int32 -> m Int32
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
    forall a b. (a -> b) -> a -> b
    $ KeymapKey -> (Ptr KeymapKey -> IO Int32) -> IO Int32
    forall a c.
    (HasCallStack, ManagedPtrNewtype a) =>
    a -> (Ptr a -> IO c) -> IO c
    withManagedPtr KeymapKey
    s ((Ptr KeymapKey -> IO Int32) -> IO Int32)
    -> (Ptr KeymapKey -> IO Int32) -> IO Int32
    forall a b. (a -> b) -> a -> b
    $ \ptr :: Ptr KeymapKey
    ptr -> do
        Int32
    val <- Ptr Int32 -> IO Int32
    forall a. Storable a => Ptr a -> IO a
    peek (Ptr KeymapKey
    ptr Ptr KeymapKey -> Int -> Ptr Int32
    forall a b. Ptr a -> Int -> Ptr b
    `plusPtr` 4) :: IO Int32
        Int32 -> IO Int32
    forall (m :: * -> *) a. Monad m => a -> m a
    return Int32
    val

    -- | Set the value of the “@group@” field.
    -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
    --
    -- @
    -- 'Data.GI.Base.Attributes.set' keymapKey [ #group 'Data.GI.Base.Attributes.:=' value ]
    -- @
    setKeymapKeyGroup :: MonadIO m => KeymapKey -> Int32 -> m ()
    setKeymapKeyGroup :: KeymapKey -> Int32 -> m ()
    setKeymapKeyGroup s :: KeymapKey
    s val :: Int32
    val = IO () -> m ()
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> m ()) -> IO () -> m ()
    forall a b. (a -> b) -> a -> b
    $ KeymapKey -> (Ptr KeymapKey -> IO ()) -> IO ()
    forall a c.
    (HasCallStack, ManagedPtrNewtype a) =>
    a -> (Ptr a -> IO c) -> IO c
    withManagedPtr KeymapKey
    s ((Ptr KeymapKey -> IO ()) -> IO ())
    -> (Ptr KeymapKey -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \ptr :: Ptr KeymapKey
    ptr -> do
        Ptr Int32 -> Int32 -> IO ()
    forall a. Storable a => Ptr a -> a -> IO ()
    poke (Ptr KeymapKey
    ptr Ptr KeymapKey -> Int -> Ptr Int32
    forall a b. Ptr a -> Int -> Ptr b
    `plusPtr` 4) (Int32
    val :: Int32)

    #if defined(ENABLE_OVERLOADING)
    data KeymapKeyGroupFieldInfo
    instance AttrInfo KeymapKeyGroupFieldInfo where
        type AttrBaseTypeConstraint KeymapKeyGroupFieldInfo = (~) KeymapKey
        type AttrAllowedOps KeymapKeyGroupFieldInfo = '[ 'AttrSet, 'AttrGet]
        type AttrSetTypeConstraint KeymapKeyGroupFieldInfo = (~) Int32
        type AttrTransferTypeConstraint KeymapKeyGroupFieldInfo = (~)Int32
        type AttrTransferType KeymapKeyGroupFieldInfo = Int32
        type AttrGetType KeymapKeyGroupFieldInfo = Int32
        type AttrLabel KeymapKeyGroupFieldInfo = "group"
        type AttrOrigin KeymapKeyGroupFieldInfo = KeymapKey
        attrGet = getKeymapKeyGroup
        attrSet = setKeymapKeyGroup
        attrConstruct = undefined
        attrClear = undefined
        attrTransfer _ v = do
            return v

    keymapKey_group :: AttrLabelProxy "group"
    keymapKey_group = AttrLabelProxy

    #endif

    -- | Get the value of the “@level@” field.
    -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
    --
    -- @
    -- 'Data.GI.Base.Attributes.get' keymapKey #level
    -- @
    getKeymapKeyLevel :: MonadIO m => KeymapKey -> m Int32
    getKeymapKeyLevel :: KeymapKey -> m Int32
    getKeymapKeyLevel s :: KeymapKey
    s = IO Int32 -> m Int32
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO Int32 -> m Int32) -> IO Int32 -> m Int32
    forall a b. (a -> b) -> a -> b
    $ KeymapKey -> (Ptr KeymapKey -> IO Int32) -> IO Int32
    forall a c.
    (HasCallStack, ManagedPtrNewtype a) =>
    a -> (Ptr a -> IO c) -> IO c
    withManagedPtr KeymapKey
    s ((Ptr KeymapKey -> IO Int32) -> IO Int32)
    -> (Ptr KeymapKey -> IO Int32) -> IO Int32
    forall a b. (a -> b) -> a -> b
    $ \ptr :: Ptr KeymapKey
    ptr -> do
        Int32
    val <- Ptr Int32 -> IO Int32
    forall a. Storable a => Ptr a -> IO a
    peek (Ptr KeymapKey
    ptr Ptr KeymapKey -> Int -> Ptr Int32
    forall a b. Ptr a -> Int -> Ptr b
    `plusPtr` 8) :: IO Int32
        Int32 -> IO Int32
    forall (m :: * -> *) a. Monad m => a -> m a
    return Int32
    val

    -- | Set the value of the “@level@” field.
    -- When <https://github.com/haskell-gi/haskell-gi/wiki/Overloading overloading> is enabled, this is equivalent to
    --
    -- @
    -- 'Data.GI.Base.Attributes.set' keymapKey [ #level 'Data.GI.Base.Attributes.:=' value ]
    -- @
    setKeymapKeyLevel :: MonadIO m => KeymapKey -> Int32 -> m ()
    setKeymapKeyLevel :: KeymapKey -> Int32 -> m ()
    setKeymapKeyLevel s :: KeymapKey
    s val :: Int32
    val = IO () -> m ()
    forall (m :: * -> *) a. MonadIO m => IO a -> m a
    liftIO (IO () -> m ()) -> IO () -> m ()
    forall a b. (a -> b) -> a -> b
    $ KeymapKey -> (Ptr KeymapKey -> IO ()) -> IO ()
    forall a c.
    (HasCallStack, ManagedPtrNewtype a) =>
    a -> (Ptr a -> IO c) -> IO c
    withManagedPtr KeymapKey
    s ((Ptr KeymapKey -> IO ()) -> IO ())
    -> (Ptr KeymapKey -> IO ()) -> IO ()
    forall a b. (a -> b) -> a -> b
    $ \ptr :: Ptr KeymapKey
    ptr -> do
        Ptr Int32 -> Int32 -> IO ()
    forall a. Storable a => Ptr a -> a -> IO ()
    poke (Ptr KeymapKey
    ptr Ptr KeymapKey -> Int -> Ptr Int32
    forall a b. Ptr a -> Int -> Ptr b
    `plusPtr` 8) (Int32
    val :: Int32)

    #if defined(ENABLE_OVERLOADING)
    data KeymapKeyLevelFieldInfo
    instance AttrInfo KeymapKeyLevelFieldInfo where
        type AttrBaseTypeConstraint KeymapKeyLevelFieldInfo = (~) KeymapKey
        type AttrAllowedOps KeymapKeyLevelFieldInfo = '[ 'AttrSet, 'AttrGet]
        type AttrSetTypeConstraint KeymapKeyLevelFieldInfo = (~) Int32
        type AttrTransferTypeConstraint KeymapKeyLevelFieldInfo = (~)Int32
        type AttrTransferType KeymapKeyLevelFieldInfo = Int32
        type AttrGetType KeymapKeyLevelFieldInfo = Int32
        type AttrLabel KeymapKeyLevelFieldInfo = "level"
        type AttrOrigin KeymapKeyLevelFieldInfo = KeymapKey
        attrGet = getKeymapKeyLevel
        attrSet = setKeymapKeyLevel
        attrConstruct = undefined
        attrClear = undefined
        attrTransfer _ v = do
            return v

    keymapKey_level :: AttrLabelProxy "level"
    keymapKey_level = AttrLabelProxy

    #endif

    #if defined(ENABLE_OVERLOADING)
    instance O.HasAttributeList KeymapKey
    type instance O.AttributeList KeymapKey = KeymapKeyAttributeList
    type KeymapKeyAttributeList = ('[ '("keycode", KeymapKeyKeycodeFieldInfo), '("group", KeymapKeyGroupFieldInfo), '("level", KeymapKeyLevelFieldInfo)] :: [(Symbol, *)])
    #endif

    #if defined(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 @info
    #else
        fromLabel _ = O.overloadedMethod @info
    #endif

    #endif