gi-gdk-3.0.18: GI/Gdk/Interfaces/DevicePad.hs
{- |
Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)
'GI.Gdk.Interfaces.DevicePad.DevicePad' is an interface implemented by devices of type
'GI.Gdk.Enums.InputSourceTabletPad', it allows querying the features provided
by the pad device.
Tablet pads may contain one or more groups, each containing a subset
of the buttons\/rings\/strips available. 'GI.Gdk.Interfaces.DevicePad.devicePadGetNGroups'
can be used to obtain the number of groups, 'GI.Gdk.Interfaces.DevicePad.devicePadGetNFeatures'
and 'GI.Gdk.Interfaces.DevicePad.devicePadGetFeatureGroup' can be combined to find out the
number of buttons\/rings\/strips the device has, and how are they grouped.
Each of those groups have different modes, which may be used to map
each individual pad feature to multiple actions. Only one mode is
effective (current) for each given group, different groups may have
different current modes. The number of available modes in a group can
be found out through 'GI.Gdk.Interfaces.DevicePad.devicePadGetGroupNModes', and the current
mode for a given group will be notified through the 'GI.Gdk.Structs.EventPadGroupMode.EventPadGroupMode'
event.
-}
#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
&& !defined(__HADDOCK_VERSION__))
module GI.Gdk.Interfaces.DevicePad
(
-- * Exported types
DevicePad(..) ,
noDevicePad ,
IsDevicePad ,
toDevicePad ,
-- * Methods
-- ** getFeatureGroup #method:getFeatureGroup#
#if ENABLE_OVERLOADING
DevicePadGetFeatureGroupMethodInfo ,
#endif
devicePadGetFeatureGroup ,
-- ** getGroupNModes #method:getGroupNModes#
#if ENABLE_OVERLOADING
DevicePadGetGroupNModesMethodInfo ,
#endif
devicePadGetGroupNModes ,
-- ** getNFeatures #method:getNFeatures#
#if ENABLE_OVERLOADING
DevicePadGetNFeaturesMethodInfo ,
#endif
devicePadGetNFeatures ,
-- ** getNGroups #method:getNGroups#
#if ENABLE_OVERLOADING
DevicePadGetNGroupsMethodInfo ,
#endif
devicePadGetNGroups ,
) 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.GObject.Objects.Object as GObject.Object
import {-# SOURCE #-} qualified GI.Gdk.Enums as Gdk.Enums
import {-# SOURCE #-} qualified GI.Gdk.Objects.Device as Gdk.Device
-- interface DevicePad
-- | Memory-managed wrapper type.
newtype DevicePad = DevicePad (ManagedPtr DevicePad)
-- | A convenience alias for `Nothing` :: `Maybe` `DevicePad`.
noDevicePad :: Maybe DevicePad
noDevicePad = Nothing
#if ENABLE_OVERLOADING
type instance O.SignalList DevicePad = DevicePadSignalList
type DevicePadSignalList = ('[ '("changed", Gdk.Device.DeviceChangedSignalInfo), '("notify", GObject.Object.ObjectNotifySignalInfo), '("toolChanged", Gdk.Device.DeviceToolChangedSignalInfo)] :: [(Symbol, *)])
#endif
foreign import ccall "gdk_device_pad_get_type"
c_gdk_device_pad_get_type :: IO GType
instance GObject DevicePad where
gobjectType = c_gdk_device_pad_get_type
-- | Type class for types which can be safely cast to `DevicePad`, for instance with `toDevicePad`.
class (GObject o, O.IsDescendantOf DevicePad o) => IsDevicePad o
instance (GObject o, O.IsDescendantOf DevicePad o) => IsDevicePad o
instance O.HasParentTypes DevicePad
type instance O.ParentTypes DevicePad = '[Gdk.Device.Device, GObject.Object.Object]
-- | Cast to `DevicePad`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`.
toDevicePad :: (MonadIO m, IsDevicePad o) => o -> m DevicePad
toDevicePad = liftIO . unsafeCastTo DevicePad
#if ENABLE_OVERLOADING
instance O.HasAttributeList DevicePad
type instance O.AttributeList DevicePad = DevicePadAttributeList
type DevicePadAttributeList = ('[ '("associatedDevice", Gdk.Device.DeviceAssociatedDevicePropertyInfo), '("axes", Gdk.Device.DeviceAxesPropertyInfo), '("deviceManager", Gdk.Device.DeviceDeviceManagerPropertyInfo), '("display", Gdk.Device.DeviceDisplayPropertyInfo), '("hasCursor", Gdk.Device.DeviceHasCursorPropertyInfo), '("inputMode", Gdk.Device.DeviceInputModePropertyInfo), '("inputSource", Gdk.Device.DeviceInputSourcePropertyInfo), '("nAxes", Gdk.Device.DeviceNAxesPropertyInfo), '("name", Gdk.Device.DeviceNamePropertyInfo), '("numTouches", Gdk.Device.DeviceNumTouchesPropertyInfo), '("productId", Gdk.Device.DeviceProductIdPropertyInfo), '("seat", Gdk.Device.DeviceSeatPropertyInfo), '("tool", Gdk.Device.DeviceToolPropertyInfo), '("type", Gdk.Device.DeviceTypePropertyInfo), '("vendorId", Gdk.Device.DeviceVendorIdPropertyInfo)] :: [(Symbol, *)])
#endif
#if ENABLE_OVERLOADING
#endif
#if ENABLE_OVERLOADING
type family ResolveDevicePadMethod (t :: Symbol) (o :: *) :: * where
ResolveDevicePadMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo
ResolveDevicePadMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo
ResolveDevicePadMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo
ResolveDevicePadMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo
ResolveDevicePadMethod "getv" o = GObject.Object.ObjectGetvMethodInfo
ResolveDevicePadMethod "grab" o = Gdk.Device.DeviceGrabMethodInfo
ResolveDevicePadMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo
ResolveDevicePadMethod "listAxes" o = Gdk.Device.DeviceListAxesMethodInfo
ResolveDevicePadMethod "listSlaveDevices" o = Gdk.Device.DeviceListSlaveDevicesMethodInfo
ResolveDevicePadMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo
ResolveDevicePadMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo
ResolveDevicePadMethod "ref" o = GObject.Object.ObjectRefMethodInfo
ResolveDevicePadMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo
ResolveDevicePadMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo
ResolveDevicePadMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo
ResolveDevicePadMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo
ResolveDevicePadMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo
ResolveDevicePadMethod "ungrab" o = Gdk.Device.DeviceUngrabMethodInfo
ResolveDevicePadMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo
ResolveDevicePadMethod "warp" o = Gdk.Device.DeviceWarpMethodInfo
ResolveDevicePadMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo
ResolveDevicePadMethod "getAssociatedDevice" o = Gdk.Device.DeviceGetAssociatedDeviceMethodInfo
ResolveDevicePadMethod "getAxes" o = Gdk.Device.DeviceGetAxesMethodInfo
ResolveDevicePadMethod "getAxisUse" o = Gdk.Device.DeviceGetAxisUseMethodInfo
ResolveDevicePadMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo
ResolveDevicePadMethod "getDeviceType" o = Gdk.Device.DeviceGetDeviceTypeMethodInfo
ResolveDevicePadMethod "getDisplay" o = Gdk.Device.DeviceGetDisplayMethodInfo
ResolveDevicePadMethod "getFeatureGroup" o = DevicePadGetFeatureGroupMethodInfo
ResolveDevicePadMethod "getGroupNModes" o = DevicePadGetGroupNModesMethodInfo
ResolveDevicePadMethod "getHasCursor" o = Gdk.Device.DeviceGetHasCursorMethodInfo
ResolveDevicePadMethod "getKey" o = Gdk.Device.DeviceGetKeyMethodInfo
ResolveDevicePadMethod "getLastEventWindow" o = Gdk.Device.DeviceGetLastEventWindowMethodInfo
ResolveDevicePadMethod "getMode" o = Gdk.Device.DeviceGetModeMethodInfo
ResolveDevicePadMethod "getNAxes" o = Gdk.Device.DeviceGetNAxesMethodInfo
ResolveDevicePadMethod "getNFeatures" o = DevicePadGetNFeaturesMethodInfo
ResolveDevicePadMethod "getNGroups" o = DevicePadGetNGroupsMethodInfo
ResolveDevicePadMethod "getNKeys" o = Gdk.Device.DeviceGetNKeysMethodInfo
ResolveDevicePadMethod "getName" o = Gdk.Device.DeviceGetNameMethodInfo
ResolveDevicePadMethod "getPosition" o = Gdk.Device.DeviceGetPositionMethodInfo
ResolveDevicePadMethod "getPositionDouble" o = Gdk.Device.DeviceGetPositionDoubleMethodInfo
ResolveDevicePadMethod "getProductId" o = Gdk.Device.DeviceGetProductIdMethodInfo
ResolveDevicePadMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo
ResolveDevicePadMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo
ResolveDevicePadMethod "getSeat" o = Gdk.Device.DeviceGetSeatMethodInfo
ResolveDevicePadMethod "getSource" o = Gdk.Device.DeviceGetSourceMethodInfo
ResolveDevicePadMethod "getVendorId" o = Gdk.Device.DeviceGetVendorIdMethodInfo
ResolveDevicePadMethod "getWindowAtPosition" o = Gdk.Device.DeviceGetWindowAtPositionMethodInfo
ResolveDevicePadMethod "getWindowAtPositionDouble" o = Gdk.Device.DeviceGetWindowAtPositionDoubleMethodInfo
ResolveDevicePadMethod "setAxisUse" o = Gdk.Device.DeviceSetAxisUseMethodInfo
ResolveDevicePadMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo
ResolveDevicePadMethod "setKey" o = Gdk.Device.DeviceSetKeyMethodInfo
ResolveDevicePadMethod "setMode" o = Gdk.Device.DeviceSetModeMethodInfo
ResolveDevicePadMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo
ResolveDevicePadMethod l o = O.MethodResolutionFailed l o
instance (info ~ ResolveDevicePadMethod t DevicePad, O.MethodInfo info DevicePad p) => OL.IsLabel t (DevicePad -> 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
-- method DevicePad::get_feature_group
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gdk", name = "DevicePad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkDevicePad", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "feature", argType = TInterface (Name {namespace = "Gdk", name = "DevicePadFeature"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the feature type to get the group from", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "feature_idx", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "the index of the feature to get the group from", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False
foreign import ccall "gdk_device_pad_get_feature_group" gdk_device_pad_get_feature_group ::
Ptr DevicePad -> -- pad : TInterface (Name {namespace = "Gdk", name = "DevicePad"})
CUInt -> -- feature : TInterface (Name {namespace = "Gdk", name = "DevicePadFeature"})
Int32 -> -- feature_idx : TBasicType TInt
IO Int32
{- |
Returns the group the given /@feature@/ and /@idx@/ belong to,
or -1 if feature\/index do not exist in /@pad@/.
/Since: 3.22/
-}
devicePadGetFeatureGroup ::
(B.CallStack.HasCallStack, MonadIO m, IsDevicePad a) =>
a
{- ^ /@pad@/: a 'GI.Gdk.Interfaces.DevicePad.DevicePad' -}
-> Gdk.Enums.DevicePadFeature
{- ^ /@feature@/: the feature type to get the group from -}
-> Int32
{- ^ /@featureIdx@/: the index of the feature to get the group from -}
-> m Int32
{- ^ __Returns:__ The group number of the queried pad feature. -}
devicePadGetFeatureGroup pad feature featureIdx = liftIO $ do
pad' <- unsafeManagedPtrCastPtr pad
let feature' = (fromIntegral . fromEnum) feature
result <- gdk_device_pad_get_feature_group pad' feature' featureIdx
touchManagedPtr pad
return result
#if ENABLE_OVERLOADING
data DevicePadGetFeatureGroupMethodInfo
instance (signature ~ (Gdk.Enums.DevicePadFeature -> Int32 -> m Int32), MonadIO m, IsDevicePad a) => O.MethodInfo DevicePadGetFeatureGroupMethodInfo a signature where
overloadedMethod _ = devicePadGetFeatureGroup
#endif
-- method DevicePad::get_group_n_modes
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gdk", name = "DevicePad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkDevicePad", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "group_idx", argType = TBasicType TInt, direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "group to get the number of available modes from", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False
foreign import ccall "gdk_device_pad_get_group_n_modes" gdk_device_pad_get_group_n_modes ::
Ptr DevicePad -> -- pad : TInterface (Name {namespace = "Gdk", name = "DevicePad"})
Int32 -> -- group_idx : TBasicType TInt
IO Int32
{- |
Returns the number of modes that /@group@/ may have.
/Since: 3.22/
-}
devicePadGetGroupNModes ::
(B.CallStack.HasCallStack, MonadIO m, IsDevicePad a) =>
a
{- ^ /@pad@/: a 'GI.Gdk.Interfaces.DevicePad.DevicePad' -}
-> Int32
{- ^ /@groupIdx@/: group to get the number of available modes from -}
-> m Int32
{- ^ __Returns:__ The number of modes available in /@group@/. -}
devicePadGetGroupNModes pad groupIdx = liftIO $ do
pad' <- unsafeManagedPtrCastPtr pad
result <- gdk_device_pad_get_group_n_modes pad' groupIdx
touchManagedPtr pad
return result
#if ENABLE_OVERLOADING
data DevicePadGetGroupNModesMethodInfo
instance (signature ~ (Int32 -> m Int32), MonadIO m, IsDevicePad a) => O.MethodInfo DevicePadGetGroupNModesMethodInfo a signature where
overloadedMethod _ = devicePadGetGroupNModes
#endif
-- method DevicePad::get_n_features
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gdk", name = "DevicePad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkDevicePad", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing},Arg {argCName = "feature", argType = TInterface (Name {namespace = "Gdk", name = "DevicePadFeature"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a pad feature", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False
foreign import ccall "gdk_device_pad_get_n_features" gdk_device_pad_get_n_features ::
Ptr DevicePad -> -- pad : TInterface (Name {namespace = "Gdk", name = "DevicePad"})
CUInt -> -- feature : TInterface (Name {namespace = "Gdk", name = "DevicePadFeature"})
IO Int32
{- |
Returns the number of features a tablet pad has.
/Since: 3.22/
-}
devicePadGetNFeatures ::
(B.CallStack.HasCallStack, MonadIO m, IsDevicePad a) =>
a
{- ^ /@pad@/: a 'GI.Gdk.Interfaces.DevicePad.DevicePad' -}
-> Gdk.Enums.DevicePadFeature
{- ^ /@feature@/: a pad feature -}
-> m Int32
{- ^ __Returns:__ The amount of elements of type /@feature@/ that this pad has. -}
devicePadGetNFeatures pad feature = liftIO $ do
pad' <- unsafeManagedPtrCastPtr pad
let feature' = (fromIntegral . fromEnum) feature
result <- gdk_device_pad_get_n_features pad' feature'
touchManagedPtr pad
return result
#if ENABLE_OVERLOADING
data DevicePadGetNFeaturesMethodInfo
instance (signature ~ (Gdk.Enums.DevicePadFeature -> m Int32), MonadIO m, IsDevicePad a) => O.MethodInfo DevicePadGetNFeaturesMethodInfo a signature where
overloadedMethod _ = devicePadGetNFeatures
#endif
-- method DevicePad::get_n_groups
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "pad", argType = TInterface (Name {namespace = "Gdk", name = "DevicePad"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkDevicePad", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TInt)
-- throws : False
-- Skip return : False
foreign import ccall "gdk_device_pad_get_n_groups" gdk_device_pad_get_n_groups ::
Ptr DevicePad -> -- pad : TInterface (Name {namespace = "Gdk", name = "DevicePad"})
IO Int32
{- |
Returns the number of groups this pad device has. Pads have
at least one group. A pad group is a subcollection of
buttons\/strip\/rings that is affected collectively by a same
current mode.
/Since: 3.22/
-}
devicePadGetNGroups ::
(B.CallStack.HasCallStack, MonadIO m, IsDevicePad a) =>
a
{- ^ /@pad@/: a 'GI.Gdk.Interfaces.DevicePad.DevicePad' -}
-> m Int32
{- ^ __Returns:__ The number of button\/ring\/strip groups in the pad. -}
devicePadGetNGroups pad = liftIO $ do
pad' <- unsafeManagedPtrCastPtr pad
result <- gdk_device_pad_get_n_groups pad'
touchManagedPtr pad
return result
#if ENABLE_OVERLOADING
data DevicePadGetNGroupsMethodInfo
instance (signature ~ (m Int32), MonadIO m, IsDevicePad a) => O.MethodInfo DevicePadGetNGroupsMethodInfo a signature where
overloadedMethod _ = devicePadGetNGroups
#endif