1use gdk_sys;
6use glib::object::ObjectType as ObjectType_;
7use glib::translate::*;
8use glib::StaticType;
9use glib::Value;
10use gobject_sys;
11use std::fmt;
12use AxisFlags;
13use DeviceToolType;
14
15glib_wrapper! {
16 pub struct DeviceTool(Object<gdk_sys::GdkDeviceTool, DeviceToolClass>);
17
18 match fn {
19 get_type => || gdk_sys::gdk_device_tool_get_type(),
20 }
21}
22
23impl DeviceTool {
24 #[cfg(any(feature = "v3_22", feature = "dox"))]
25 pub fn get_hardware_id(&self) -> u64 {
26 unsafe { gdk_sys::gdk_device_tool_get_hardware_id(self.to_glib_none().0) }
27 }
28
29 #[cfg(any(feature = "v3_22", feature = "dox"))]
30 pub fn get_serial(&self) -> u64 {
31 unsafe { gdk_sys::gdk_device_tool_get_serial(self.to_glib_none().0) }
32 }
33
34 #[cfg(any(feature = "v3_22", feature = "dox"))]
35 pub fn get_tool_type(&self) -> DeviceToolType {
36 unsafe {
37 from_glib(gdk_sys::gdk_device_tool_get_tool_type(
38 self.to_glib_none().0,
39 ))
40 }
41 }
42
43 pub fn get_property_axes(&self) -> AxisFlags {
44 unsafe {
45 let mut value = Value::from_type(<AxisFlags as StaticType>::static_type());
46 gobject_sys::g_object_get_property(
47 self.as_ptr() as *mut gobject_sys::GObject,
48 b"axes\0".as_ptr() as *const _,
49 value.to_glib_none_mut().0,
50 );
51 value.get().unwrap()
52 }
53 }
54
55 pub fn get_property_hardware_id(&self) -> u64 {
56 unsafe {
57 let mut value = Value::from_type(<u64 as StaticType>::static_type());
58 gobject_sys::g_object_get_property(
59 self.as_ptr() as *mut gobject_sys::GObject,
60 b"hardware-id\0".as_ptr() as *const _,
61 value.to_glib_none_mut().0,
62 );
63 value.get().unwrap()
64 }
65 }
66
67 pub fn get_property_serial(&self) -> u64 {
68 unsafe {
69 let mut value = Value::from_type(<u64 as StaticType>::static_type());
70 gobject_sys::g_object_get_property(
71 self.as_ptr() as *mut gobject_sys::GObject,
72 b"serial\0".as_ptr() as *const _,
73 value.to_glib_none_mut().0,
74 );
75 value.get().unwrap()
76 }
77 }
78
79 pub fn get_property_tool_type(&self) -> DeviceToolType {
80 unsafe {
81 let mut value = Value::from_type(<DeviceToolType as StaticType>::static_type());
82 gobject_sys::g_object_get_property(
83 self.as_ptr() as *mut gobject_sys::GObject,
84 b"tool-type\0".as_ptr() as *const _,
85 value.to_glib_none_mut().0,
86 );
87 value.get().unwrap()
88 }
89 }
90}
91
92impl fmt::Display for DeviceTool {
93 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
94 write!(f, "DeviceTool")
95 }
96}