atk/
editable_text.rs

1// Copyright 2013-2018, The Gtk-rs Project Developers.
2// See the COPYRIGHT file at the top-level directory of this distribution.
3// Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT>
4
5use atk_sys;
6use glib::object::IsA;
7use glib::translate::*;
8use EditableText;
9
10pub trait EditableTextExtManual: 'static {
11    fn insert_text(&self, string: &str, position: i32) -> i32;
12}
13
14impl<O: IsA<EditableText>> EditableTextExtManual for O {
15    fn insert_text(&self, string: &str, mut position: i32) -> i32 {
16        let length = string.len() as i32;
17        unsafe {
18            atk_sys::atk_editable_text_insert_text(
19                self.as_ref().to_glib_none().0,
20                string.to_glib_none().0,
21                length,
22                &mut position,
23            );
24        }
25        position
26    }
27}