{- | Copyright : Will Thompson, Iñaki García Etxebarria and Jonas Platte License : LGPL-2.1 Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc) /No description available in the introspection data./ -} #define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \ && !defined(__HADDOCK_VERSION__)) module GI.Gdk.Objects.DeviceTool ( -- * Exported types DeviceTool(..) , IsDeviceTool , toDeviceTool , noDeviceTool , -- * Methods -- ** getHardwareId #method:getHardwareId# #if ENABLE_OVERLOADING DeviceToolGetHardwareIdMethodInfo , #endif deviceToolGetHardwareId , -- ** getSerial #method:getSerial# #if ENABLE_OVERLOADING DeviceToolGetSerialMethodInfo , #endif deviceToolGetSerial , -- ** getToolType #method:getToolType# #if ENABLE_OVERLOADING DeviceToolGetToolTypeMethodInfo , #endif deviceToolGetToolType , -- * Properties -- ** axes #attr:axes# {- | /No description available in the introspection data./ -} #if ENABLE_OVERLOADING DeviceToolAxesPropertyInfo , #endif constructDeviceToolAxes , #if ENABLE_OVERLOADING deviceToolAxes , #endif getDeviceToolAxes , -- ** hardwareId #attr:hardwareId# {- | /No description available in the introspection data./ -} #if ENABLE_OVERLOADING DeviceToolHardwareIdPropertyInfo , #endif constructDeviceToolHardwareId , #if ENABLE_OVERLOADING deviceToolHardwareId , #endif getDeviceToolHardwareId , -- ** serial #attr:serial# {- | /No description available in the introspection data./ -} #if ENABLE_OVERLOADING DeviceToolSerialPropertyInfo , #endif constructDeviceToolSerial , #if ENABLE_OVERLOADING deviceToolSerial , #endif getDeviceToolSerial , -- ** toolType #attr:toolType# {- | /No description available in the introspection data./ -} #if ENABLE_OVERLOADING DeviceToolToolTypePropertyInfo , #endif constructDeviceToolToolType , #if ENABLE_OVERLOADING deviceToolToolType , #endif getDeviceToolToolType , ) 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.Flags as Gdk.Flags -- | Memory-managed wrapper type. newtype DeviceTool = DeviceTool (ManagedPtr DeviceTool) foreign import ccall "gdk_device_tool_get_type" c_gdk_device_tool_get_type :: IO GType instance GObject DeviceTool where gobjectType = c_gdk_device_tool_get_type -- | Type class for types which can be safely cast to `DeviceTool`, for instance with `toDeviceTool`. class (GObject o, O.IsDescendantOf DeviceTool o) => IsDeviceTool o instance (GObject o, O.IsDescendantOf DeviceTool o) => IsDeviceTool o instance O.HasParentTypes DeviceTool type instance O.ParentTypes DeviceTool = '[GObject.Object.Object] -- | Cast to `DeviceTool`, for types for which this is known to be safe. For general casts, use `Data.GI.Base.ManagedPtr.castTo`. toDeviceTool :: (MonadIO m, IsDeviceTool o) => o -> m DeviceTool toDeviceTool = liftIO . unsafeCastTo DeviceTool -- | A convenience alias for `Nothing` :: `Maybe` `DeviceTool`. noDeviceTool :: Maybe DeviceTool noDeviceTool = Nothing #if ENABLE_OVERLOADING type family ResolveDeviceToolMethod (t :: Symbol) (o :: *) :: * where ResolveDeviceToolMethod "bindProperty" o = GObject.Object.ObjectBindPropertyMethodInfo ResolveDeviceToolMethod "bindPropertyFull" o = GObject.Object.ObjectBindPropertyFullMethodInfo ResolveDeviceToolMethod "forceFloating" o = GObject.Object.ObjectForceFloatingMethodInfo ResolveDeviceToolMethod "freezeNotify" o = GObject.Object.ObjectFreezeNotifyMethodInfo ResolveDeviceToolMethod "getv" o = GObject.Object.ObjectGetvMethodInfo ResolveDeviceToolMethod "isFloating" o = GObject.Object.ObjectIsFloatingMethodInfo ResolveDeviceToolMethod "notify" o = GObject.Object.ObjectNotifyMethodInfo ResolveDeviceToolMethod "notifyByPspec" o = GObject.Object.ObjectNotifyByPspecMethodInfo ResolveDeviceToolMethod "ref" o = GObject.Object.ObjectRefMethodInfo ResolveDeviceToolMethod "refSink" o = GObject.Object.ObjectRefSinkMethodInfo ResolveDeviceToolMethod "runDispose" o = GObject.Object.ObjectRunDisposeMethodInfo ResolveDeviceToolMethod "stealData" o = GObject.Object.ObjectStealDataMethodInfo ResolveDeviceToolMethod "stealQdata" o = GObject.Object.ObjectStealQdataMethodInfo ResolveDeviceToolMethod "thawNotify" o = GObject.Object.ObjectThawNotifyMethodInfo ResolveDeviceToolMethod "unref" o = GObject.Object.ObjectUnrefMethodInfo ResolveDeviceToolMethod "watchClosure" o = GObject.Object.ObjectWatchClosureMethodInfo ResolveDeviceToolMethod "getData" o = GObject.Object.ObjectGetDataMethodInfo ResolveDeviceToolMethod "getHardwareId" o = DeviceToolGetHardwareIdMethodInfo ResolveDeviceToolMethod "getProperty" o = GObject.Object.ObjectGetPropertyMethodInfo ResolveDeviceToolMethod "getQdata" o = GObject.Object.ObjectGetQdataMethodInfo ResolveDeviceToolMethod "getSerial" o = DeviceToolGetSerialMethodInfo ResolveDeviceToolMethod "getToolType" o = DeviceToolGetToolTypeMethodInfo ResolveDeviceToolMethod "setData" o = GObject.Object.ObjectSetDataMethodInfo ResolveDeviceToolMethod "setProperty" o = GObject.Object.ObjectSetPropertyMethodInfo ResolveDeviceToolMethod l o = O.MethodResolutionFailed l o instance (info ~ ResolveDeviceToolMethod t DeviceTool, O.MethodInfo info DeviceTool p) => OL.IsLabel t (DeviceTool -> 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 -- VVV Prop "axes" -- Type: TInterface (Name {namespace = "Gdk", name = "AxisFlags"}) -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly] -- Nullable: (Nothing,Nothing) {- | Get the value of the “@axes@” property. When is enabled, this is equivalent to @ 'Data.GI.Base.Attributes.get' deviceTool #axes @ -} getDeviceToolAxes :: (MonadIO m, IsDeviceTool o) => o -> m [Gdk.Flags.AxisFlags] getDeviceToolAxes obj = liftIO $ B.Properties.getObjectPropertyFlags obj "axes" {- | Construct a `GValueConstruct` with valid value for the “@axes@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`. -} constructDeviceToolAxes :: (IsDeviceTool o) => [Gdk.Flags.AxisFlags] -> IO (GValueConstruct o) constructDeviceToolAxes val = B.Properties.constructObjectPropertyFlags "axes" val #if ENABLE_OVERLOADING data DeviceToolAxesPropertyInfo instance AttrInfo DeviceToolAxesPropertyInfo where type AttrAllowedOps DeviceToolAxesPropertyInfo = '[ 'AttrConstruct, 'AttrGet] type AttrSetTypeConstraint DeviceToolAxesPropertyInfo = (~) [Gdk.Flags.AxisFlags] type AttrBaseTypeConstraint DeviceToolAxesPropertyInfo = IsDeviceTool type AttrGetType DeviceToolAxesPropertyInfo = [Gdk.Flags.AxisFlags] type AttrLabel DeviceToolAxesPropertyInfo = "axes" type AttrOrigin DeviceToolAxesPropertyInfo = DeviceTool attrGet _ = getDeviceToolAxes attrSet _ = undefined attrConstruct _ = constructDeviceToolAxes attrClear _ = undefined #endif -- VVV Prop "hardware-id" -- Type: TBasicType TUInt64 -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly] -- Nullable: (Just False,Nothing) {- | Get the value of the “@hardware-id@” property. When is enabled, this is equivalent to @ 'Data.GI.Base.Attributes.get' deviceTool #hardwareId @ -} getDeviceToolHardwareId :: (MonadIO m, IsDeviceTool o) => o -> m Word64 getDeviceToolHardwareId obj = liftIO $ B.Properties.getObjectPropertyUInt64 obj "hardware-id" {- | Construct a `GValueConstruct` with valid value for the “@hardware-id@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`. -} constructDeviceToolHardwareId :: (IsDeviceTool o) => Word64 -> IO (GValueConstruct o) constructDeviceToolHardwareId val = B.Properties.constructObjectPropertyUInt64 "hardware-id" val #if ENABLE_OVERLOADING data DeviceToolHardwareIdPropertyInfo instance AttrInfo DeviceToolHardwareIdPropertyInfo where type AttrAllowedOps DeviceToolHardwareIdPropertyInfo = '[ 'AttrConstruct, 'AttrGet] type AttrSetTypeConstraint DeviceToolHardwareIdPropertyInfo = (~) Word64 type AttrBaseTypeConstraint DeviceToolHardwareIdPropertyInfo = IsDeviceTool type AttrGetType DeviceToolHardwareIdPropertyInfo = Word64 type AttrLabel DeviceToolHardwareIdPropertyInfo = "hardware-id" type AttrOrigin DeviceToolHardwareIdPropertyInfo = DeviceTool attrGet _ = getDeviceToolHardwareId attrSet _ = undefined attrConstruct _ = constructDeviceToolHardwareId attrClear _ = undefined #endif -- VVV Prop "serial" -- Type: TBasicType TUInt64 -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly] -- Nullable: (Just False,Nothing) {- | Get the value of the “@serial@” property. When is enabled, this is equivalent to @ 'Data.GI.Base.Attributes.get' deviceTool #serial @ -} getDeviceToolSerial :: (MonadIO m, IsDeviceTool o) => o -> m Word64 getDeviceToolSerial obj = liftIO $ B.Properties.getObjectPropertyUInt64 obj "serial" {- | Construct a `GValueConstruct` with valid value for the “@serial@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`. -} constructDeviceToolSerial :: (IsDeviceTool o) => Word64 -> IO (GValueConstruct o) constructDeviceToolSerial val = B.Properties.constructObjectPropertyUInt64 "serial" val #if ENABLE_OVERLOADING data DeviceToolSerialPropertyInfo instance AttrInfo DeviceToolSerialPropertyInfo where type AttrAllowedOps DeviceToolSerialPropertyInfo = '[ 'AttrConstruct, 'AttrGet] type AttrSetTypeConstraint DeviceToolSerialPropertyInfo = (~) Word64 type AttrBaseTypeConstraint DeviceToolSerialPropertyInfo = IsDeviceTool type AttrGetType DeviceToolSerialPropertyInfo = Word64 type AttrLabel DeviceToolSerialPropertyInfo = "serial" type AttrOrigin DeviceToolSerialPropertyInfo = DeviceTool attrGet _ = getDeviceToolSerial attrSet _ = undefined attrConstruct _ = constructDeviceToolSerial attrClear _ = undefined #endif -- VVV Prop "tool-type" -- Type: TInterface (Name {namespace = "Gdk", name = "DeviceToolType"}) -- Flags: [PropertyReadable,PropertyWritable,PropertyConstructOnly] -- Nullable: (Just False,Nothing) {- | Get the value of the “@tool-type@” property. When is enabled, this is equivalent to @ 'Data.GI.Base.Attributes.get' deviceTool #toolType @ -} getDeviceToolToolType :: (MonadIO m, IsDeviceTool o) => o -> m Gdk.Enums.DeviceToolType getDeviceToolToolType obj = liftIO $ B.Properties.getObjectPropertyEnum obj "tool-type" {- | Construct a `GValueConstruct` with valid value for the “@tool-type@” property. This is rarely needed directly, but it is used by `Data.GI.Base.Constructible.new`. -} constructDeviceToolToolType :: (IsDeviceTool o) => Gdk.Enums.DeviceToolType -> IO (GValueConstruct o) constructDeviceToolToolType val = B.Properties.constructObjectPropertyEnum "tool-type" val #if ENABLE_OVERLOADING data DeviceToolToolTypePropertyInfo instance AttrInfo DeviceToolToolTypePropertyInfo where type AttrAllowedOps DeviceToolToolTypePropertyInfo = '[ 'AttrConstruct, 'AttrGet] type AttrSetTypeConstraint DeviceToolToolTypePropertyInfo = (~) Gdk.Enums.DeviceToolType type AttrBaseTypeConstraint DeviceToolToolTypePropertyInfo = IsDeviceTool type AttrGetType DeviceToolToolTypePropertyInfo = Gdk.Enums.DeviceToolType type AttrLabel DeviceToolToolTypePropertyInfo = "tool-type" type AttrOrigin DeviceToolToolTypePropertyInfo = DeviceTool attrGet _ = getDeviceToolToolType attrSet _ = undefined attrConstruct _ = constructDeviceToolToolType attrClear _ = undefined #endif #if ENABLE_OVERLOADING instance O.HasAttributeList DeviceTool type instance O.AttributeList DeviceTool = DeviceToolAttributeList type DeviceToolAttributeList = ('[ '("axes", DeviceToolAxesPropertyInfo), '("hardwareId", DeviceToolHardwareIdPropertyInfo), '("serial", DeviceToolSerialPropertyInfo), '("toolType", DeviceToolToolTypePropertyInfo)] :: [(Symbol, *)]) #endif #if ENABLE_OVERLOADING deviceToolAxes :: AttrLabelProxy "axes" deviceToolAxes = AttrLabelProxy deviceToolHardwareId :: AttrLabelProxy "hardwareId" deviceToolHardwareId = AttrLabelProxy deviceToolSerial :: AttrLabelProxy "serial" deviceToolSerial = AttrLabelProxy deviceToolToolType :: AttrLabelProxy "toolType" deviceToolToolType = AttrLabelProxy #endif #if ENABLE_OVERLOADING type instance O.SignalList DeviceTool = DeviceToolSignalList type DeviceToolSignalList = ('[ '("notify", GObject.Object.ObjectNotifySignalInfo)] :: [(Symbol, *)]) #endif -- method DeviceTool::get_hardware_id -- method type : OrdinaryMethod -- Args : [Arg {argCName = "tool", argType = TInterface (Name {namespace = "Gdk", name = "DeviceTool"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkDeviceTool", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TUInt64) -- throws : False -- Skip return : False foreign import ccall "gdk_device_tool_get_hardware_id" gdk_device_tool_get_hardware_id :: Ptr DeviceTool -> -- tool : TInterface (Name {namespace = "Gdk", name = "DeviceTool"}) IO Word64 {- | Gets the hardware ID of this tool, or 0 if it\'s not known. When non-zero, the identificator is unique for the given tool model, meaning that two identical tools will share the same /@hardwareId@/, but will have different serial numbers (see 'GI.Gdk.Objects.DeviceTool.deviceToolGetSerial'). This is a more concrete (and device specific) method to identify a 'GI.Gdk.Objects.DeviceTool.DeviceTool' than 'GI.Gdk.Objects.DeviceTool.deviceToolGetToolType', as a tablet may support multiple devices with the same 'GI.Gdk.Enums.DeviceToolType', but having different hardware identificators. /Since: 3.22/ -} deviceToolGetHardwareId :: (B.CallStack.HasCallStack, MonadIO m, IsDeviceTool a) => a {- ^ /@tool@/: a 'GI.Gdk.Objects.DeviceTool.DeviceTool' -} -> m Word64 {- ^ __Returns:__ The hardware identificator of this tool. -} deviceToolGetHardwareId tool = liftIO $ do tool' <- unsafeManagedPtrCastPtr tool result <- gdk_device_tool_get_hardware_id tool' touchManagedPtr tool return result #if ENABLE_OVERLOADING data DeviceToolGetHardwareIdMethodInfo instance (signature ~ (m Word64), MonadIO m, IsDeviceTool a) => O.MethodInfo DeviceToolGetHardwareIdMethodInfo a signature where overloadedMethod _ = deviceToolGetHardwareId #endif -- method DeviceTool::get_serial -- method type : OrdinaryMethod -- Args : [Arg {argCName = "tool", argType = TInterface (Name {namespace = "Gdk", name = "DeviceTool"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkDeviceTool", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TBasicType TUInt64) -- throws : False -- Skip return : False foreign import ccall "gdk_device_tool_get_serial" gdk_device_tool_get_serial :: Ptr DeviceTool -> -- tool : TInterface (Name {namespace = "Gdk", name = "DeviceTool"}) IO Word64 {- | Gets the serial of this tool, this value can be used to identify a physical tool (eg. a tablet pen) across program executions. /Since: 3.22/ -} deviceToolGetSerial :: (B.CallStack.HasCallStack, MonadIO m, IsDeviceTool a) => a {- ^ /@tool@/: a 'GI.Gdk.Objects.DeviceTool.DeviceTool' -} -> m Word64 {- ^ __Returns:__ The serial ID for this tool -} deviceToolGetSerial tool = liftIO $ do tool' <- unsafeManagedPtrCastPtr tool result <- gdk_device_tool_get_serial tool' touchManagedPtr tool return result #if ENABLE_OVERLOADING data DeviceToolGetSerialMethodInfo instance (signature ~ (m Word64), MonadIO m, IsDeviceTool a) => O.MethodInfo DeviceToolGetSerialMethodInfo a signature where overloadedMethod _ = deviceToolGetSerial #endif -- method DeviceTool::get_tool_type -- method type : OrdinaryMethod -- Args : [Arg {argCName = "tool", argType = TInterface (Name {namespace = "Gdk", name = "DeviceTool"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GdkDeviceTool", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}] -- Lengths : [] -- returnType : Just (TInterface (Name {namespace = "Gdk", name = "DeviceToolType"})) -- throws : False -- Skip return : False foreign import ccall "gdk_device_tool_get_tool_type" gdk_device_tool_get_tool_type :: Ptr DeviceTool -> -- tool : TInterface (Name {namespace = "Gdk", name = "DeviceTool"}) IO CUInt {- | Gets the 'GI.Gdk.Enums.DeviceToolType' of the tool. /Since: 3.22/ -} deviceToolGetToolType :: (B.CallStack.HasCallStack, MonadIO m, IsDeviceTool a) => a {- ^ /@tool@/: a 'GI.Gdk.Objects.DeviceTool.DeviceTool' -} -> m Gdk.Enums.DeviceToolType {- ^ __Returns:__ The physical type for this tool. This can be used to figure out what sort of pen is being used, such as an airbrush or a pencil. -} deviceToolGetToolType tool = liftIO $ do tool' <- unsafeManagedPtrCastPtr tool result <- gdk_device_tool_get_tool_type tool' let result' = (toEnum . fromIntegral) result touchManagedPtr tool return result' #if ENABLE_OVERLOADING data DeviceToolGetToolTypeMethodInfo instance (signature ~ (m Gdk.Enums.DeviceToolType), MonadIO m, IsDeviceTool a) => O.MethodInfo DeviceToolGetToolTypeMethodInfo a signature where overloadedMethod _ = deviceToolGetToolType #endif