gtk/
im_context_simple.rs

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
5use glib::translate::*;
6use gtk_sys;
7use std::path::Path;
8use IMContextSimple;
9use IsA;
10
11pub trait IMContextSimpleExtManual: 'static {
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
16impl<O: IsA<IMContextSimple>> IMContextSimpleExtManual for O {
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}