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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
use CellArea;
use CellRenderer;
use ffi;
use glib::object::IsA;
use glib::translate::*;
use gobject_ffi;
glib_wrapper! {
pub struct CellLayout(Object<ffi::GtkCellLayout>);
match fn {
get_type => || ffi::gtk_cell_layout_get_type(),
}
}
pub trait CellLayoutExt {
fn add_attribute<P: IsA<CellRenderer>>(&self, cell: &P, attribute: &str, column: i32);
fn clear(&self);
fn clear_attributes<P: IsA<CellRenderer>>(&self, cell: &P);
fn get_area(&self) -> Option<CellArea>;
fn get_cells(&self) -> Vec<CellRenderer>;
fn pack_end<P: IsA<CellRenderer>>(&self, cell: &P, expand: bool);
fn pack_start<P: IsA<CellRenderer>>(&self, cell: &P, expand: bool);
fn reorder<P: IsA<CellRenderer>>(&self, cell: &P, position: i32);
}
impl<O: IsA<CellLayout>> CellLayoutExt for O {
fn add_attribute<P: IsA<CellRenderer>>(&self, cell: &P, attribute: &str, column: i32) {
unsafe {
ffi::gtk_cell_layout_add_attribute(self.to_glib_none().0, cell.to_glib_none().0, attribute.to_glib_none().0, column);
}
}
fn clear(&self) {
unsafe {
ffi::gtk_cell_layout_clear(self.to_glib_none().0);
}
}
fn clear_attributes<P: IsA<CellRenderer>>(&self, cell: &P) {
unsafe {
ffi::gtk_cell_layout_clear_attributes(self.to_glib_none().0, cell.to_glib_none().0);
}
}
fn get_area(&self) -> Option<CellArea> {
unsafe {
from_glib_none(ffi::gtk_cell_layout_get_area(self.to_glib_none().0))
}
}
fn get_cells(&self) -> Vec<CellRenderer> {
unsafe {
FromGlibPtrContainer::from_glib_container(ffi::gtk_cell_layout_get_cells(self.to_glib_none().0))
}
}
fn pack_end<P: IsA<CellRenderer>>(&self, cell: &P, expand: bool) {
unsafe {
ffi::gtk_cell_layout_pack_end(self.to_glib_none().0, cell.to_glib_none().0, expand.to_glib());
}
}
fn pack_start<P: IsA<CellRenderer>>(&self, cell: &P, expand: bool) {
unsafe {
ffi::gtk_cell_layout_pack_start(self.to_glib_none().0, cell.to_glib_none().0, expand.to_glib());
}
}
fn reorder<P: IsA<CellRenderer>>(&self, cell: &P, position: i32) {
unsafe {
ffi::gtk_cell_layout_reorder(self.to_glib_none().0, cell.to_glib_none().0, position);
}
}
}