Skip to main content

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