1 // Copyright 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 5 use glib::translate::*; 6 use gtk_sys; 7 use std::path::Path; 8 use IMContextSimple; 9 use IsA; 10 11 pub trait IMContextSimpleExtManual: 'static { add_compose_file<P: AsRef<Path>>(&self, compose_file: P)12 fn add_compose_file<P: AsRef<Path>>(&self, compose_file: P); 13 //fn add_table(&self, data: &[u16], max_seq_len: u32, n_seqs: u32); 14 } 15 16 impl<O: IsA<IMContextSimple>> IMContextSimpleExtManual for O { add_compose_file<P: AsRef<Path>>(&self, compose_file: P)17 fn add_compose_file<P: AsRef<Path>>(&self, compose_file: P) { 18 unsafe { 19 let compose_file = compose_file.as_ref(); 20 gtk_sys::gtk_im_context_simple_add_compose_file( 21 self.as_ref().to_glib_none().0, 22 compose_file.to_glib_none().0, 23 ); 24 } 25 } 26 27 /*fn add_table(&self, data: &[u16], max_seq_len: u32, n_seqs: u32) { 28 assert!(max_seq_len * n_seqs < data.len() as u32); 29 unsafe { 30 gtk_sys::gtk_im_context_simple_add_table(self.as_ref().to_glib_none().0, 31 data.to_glib_none().0, 32 max_seq_len as i32, 33 n_seqs as i32); 34 } 35 }*/ 36 } 37