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::{IMContext, InputHints, InputPurpose, ffi};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9 /// , followed by a
10 /// hexadecimal Unicode codepoint.
11 ///
12 /// For example,
13 ///
14 /// Ctrl-Shift-u 1 2 3 Enter
15 ///
16 /// yields U+0123 LATIN SMALL LETTER G WITH CEDILLA, i.e. ģ.
17 ///
18 /// ## Dead keys
19 ///
20 /// [`IMContextSimple`][crate::IMContextSimple] supports dead keys. For example, typing
21 ///
22 /// dead_acute a
23 ///
24 /// yields U+00E! LATIN SMALL LETTER_A WITH ACUTE, i.e. á. Note that this
25 /// depends on the keyboard layout including dead keys.
26 ///
27 /// # Implements
28 ///
29 /// [`IMContextExt`][trait@crate::prelude::IMContextExt], [`trait@glib::ObjectExt`]
30 #[doc(alias = "GtkIMContextSimple")]
31 pub struct IMContextSimple(Object<ffi::GtkIMContextSimple, ffi::GtkIMContextSimpleClass>) @extends IMContext;
32
33 match fn {
34 type_ => || ffi::gtk_im_context_simple_get_type(),
35 }
36}
37
38impl IMContextSimple {
39 pub const NONE: Option<&'static IMContextSimple> = None;
40
41 /// Creates a new [`IMContextSimple`][crate::IMContextSimple].
42 ///
43 /// # Returns
44 ///
45 /// a new [`IMContextSimple`][crate::IMContextSimple]
46 #[doc(alias = "gtk_im_context_simple_new")]
47 pub fn new() -> IMContextSimple {
48 assert_initialized_main_thread!();
49 unsafe { IMContext::from_glib_full(ffi::gtk_im_context_simple_new()).unsafe_cast() }
50 }
51
52 // rustdoc-stripper-ignore-next
53 /// Creates a new builder-pattern struct instance to construct [`IMContextSimple`] objects.
54 ///
55 /// This method returns an instance of [`IMContextSimpleBuilder`](crate::builders::IMContextSimpleBuilder) which can be used to create [`IMContextSimple`] objects.
56 pub fn builder() -> IMContextSimpleBuilder {
57 IMContextSimpleBuilder::new()
58 }
59}
60
61impl Default for IMContextSimple {
62 fn default() -> Self {
63 Self::new()
64 }
65}
66
67// rustdoc-stripper-ignore-next
68/// A [builder-pattern] type to construct [`IMContextSimple`] objects.
69///
70/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
71#[must_use = "The builder must be built to be used"]
72pub struct IMContextSimpleBuilder {
73 builder: glib::object::ObjectBuilder<'static, IMContextSimple>,
74}
75
76impl IMContextSimpleBuilder {
77 fn new() -> Self {
78 Self {
79 builder: glib::object::Object::builder(),
80 }
81 }
82
83 /// Additional hints that allow input methods to fine-tune
84 /// their behaviour.
85 pub fn input_hints(self, input_hints: InputHints) -> Self {
86 Self {
87 builder: self.builder.property("input-hints", input_hints),
88 }
89 }
90
91 /// The purpose of the text field that the `GtkIMContext is connected to.
92 ///
93 /// This property can be used by on-screen keyboards and other input
94 /// methods to adjust their behaviour.
95 pub fn input_purpose(self, input_purpose: InputPurpose) -> Self {
96 Self {
97 builder: self.builder.property("input-purpose", input_purpose),
98 }
99 }
100
101 // rustdoc-stripper-ignore-next
102 /// Build the [`IMContextSimple`].
103 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
104 pub fn build(self) -> IMContextSimple {
105 assert_initialized_main_thread!();
106 self.builder.build()
107 }
108}