[go: up one dir, main page]

gtk4/auto/
cell_layout.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#![allow(deprecated)]
5
6use crate::{ffi, CellArea, CellRenderer, TreeIter, TreeModel};
7use glib::{prelude::*, translate::*};
8use std::boxed::Box as Box_;
9
10glib::wrapper! {
11    #[doc(alias = "GtkCellLayout")]
12    pub struct CellLayout(Interface<ffi::GtkCellLayout, ffi::GtkCellLayoutIface>);
13
14    match fn {
15        type_ => || ffi::gtk_cell_layout_get_type(),
16    }
17}
18
19impl CellLayout {
20    pub const NONE: Option<&'static CellLayout> = None;
21}
22
23pub trait CellLayoutExt: IsA<CellLayout> + 'static {
24    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
25    #[allow(deprecated)]
26    #[doc(alias = "gtk_cell_layout_add_attribute")]
27    fn add_attribute(&self, cell: &impl IsA<CellRenderer>, attribute: &str, column: i32) {
28        unsafe {
29            ffi::gtk_cell_layout_add_attribute(
30                self.as_ref().to_glib_none().0,
31                cell.as_ref().to_glib_none().0,
32                attribute.to_glib_none().0,
33                column,
34            );
35        }
36    }
37
38    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
39    #[allow(deprecated)]
40    #[doc(alias = "gtk_cell_layout_clear")]
41    fn clear(&self) {
42        unsafe {
43            ffi::gtk_cell_layout_clear(self.as_ref().to_glib_none().0);
44        }
45    }
46
47    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
48    #[allow(deprecated)]
49    #[doc(alias = "gtk_cell_layout_clear_attributes")]
50    fn clear_attributes(&self, cell: &impl IsA<CellRenderer>) {
51        unsafe {
52            ffi::gtk_cell_layout_clear_attributes(
53                self.as_ref().to_glib_none().0,
54                cell.as_ref().to_glib_none().0,
55            );
56        }
57    }
58
59    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
60    #[allow(deprecated)]
61    #[doc(alias = "gtk_cell_layout_get_area")]
62    #[doc(alias = "get_area")]
63    fn area(&self) -> Option<CellArea> {
64        unsafe {
65            from_glib_none(ffi::gtk_cell_layout_get_area(
66                self.as_ref().to_glib_none().0,
67            ))
68        }
69    }
70
71    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
72    #[allow(deprecated)]
73    #[doc(alias = "gtk_cell_layout_get_cells")]
74    #[doc(alias = "get_cells")]
75    fn cells(&self) -> Vec<CellRenderer> {
76        unsafe {
77            FromGlibPtrContainer::from_glib_container(ffi::gtk_cell_layout_get_cells(
78                self.as_ref().to_glib_none().0,
79            ))
80        }
81    }
82
83    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
84    #[allow(deprecated)]
85    #[doc(alias = "gtk_cell_layout_pack_end")]
86    fn pack_end(&self, cell: &impl IsA<CellRenderer>, expand: bool) {
87        unsafe {
88            ffi::gtk_cell_layout_pack_end(
89                self.as_ref().to_glib_none().0,
90                cell.as_ref().to_glib_none().0,
91                expand.into_glib(),
92            );
93        }
94    }
95
96    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
97    #[allow(deprecated)]
98    #[doc(alias = "gtk_cell_layout_pack_start")]
99    fn pack_start(&self, cell: &impl IsA<CellRenderer>, expand: bool) {
100        unsafe {
101            ffi::gtk_cell_layout_pack_start(
102                self.as_ref().to_glib_none().0,
103                cell.as_ref().to_glib_none().0,
104                expand.into_glib(),
105            );
106        }
107    }
108
109    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
110    #[allow(deprecated)]
111    #[doc(alias = "gtk_cell_layout_reorder")]
112    fn reorder(&self, cell: &impl IsA<CellRenderer>, position: i32) {
113        unsafe {
114            ffi::gtk_cell_layout_reorder(
115                self.as_ref().to_glib_none().0,
116                cell.as_ref().to_glib_none().0,
117                position,
118            );
119        }
120    }
121
122    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
123    #[allow(deprecated)]
124    #[doc(alias = "gtk_cell_layout_set_cell_data_func")]
125    fn set_cell_data_func<P: Fn(&CellLayout, &CellRenderer, &TreeModel, &TreeIter) + 'static>(
126        &self,
127        cell: &impl IsA<CellRenderer>,
128        func: P,
129    ) {
130        let func_data: Box_<P> = Box_::new(func);
131        unsafe extern "C" fn func_func<
132            P: Fn(&CellLayout, &CellRenderer, &TreeModel, &TreeIter) + 'static,
133        >(
134            cell_layout: *mut ffi::GtkCellLayout,
135            cell: *mut ffi::GtkCellRenderer,
136            tree_model: *mut ffi::GtkTreeModel,
137            iter: *mut ffi::GtkTreeIter,
138            data: glib::ffi::gpointer,
139        ) {
140            let cell_layout = from_glib_borrow(cell_layout);
141            let cell = from_glib_borrow(cell);
142            let tree_model = from_glib_borrow(tree_model);
143            let iter = from_glib_borrow(iter);
144            let callback = &*(data as *mut P);
145            (*callback)(&cell_layout, &cell, &tree_model, &iter)
146        }
147        let func = Some(func_func::<P> as _);
148        unsafe extern "C" fn destroy_func<
149            P: Fn(&CellLayout, &CellRenderer, &TreeModel, &TreeIter) + 'static,
150        >(
151            data: glib::ffi::gpointer,
152        ) {
153            let _callback = Box_::from_raw(data as *mut P);
154        }
155        let destroy_call4 = Some(destroy_func::<P> as _);
156        let super_callback0: Box_<P> = func_data;
157        unsafe {
158            ffi::gtk_cell_layout_set_cell_data_func(
159                self.as_ref().to_glib_none().0,
160                cell.as_ref().to_glib_none().0,
161                func,
162                Box_::into_raw(super_callback0) as *mut _,
163                destroy_call4,
164            );
165        }
166    }
167}
168
169impl<O: IsA<CellLayout>> CellLayoutExt for O {}