{-# 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 ,
noAccelKey ,
#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.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
import qualified GI.Gdk.Flags as Gdk.Flags
newtype AccelKey = AccelKey (ManagedPtr AccelKey)
deriving (AccelKey -> AccelKey -> Bool
(AccelKey -> AccelKey -> Bool)
-> (AccelKey -> AccelKey -> Bool) -> Eq AccelKey
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AccelKey -> AccelKey -> Bool
$c/= :: AccelKey -> AccelKey -> Bool
== :: AccelKey -> AccelKey -> Bool
$c== :: AccelKey -> AccelKey -> Bool
Eq)
instance WrappedPtr AccelKey where
wrappedPtrCalloc :: IO (Ptr AccelKey)
wrappedPtrCalloc = Int -> IO (Ptr AccelKey)
forall a. Int -> IO (Ptr a)
callocBytes 12
wrappedPtrCopy :: AccelKey -> IO AccelKey
wrappedPtrCopy = \p :: AccelKey
p -> AccelKey -> (Ptr AccelKey -> IO AccelKey) -> IO AccelKey
forall a c.
(HasCallStack, ManagedPtrNewtype a) =>
a -> (Ptr a -> IO c) -> IO c
withManagedPtr AccelKey
p (Int -> Ptr AccelKey -> IO (Ptr AccelKey)
forall a. WrappedPtr a => Int -> Ptr a -> IO (Ptr a)
copyBytes 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, WrappedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr AccelKey -> AccelKey
AccelKey)
wrappedPtrFree :: Maybe (GDestroyNotify AccelKey)
wrappedPtrFree = GDestroyNotify AccelKey -> Maybe (GDestroyNotify AccelKey)
forall a. a -> Maybe a
Just GDestroyNotify AccelKey
forall a. FunPtr (Ptr a -> IO ())
ptr_to_g_free
newZeroAccelKey :: MonadIO m => m AccelKey
newZeroAccelKey :: m AccelKey
newZeroAccelKey = IO AccelKey -> m AccelKey
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. WrappedPtr a => IO (Ptr a)
wrappedPtrCalloc IO (Ptr AccelKey) -> (Ptr AccelKey -> IO AccelKey) -> IO AccelKey
forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
>>= (ManagedPtr AccelKey -> AccelKey) -> Ptr AccelKey -> IO AccelKey
forall a.
(HasCallStack, WrappedPtr a) =>
(ManagedPtr a -> a) -> Ptr a -> IO a
wrapPtr ManagedPtr AccelKey -> AccelKey
AccelKey
instance tag ~ 'AttrSet => Constructible AccelKey tag where
new :: (ManagedPtr AccelKey -> AccelKey)
-> [AttrOp AccelKey tag] -> m AccelKey
new _ attrs :: [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 (m :: * -> *) a. Monad m => a -> m a
return AccelKey
o
noAccelKey :: Maybe AccelKey
noAccelKey :: Maybe AccelKey
noAccelKey = Maybe AccelKey
forall a. Maybe a
Nothing
getAccelKeyAccelKey :: MonadIO m => AccelKey -> m Word32
getAccelKeyAccelKey :: AccelKey -> m Word32
getAccelKeyAccelKey s :: AccelKey
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
$ 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 :: 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` 0) :: IO Word32
Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
val
setAccelKeyAccelKey :: MonadIO m => AccelKey -> Word32 -> m ()
setAccelKeyAccelKey :: AccelKey -> Word32 -> m ()
setAccelKeyAccelKey s :: AccelKey
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
$ 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 :: 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` 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
accelKey_accelKey :: AttrLabelProxy "accelKey"
accelKey_accelKey = AttrLabelProxy
#endif
getAccelKeyAccelMods :: MonadIO m => AccelKey -> m [Gdk.Flags.ModifierType]
getAccelKeyAccelMods :: AccelKey -> m [ModifierType]
getAccelKeyAccelMods s :: AccelKey
s = IO [ModifierType] -> m [ModifierType]
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 :: 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` 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 (m :: * -> *) a. Monad m => a -> m a
return [ModifierType]
val'
setAccelKeyAccelMods :: MonadIO m => AccelKey -> [Gdk.Flags.ModifierType] -> m ()
setAccelKeyAccelMods :: AccelKey -> [ModifierType] -> m ()
setAccelKeyAccelMods s :: AccelKey
s val :: [ModifierType]
val = IO () -> m ()
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 :: 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` 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
accelKey_accelMods :: AttrLabelProxy "accelMods"
accelKey_accelMods = AttrLabelProxy
#endif
getAccelKeyAccelFlags :: MonadIO m => AccelKey -> m Word32
getAccelKeyAccelFlags :: AccelKey -> m Word32
getAccelKeyAccelFlags s :: AccelKey
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
$ 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 :: 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` 8) :: IO Word32
Word32 -> IO Word32
forall (m :: * -> *) a. Monad m => a -> m a
return Word32
val
setAccelKeyAccelFlags :: MonadIO m => AccelKey -> Word32 -> m ()
setAccelKeyAccelFlags :: AccelKey -> Word32 -> m ()
setAccelKeyAccelFlags s :: AccelKey
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
$ 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 :: 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` 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
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, *)])
#endif
#if defined(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 @info
#else
fromLabel _ = O.overloadedMethod @info
#endif
#endif