gtk4/auto/
im_context_simple.rs1use 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 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#[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 #[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}