gdk4_x11/auto/
x11_device_xi2.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use crate::ffi;
use glib::{prelude::*, translate::*};

glib::wrapper! {
    ///
    ///
    /// ## Properties
    ///
    ///
    /// #### `device-id`
    ///  Readable | Writeable | Construct Only
    /// <details><summary><h4>Device</h4></summary>
    ///
    ///
    /// #### `caps-lock-state`
    ///  Whether Caps Lock is on.
    ///
    /// This is only relevant for keyboard devices.
    ///
    /// Readable
    ///
    ///
    /// #### `direction`
    ///  The direction of the current layout.
    ///
    /// This is only relevant for keyboard devices.
    ///
    /// Readable
    ///
    ///
    /// #### `display`
    ///  The [`gdk::Display`][crate::gdk::Display] the [`gdk::Device`][crate::gdk::Device] pertains to.
    ///
    /// Readable | Writeable | Construct Only
    ///
    ///
    /// #### `has-bidi-layouts`
    ///  Whether the device has both right-to-left and left-to-right layouts.
    ///
    /// This is only relevant for keyboard devices.
    ///
    /// Readable
    ///
    ///
    /// #### `has-cursor`
    ///  Whether the device is represented by a cursor on the screen.
    ///
    /// Readable | Writeable | Construct Only
    ///
    ///
    /// #### `modifier-state`
    ///  The current modifier state of the device.
    ///
    /// This is only relevant for keyboard devices.
    ///
    /// Readable
    ///
    ///
    /// #### `n-axes`
    ///  Number of axes in the device.
    ///
    /// Readable
    ///
    ///
    /// #### `name`
    ///  The device name.
    ///
    /// Readable | Writeable | Construct Only
    ///
    ///
    /// #### `num-lock-state`
    ///  Whether Num Lock is on.
    ///
    /// This is only relevant for keyboard devices.
    ///
    /// Readable
    ///
    ///
    /// #### `num-touches`
    ///  The maximal number of concurrent touches on a touch device.
    ///
    /// Will be 0 if the device is not a touch device or if the number
    /// of touches is unknown.
    ///
    /// Readable | Writeable | Construct Only
    ///
    ///
    /// #### `product-id`
    ///  Product ID of this device.
    ///
    /// See `Gdk::Device::get_product_id()`.
    ///
    /// Readable | Writeable | Construct Only
    ///
    ///
    /// #### `scroll-lock-state`
    ///  Whether Scroll Lock is on.
    ///
    /// This is only relevant for keyboard devices.
    ///
    /// Readable
    ///
    ///
    /// #### `seat`
    ///  [`gdk::Seat`][crate::gdk::Seat] of this device.
    ///
    /// Readable | Writeable
    ///
    ///
    /// #### `source`
    ///  Source type for the device.
    ///
    /// Readable | Writeable | Construct Only
    ///
    ///
    /// #### `tool`
    ///  The [`gdk::DeviceTool`][crate::gdk::DeviceTool] that is currently used with this device.
    ///
    /// Readable
    ///
    ///
    /// #### `vendor-id`
    ///  Vendor ID of this device.
    ///
    /// See `Gdk::Device::get_vendor_id()`.
    ///
    /// Readable | Writeable | Construct Only
    /// </details>
    ///
    /// # Implements
    ///
    /// [`trait@gdk::prelude::DeviceExt`]
    #[doc(alias = "GdkX11DeviceXI2")]
    pub struct X11DeviceXI2(Object<ffi::GdkX11DeviceXI2, ffi::GdkX11DeviceXI2Class>) @extends gdk::Device;

    match fn {
        type_ => || ffi::gdk_x11_device_xi2_get_type(),
    }
}

impl X11DeviceXI2 {
    // rustdoc-stripper-ignore-next
    /// Creates a new builder-pattern struct instance to construct [`X11DeviceXI2`] objects.
    ///
    /// This method returns an instance of [`X11DeviceXI2Builder`](crate::builders::X11DeviceXI2Builder) which can be used to create [`X11DeviceXI2`] objects.
    pub fn builder() -> X11DeviceXI2Builder {
        X11DeviceXI2Builder::new()
    }

    #[doc(alias = "device-id")]
    pub fn device_id(&self) -> i32 {
        ObjectExt::property(self, "device-id")
    }
}

// rustdoc-stripper-ignore-next
/// A [builder-pattern] type to construct [`X11DeviceXI2`] objects.
///
/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
#[must_use = "The builder must be built to be used"]
pub struct X11DeviceXI2Builder {
    builder: glib::object::ObjectBuilder<'static, X11DeviceXI2>,
}

impl X11DeviceXI2Builder {
    fn new() -> Self {
        Self {
            builder: glib::object::Object::builder(),
        }
    }

    pub fn device_id(self, device_id: i32) -> Self {
        Self {
            builder: self.builder.property("device-id", device_id),
        }
    }

    /// The [`gdk::Display`][crate::gdk::Display] the [`gdk::Device`][crate::gdk::Device] pertains to.
    pub fn display(self, display: &impl IsA<gdk::Display>) -> Self {
        Self {
            builder: self.builder.property("display", display.clone().upcast()),
        }
    }

    /// Whether the device is represented by a cursor on the screen.
    pub fn has_cursor(self, has_cursor: bool) -> Self {
        Self {
            builder: self.builder.property("has-cursor", has_cursor),
        }
    }

    /// The device name.
    pub fn name(self, name: impl Into<glib::GString>) -> Self {
        Self {
            builder: self.builder.property("name", name.into()),
        }
    }

    /// The maximal number of concurrent touches on a touch device.
    ///
    /// Will be 0 if the device is not a touch device or if the number
    /// of touches is unknown.
    pub fn num_touches(self, num_touches: u32) -> Self {
        Self {
            builder: self.builder.property("num-touches", num_touches),
        }
    }

    /// Product ID of this device.
    ///
    /// See `Gdk::Device::get_product_id()`.
    pub fn product_id(self, product_id: impl Into<glib::GString>) -> Self {
        Self {
            builder: self.builder.property("product-id", product_id.into()),
        }
    }

    /// [`gdk::Seat`][crate::gdk::Seat] of this device.
    pub fn seat(self, seat: &gdk::Seat) -> Self {
        Self {
            builder: self.builder.property("seat", seat.clone()),
        }
    }

    /// Source type for the device.
    pub fn source(self, source: gdk::InputSource) -> Self {
        Self {
            builder: self.builder.property("source", source),
        }
    }

    /// Vendor ID of this device.
    ///
    /// See `Gdk::Device::get_vendor_id()`.
    pub fn vendor_id(self, vendor_id: impl Into<glib::GString>) -> Self {
        Self {
            builder: self.builder.property("vendor-id", vendor_id.into()),
        }
    }

    // rustdoc-stripper-ignore-next
    /// Build the [`X11DeviceXI2`].
    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
    pub fn build(self) -> X11DeviceXI2 {
        self.builder.build()
    }
}