{-# LANGUAGE TypeApplications #-}
#if (MIN_VERSION_haskell_gi_overloading(1,0,0) && !defined(__HADDOCK_VERSION__))
#define ENABLE_OVERLOADING
#endif
module GI.Gtk.Structs.AccelKey
(
AccelKey(..) ,
newZeroAccelKey ,
#if defined(ENABLE_OVERLOADING)
ResolveAccelKeyMethod ,
#endif
#if defined(ENABLE_OVERLOADING)
accelKey_accelFlags ,
#endif
getAccelKeyAccelFlags ,
setAccelKeyAccelFlags ,
#if defined(ENABLE_OVERLOADING)
accelKey_accelKey ,
#endif
getAccelKeyAccelKey ,
setAccelKeyAccelKey ,
#if defined(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.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.GHashTable as B.GHT
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.Coerce as Coerce
import qualified Data.Text as T
import qualified Data.Kind as DK
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 GHC.Records as R
import qualified Data.Word as DW
import qualified Data.Int as DI
import qualified System.Posix.Types as SPT
import qualified Foreign.C.Types as FCT
#if MIN_VERSION_base(4,18,0)
import qualified GI.Gdk.Flags as Gdk.Flags
#else
import qualified GI.Gdk.Flags as Gdk.Flags
#endif
newtype AccelKey = AccelKey (SP.ManagedPtr AccelKey)
deriving (AccelKey -> AccelKey -> Bool
(AccelKey -> AccelKey -> Bool)
-> (AccelKey -> AccelKey -> Bool) -> Eq AccelKey
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: AccelKey -> AccelKey -> Bool
== :: AccelKey -> AccelKey -> Bool
$c/= :: AccelKey -> AccelKey -> Bool
/= :: AccelKey -> AccelKey -> Bool
Eq)
instance SP.ManagedPtrNewtype AccelKey where
toManagedPtr :: AccelKey -> ManagedPtr AccelKey
toManagedPtr (AccelKey ManagedPtr AccelKey
p) = ManagedPtr AccelKey
p
instance BoxedPtr AccelKey where
boxedPtrCopy :: AccelKey -> IO AccelKey
boxedPtrCopy = \AccelKey
p -> AccelKey -> (Ptr AccelKey -> IO AccelKey) -> IO AccelKey
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
B.ManagedPtr.withManagedPtr AccelKey
p (Int -> Ptr AccelKey -> IO (Ptr AccelKey)
forall a. (HasCallStack, CallocPtr a) => Int -> Ptr a -> IO (Ptr a)
copyBytes Int
12 (Ptr AccelKey -> IO (Ptr AccelKey))
-> (Ptr AccelKey -> IO AccelKey) -> Ptr AccelKey -> IO AccelKey
forall (m :: * -> *) a b c.
Monad m =>
(a -> m b) -> (b -> m c) -> a -> m c
>=> (ManagedPtr AccelKey -> AccelKey) -> Ptr AccelKey -> IO AccelKey
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
B.ManagedPtr.wrapPtr ManagedPtr AccelKey -> AccelKey
AccelKey)
boxedPtrFree :: AccelKey -> IO ()
boxedPtrFree = \AccelKey
x -> AccelKey -> (Ptr AccelKey -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
SP.withManagedPtr AccelKey
x Ptr AccelKey -> IO ()
forall a. Ptr a -> IO ()
SP.freeMem
instance CallocPtr AccelKey where
boxedPtrCalloc :: IO (Ptr AccelKey)
boxedPtrCalloc = Int -> IO (Ptr AccelKey)
forall a. Int -> IO (Ptr a)
callocBytes Int
12
newZeroAccelKey :: MonadIO m => m AccelKey
newZeroAccelKey :: forall (m :: * -> *). MonadIO m => m AccelKey
newZeroAccelKey = IO AccelKey -> m AccelKey
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO AccelKey -> m AccelKey) -> IO AccelKey -> m AccelKey
forall a b. (a -> b) -> a -> b
$ IO (Ptr AccelKey)
forall a. CallocPtr a => IO (Ptr a)
boxedPtrCalloc IO (Ptr AccelKey) -> (Ptr AccelKey -> IO AccelKey) -> IO AccelKey
forall a b. IO a -> (a -> IO b) -> IO b
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr AccelKey -> AccelKey) -> Ptr AccelKey -> IO AccelKey
forall a.
(HasCallStack, BoxedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr AccelKey -> AccelKey
AccelKey
instance tag ~ 'AttrSet => Constructible AccelKey tag where
new :: forall (m :: * -> *).
MonadIO m =>
(ManagedPtr AccelKey -> AccelKey)
-> [AttrOp AccelKey tag] -> m AccelKey
new ManagedPtr AccelKey -> AccelKey
_ [AttrOp AccelKey tag]
attrs = do
AccelKey
o <- m AccelKey
forall (m :: * -> *). MonadIO m => m AccelKey
newZeroAccelKey
AccelKey -> [AttrOp AccelKey 'AttrSet] -> m ()
forall o (m :: * -> *).
MonadIO m =>
o -> [AttrOp o 'AttrSet] -> m ()
GI.Attributes.set AccelKey
o [AttrOp AccelKey tag]
[AttrOp AccelKey 'AttrSet]
attrs
AccelKey -> m AccelKey
forall a. a -> m a
forall (m :: * -> *) a. Monad m => a -> m a
return AccelKey
o
getAccelKeyAccelKey :: MonadIO m => AccelKey -> m Word32
getAccelKeyAccelKey :: forall (m :: * -> *). MonadIO m => AccelKey -> m Word32
getAccelKeyAccelKey AccelKey
s = IO Word32 -> m Word32
forall a. IO a -> m a
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
$ AccelKey -> (Ptr AccelKey -> IO Word32) -> IO Word32
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr AccelKey
s ((Ptr AccelKey -> IO Word32) -> IO Word32)
-> (Ptr AccelKey -> IO Word32) -> IO Word32
forall a b. (a -> b) -> a -> b
$ \Ptr AccelKey
ptr -> do
Word32
val <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek (Ptr AccelKey
ptr Ptr AccelKey -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) :: IO Word32
Word32 -> IO Word32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
val
setAccelKeyAccelKey :: MonadIO m => AccelKey -> Word32 -> m ()
setAccelKeyAccelKey :: forall (m :: * -> *). MonadIO m => AccelKey -> Word32 -> m ()
setAccelKeyAccelKey AccelKey
s Word32
val = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ AccelKey -> (Ptr AccelKey -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr AccelKey
s ((Ptr AccelKey -> IO ()) -> IO ())
-> (Ptr AccelKey -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr AccelKey
ptr -> do
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr AccelKey
ptr Ptr AccelKey -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
0) (Word32
val :: Word32)
#if defined(ENABLE_OVERLOADING)
data AccelKeyAccelKeyFieldInfo
instance AttrInfo AccelKeyAccelKeyFieldInfo where
type AttrBaseTypeConstraint AccelKeyAccelKeyFieldInfo = (~) AccelKey
type AttrAllowedOps AccelKeyAccelKeyFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint AccelKeyAccelKeyFieldInfo = (~) Word32
type AttrTransferTypeConstraint AccelKeyAccelKeyFieldInfo = (~)Word32
type AttrTransferType AccelKeyAccelKeyFieldInfo = Word32
type AttrGetType AccelKeyAccelKeyFieldInfo = Word32
type AttrLabel AccelKeyAccelKeyFieldInfo = "accel_key"
type AttrOrigin AccelKeyAccelKeyFieldInfo = AccelKey
attrGet = getAccelKeyAccelKey
attrSet = setAccelKeyAccelKey
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gtk.Structs.AccelKey.accelKey"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-3.0.43/docs/GI-Gtk-Structs-AccelKey.html#g:attr:accelKey"
})
accelKey_accelKey :: AttrLabelProxy "accelKey"
accelKey_accelKey = AttrLabelProxy
#endif
getAccelKeyAccelMods :: MonadIO m => AccelKey -> m [Gdk.Flags.ModifierType]
getAccelKeyAccelMods :: forall (m :: * -> *). MonadIO m => AccelKey -> m [ModifierType]
getAccelKeyAccelMods AccelKey
s = IO [ModifierType] -> m [ModifierType]
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO [ModifierType] -> m [ModifierType])
-> IO [ModifierType] -> m [ModifierType]
forall a b. (a -> b) -> a -> b
$ AccelKey
-> (Ptr AccelKey -> IO [ModifierType]) -> IO [ModifierType]
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr AccelKey
s ((Ptr AccelKey -> IO [ModifierType]) -> IO [ModifierType])
-> (Ptr AccelKey -> IO [ModifierType]) -> IO [ModifierType]
forall a b. (a -> b) -> a -> b
$ \Ptr AccelKey
ptr -> do
CUInt
val <- Ptr CUInt -> IO CUInt
forall a. Storable a => Ptr a -> IO a
peek (Ptr AccelKey
ptr Ptr AccelKey -> Int -> Ptr CUInt
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4) :: IO CUInt
let val' :: [ModifierType]
val' = CUInt -> [ModifierType]
forall a b. (Storable a, Integral a, Bits a, IsGFlag b) => a -> [b]
wordToGFlags CUInt
val
[ModifierType] -> IO [ModifierType]
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return [ModifierType]
val'
setAccelKeyAccelMods :: MonadIO m => AccelKey -> [Gdk.Flags.ModifierType] -> m ()
setAccelKeyAccelMods :: forall (m :: * -> *).
MonadIO m =>
AccelKey -> [ModifierType] -> m ()
setAccelKeyAccelMods AccelKey
s [ModifierType]
val = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ AccelKey -> (Ptr AccelKey -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr AccelKey
s ((Ptr AccelKey -> IO ()) -> IO ())
-> (Ptr AccelKey -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr AccelKey
ptr -> do
let val' :: CUInt
val' = [ModifierType] -> CUInt
forall b a. (Num b, IsGFlag a) => [a] -> b
gflagsToWord [ModifierType]
val
Ptr CUInt -> CUInt -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr AccelKey
ptr Ptr AccelKey -> Int -> Ptr CUInt
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
4) (CUInt
val' :: CUInt)
#if defined(ENABLE_OVERLOADING)
data AccelKeyAccelModsFieldInfo
instance AttrInfo AccelKeyAccelModsFieldInfo where
type AttrBaseTypeConstraint AccelKeyAccelModsFieldInfo = (~) AccelKey
type AttrAllowedOps AccelKeyAccelModsFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint AccelKeyAccelModsFieldInfo = (~) [Gdk.Flags.ModifierType]
type AttrTransferTypeConstraint AccelKeyAccelModsFieldInfo = (~)[Gdk.Flags.ModifierType]
type AttrTransferType AccelKeyAccelModsFieldInfo = [Gdk.Flags.ModifierType]
type AttrGetType AccelKeyAccelModsFieldInfo = [Gdk.Flags.ModifierType]
type AttrLabel AccelKeyAccelModsFieldInfo = "accel_mods"
type AttrOrigin AccelKeyAccelModsFieldInfo = AccelKey
attrGet = getAccelKeyAccelMods
attrSet = setAccelKeyAccelMods
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gtk.Structs.AccelKey.accelMods"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-3.0.43/docs/GI-Gtk-Structs-AccelKey.html#g:attr:accelMods"
})
accelKey_accelMods :: AttrLabelProxy "accelMods"
accelKey_accelMods = AttrLabelProxy
#endif
getAccelKeyAccelFlags :: MonadIO m => AccelKey -> m Word32
getAccelKeyAccelFlags :: forall (m :: * -> *). MonadIO m => AccelKey -> m Word32
getAccelKeyAccelFlags AccelKey
s = IO Word32 -> m Word32
forall a. IO a -> m a
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
$ AccelKey -> (Ptr AccelKey -> IO Word32) -> IO Word32
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr AccelKey
s ((Ptr AccelKey -> IO Word32) -> IO Word32)
-> (Ptr AccelKey -> IO Word32) -> IO Word32
forall a b. (a -> b) -> a -> b
$ \Ptr AccelKey
ptr -> do
Word32
val <- Ptr Word32 -> IO Word32
forall a. Storable a => Ptr a -> IO a
peek (Ptr AccelKey
ptr Ptr AccelKey -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) :: IO Word32
Word32 -> IO Word32
forall a. a -> IO a
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
val
setAccelKeyAccelFlags :: MonadIO m => AccelKey -> Word32 -> m ()
setAccelKeyAccelFlags :: forall (m :: * -> *). MonadIO m => AccelKey -> Word32 -> m ()
setAccelKeyAccelFlags AccelKey
s Word32
val = IO () -> m ()
forall a. IO a -> m a
forall (m :: * -> *) a. MonadIO m => IO a -> m a
liftIO (IO () -> m ()) -> IO () -> m ()
forall a b. (a -> b) -> a -> b
$ AccelKey -> (Ptr AccelKey -> IO ()) -> IO ()
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr AccelKey
s ((Ptr AccelKey -> IO ()) -> IO ())
-> (Ptr AccelKey -> IO ()) -> IO ()
forall a b. (a -> b) -> a -> b
$ \Ptr AccelKey
ptr -> do
Ptr Word32 -> Word32 -> IO ()
forall a. Storable a => Ptr a -> a -> IO ()
poke (Ptr AccelKey
ptr Ptr AccelKey -> Int -> Ptr Word32
forall a b. Ptr a -> Int -> Ptr b
`plusPtr` Int
8) (Word32
val :: Word32)
#if defined(ENABLE_OVERLOADING)
data AccelKeyAccelFlagsFieldInfo
instance AttrInfo AccelKeyAccelFlagsFieldInfo where
type AttrBaseTypeConstraint AccelKeyAccelFlagsFieldInfo = (~) AccelKey
type AttrAllowedOps AccelKeyAccelFlagsFieldInfo = '[ 'AttrSet, 'AttrGet]
type AttrSetTypeConstraint AccelKeyAccelFlagsFieldInfo = (~) Word32
type AttrTransferTypeConstraint AccelKeyAccelFlagsFieldInfo = (~)Word32
type AttrTransferType AccelKeyAccelFlagsFieldInfo = Word32
type AttrGetType AccelKeyAccelFlagsFieldInfo = Word32
type AttrLabel AccelKeyAccelFlagsFieldInfo = "accel_flags"
type AttrOrigin AccelKeyAccelFlagsFieldInfo = AccelKey
attrGet = getAccelKeyAccelFlags
attrSet = setAccelKeyAccelFlags
attrConstruct = undefined
attrClear = undefined
attrTransfer _ v = do
return v
dbgAttrInfo = P.Just (O.ResolvedSymbolInfo {
O.resolvedSymbolName = "GI.Gtk.Structs.AccelKey.accelFlags"
, O.resolvedSymbolURL = "https://hackage.haskell.org/package/gi-gtk-3.0.43/docs/GI-Gtk-Structs-AccelKey.html#g:attr:accelFlags"
})
accelKey_accelFlags :: AttrLabelProxy "accelFlags"
accelKey_accelFlags = AttrLabelProxy
#endif
#if defined(ENABLE_OVERLOADING)
instance O.HasAttributeList AccelKey
type instance O.AttributeList AccelKey = AccelKeyAttributeList
type AccelKeyAttributeList = ('[ '("accelKey", AccelKeyAccelKeyFieldInfo), '("accelMods", AccelKeyAccelModsFieldInfo), '("accelFlags", AccelKeyAccelFlagsFieldInfo)] :: [(Symbol, DK.Type)])
#endif
#if defined(ENABLE_OVERLOADING)
type family ResolveAccelKeyMethod (t :: Symbol) (o :: DK.Type) :: DK.Type where
ResolveAccelKeyMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveAccelKeyMethod t AccelKey, O.OverloadedMethod info AccelKey p) => OL.IsLabel t (AccelKey -> p) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.overloadedMethod @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#if MIN_VERSION_base(4,13,0)
instance (info ~ ResolveAccelKeyMethod t AccelKey, O.OverloadedMethod info AccelKey p, R.HasField t AccelKey p) => R.HasField t AccelKey p where
getField = O.overloadedMethod @info
#endif
instance (info ~ ResolveAccelKeyMethod t AccelKey, O.OverloadedMethodInfo info AccelKey) => OL.IsLabel t (O.MethodProxy info AccelKey) where
#if MIN_VERSION_base(4,10,0)
fromLabel = O.MethodProxy
#else
fromLabel _ = O.MethodProxy
#endif
#endif