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    #[doc(alias = "gtk_cell_layout_set_attributes")]
14    fn set_attributes(&self, cell: &impl IsA<CellRenderer>, attributes: &[(&str, i32)]) {
15        self.as_ref().clear_attributes(cell);
16        attributes.iter().for_each(|(attr, column)| {
17            self.as_ref().add_attribute(cell, attr, *column);
18        });
19    }
20
21    #[doc(alias = "gtk_cell_layout_set_cell_data_func")]
22    #[doc(alias = "set_cell_data_func")]
23    fn unset_cell_data_func(&self, cell: &impl IsA<CellRenderer>) {
24        unsafe {
25            crate::ffi::gtk_cell_layout_set_cell_data_func(
26                self.as_ref().to_glib_none().0,
27                cell.as_ref().to_glib_none().0,
28                None,
29                std::ptr::null_mut(),
30                None,
31            );
32        }
33    }
34}
35
36impl<O: IsA<CellLayout>> CellLayoutExtManual for O {}