gtk4/auto/
column_view_cell.rs1use crate::{ffi, ListItem, Widget};
6use glib::{prelude::*, translate::*};
7
8glib::wrapper! {
9 #[doc(alias = "GtkColumnViewCell")]
10 pub struct ColumnViewCell(Object<ffi::GtkColumnViewCell, ffi::GtkColumnViewCellClass>) @extends ListItem;
11
12 match fn {
13 type_ => || ffi::gtk_column_view_cell_get_type(),
14 }
15}
16
17impl ColumnViewCell {
18 pub fn builder() -> ColumnViewCellBuilder {
23 ColumnViewCellBuilder::new()
24 }
25
26 #[doc(alias = "gtk_column_view_cell_get_child")]
27 #[doc(alias = "get_child")]
28 pub fn child(&self) -> Option<Widget> {
29 unsafe { from_glib_none(ffi::gtk_column_view_cell_get_child(self.to_glib_none().0)) }
30 }
31
32 #[cfg(not(feature = "v4_12"))]
33 #[cfg_attr(docsrs, doc(cfg(not(feature = "v4_12"))))]
34 #[doc(alias = "gtk_column_view_cell_get_focusable")]
35 #[doc(alias = "get_focusable")]
36 #[doc(alias = "focusable")]
37 pub fn is_focusable(&self) -> bool {
38 unsafe {
39 from_glib(ffi::gtk_column_view_cell_get_focusable(
40 self.to_glib_none().0,
41 ))
42 }
43 }
44
45 #[doc(alias = "gtk_column_view_cell_get_item")]
46 #[doc(alias = "get_item")]
47 pub fn item(&self) -> Option<glib::Object> {
48 unsafe { from_glib_none(ffi::gtk_column_view_cell_get_item(self.to_glib_none().0)) }
49 }
50
51 #[doc(alias = "gtk_column_view_cell_get_position")]
52 #[doc(alias = "get_position")]
53 pub fn position(&self) -> u32 {
54 unsafe { ffi::gtk_column_view_cell_get_position(self.to_glib_none().0) }
55 }
56
57 #[doc(alias = "gtk_column_view_cell_get_selected")]
58 #[doc(alias = "get_selected")]
59 #[doc(alias = "selected")]
60 pub fn is_selected(&self) -> bool {
61 unsafe {
62 from_glib(ffi::gtk_column_view_cell_get_selected(
63 self.to_glib_none().0,
64 ))
65 }
66 }
67
68 #[doc(alias = "gtk_column_view_cell_set_child")]
69 #[doc(alias = "child")]
70 pub fn set_child(&self, child: Option<&impl IsA<Widget>>) {
71 unsafe {
72 ffi::gtk_column_view_cell_set_child(
73 self.to_glib_none().0,
74 child.map(|p| p.as_ref()).to_glib_none().0,
75 );
76 }
77 }
78
79 #[cfg(not(feature = "v4_12"))]
80 #[cfg_attr(docsrs, doc(cfg(not(feature = "v4_12"))))]
81 #[doc(alias = "gtk_column_view_cell_set_focusable")]
82 #[doc(alias = "focusable")]
83 pub fn set_focusable(&self, focusable: bool) {
84 unsafe {
85 ffi::gtk_column_view_cell_set_focusable(self.to_glib_none().0, focusable.into_glib());
86 }
87 }
88}
89
90#[must_use = "The builder must be built to be used"]
95pub struct ColumnViewCellBuilder {
96 builder: glib::object::ObjectBuilder<'static, ColumnViewCell>,
97}
98
99impl ColumnViewCellBuilder {
100 fn new() -> Self {
101 Self {
102 builder: glib::object::Object::builder(),
103 }
104 }
105
106 #[cfg(feature = "v4_12")]
107 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
108 pub fn child(self, child: &impl IsA<Widget>) -> Self {
109 Self {
110 builder: self.builder.property("child", child.clone().upcast()),
111 }
112 }
113
114 #[cfg(feature = "v4_12")]
115 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
116 pub fn focusable(self, focusable: bool) -> Self {
117 Self {
118 builder: self.builder.property("focusable", focusable),
119 }
120 }
121
122 #[cfg(feature = "v4_12")]
123 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
124 pub fn accessible_description(self, accessible_description: impl Into<glib::GString>) -> Self {
125 Self {
126 builder: self
127 .builder
128 .property("accessible-description", accessible_description.into()),
129 }
130 }
131
132 #[cfg(feature = "v4_12")]
133 #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
134 pub fn accessible_label(self, accessible_label: impl Into<glib::GString>) -> Self {
135 Self {
136 builder: self
137 .builder
138 .property("accessible-label", accessible_label.into()),
139 }
140 }
141
142 pub fn activatable(self, activatable: bool) -> Self {
143 Self {
144 builder: self.builder.property("activatable", activatable),
145 }
146 }
147
148 pub fn selectable(self, selectable: bool) -> Self {
149 Self {
150 builder: self.builder.property("selectable", selectable),
151 }
152 }
153
154 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
157 pub fn build(self) -> ColumnViewCell {
158 assert_initialized_main_thread!();
159 self.builder.build()
160 }
161}