1use gdk_sys;
6use glib::object::IsA;
7use glib::translate::*;
8use std::fmt;
9use Device;
10#[cfg(any(feature = "v3_22", feature = "dox"))]
11use DevicePadFeature;
12
13glib_wrapper! {
14 pub struct DevicePad(Interface<gdk_sys::GdkDevicePad>) @requires Device;
15
16 match fn {
17 get_type => || gdk_sys::gdk_device_pad_get_type(),
18 }
19}
20
21pub const NONE_DEVICE_PAD: Option<&DevicePad> = None;
22
23pub trait DevicePadExt: 'static {
24 #[cfg(any(feature = "v3_22", feature = "dox"))]
25 fn get_feature_group(&self, feature: DevicePadFeature, feature_idx: i32) -> i32;
26
27 #[cfg(any(feature = "v3_22", feature = "dox"))]
28 fn get_group_n_modes(&self, group_idx: i32) -> i32;
29
30 #[cfg(any(feature = "v3_22", feature = "dox"))]
31 fn get_n_features(&self, feature: DevicePadFeature) -> i32;
32
33 #[cfg(any(feature = "v3_22", feature = "dox"))]
34 fn get_n_groups(&self) -> i32;
35}
36
37impl<O: IsA<DevicePad>> DevicePadExt for O {
38 #[cfg(any(feature = "v3_22", feature = "dox"))]
39 fn get_feature_group(&self, feature: DevicePadFeature, feature_idx: i32) -> i32 {
40 unsafe {
41 gdk_sys::gdk_device_pad_get_feature_group(
42 self.as_ref().to_glib_none().0,
43 feature.to_glib(),
44 feature_idx,
45 )
46 }
47 }
48
49 #[cfg(any(feature = "v3_22", feature = "dox"))]
50 fn get_group_n_modes(&self, group_idx: i32) -> i32 {
51 unsafe {
52 gdk_sys::gdk_device_pad_get_group_n_modes(self.as_ref().to_glib_none().0, group_idx)
53 }
54 }
55
56 #[cfg(any(feature = "v3_22", feature = "dox"))]
57 fn get_n_features(&self, feature: DevicePadFeature) -> i32 {
58 unsafe {
59 gdk_sys::gdk_device_pad_get_n_features(
60 self.as_ref().to_glib_none().0,
61 feature.to_glib(),
62 )
63 }
64 }
65
66 #[cfg(any(feature = "v3_22", feature = "dox"))]
67 fn get_n_groups(&self) -> i32 {
68 unsafe { gdk_sys::gdk_device_pad_get_n_groups(self.as_ref().to_glib_none().0) }
69 }
70}
71
72impl fmt::Display for DevicePad {
73 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
74 write!(f, "DevicePad")
75 }
76}