atk/editable_text.rs
1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use crate::{EditableText, ffi};
4use glib::object::IsA;
5use glib::translate::*;
6
7pub trait EditableTextExtManual: IsA<EditableText> + 'static {
8 /// Insert text at a given position.
9 /// ## `string`
10 /// the text to insert
11 /// ## `length`
12 /// the length of text to insert, in bytes
13 /// ## `position`
14 /// The caller initializes this to
15 /// the position at which to insert the text. After the call it
16 /// points at the position after the newly inserted text.
17 #[doc(alias = "atk_editable_text_insert_text")]
18 fn insert_text(&self, string: &str, mut position: i32) -> i32 {
19 let length = string.len() as i32;
20 unsafe {
21 ffi::atk_editable_text_insert_text(
22 self.as_ref().to_glib_none().0,
23 string.to_glib_none().0,
24 length,
25 &mut position,
26 );
27 }
28 position
29 }
30}
31
32impl<O: IsA<EditableText>> EditableTextExtManual for O {}