atk/auto/gobject_accessible.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{Object, ffi};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9 /// This object class is derived from AtkObject and can be used as a basis implementing accessible objects.
10 ///
11 /// This object class is derived from AtkObject. It can be used as a
12 /// basis for implementing accessible objects for GObjects which are
13 /// not derived from GtkWidget. One example of its use is in providing
14 /// an accessible object for GnomeCanvasItem in the GAIL library.
15 ///
16 /// # Implements
17 ///
18 /// [`GObjectAccessibleExt`][trait@crate::prelude::GObjectAccessibleExt], [`AtkObjectExt`][trait@crate::prelude::AtkObjectExt], [`trait@glib::ObjectExt`]
19 #[doc(alias = "AtkGObjectAccessible")]
20 pub struct GObjectAccessible(Object<ffi::AtkGObjectAccessible, ffi::AtkGObjectAccessibleClass>) @extends Object;
21
22 match fn {
23 type_ => || ffi::atk_gobject_accessible_get_type(),
24 }
25}
26
27impl GObjectAccessible {
28 pub const NONE: Option<&'static GObjectAccessible> = None;
29
30 /// Gets the accessible object for the specified `obj`.
31 /// ## `obj`
32 /// a [`glib::Object`][crate::glib::Object]
33 ///
34 /// # Returns
35 ///
36 /// a [`Object`][crate::Object] which is the accessible object for
37 /// the `obj`
38 #[doc(alias = "atk_gobject_accessible_for_object")]
39 pub fn for_object(obj: &impl IsA<glib::Object>) -> Option<Object> {
40 assert_initialized_main_thread!();
41 unsafe {
42 from_glib_none(ffi::atk_gobject_accessible_for_object(
43 obj.as_ref().to_glib_none().0,
44 ))
45 }
46 }
47}
48
49/// Trait containing all [`struct@GObjectAccessible`] methods.
50///
51/// # Implementors
52///
53/// [`GObjectAccessible`][struct@crate::GObjectAccessible]
54pub trait GObjectAccessibleExt: IsA<GObjectAccessible> + 'static {
55 /// Gets the GObject for which `self` is the accessible object.
56 ///
57 /// # Returns
58 ///
59 /// a [`glib::Object`][crate::glib::Object] which is the object for which `self` is
60 /// the accessible object
61 #[doc(alias = "atk_gobject_accessible_get_object")]
62 #[doc(alias = "get_object")]
63 fn object(&self) -> Option<glib::Object> {
64 unsafe {
65 from_glib_none(ffi::atk_gobject_accessible_get_object(
66 self.as_ref().to_glib_none().0,
67 ))
68 }
69 }
70}
71
72impl<O: IsA<GObjectAccessible>> GObjectAccessibleExt for O {}