gdkx11/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 ///
10 ///
11 /// ## Properties
12 ///
13 ///
14 /// #### `device-id`
15 /// Readable | Writable | Construct Only
16 /// <details><summary><h4>Device</h4></summary>
17 ///
18 ///
19 /// #### `associated-device`
20 /// Associated pointer or keyboard with this device, if any. Devices of type [`gdk::DeviceType::Master`][crate::gdk::DeviceType::Master]
21 /// always come in keyboard/pointer pairs. Other device types will have a [`None`] associated device.
22 ///
23 /// Readable
24 ///
25 ///
26 /// #### `axes`
27 /// The axes currently available for this device.
28 ///
29 /// Readable
30 ///
31 ///
32 /// #### `device-manager`
33 /// The [`gdk::DeviceManager`][crate::gdk::DeviceManager] the [`gdk::Device`][crate::gdk::Device] pertains to.
34 ///
35 /// Readable | Writable | Construct Only
36 ///
37 ///
38 /// #### `display`
39 /// The [`gdk::Display`][crate::gdk::Display] the [`gdk::Device`][crate::gdk::Device] pertains to.
40 ///
41 /// Readable | Writable | Construct Only
42 ///
43 ///
44 /// #### `has-cursor`
45 /// Whether the device is represented by a cursor on the screen. Devices of type
46 /// [`gdk::DeviceType::Master`][crate::gdk::DeviceType::Master] will have [`true`] here.
47 ///
48 /// Readable | Writable | Construct Only
49 ///
50 ///
51 /// #### `input-mode`
52 /// Readable | Writable
53 ///
54 ///
55 /// #### `input-source`
56 /// Source type for the device.
57 ///
58 /// Readable | Writable | Construct Only
59 ///
60 ///
61 /// #### `n-axes`
62 /// Number of axes in the device.
63 ///
64 /// Readable
65 ///
66 ///
67 /// #### `name`
68 /// The device name.
69 ///
70 /// Readable | Writable | Construct Only
71 ///
72 ///
73 /// #### `num-touches`
74 /// The maximal number of concurrent touches on a touch device.
75 /// Will be 0 if the device is not a touch device or if the number
76 /// of touches is unknown.
77 ///
78 /// Readable | Writable | Construct Only
79 ///
80 ///
81 /// #### `product-id`
82 /// Product ID of this device, see [`DeviceExtManual::product_id()`][crate::gdk::prelude::DeviceExtManual::product_id()].
83 ///
84 /// Readable | Writable | Construct Only
85 ///
86 ///
87 /// #### `seat`
88 /// [`gdk::Seat`][crate::gdk::Seat] of this device.
89 ///
90 /// Readable | Writable
91 ///
92 ///
93 /// #### `tool`
94 /// Readable
95 ///
96 ///
97 /// #### `type`
98 /// Device role in the device manager.
99 ///
100 /// Readable | Writable | Construct Only
101 ///
102 ///
103 /// #### `vendor-id`
104 /// Vendor ID of this device, see [`DeviceExtManual::vendor_id()`][crate::gdk::prelude::DeviceExtManual::vendor_id()].
105 ///
106 /// Readable | Writable | Construct Only
107 /// </details>
108 ///
109 /// # Implements
110 ///
111 /// [`trait@gdk::prelude::DeviceExt`]
112 #[doc(alias = "GdkX11DeviceXI2")]
113 pub struct X11DeviceXI2(Object<ffi::GdkX11DeviceXI2, ffi::GdkX11DeviceXI2Class>) @extends gdk::Device;
114
115 match fn {
116 type_ => || ffi::gdk_x11_device_xi2_get_type(),
117 }
118}
119
120impl X11DeviceXI2 {
121 // rustdoc-stripper-ignore-next
122 /// Creates a new builder-pattern struct instance to construct [`X11DeviceXI2`] objects.
123 ///
124 /// This method returns an instance of [`X11DeviceXI2Builder`](crate::builders::X11DeviceXI2Builder) which can be used to create [`X11DeviceXI2`] objects.
125 pub fn builder() -> X11DeviceXI2Builder {
126 X11DeviceXI2Builder::new()
127 }
128
129 #[doc(alias = "device-id")]
130 pub fn device_id(&self) -> i32 {
131 ObjectExt::property(self, "device-id")
132 }
133}
134
135// rustdoc-stripper-ignore-next
136/// A [builder-pattern] type to construct [`X11DeviceXI2`] objects.
137///
138/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
139#[must_use = "The builder must be built to be used"]
140pub struct X11DeviceXI2Builder {
141 builder: glib::object::ObjectBuilder<'static, X11DeviceXI2>,
142}
143
144impl X11DeviceXI2Builder {
145 fn new() -> Self {
146 Self {
147 builder: glib::object::Object::builder(),
148 }
149 }
150
151 pub fn device_id(self, device_id: i32) -> Self {
152 Self {
153 builder: self.builder.property("device-id", device_id),
154 }
155 }
156
157 /// The [`gdk::DeviceManager`][crate::gdk::DeviceManager] the [`gdk::Device`][crate::gdk::Device] pertains to.
158 pub fn device_manager(self, device_manager: &impl IsA<gdk::DeviceManager>) -> Self {
159 Self {
160 builder: self
161 .builder
162 .property("device-manager", device_manager.clone().upcast()),
163 }
164 }
165
166 /// The [`gdk::Display`][crate::gdk::Display] the [`gdk::Device`][crate::gdk::Device] pertains to.
167 pub fn display(self, display: &impl IsA<gdk::Display>) -> Self {
168 Self {
169 builder: self.builder.property("display", display.clone().upcast()),
170 }
171 }
172
173 /// Whether the device is represented by a cursor on the screen. Devices of type
174 /// [`gdk::DeviceType::Master`][crate::gdk::DeviceType::Master] will have [`true`] here.
175 pub fn has_cursor(self, has_cursor: bool) -> Self {
176 Self {
177 builder: self.builder.property("has-cursor", has_cursor),
178 }
179 }
180
181 pub fn input_mode(self, input_mode: gdk::InputMode) -> Self {
182 Self {
183 builder: self.builder.property("input-mode", input_mode),
184 }
185 }
186
187 /// Source type for the device.
188 pub fn input_source(self, input_source: gdk::InputSource) -> Self {
189 Self {
190 builder: self.builder.property("input-source", input_source),
191 }
192 }
193
194 /// The device name.
195 pub fn name(self, name: impl Into<glib::GString>) -> Self {
196 Self {
197 builder: self.builder.property("name", name.into()),
198 }
199 }
200
201 /// The maximal number of concurrent touches on a touch device.
202 /// Will be 0 if the device is not a touch device or if the number
203 /// of touches is unknown.
204 pub fn num_touches(self, num_touches: u32) -> Self {
205 Self {
206 builder: self.builder.property("num-touches", num_touches),
207 }
208 }
209
210 /// Product ID of this device, see [`DeviceExtManual::product_id()`][crate::gdk::prelude::DeviceExtManual::product_id()].
211 pub fn product_id(self, product_id: impl Into<glib::GString>) -> Self {
212 Self {
213 builder: self.builder.property("product-id", product_id.into()),
214 }
215 }
216
217 /// [`gdk::Seat`][crate::gdk::Seat] of this device.
218 pub fn seat(self, seat: &gdk::Seat) -> Self {
219 Self {
220 builder: self.builder.property("seat", seat.clone()),
221 }
222 }
223
224 pub fn type_(self, type_: gdk::DeviceType) -> Self {
225 Self {
226 builder: self.builder.property("type", type_),
227 }
228 }
229
230 /// Vendor ID of this device, see [`DeviceExtManual::vendor_id()`][crate::gdk::prelude::DeviceExtManual::vendor_id()].
231 pub fn vendor_id(self, vendor_id: impl Into<glib::GString>) -> Self {
232 Self {
233 builder: self.builder.property("vendor-id", vendor_id.into()),
234 }
235 }
236
237 // rustdoc-stripper-ignore-next
238 /// Build the [`X11DeviceXI2`].
239 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
240 pub fn build(self) -> X11DeviceXI2 {
241 assert_initialized_main_thread!();
242 self.builder.build()
243 }
244}