// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// DO NOT EDIT

use glib::{prelude::*, translate::*};
use std::fmt;

glib::wrapper! {
    #[doc(alias = "AtkMisc")]
    pub struct Misc(Object<ffi::AtkMisc, ffi::AtkMiscClass>);

    match fn {
        type_ => || ffi::atk_misc_get_type(),
    }
}

impl Misc {
    pub const NONE: Option<&'static Misc> = None;

    #[doc(alias = "atk_misc_get_instance")]
    #[doc(alias = "get_instance")]
    pub fn instance() -> Option<Misc> {
        assert_initialized_main_thread!();
        unsafe { from_glib_none(ffi::atk_misc_get_instance()) }
    }
}

mod sealed {
    pub trait Sealed {}
    impl<T: super::IsA<super::Misc>> Sealed for T {}
}

pub trait AtkMiscExt: IsA<Misc> + sealed::Sealed + 'static {
    #[doc(alias = "atk_misc_threads_enter")]
    fn threads_enter(&self) {
        unsafe {
            ffi::atk_misc_threads_enter(self.as_ref().to_glib_none().0);
        }
    }

    #[doc(alias = "atk_misc_threads_leave")]
    fn threads_leave(&self) {
        unsafe {
            ffi::atk_misc_threads_leave(self.as_ref().to_glib_none().0);
        }
    }
}

impl<O: IsA<Misc>> AtkMiscExt for O {}

impl fmt::Display for Misc {
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        f.write_str("Misc")
    }
}
