[go: up one dir, main page]

gtk4/auto/
im_context_simple.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, IMContext, InputHints, InputPurpose};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9    #[doc(alias = "GtkIMContextSimple")]
10    pub struct IMContextSimple(Object<ffi::GtkIMContextSimple, ffi::GtkIMContextSimpleClass>) @extends IMContext;
11
12    match fn {
13        type_ => || ffi::gtk_im_context_simple_get_type(),
14    }
15}
16
17impl IMContextSimple {
18    pub const NONE: Option<&'static IMContextSimple> = None;
19
20    #[doc(alias = "gtk_im_context_simple_new")]
21    pub fn new() -> IMContextSimple {
22        assert_initialized_main_thread!();
23        unsafe { IMContext::from_glib_full(ffi::gtk_im_context_simple_new()).unsafe_cast() }
24    }
25
26    // rustdoc-stripper-ignore-next
27    /// Creates a new builder-pattern struct instance to construct [`IMContextSimple`] objects.
28    ///
29    /// This method returns an instance of [`IMContextSimpleBuilder`](crate::builders::IMContextSimpleBuilder) which can be used to create [`IMContextSimple`] objects.
30    pub fn builder() -> IMContextSimpleBuilder {
31        IMContextSimpleBuilder::new()
32    }
33}
34
35impl Default for IMContextSimple {
36    fn default() -> Self {
37        Self::new()
38    }
39}
40
41// rustdoc-stripper-ignore-next
42/// A [builder-pattern] type to construct [`IMContextSimple`] objects.
43///
44/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
45#[must_use = "The builder must be built to be used"]
46pub struct IMContextSimpleBuilder {
47    builder: glib::object::ObjectBuilder<'static, IMContextSimple>,
48}
49
50impl IMContextSimpleBuilder {
51    fn new() -> Self {
52        Self {
53            builder: glib::object::Object::builder(),
54        }
55    }
56
57    pub fn input_hints(self, input_hints: InputHints) -> Self {
58        Self {
59            builder: self.builder.property("input-hints", input_hints),
60        }
61    }
62
63    pub fn input_purpose(self, input_purpose: InputPurpose) -> Self {
64        Self {
65            builder: self.builder.property("input-purpose", input_purpose),
66        }
67    }
68
69    // rustdoc-stripper-ignore-next
70    /// Build the [`IMContextSimple`].
71    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
72    pub fn build(self) -> IMContextSimple {
73        assert_initialized_main_thread!();
74        self.builder.build()
75    }
76}