1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
use IMContext;
use MenuShell;
use ffi;
use glib::object::Downcast;
use glib::object::IsA;
use glib::translate::*;
use gobject_ffi;
glib_wrapper! {
pub struct IMMulticontext(Object<ffi::GtkIMMulticontext>): IMContext;
match fn {
get_type => || ffi::gtk_im_multicontext_get_type(),
}
}
impl IMMulticontext {
pub fn new() -> IMMulticontext {
assert_initialized_main_thread!();
unsafe {
IMContext::from_glib_full(ffi::gtk_im_multicontext_new()).downcast_unchecked()
}
}
}
pub trait IMMulticontextExt {
fn append_menuitems<P: IsA<MenuShell>>(&self, menushell: &P);
fn get_context_id(&self) -> Option<String>;
fn set_context_id(&self, context_id: &str);
}
impl<O: IsA<IMMulticontext>> IMMulticontextExt for O {
fn append_menuitems<P: IsA<MenuShell>>(&self, menushell: &P) {
unsafe {
ffi::gtk_im_multicontext_append_menuitems(self.to_glib_none().0, menushell.to_glib_none().0);
}
}
fn get_context_id(&self) -> Option<String> {
unsafe {
from_glib_none(ffi::gtk_im_multicontext_get_context_id(self.to_glib_none().0))
}
}
fn set_context_id(&self, context_id: &str) {
unsafe {
ffi::gtk_im_multicontext_set_context_id(self.to_glib_none().0, context_id.to_glib_none().0);
}
}
}