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 crate::ffi;
6use glib::{prelude::*, translate::*};
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
36/// Trait containing all [`struct@EditableText`] methods.
37///
38/// # Implementors
39///
40/// [`EditableText`][struct@crate::EditableText], [`NoOpObject`][struct@crate::NoOpObject]
41pub trait EditableTextExt: IsA<EditableText> + 'static {
42 /// Copy text from `start_pos` up to, but not including `end_pos`
43 /// to the clipboard.
44 /// ## `start_pos`
45 /// start position
46 /// ## `end_pos`
47 /// end position
48 #[doc(alias = "atk_editable_text_copy_text")]
49 fn copy_text(&self, start_pos: i32, end_pos: i32) {
50 unsafe {
51 ffi::atk_editable_text_copy_text(self.as_ref().to_glib_none().0, start_pos, end_pos);
52 }
53 }
54
55 /// Copy text from `start_pos` up to, but not including `end_pos`
56 /// to the clipboard and then delete from the widget.
57 /// ## `start_pos`
58 /// start position
59 /// ## `end_pos`
60 /// end position
61 #[doc(alias = "atk_editable_text_cut_text")]
62 fn cut_text(&self, start_pos: i32, end_pos: i32) {
63 unsafe {
64 ffi::atk_editable_text_cut_text(self.as_ref().to_glib_none().0, start_pos, end_pos);
65 }
66 }
67
68 /// Delete text `start_pos` up to, but not including `end_pos`.
69 /// ## `start_pos`
70 /// start position
71 /// ## `end_pos`
72 /// end position
73 #[doc(alias = "atk_editable_text_delete_text")]
74 fn delete_text(&self, start_pos: i32, end_pos: i32) {
75 unsafe {
76 ffi::atk_editable_text_delete_text(self.as_ref().to_glib_none().0, start_pos, end_pos);
77 }
78 }
79
80 /// Paste text from clipboard to specified `position`.
81 /// ## `position`
82 /// position to paste
83 #[doc(alias = "atk_editable_text_paste_text")]
84 fn paste_text(&self, position: i32) {
85 unsafe {
86 ffi::atk_editable_text_paste_text(self.as_ref().to_glib_none().0, position);
87 }
88 }
89
90 //#[doc(alias = "atk_editable_text_set_run_attributes")]
91 //fn set_run_attributes(&self, attrib_set: /*Ignored*/&mut AttributeSet, start_offset: i32, end_offset: i32) -> bool {
92 // unsafe { TODO: call ffi:atk_editable_text_set_run_attributes() }
93 //}
94
95 /// Set text contents of `self`.
96 /// ## `string`
97 /// string to set for text contents of `self`
98 #[doc(alias = "atk_editable_text_set_text_contents")]
99 fn set_text_contents(&self, string: &str) {
100 unsafe {
101 ffi::atk_editable_text_set_text_contents(
102 self.as_ref().to_glib_none().0,
103 string.to_glib_none().0,
104 );
105 }
106 }
107}
108
109impl<O: IsA<EditableText>> EditableTextExt for O {}