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