gdk4_x11/auto/
x11_device_manager_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 = "GdkX11DeviceManagerXI2")]
10    pub struct X11DeviceManagerXI2(Object<ffi::GdkX11DeviceManagerXI2, ffi::GdkX11DeviceManagerXI2Class>);
11
12    match fn {
13        type_ => || ffi::gdk_x11_device_manager_xi2_get_type(),
14    }
15}
16
17impl X11DeviceManagerXI2 {
18    // rustdoc-stripper-ignore-next
19    /// Creates a new builder-pattern struct instance to construct [`X11DeviceManagerXI2`] objects.
20    ///
21    /// This method returns an instance of [`X11DeviceManagerXI2Builder`](crate::builders::X11DeviceManagerXI2Builder) which can be used to create [`X11DeviceManagerXI2`] objects.
22    pub fn builder() -> X11DeviceManagerXI2Builder {
23        X11DeviceManagerXI2Builder::new()
24    }
25
26    pub fn display(&self) -> Option<gdk::Display> {
27        ObjectExt::property(self, "display")
28    }
29
30    pub fn major(&self) -> i32 {
31        ObjectExt::property(self, "major")
32    }
33
34    pub fn minor(&self) -> i32 {
35        ObjectExt::property(self, "minor")
36    }
37
38    pub fn opcode(&self) -> i32 {
39        ObjectExt::property(self, "opcode")
40    }
41}
42
43// rustdoc-stripper-ignore-next
44/// A [builder-pattern] type to construct [`X11DeviceManagerXI2`] objects.
45///
46/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
47#[must_use = "The builder must be built to be used"]
48pub struct X11DeviceManagerXI2Builder {
49    builder: glib::object::ObjectBuilder<'static, X11DeviceManagerXI2>,
50}
51
52impl X11DeviceManagerXI2Builder {
53    fn new() -> Self {
54        Self {
55            builder: glib::object::Object::builder(),
56        }
57    }
58
59    pub fn display(self, display: &impl IsA<gdk::Display>) -> Self {
60        Self {
61            builder: self.builder.property("display", display.clone().upcast()),
62        }
63    }
64
65    pub fn major(self, major: i32) -> Self {
66        Self {
67            builder: self.builder.property("major", major),
68        }
69    }
70
71    pub fn minor(self, minor: i32) -> Self {
72        Self {
73            builder: self.builder.property("minor", minor),
74        }
75    }
76
77    pub fn opcode(self, opcode: i32) -> Self {
78        Self {
79            builder: self.builder.property("opcode", opcode),
80        }
81    }
82
83    // rustdoc-stripper-ignore-next
84    /// Build the [`X11DeviceManagerXI2`].
85    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
86    pub fn build(self) -> X11DeviceManagerXI2 {
87        assert_initialized_main_thread!();
88        self.builder.build()
89    }
90}