atk/auto/editable_text.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 glib::{prelude::*, translate::*};
6use std::fmt;
7
8glib::wrapper! {
9 /// The ATK interface implemented by components containing user-editable text content.
10 ///
11 /// [`EditableText`][crate::EditableText] should be implemented by UI components which
12 /// contain text which the user can edit, via the [`Object`][crate::Object]
13 /// corresponding to that component (see [`Object`][crate::Object]).
14 ///
15 /// [`EditableText`][crate::EditableText] is a subclass of [`Text`][crate::Text], and as such, an object
16 /// which implements [`EditableText`][crate::EditableText] is by definition an [`Text`][crate::Text]
17 /// implementor as well.
18 ///
19 /// See [iface[`Text`][crate::Text]]
20 ///
21 /// # Implements
22 ///
23 /// [`EditableTextExt`][trait@crate::prelude::EditableTextExt], [`EditableTextExtManual`][trait@crate::prelude::EditableTextExtManual]
24 #[doc(alias = "AtkEditableText")]
25 pub struct EditableText(Interface<ffi::AtkEditableText, ffi::AtkEditableTextIface>);
26
27 match fn {
28 type_ => || ffi::atk_editable_text_get_type(),
29 }
30}
31
32impl EditableText {
33 pub const NONE: Option<&'static EditableText> = None;
34}
35
36mod sealed {
37 pub trait Sealed {}
38 impl<T: super::IsA<super::EditableText>> Sealed for T {}
39}
40
41/// Trait containing all [`struct@EditableText`] methods.
42///
43/// # Implementors
44///
45/// [`EditableText`][struct@crate::EditableText], [`NoOpObject`][struct@crate::NoOpObject]
46pub trait EditableTextExt: IsA<EditableText> + sealed::Sealed + 'static {
47 /// Copy text from `start_pos` up to, but not including `end_pos`
48 /// to the clipboard.
49 /// ## `start_pos`
50 /// start position
51 /// ## `end_pos`
52 /// end position
53 #[doc(alias = "atk_editable_text_copy_text")]
54 fn copy_text(&self, start_pos: i32, end_pos: i32) {
55 unsafe {
56 ffi::atk_editable_text_copy_text(self.as_ref().to_glib_none().0, start_pos, end_pos);
57 }
58 }
59
60 /// Copy text from `start_pos` up to, but not including `end_pos`
61 /// to the clipboard and then delete from the widget.
62 /// ## `start_pos`
63 /// start position
64 /// ## `end_pos`
65 /// end position
66 #[doc(alias = "atk_editable_text_cut_text")]
67 fn cut_text(&self, start_pos: i32, end_pos: i32) {
68 unsafe {
69 ffi::atk_editable_text_cut_text(self.as_ref().to_glib_none().0, start_pos, end_pos);
70 }
71 }
72
73 /// Delete text `start_pos` up to, but not including `end_pos`.
74 /// ## `start_pos`
75 /// start position
76 /// ## `end_pos`
77 /// end position
78 #[doc(alias = "atk_editable_text_delete_text")]
79 fn delete_text(&self, start_pos: i32, end_pos: i32) {
80 unsafe {
81 ffi::atk_editable_text_delete_text(self.as_ref().to_glib_none().0, start_pos, end_pos);
82 }
83 }
84
85 /// Paste text from clipboard to specified `position`.
86 /// ## `position`
87 /// position to paste
88 #[doc(alias = "atk_editable_text_paste_text")]
89 fn paste_text(&self, position: i32) {
90 unsafe {
91 ffi::atk_editable_text_paste_text(self.as_ref().to_glib_none().0, position);
92 }
93 }
94
95 //#[doc(alias = "atk_editable_text_set_run_attributes")]
96 //fn set_run_attributes(&self, attrib_set: /*Ignored*/&mut AttributeSet, start_offset: i32, end_offset: i32) -> bool {
97 // unsafe { TODO: call ffi:atk_editable_text_set_run_attributes() }
98 //}
99
100 /// Set text contents of `self`.
101 /// ## `string`
102 /// string to set for text contents of `self`
103 #[doc(alias = "atk_editable_text_set_text_contents")]
104 fn set_text_contents(&self, string: &str) {
105 unsafe {
106 ffi::atk_editable_text_set_text_contents(
107 self.as_ref().to_glib_none().0,
108 string.to_glib_none().0,
109 );
110 }
111 }
112}
113
114impl<O: IsA<EditableText>> EditableTextExt for O {}
115
116impl fmt::Display for EditableText {
117 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
118 f.write_str("EditableText")
119 }
120}