gdk4_x11/auto/
x11_device_xi2.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::ffi;
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9    #[doc(alias = "GdkX11DeviceXI2")]
10    pub struct X11DeviceXI2(Object<ffi::GdkX11DeviceXI2, ffi::GdkX11DeviceXI2Class>) @extends gdk::Device;
11
12    match fn {
13        type_ => || ffi::gdk_x11_device_xi2_get_type(),
14    }
15}
16
17impl X11DeviceXI2 {
18    // rustdoc-stripper-ignore-next
19    /// Creates a new builder-pattern struct instance to construct [`X11DeviceXI2`] objects.
20    ///
21    /// This method returns an instance of [`X11DeviceXI2Builder`](crate::builders::X11DeviceXI2Builder) which can be used to create [`X11DeviceXI2`] objects.
22    pub fn builder() -> X11DeviceXI2Builder {
23        X11DeviceXI2Builder::new()
24    }
25
26    #[doc(alias = "device-id")]
27    pub fn device_id(&self) -> i32 {
28        ObjectExt::property(self, "device-id")
29    }
30}
31
32// rustdoc-stripper-ignore-next
33/// A [builder-pattern] type to construct [`X11DeviceXI2`] objects.
34///
35/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
36#[must_use = "The builder must be built to be used"]
37pub struct X11DeviceXI2Builder {
38    builder: glib::object::ObjectBuilder<'static, X11DeviceXI2>,
39}
40
41impl X11DeviceXI2Builder {
42    fn new() -> Self {
43        Self {
44            builder: glib::object::Object::builder(),
45        }
46    }
47
48    pub fn device_id(self, device_id: i32) -> Self {
49        Self {
50            builder: self.builder.property("device-id", device_id),
51        }
52    }
53
54    pub fn display(self, display: &impl IsA<gdk::Display>) -> Self {
55        Self {
56            builder: self.builder.property("display", display.clone().upcast()),
57        }
58    }
59
60    pub fn has_cursor(self, has_cursor: bool) -> Self {
61        Self {
62            builder: self.builder.property("has-cursor", has_cursor),
63        }
64    }
65
66    pub fn name(self, name: impl Into<glib::GString>) -> Self {
67        Self {
68            builder: self.builder.property("name", name.into()),
69        }
70    }
71
72    pub fn num_touches(self, num_touches: u32) -> Self {
73        Self {
74            builder: self.builder.property("num-touches", num_touches),
75        }
76    }
77
78    pub fn product_id(self, product_id: impl Into<glib::GString>) -> Self {
79        Self {
80            builder: self.builder.property("product-id", product_id.into()),
81        }
82    }
83
84    pub fn seat(self, seat: &gdk::Seat) -> Self {
85        Self {
86            builder: self.builder.property("seat", seat.clone()),
87        }
88    }
89
90    pub fn source(self, source: gdk::InputSource) -> Self {
91        Self {
92            builder: self.builder.property("source", source),
93        }
94    }
95
96    pub fn vendor_id(self, vendor_id: impl Into<glib::GString>) -> Self {
97        Self {
98            builder: self.builder.property("vendor-id", vendor_id.into()),
99        }
100    }
101
102    // rustdoc-stripper-ignore-next
103    /// Build the [`X11DeviceXI2`].
104    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
105    pub fn build(self) -> X11DeviceXI2 {
106        assert_initialized_main_thread!();
107        self.builder.build()
108    }
109}