Skip to main content

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, ffi};
5use gdk::AxisUse;
6use glib::object::IsA;
7use glib::translate::*;
8
9pub trait GestureStylusExtManual: IsA<GestureStylus> + 'static {
10    #[cfg(feature = "v3_24")]
11    #[cfg_attr(docsrs, doc(cfg(feature = "v3_24")))]
12    #[doc(alias = "gtk_gesture_stylus_get_axes")]
13    #[doc(alias = "get_axes")]
14    fn axes(&self, axes: Vec<AxisUse>) -> Option<Vec<f64>> {
15        let mut values: Vec<f64> = Vec::new();
16        unsafe {
17            let mut axes1: Vec<gdk::ffi::GdkAxisUse> = axes.iter().map(|a| a.into_glib()).collect();
18            axes1.push(gdk::ffi::GDK_AXIS_IGNORE);
19            if from_glib(ffi::gtk_gesture_stylus_get_axes(
20                self.as_ref().to_glib_none().0,
21                axes1.as_mut_ptr(),
22                values.as_mut_ptr() as *mut *mut f64,
23            )) {
24                Some(values)
25            } else {
26                None
27            }
28        }
29    }
30}
31
32impl<O: IsA<GestureStylus>> GestureStylusExtManual for O {}