gtk/gesture_stylus.rs
1// Take a look at the license at the top of the repository in the LICENSE file.
2
3#[cfg(feature = "v3_24")]
4use crate::GestureStylus;
5use gdk::AxisUse;
6use glib::object::IsA;
7use glib::translate::*;
8
9mod sealed {
10 pub trait Sealed {}
11 impl<T: glib::IsA<crate::GestureStylus>> Sealed for T {}
12}
13
14pub trait GestureStylusExtManual: IsA<GestureStylus> + sealed::Sealed + 'static {
15 #[cfg(feature = "v3_24")]
16 #[cfg_attr(docsrs, doc(cfg(feature = "v3_24")))]
17 #[doc(alias = "gtk_gesture_stylus_get_axes")]
18 #[doc(alias = "get_axes")]
19 fn axes(&self, axes: Vec<AxisUse>) -> Option<Vec<f64>> {
20 let mut values: Vec<f64> = Vec::new();
21 unsafe {
22 let mut axes1: Vec<gdk::ffi::GdkAxisUse> = axes.iter().map(|a| a.into_glib()).collect();
23 axes1.push(gdk::ffi::GDK_AXIS_IGNORE);
24 if from_glib(ffi::gtk_gesture_stylus_get_axes(
25 self.as_ref().to_glib_none().0,
26 axes1.as_mut_ptr(),
27 values.as_mut_ptr() as *mut *mut f64,
28 )) {
29 Some(values)
30 } else {
31 None
32 }
33 }
34 }
35}
36
37impl<O: IsA<GestureStylus>> GestureStylusExtManual for O {}