1use atk_sys;
6use glib::object::IsA;
7use glib::translate::*;
8use std::fmt;
9
10glib_wrapper! {
11 pub struct Misc(Object<atk_sys::AtkMisc, atk_sys::AtkMiscClass, MiscClass>);
12
13 match fn {
14 get_type => || atk_sys::atk_misc_get_type(),
15 }
16}
17
18impl Misc {
19 pub fn get_instance() -> Option<Misc> {
20 assert_initialized_main_thread!();
21 unsafe { from_glib_none(atk_sys::atk_misc_get_instance()) }
22 }
23}
24
25pub const NONE_MISC: Option<&Misc> = None;
26
27pub trait AtkMiscExt: 'static {
28 fn threads_enter(&self);
29
30 fn threads_leave(&self);
31}
32
33impl<O: IsA<Misc>> AtkMiscExt for O {
34 fn threads_enter(&self) {
35 unsafe {
36 atk_sys::atk_misc_threads_enter(self.as_ref().to_glib_none().0);
37 }
38 }
39
40 fn threads_leave(&self) {
41 unsafe {
42 atk_sys::atk_misc_threads_leave(self.as_ref().to_glib_none().0);
43 }
44 }
45}
46
47impl fmt::Display for Misc {
48 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
49 write!(f, "Misc")
50 }
51}