gtk4/auto/
im_context_simple.rs1use crate::{IMContext, InputHints, InputPurpose, ffi};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9 #[doc(alias = "GtkIMContextSimple")]
16 pub struct IMContextSimple(Object<ffi::GtkIMContextSimple, ffi::GtkIMContextSimpleClass>) @extends IMContext;
17
18 match fn {
19 type_ => || ffi::gtk_im_context_simple_get_type(),
20 }
21}
22
23impl IMContextSimple {
24 pub const NONE: Option<&'static IMContextSimple> = None;
25
26 #[doc(alias = "gtk_im_context_simple_new")]
32 pub fn new() -> IMContextSimple {
33 assert_initialized_main_thread!();
34 unsafe { IMContext::from_glib_full(ffi::gtk_im_context_simple_new()).unsafe_cast() }
35 }
36
37 pub fn builder() -> IMContextSimpleBuilder {
42 IMContextSimpleBuilder::new()
43 }
44}
45
46impl Default for IMContextSimple {
47 fn default() -> Self {
48 Self::new()
49 }
50}
51
52#[must_use = "The builder must be built to be used"]
57pub struct IMContextSimpleBuilder {
58 builder: glib::object::ObjectBuilder<'static, IMContextSimple>,
59}
60
61impl IMContextSimpleBuilder {
62 fn new() -> Self {
63 Self {
64 builder: glib::object::Object::builder(),
65 }
66 }
67
68 pub fn input_hints(self, input_hints: InputHints) -> Self {
71 Self {
72 builder: self.builder.property("input-hints", input_hints),
73 }
74 }
75
76 pub fn input_purpose(self, input_purpose: InputPurpose) -> Self {
81 Self {
82 builder: self.builder.property("input-purpose", input_purpose),
83 }
84 }
85
86 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
89 pub fn build(self) -> IMContextSimple {
90 assert_initialized_main_thread!();
91 self.builder.build()
92 }
93}