Skip to main content

atk/auto/
registry.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::{ObjectFactory, ffi};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9    /// An object used to store the GType of the
10    /// factories used to create an accessible object for an object of a
11    /// particular GType.
12    ///
13    /// The AtkRegistry is normally used to create appropriate ATK "peers"
14    /// for user interface components. Application developers usually need
15    /// only interact with the AtkRegistry by associating appropriate ATK
16    /// implementation classes with GObject classes via the
17    /// atk_registry_set_factory_type call, passing the appropriate GType
18    /// for application custom widget classes.
19    ///
20    /// # Implements
21    ///
22    /// [`RegistryExt`][trait@crate::prelude::RegistryExt], [`trait@glib::ObjectExt`]
23    #[doc(alias = "AtkRegistry")]
24    pub struct Registry(Object<ffi::AtkRegistry, ffi::AtkRegistryClass>);
25
26    match fn {
27        type_ => || ffi::atk_registry_get_type(),
28    }
29}
30
31impl Registry {
32    pub const NONE: Option<&'static Registry> = None;
33}
34
35/// Trait containing all [`struct@Registry`] methods.
36///
37/// # Implementors
38///
39/// [`Registry`][struct@crate::Registry]
40pub trait RegistryExt: IsA<Registry> + 'static {
41    /// Gets an [`ObjectFactory`][crate::ObjectFactory] appropriate for creating `AtkObjects`
42    /// appropriate for `type_`.
43    /// ## `type_`
44    /// a `GType` with which to look up the associated [`ObjectFactory`][crate::ObjectFactory]
45    ///
46    /// # Returns
47    ///
48    /// an [`ObjectFactory`][crate::ObjectFactory] appropriate for creating
49    /// `AtkObjects` appropriate for `type_`.
50    #[doc(alias = "atk_registry_get_factory")]
51    #[doc(alias = "get_factory")]
52    fn factory(&self, type_: glib::types::Type) -> Option<ObjectFactory> {
53        unsafe {
54            from_glib_none(ffi::atk_registry_get_factory(
55                self.as_ref().to_glib_none().0,
56                type_.into_glib(),
57            ))
58        }
59    }
60
61    /// Provides a `GType` indicating the [`ObjectFactory`][crate::ObjectFactory] subclass
62    /// associated with `type_`.
63    /// ## `type_`
64    /// a `GType` with which to look up the associated [`ObjectFactory`][crate::ObjectFactory]
65    /// subclass
66    ///
67    /// # Returns
68    ///
69    /// a `GType` associated with type `type_`
70    #[doc(alias = "atk_registry_get_factory_type")]
71    #[doc(alias = "get_factory_type")]
72    fn factory_type(&self, type_: glib::types::Type) -> glib::types::Type {
73        unsafe {
74            from_glib(ffi::atk_registry_get_factory_type(
75                self.as_ref().to_glib_none().0,
76                type_.into_glib(),
77            ))
78        }
79    }
80
81    /// Associate an [`ObjectFactory`][crate::ObjectFactory] subclass with a `GType`. Note:
82    /// The associated `factory_type` will thereafter be responsible for
83    /// the creation of new [`Object`][crate::Object] implementations for instances
84    /// appropriate for `type_`.
85    /// ## `type_`
86    /// an [`Object`][crate::Object] type
87    /// ## `factory_type`
88    /// an [`ObjectFactory`][crate::ObjectFactory] type to associate with `type_`. Must
89    /// implement AtkObject appropriate for `type_`.
90    #[doc(alias = "atk_registry_set_factory_type")]
91    fn set_factory_type(&self, type_: glib::types::Type, factory_type: glib::types::Type) {
92        unsafe {
93            ffi::atk_registry_set_factory_type(
94                self.as_ref().to_glib_none().0,
95                type_.into_glib(),
96                factory_type.into_glib(),
97            );
98        }
99    }
100}
101
102impl<O: IsA<Registry>> RegistryExt for O {}