gtk4/
cell_layout.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use glib::translate::*;
4
5use crate::{prelude::*, CellLayout, CellRenderer};
6
7mod sealed {
8    pub trait Sealed {}
9    impl<T: super::IsA<super::CellLayout>> Sealed for T {}
10}
11// rustdoc-stripper-ignore-next
12/// Trait containing manually implemented methods of
13/// [`CellLayout`](crate::CellLayout).
14#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
15#[allow(deprecated)]
16pub trait CellLayoutExtManual: sealed::Sealed + IsA<CellLayout> + 'static {
17    /// Sets the attributes in the parameter list as the attributes
18    /// of @self.
19    ///
20    /// See [`CellLayoutExt::add_attribute()`][crate::prelude::CellLayoutExt::add_attribute()] for more details.
21    ///
22    /// The attributes should be in attribute/column order, as in
23    /// gtk_cell_layout_add_attribute(). All existing attributes are
24    /// removed, and replaced with the new attributes.
25    ///
26    /// # Deprecated since 4.10
27    ///
28    /// ## `cell`
29    /// a [`CellRenderer`][crate::CellRenderer]
30    #[doc(alias = "gtk_cell_layout_set_attributes")]
31    fn set_attributes(&self, cell: &impl IsA<CellRenderer>, attributes: &[(&str, i32)]) {
32        self.as_ref().clear_attributes(cell);
33        attributes.iter().for_each(|(attr, column)| {
34            self.as_ref().add_attribute(cell, attr, *column);
35        });
36    }
37
38    #[doc(alias = "gtk_cell_layout_set_cell_data_func")]
39    #[doc(alias = "set_cell_data_func")]
40    fn unset_cell_data_func(&self, cell: &impl IsA<CellRenderer>) {
41        unsafe {
42            crate::ffi::gtk_cell_layout_set_cell_data_func(
43                self.as_ref().to_glib_none().0,
44                cell.as_ref().to_glib_none().0,
45                None,
46                std::ptr::null_mut(),
47                None,
48            );
49        }
50    }
51}
52
53impl<O: IsA<CellLayout>> CellLayoutExtManual for O {}