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