gtk4/auto/
accessible_list.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::{ffi, Accessible};
6use glib::translate::*;
7
8glib::wrapper! {
9    /// A boxed type which wraps a list of references to GtkAccessible objects.
10    #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
11    pub struct AccessibleList(Boxed<ffi::GtkAccessibleList>);
12
13    match fn {
14        copy => |ptr| glib::gobject_ffi::g_boxed_copy(ffi::gtk_accessible_list_get_type(), ptr as *mut _) as *mut ffi::GtkAccessibleList,
15        free => |ptr| glib::gobject_ffi::g_boxed_free(ffi::gtk_accessible_list_get_type(), ptr as *mut _),
16        type_ => || ffi::gtk_accessible_list_get_type(),
17    }
18}
19
20impl AccessibleList {
21    /// Allocates a new list of accessible objects.
22    /// ## `accessibles`
23    /// array of accessible objects
24    ///
25    /// # Returns
26    ///
27    /// the newly created list of accessible objects
28    #[doc(alias = "gtk_accessible_list_new_from_array")]
29    #[doc(alias = "new_from_array")]
30    pub fn from_array(accessibles: &[Accessible]) -> AccessibleList {
31        assert_initialized_main_thread!();
32        let n_accessibles = accessibles.len() as _;
33        unsafe {
34            from_glib_full(ffi::gtk_accessible_list_new_from_array(
35                accessibles.to_glib_none().0,
36                n_accessibles,
37            ))
38        }
39    }
40
41    /// Gets the list of objects this boxed type holds.
42    ///
43    /// # Returns
44    ///
45    /// a shallow copy
46    ///   of the objects
47    #[doc(alias = "gtk_accessible_list_get_objects")]
48    #[doc(alias = "get_objects")]
49    pub fn objects(&self) -> Vec<Accessible> {
50        unsafe {
51            FromGlibPtrContainer::from_glib_container(ffi::gtk_accessible_list_get_objects(
52                mut_override(self.to_glib_none().0),
53            ))
54        }
55    }
56}