1#![allow(deprecated)]
5
6use crate::{
7 ffi, Buildable, CellArea, CellLayout, CellRenderer, SortType, TreeIter, TreeModel,
8 TreeViewColumnSizing, Widget,
9};
10use glib::{
11 object::ObjectType as _,
12 prelude::*,
13 signal::{connect_raw, SignalHandlerId},
14 translate::*,
15};
16use std::boxed::Box as Box_;
17
18glib::wrapper! {
19 #[doc(alias = "GtkTreeViewColumn")]
20 pub struct TreeViewColumn(Object<ffi::GtkTreeViewColumn>) @implements Buildable, CellLayout;
21
22 match fn {
23 type_ => || ffi::gtk_tree_view_column_get_type(),
24 }
25}
26
27impl TreeViewColumn {
28 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
29 #[allow(deprecated)]
30 #[doc(alias = "gtk_tree_view_column_new")]
31 pub fn new() -> TreeViewColumn {
32 assert_initialized_main_thread!();
33 unsafe { from_glib_none(ffi::gtk_tree_view_column_new()) }
34 }
35
36 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
37 #[allow(deprecated)]
38 #[doc(alias = "gtk_tree_view_column_new_with_area")]
39 #[doc(alias = "new_with_area")]
40 pub fn with_area(area: &impl IsA<CellArea>) -> TreeViewColumn {
41 skip_assert_initialized!();
42 unsafe {
43 from_glib_none(ffi::gtk_tree_view_column_new_with_area(
44 area.as_ref().to_glib_none().0,
45 ))
46 }
47 }
48
49 pub fn builder() -> TreeViewColumnBuilder {
54 TreeViewColumnBuilder::new()
55 }
56
57 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
58 #[allow(deprecated)]
59 #[doc(alias = "gtk_tree_view_column_add_attribute")]
60 pub fn add_attribute(
61 &self,
62 cell_renderer: &impl IsA<CellRenderer>,
63 attribute: &str,
64 column: i32,
65 ) {
66 unsafe {
67 ffi::gtk_tree_view_column_add_attribute(
68 self.to_glib_none().0,
69 cell_renderer.as_ref().to_glib_none().0,
70 attribute.to_glib_none().0,
71 column,
72 );
73 }
74 }
75
76 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
77 #[allow(deprecated)]
78 #[doc(alias = "gtk_tree_view_column_cell_get_position")]
79 pub fn cell_get_position(&self, cell_renderer: &impl IsA<CellRenderer>) -> Option<(i32, i32)> {
80 unsafe {
81 let mut x_offset = std::mem::MaybeUninit::uninit();
82 let mut width = std::mem::MaybeUninit::uninit();
83 let ret = from_glib(ffi::gtk_tree_view_column_cell_get_position(
84 self.to_glib_none().0,
85 cell_renderer.as_ref().to_glib_none().0,
86 x_offset.as_mut_ptr(),
87 width.as_mut_ptr(),
88 ));
89 if ret {
90 Some((x_offset.assume_init(), width.assume_init()))
91 } else {
92 None
93 }
94 }
95 }
96
97 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
98 #[allow(deprecated)]
99 #[doc(alias = "gtk_tree_view_column_cell_get_size")]
100 pub fn cell_get_size(&self) -> (i32, i32, i32, i32) {
101 unsafe {
102 let mut x_offset = std::mem::MaybeUninit::uninit();
103 let mut y_offset = std::mem::MaybeUninit::uninit();
104 let mut width = std::mem::MaybeUninit::uninit();
105 let mut height = std::mem::MaybeUninit::uninit();
106 ffi::gtk_tree_view_column_cell_get_size(
107 self.to_glib_none().0,
108 x_offset.as_mut_ptr(),
109 y_offset.as_mut_ptr(),
110 width.as_mut_ptr(),
111 height.as_mut_ptr(),
112 );
113 (
114 x_offset.assume_init(),
115 y_offset.assume_init(),
116 width.assume_init(),
117 height.assume_init(),
118 )
119 }
120 }
121
122 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
123 #[allow(deprecated)]
124 #[doc(alias = "gtk_tree_view_column_cell_is_visible")]
125 pub fn cell_is_visible(&self) -> bool {
126 unsafe {
127 from_glib(ffi::gtk_tree_view_column_cell_is_visible(
128 self.to_glib_none().0,
129 ))
130 }
131 }
132
133 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
134 #[allow(deprecated)]
135 #[doc(alias = "gtk_tree_view_column_cell_set_cell_data")]
136 pub fn cell_set_cell_data(
137 &self,
138 tree_model: &impl IsA<TreeModel>,
139 iter: &TreeIter,
140 is_expander: bool,
141 is_expanded: bool,
142 ) {
143 unsafe {
144 ffi::gtk_tree_view_column_cell_set_cell_data(
145 self.to_glib_none().0,
146 tree_model.as_ref().to_glib_none().0,
147 mut_override(iter.to_glib_none().0),
148 is_expander.into_glib(),
149 is_expanded.into_glib(),
150 );
151 }
152 }
153
154 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
155 #[allow(deprecated)]
156 #[doc(alias = "gtk_tree_view_column_clear")]
157 pub fn clear(&self) {
158 unsafe {
159 ffi::gtk_tree_view_column_clear(self.to_glib_none().0);
160 }
161 }
162
163 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
164 #[allow(deprecated)]
165 #[doc(alias = "gtk_tree_view_column_clear_attributes")]
166 pub fn clear_attributes(&self, cell_renderer: &impl IsA<CellRenderer>) {
167 unsafe {
168 ffi::gtk_tree_view_column_clear_attributes(
169 self.to_glib_none().0,
170 cell_renderer.as_ref().to_glib_none().0,
171 );
172 }
173 }
174
175 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
176 #[allow(deprecated)]
177 #[doc(alias = "gtk_tree_view_column_clicked")]
178 pub fn clicked(&self) {
179 unsafe {
180 ffi::gtk_tree_view_column_clicked(self.to_glib_none().0);
181 }
182 }
183
184 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
185 #[allow(deprecated)]
186 #[doc(alias = "gtk_tree_view_column_focus_cell")]
187 pub fn focus_cell(&self, cell: &impl IsA<CellRenderer>) {
188 unsafe {
189 ffi::gtk_tree_view_column_focus_cell(
190 self.to_glib_none().0,
191 cell.as_ref().to_glib_none().0,
192 );
193 }
194 }
195
196 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
197 #[allow(deprecated)]
198 #[doc(alias = "gtk_tree_view_column_get_alignment")]
199 #[doc(alias = "get_alignment")]
200 pub fn alignment(&self) -> f32 {
201 unsafe { ffi::gtk_tree_view_column_get_alignment(self.to_glib_none().0) }
202 }
203
204 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
205 #[allow(deprecated)]
206 #[doc(alias = "gtk_tree_view_column_get_button")]
207 #[doc(alias = "get_button")]
208 pub fn button(&self) -> Widget {
209 unsafe { from_glib_none(ffi::gtk_tree_view_column_get_button(self.to_glib_none().0)) }
210 }
211
212 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
213 #[allow(deprecated)]
214 #[doc(alias = "gtk_tree_view_column_get_clickable")]
215 #[doc(alias = "get_clickable")]
216 #[doc(alias = "clickable")]
217 pub fn is_clickable(&self) -> bool {
218 unsafe {
219 from_glib(ffi::gtk_tree_view_column_get_clickable(
220 self.to_glib_none().0,
221 ))
222 }
223 }
224
225 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
226 #[allow(deprecated)]
227 #[doc(alias = "gtk_tree_view_column_get_expand")]
228 #[doc(alias = "get_expand")]
229 #[doc(alias = "expand")]
230 pub fn expands(&self) -> bool {
231 unsafe { from_glib(ffi::gtk_tree_view_column_get_expand(self.to_glib_none().0)) }
232 }
233
234 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
235 #[allow(deprecated)]
236 #[doc(alias = "gtk_tree_view_column_get_fixed_width")]
237 #[doc(alias = "get_fixed_width")]
238 #[doc(alias = "fixed-width")]
239 pub fn fixed_width(&self) -> i32 {
240 unsafe { ffi::gtk_tree_view_column_get_fixed_width(self.to_glib_none().0) }
241 }
242
243 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
244 #[allow(deprecated)]
245 #[doc(alias = "gtk_tree_view_column_get_max_width")]
246 #[doc(alias = "get_max_width")]
247 #[doc(alias = "max-width")]
248 pub fn max_width(&self) -> i32 {
249 unsafe { ffi::gtk_tree_view_column_get_max_width(self.to_glib_none().0) }
250 }
251
252 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
253 #[allow(deprecated)]
254 #[doc(alias = "gtk_tree_view_column_get_min_width")]
255 #[doc(alias = "get_min_width")]
256 #[doc(alias = "min-width")]
257 pub fn min_width(&self) -> i32 {
258 unsafe { ffi::gtk_tree_view_column_get_min_width(self.to_glib_none().0) }
259 }
260
261 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
262 #[allow(deprecated)]
263 #[doc(alias = "gtk_tree_view_column_get_reorderable")]
264 #[doc(alias = "get_reorderable")]
265 #[doc(alias = "reorderable")]
266 pub fn is_reorderable(&self) -> bool {
267 unsafe {
268 from_glib(ffi::gtk_tree_view_column_get_reorderable(
269 self.to_glib_none().0,
270 ))
271 }
272 }
273
274 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
275 #[allow(deprecated)]
276 #[doc(alias = "gtk_tree_view_column_get_resizable")]
277 #[doc(alias = "get_resizable")]
278 #[doc(alias = "resizable")]
279 pub fn is_resizable(&self) -> bool {
280 unsafe {
281 from_glib(ffi::gtk_tree_view_column_get_resizable(
282 self.to_glib_none().0,
283 ))
284 }
285 }
286
287 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
288 #[allow(deprecated)]
289 #[doc(alias = "gtk_tree_view_column_get_sizing")]
290 #[doc(alias = "get_sizing")]
291 pub fn sizing(&self) -> TreeViewColumnSizing {
292 unsafe { from_glib(ffi::gtk_tree_view_column_get_sizing(self.to_glib_none().0)) }
293 }
294
295 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
296 #[allow(deprecated)]
297 #[doc(alias = "gtk_tree_view_column_get_sort_column_id")]
298 #[doc(alias = "get_sort_column_id")]
299 #[doc(alias = "sort-column-id")]
300 pub fn sort_column_id(&self) -> i32 {
301 unsafe { ffi::gtk_tree_view_column_get_sort_column_id(self.to_glib_none().0) }
302 }
303
304 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
305 #[allow(deprecated)]
306 #[doc(alias = "gtk_tree_view_column_get_sort_indicator")]
307 #[doc(alias = "get_sort_indicator")]
308 #[doc(alias = "sort-indicator")]
309 pub fn is_sort_indicator(&self) -> bool {
310 unsafe {
311 from_glib(ffi::gtk_tree_view_column_get_sort_indicator(
312 self.to_glib_none().0,
313 ))
314 }
315 }
316
317 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
318 #[allow(deprecated)]
319 #[doc(alias = "gtk_tree_view_column_get_sort_order")]
320 #[doc(alias = "get_sort_order")]
321 #[doc(alias = "sort-order")]
322 pub fn sort_order(&self) -> SortType {
323 unsafe {
324 from_glib(ffi::gtk_tree_view_column_get_sort_order(
325 self.to_glib_none().0,
326 ))
327 }
328 }
329
330 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
331 #[allow(deprecated)]
332 #[doc(alias = "gtk_tree_view_column_get_spacing")]
333 #[doc(alias = "get_spacing")]
334 pub fn spacing(&self) -> i32 {
335 unsafe { ffi::gtk_tree_view_column_get_spacing(self.to_glib_none().0) }
336 }
337
338 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
339 #[allow(deprecated)]
340 #[doc(alias = "gtk_tree_view_column_get_title")]
341 #[doc(alias = "get_title")]
342 pub fn title(&self) -> glib::GString {
343 unsafe { from_glib_none(ffi::gtk_tree_view_column_get_title(self.to_glib_none().0)) }
344 }
345
346 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
347 #[allow(deprecated)]
348 #[doc(alias = "gtk_tree_view_column_get_tree_view")]
349 #[doc(alias = "get_tree_view")]
350 pub fn tree_view(&self) -> Option<Widget> {
351 unsafe {
352 from_glib_none(ffi::gtk_tree_view_column_get_tree_view(
353 self.to_glib_none().0,
354 ))
355 }
356 }
357
358 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
359 #[allow(deprecated)]
360 #[doc(alias = "gtk_tree_view_column_get_visible")]
361 #[doc(alias = "get_visible")]
362 #[doc(alias = "visible")]
363 pub fn is_visible(&self) -> bool {
364 unsafe { from_glib(ffi::gtk_tree_view_column_get_visible(self.to_glib_none().0)) }
365 }
366
367 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
368 #[allow(deprecated)]
369 #[doc(alias = "gtk_tree_view_column_get_widget")]
370 #[doc(alias = "get_widget")]
371 pub fn widget(&self) -> Option<Widget> {
372 unsafe { from_glib_none(ffi::gtk_tree_view_column_get_widget(self.to_glib_none().0)) }
373 }
374
375 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
376 #[allow(deprecated)]
377 #[doc(alias = "gtk_tree_view_column_get_width")]
378 #[doc(alias = "get_width")]
379 pub fn width(&self) -> i32 {
380 unsafe { ffi::gtk_tree_view_column_get_width(self.to_glib_none().0) }
381 }
382
383 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
384 #[allow(deprecated)]
385 #[doc(alias = "gtk_tree_view_column_get_x_offset")]
386 #[doc(alias = "get_x_offset")]
387 #[doc(alias = "x-offset")]
388 pub fn x_offset(&self) -> i32 {
389 unsafe { ffi::gtk_tree_view_column_get_x_offset(self.to_glib_none().0) }
390 }
391
392 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
393 #[allow(deprecated)]
394 #[doc(alias = "gtk_tree_view_column_pack_end")]
395 pub fn pack_end(&self, cell: &impl IsA<CellRenderer>, expand: bool) {
396 unsafe {
397 ffi::gtk_tree_view_column_pack_end(
398 self.to_glib_none().0,
399 cell.as_ref().to_glib_none().0,
400 expand.into_glib(),
401 );
402 }
403 }
404
405 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
406 #[allow(deprecated)]
407 #[doc(alias = "gtk_tree_view_column_pack_start")]
408 pub fn pack_start(&self, cell: &impl IsA<CellRenderer>, expand: bool) {
409 unsafe {
410 ffi::gtk_tree_view_column_pack_start(
411 self.to_glib_none().0,
412 cell.as_ref().to_glib_none().0,
413 expand.into_glib(),
414 );
415 }
416 }
417
418 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
419 #[allow(deprecated)]
420 #[doc(alias = "gtk_tree_view_column_queue_resize")]
421 pub fn queue_resize(&self) {
422 unsafe {
423 ffi::gtk_tree_view_column_queue_resize(self.to_glib_none().0);
424 }
425 }
426
427 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
428 #[allow(deprecated)]
429 #[doc(alias = "gtk_tree_view_column_set_alignment")]
430 #[doc(alias = "alignment")]
431 pub fn set_alignment(&self, xalign: f32) {
432 unsafe {
433 ffi::gtk_tree_view_column_set_alignment(self.to_glib_none().0, xalign);
434 }
435 }
436
437 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
438 #[allow(deprecated)]
439 #[doc(alias = "gtk_tree_view_column_set_cell_data_func")]
440 pub fn set_cell_data_func<
441 P: Fn(&TreeViewColumn, &CellRenderer, &TreeModel, &TreeIter) + 'static,
442 >(
443 &self,
444 cell_renderer: &impl IsA<CellRenderer>,
445 func: P,
446 ) {
447 let func_data: Box_<P> = Box_::new(func);
448 unsafe extern "C" fn func_func<
449 P: Fn(&TreeViewColumn, &CellRenderer, &TreeModel, &TreeIter) + 'static,
450 >(
451 tree_column: *mut ffi::GtkTreeViewColumn,
452 cell: *mut ffi::GtkCellRenderer,
453 tree_model: *mut ffi::GtkTreeModel,
454 iter: *mut ffi::GtkTreeIter,
455 data: glib::ffi::gpointer,
456 ) {
457 let tree_column = from_glib_borrow(tree_column);
458 let cell = from_glib_borrow(cell);
459 let tree_model = from_glib_borrow(tree_model);
460 let iter = from_glib_borrow(iter);
461 let callback = &*(data as *mut P);
462 (*callback)(&tree_column, &cell, &tree_model, &iter)
463 }
464 let func = Some(func_func::<P> as _);
465 unsafe extern "C" fn destroy_func<
466 P: Fn(&TreeViewColumn, &CellRenderer, &TreeModel, &TreeIter) + 'static,
467 >(
468 data: glib::ffi::gpointer,
469 ) {
470 let _callback = Box_::from_raw(data as *mut P);
471 }
472 let destroy_call4 = Some(destroy_func::<P> as _);
473 let super_callback0: Box_<P> = func_data;
474 unsafe {
475 ffi::gtk_tree_view_column_set_cell_data_func(
476 self.to_glib_none().0,
477 cell_renderer.as_ref().to_glib_none().0,
478 func,
479 Box_::into_raw(super_callback0) as *mut _,
480 destroy_call4,
481 );
482 }
483 }
484
485 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
486 #[allow(deprecated)]
487 #[doc(alias = "gtk_tree_view_column_set_clickable")]
488 #[doc(alias = "clickable")]
489 pub fn set_clickable(&self, clickable: bool) {
490 unsafe {
491 ffi::gtk_tree_view_column_set_clickable(self.to_glib_none().0, clickable.into_glib());
492 }
493 }
494
495 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
496 #[allow(deprecated)]
497 #[doc(alias = "gtk_tree_view_column_set_expand")]
498 #[doc(alias = "expand")]
499 pub fn set_expand(&self, expand: bool) {
500 unsafe {
501 ffi::gtk_tree_view_column_set_expand(self.to_glib_none().0, expand.into_glib());
502 }
503 }
504
505 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
506 #[allow(deprecated)]
507 #[doc(alias = "gtk_tree_view_column_set_fixed_width")]
508 #[doc(alias = "fixed-width")]
509 pub fn set_fixed_width(&self, fixed_width: i32) {
510 unsafe {
511 ffi::gtk_tree_view_column_set_fixed_width(self.to_glib_none().0, fixed_width);
512 }
513 }
514
515 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
516 #[allow(deprecated)]
517 #[doc(alias = "gtk_tree_view_column_set_max_width")]
518 #[doc(alias = "max-width")]
519 pub fn set_max_width(&self, max_width: i32) {
520 unsafe {
521 ffi::gtk_tree_view_column_set_max_width(self.to_glib_none().0, max_width);
522 }
523 }
524
525 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
526 #[allow(deprecated)]
527 #[doc(alias = "gtk_tree_view_column_set_min_width")]
528 #[doc(alias = "min-width")]
529 pub fn set_min_width(&self, min_width: i32) {
530 unsafe {
531 ffi::gtk_tree_view_column_set_min_width(self.to_glib_none().0, min_width);
532 }
533 }
534
535 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
536 #[allow(deprecated)]
537 #[doc(alias = "gtk_tree_view_column_set_reorderable")]
538 #[doc(alias = "reorderable")]
539 pub fn set_reorderable(&self, reorderable: bool) {
540 unsafe {
541 ffi::gtk_tree_view_column_set_reorderable(
542 self.to_glib_none().0,
543 reorderable.into_glib(),
544 );
545 }
546 }
547
548 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
549 #[allow(deprecated)]
550 #[doc(alias = "gtk_tree_view_column_set_resizable")]
551 #[doc(alias = "resizable")]
552 pub fn set_resizable(&self, resizable: bool) {
553 unsafe {
554 ffi::gtk_tree_view_column_set_resizable(self.to_glib_none().0, resizable.into_glib());
555 }
556 }
557
558 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
559 #[allow(deprecated)]
560 #[doc(alias = "gtk_tree_view_column_set_sizing")]
561 #[doc(alias = "sizing")]
562 pub fn set_sizing(&self, type_: TreeViewColumnSizing) {
563 unsafe {
564 ffi::gtk_tree_view_column_set_sizing(self.to_glib_none().0, type_.into_glib());
565 }
566 }
567
568 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
569 #[allow(deprecated)]
570 #[doc(alias = "gtk_tree_view_column_set_sort_column_id")]
571 #[doc(alias = "sort-column-id")]
572 pub fn set_sort_column_id(&self, sort_column_id: i32) {
573 unsafe {
574 ffi::gtk_tree_view_column_set_sort_column_id(self.to_glib_none().0, sort_column_id);
575 }
576 }
577
578 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
579 #[allow(deprecated)]
580 #[doc(alias = "gtk_tree_view_column_set_sort_indicator")]
581 #[doc(alias = "sort-indicator")]
582 pub fn set_sort_indicator(&self, setting: bool) {
583 unsafe {
584 ffi::gtk_tree_view_column_set_sort_indicator(
585 self.to_glib_none().0,
586 setting.into_glib(),
587 );
588 }
589 }
590
591 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
592 #[allow(deprecated)]
593 #[doc(alias = "gtk_tree_view_column_set_sort_order")]
594 #[doc(alias = "sort-order")]
595 pub fn set_sort_order(&self, order: SortType) {
596 unsafe {
597 ffi::gtk_tree_view_column_set_sort_order(self.to_glib_none().0, order.into_glib());
598 }
599 }
600
601 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
602 #[allow(deprecated)]
603 #[doc(alias = "gtk_tree_view_column_set_spacing")]
604 #[doc(alias = "spacing")]
605 pub fn set_spacing(&self, spacing: i32) {
606 unsafe {
607 ffi::gtk_tree_view_column_set_spacing(self.to_glib_none().0, spacing);
608 }
609 }
610
611 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
612 #[allow(deprecated)]
613 #[doc(alias = "gtk_tree_view_column_set_title")]
614 #[doc(alias = "title")]
615 pub fn set_title(&self, title: &str) {
616 unsafe {
617 ffi::gtk_tree_view_column_set_title(self.to_glib_none().0, title.to_glib_none().0);
618 }
619 }
620
621 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
622 #[allow(deprecated)]
623 #[doc(alias = "gtk_tree_view_column_set_visible")]
624 #[doc(alias = "visible")]
625 pub fn set_visible(&self, visible: bool) {
626 unsafe {
627 ffi::gtk_tree_view_column_set_visible(self.to_glib_none().0, visible.into_glib());
628 }
629 }
630
631 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
632 #[allow(deprecated)]
633 #[doc(alias = "gtk_tree_view_column_set_widget")]
634 #[doc(alias = "widget")]
635 pub fn set_widget(&self, widget: Option<&impl IsA<Widget>>) {
636 unsafe {
637 ffi::gtk_tree_view_column_set_widget(
638 self.to_glib_none().0,
639 widget.map(|p| p.as_ref()).to_glib_none().0,
640 );
641 }
642 }
643
644 #[doc(alias = "cell-area")]
645 pub fn cell_area(&self) -> Option<CellArea> {
646 ObjectExt::property(self, "cell-area")
647 }
648
649 #[doc(alias = "clicked")]
650 pub fn connect_clicked<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
651 unsafe extern "C" fn clicked_trampoline<F: Fn(&TreeViewColumn) + 'static>(
652 this: *mut ffi::GtkTreeViewColumn,
653 f: glib::ffi::gpointer,
654 ) {
655 let f: &F = &*(f as *const F);
656 f(&from_glib_borrow(this))
657 }
658 unsafe {
659 let f: Box_<F> = Box_::new(f);
660 connect_raw(
661 self.as_ptr() as *mut _,
662 b"clicked\0".as_ptr() as *const _,
663 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
664 clicked_trampoline::<F> as *const (),
665 )),
666 Box_::into_raw(f),
667 )
668 }
669 }
670
671 #[doc(alias = "alignment")]
672 pub fn connect_alignment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
673 unsafe extern "C" fn notify_alignment_trampoline<F: Fn(&TreeViewColumn) + 'static>(
674 this: *mut ffi::GtkTreeViewColumn,
675 _param_spec: glib::ffi::gpointer,
676 f: glib::ffi::gpointer,
677 ) {
678 let f: &F = &*(f as *const F);
679 f(&from_glib_borrow(this))
680 }
681 unsafe {
682 let f: Box_<F> = Box_::new(f);
683 connect_raw(
684 self.as_ptr() as *mut _,
685 b"notify::alignment\0".as_ptr() as *const _,
686 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
687 notify_alignment_trampoline::<F> as *const (),
688 )),
689 Box_::into_raw(f),
690 )
691 }
692 }
693
694 #[doc(alias = "clickable")]
695 pub fn connect_clickable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
696 unsafe extern "C" fn notify_clickable_trampoline<F: Fn(&TreeViewColumn) + 'static>(
697 this: *mut ffi::GtkTreeViewColumn,
698 _param_spec: glib::ffi::gpointer,
699 f: glib::ffi::gpointer,
700 ) {
701 let f: &F = &*(f as *const F);
702 f(&from_glib_borrow(this))
703 }
704 unsafe {
705 let f: Box_<F> = Box_::new(f);
706 connect_raw(
707 self.as_ptr() as *mut _,
708 b"notify::clickable\0".as_ptr() as *const _,
709 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
710 notify_clickable_trampoline::<F> as *const (),
711 )),
712 Box_::into_raw(f),
713 )
714 }
715 }
716
717 #[doc(alias = "expand")]
718 pub fn connect_expand_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
719 unsafe extern "C" fn notify_expand_trampoline<F: Fn(&TreeViewColumn) + 'static>(
720 this: *mut ffi::GtkTreeViewColumn,
721 _param_spec: glib::ffi::gpointer,
722 f: glib::ffi::gpointer,
723 ) {
724 let f: &F = &*(f as *const F);
725 f(&from_glib_borrow(this))
726 }
727 unsafe {
728 let f: Box_<F> = Box_::new(f);
729 connect_raw(
730 self.as_ptr() as *mut _,
731 b"notify::expand\0".as_ptr() as *const _,
732 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
733 notify_expand_trampoline::<F> as *const (),
734 )),
735 Box_::into_raw(f),
736 )
737 }
738 }
739
740 #[doc(alias = "fixed-width")]
741 pub fn connect_fixed_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
742 unsafe extern "C" fn notify_fixed_width_trampoline<F: Fn(&TreeViewColumn) + 'static>(
743 this: *mut ffi::GtkTreeViewColumn,
744 _param_spec: glib::ffi::gpointer,
745 f: glib::ffi::gpointer,
746 ) {
747 let f: &F = &*(f as *const F);
748 f(&from_glib_borrow(this))
749 }
750 unsafe {
751 let f: Box_<F> = Box_::new(f);
752 connect_raw(
753 self.as_ptr() as *mut _,
754 b"notify::fixed-width\0".as_ptr() as *const _,
755 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
756 notify_fixed_width_trampoline::<F> as *const (),
757 )),
758 Box_::into_raw(f),
759 )
760 }
761 }
762
763 #[doc(alias = "max-width")]
764 pub fn connect_max_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
765 unsafe extern "C" fn notify_max_width_trampoline<F: Fn(&TreeViewColumn) + 'static>(
766 this: *mut ffi::GtkTreeViewColumn,
767 _param_spec: glib::ffi::gpointer,
768 f: glib::ffi::gpointer,
769 ) {
770 let f: &F = &*(f as *const F);
771 f(&from_glib_borrow(this))
772 }
773 unsafe {
774 let f: Box_<F> = Box_::new(f);
775 connect_raw(
776 self.as_ptr() as *mut _,
777 b"notify::max-width\0".as_ptr() as *const _,
778 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
779 notify_max_width_trampoline::<F> as *const (),
780 )),
781 Box_::into_raw(f),
782 )
783 }
784 }
785
786 #[doc(alias = "min-width")]
787 pub fn connect_min_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
788 unsafe extern "C" fn notify_min_width_trampoline<F: Fn(&TreeViewColumn) + 'static>(
789 this: *mut ffi::GtkTreeViewColumn,
790 _param_spec: glib::ffi::gpointer,
791 f: glib::ffi::gpointer,
792 ) {
793 let f: &F = &*(f as *const F);
794 f(&from_glib_borrow(this))
795 }
796 unsafe {
797 let f: Box_<F> = Box_::new(f);
798 connect_raw(
799 self.as_ptr() as *mut _,
800 b"notify::min-width\0".as_ptr() as *const _,
801 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
802 notify_min_width_trampoline::<F> as *const (),
803 )),
804 Box_::into_raw(f),
805 )
806 }
807 }
808
809 #[doc(alias = "reorderable")]
810 pub fn connect_reorderable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
811 unsafe extern "C" fn notify_reorderable_trampoline<F: Fn(&TreeViewColumn) + 'static>(
812 this: *mut ffi::GtkTreeViewColumn,
813 _param_spec: glib::ffi::gpointer,
814 f: glib::ffi::gpointer,
815 ) {
816 let f: &F = &*(f as *const F);
817 f(&from_glib_borrow(this))
818 }
819 unsafe {
820 let f: Box_<F> = Box_::new(f);
821 connect_raw(
822 self.as_ptr() as *mut _,
823 b"notify::reorderable\0".as_ptr() as *const _,
824 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
825 notify_reorderable_trampoline::<F> as *const (),
826 )),
827 Box_::into_raw(f),
828 )
829 }
830 }
831
832 #[doc(alias = "resizable")]
833 pub fn connect_resizable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
834 unsafe extern "C" fn notify_resizable_trampoline<F: Fn(&TreeViewColumn) + 'static>(
835 this: *mut ffi::GtkTreeViewColumn,
836 _param_spec: glib::ffi::gpointer,
837 f: glib::ffi::gpointer,
838 ) {
839 let f: &F = &*(f as *const F);
840 f(&from_glib_borrow(this))
841 }
842 unsafe {
843 let f: Box_<F> = Box_::new(f);
844 connect_raw(
845 self.as_ptr() as *mut _,
846 b"notify::resizable\0".as_ptr() as *const _,
847 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
848 notify_resizable_trampoline::<F> as *const (),
849 )),
850 Box_::into_raw(f),
851 )
852 }
853 }
854
855 #[doc(alias = "sizing")]
856 pub fn connect_sizing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
857 unsafe extern "C" fn notify_sizing_trampoline<F: Fn(&TreeViewColumn) + 'static>(
858 this: *mut ffi::GtkTreeViewColumn,
859 _param_spec: glib::ffi::gpointer,
860 f: glib::ffi::gpointer,
861 ) {
862 let f: &F = &*(f as *const F);
863 f(&from_glib_borrow(this))
864 }
865 unsafe {
866 let f: Box_<F> = Box_::new(f);
867 connect_raw(
868 self.as_ptr() as *mut _,
869 b"notify::sizing\0".as_ptr() as *const _,
870 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
871 notify_sizing_trampoline::<F> as *const (),
872 )),
873 Box_::into_raw(f),
874 )
875 }
876 }
877
878 #[doc(alias = "sort-column-id")]
879 pub fn connect_sort_column_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
880 unsafe extern "C" fn notify_sort_column_id_trampoline<F: Fn(&TreeViewColumn) + 'static>(
881 this: *mut ffi::GtkTreeViewColumn,
882 _param_spec: glib::ffi::gpointer,
883 f: glib::ffi::gpointer,
884 ) {
885 let f: &F = &*(f as *const F);
886 f(&from_glib_borrow(this))
887 }
888 unsafe {
889 let f: Box_<F> = Box_::new(f);
890 connect_raw(
891 self.as_ptr() as *mut _,
892 b"notify::sort-column-id\0".as_ptr() as *const _,
893 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
894 notify_sort_column_id_trampoline::<F> as *const (),
895 )),
896 Box_::into_raw(f),
897 )
898 }
899 }
900
901 #[doc(alias = "sort-indicator")]
902 pub fn connect_sort_indicator_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
903 unsafe extern "C" fn notify_sort_indicator_trampoline<F: Fn(&TreeViewColumn) + 'static>(
904 this: *mut ffi::GtkTreeViewColumn,
905 _param_spec: glib::ffi::gpointer,
906 f: glib::ffi::gpointer,
907 ) {
908 let f: &F = &*(f as *const F);
909 f(&from_glib_borrow(this))
910 }
911 unsafe {
912 let f: Box_<F> = Box_::new(f);
913 connect_raw(
914 self.as_ptr() as *mut _,
915 b"notify::sort-indicator\0".as_ptr() as *const _,
916 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
917 notify_sort_indicator_trampoline::<F> as *const (),
918 )),
919 Box_::into_raw(f),
920 )
921 }
922 }
923
924 #[doc(alias = "sort-order")]
925 pub fn connect_sort_order_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
926 unsafe extern "C" fn notify_sort_order_trampoline<F: Fn(&TreeViewColumn) + 'static>(
927 this: *mut ffi::GtkTreeViewColumn,
928 _param_spec: glib::ffi::gpointer,
929 f: glib::ffi::gpointer,
930 ) {
931 let f: &F = &*(f as *const F);
932 f(&from_glib_borrow(this))
933 }
934 unsafe {
935 let f: Box_<F> = Box_::new(f);
936 connect_raw(
937 self.as_ptr() as *mut _,
938 b"notify::sort-order\0".as_ptr() as *const _,
939 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
940 notify_sort_order_trampoline::<F> as *const (),
941 )),
942 Box_::into_raw(f),
943 )
944 }
945 }
946
947 #[doc(alias = "spacing")]
948 pub fn connect_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
949 unsafe extern "C" fn notify_spacing_trampoline<F: Fn(&TreeViewColumn) + 'static>(
950 this: *mut ffi::GtkTreeViewColumn,
951 _param_spec: glib::ffi::gpointer,
952 f: glib::ffi::gpointer,
953 ) {
954 let f: &F = &*(f as *const F);
955 f(&from_glib_borrow(this))
956 }
957 unsafe {
958 let f: Box_<F> = Box_::new(f);
959 connect_raw(
960 self.as_ptr() as *mut _,
961 b"notify::spacing\0".as_ptr() as *const _,
962 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
963 notify_spacing_trampoline::<F> as *const (),
964 )),
965 Box_::into_raw(f),
966 )
967 }
968 }
969
970 #[doc(alias = "title")]
971 pub fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
972 unsafe extern "C" fn notify_title_trampoline<F: Fn(&TreeViewColumn) + 'static>(
973 this: *mut ffi::GtkTreeViewColumn,
974 _param_spec: glib::ffi::gpointer,
975 f: glib::ffi::gpointer,
976 ) {
977 let f: &F = &*(f as *const F);
978 f(&from_glib_borrow(this))
979 }
980 unsafe {
981 let f: Box_<F> = Box_::new(f);
982 connect_raw(
983 self.as_ptr() as *mut _,
984 b"notify::title\0".as_ptr() as *const _,
985 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
986 notify_title_trampoline::<F> as *const (),
987 )),
988 Box_::into_raw(f),
989 )
990 }
991 }
992
993 #[doc(alias = "visible")]
994 pub fn connect_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
995 unsafe extern "C" fn notify_visible_trampoline<F: Fn(&TreeViewColumn) + 'static>(
996 this: *mut ffi::GtkTreeViewColumn,
997 _param_spec: glib::ffi::gpointer,
998 f: glib::ffi::gpointer,
999 ) {
1000 let f: &F = &*(f as *const F);
1001 f(&from_glib_borrow(this))
1002 }
1003 unsafe {
1004 let f: Box_<F> = Box_::new(f);
1005 connect_raw(
1006 self.as_ptr() as *mut _,
1007 b"notify::visible\0".as_ptr() as *const _,
1008 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1009 notify_visible_trampoline::<F> as *const (),
1010 )),
1011 Box_::into_raw(f),
1012 )
1013 }
1014 }
1015
1016 #[doc(alias = "widget")]
1017 pub fn connect_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1018 unsafe extern "C" fn notify_widget_trampoline<F: Fn(&TreeViewColumn) + 'static>(
1019 this: *mut ffi::GtkTreeViewColumn,
1020 _param_spec: glib::ffi::gpointer,
1021 f: glib::ffi::gpointer,
1022 ) {
1023 let f: &F = &*(f as *const F);
1024 f(&from_glib_borrow(this))
1025 }
1026 unsafe {
1027 let f: Box_<F> = Box_::new(f);
1028 connect_raw(
1029 self.as_ptr() as *mut _,
1030 b"notify::widget\0".as_ptr() as *const _,
1031 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1032 notify_widget_trampoline::<F> as *const (),
1033 )),
1034 Box_::into_raw(f),
1035 )
1036 }
1037 }
1038
1039 #[doc(alias = "width")]
1040 pub fn connect_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1041 unsafe extern "C" fn notify_width_trampoline<F: Fn(&TreeViewColumn) + 'static>(
1042 this: *mut ffi::GtkTreeViewColumn,
1043 _param_spec: glib::ffi::gpointer,
1044 f: glib::ffi::gpointer,
1045 ) {
1046 let f: &F = &*(f as *const F);
1047 f(&from_glib_borrow(this))
1048 }
1049 unsafe {
1050 let f: Box_<F> = Box_::new(f);
1051 connect_raw(
1052 self.as_ptr() as *mut _,
1053 b"notify::width\0".as_ptr() as *const _,
1054 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1055 notify_width_trampoline::<F> as *const (),
1056 )),
1057 Box_::into_raw(f),
1058 )
1059 }
1060 }
1061
1062 #[doc(alias = "x-offset")]
1063 pub fn connect_x_offset_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1064 unsafe extern "C" fn notify_x_offset_trampoline<F: Fn(&TreeViewColumn) + 'static>(
1065 this: *mut ffi::GtkTreeViewColumn,
1066 _param_spec: glib::ffi::gpointer,
1067 f: glib::ffi::gpointer,
1068 ) {
1069 let f: &F = &*(f as *const F);
1070 f(&from_glib_borrow(this))
1071 }
1072 unsafe {
1073 let f: Box_<F> = Box_::new(f);
1074 connect_raw(
1075 self.as_ptr() as *mut _,
1076 b"notify::x-offset\0".as_ptr() as *const _,
1077 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1078 notify_x_offset_trampoline::<F> as *const (),
1079 )),
1080 Box_::into_raw(f),
1081 )
1082 }
1083 }
1084}
1085
1086impl Default for TreeViewColumn {
1087 fn default() -> Self {
1088 Self::new()
1089 }
1090}
1091
1092#[must_use = "The builder must be built to be used"]
1097pub struct TreeViewColumnBuilder {
1098 builder: glib::object::ObjectBuilder<'static, TreeViewColumn>,
1099}
1100
1101impl TreeViewColumnBuilder {
1102 fn new() -> Self {
1103 Self {
1104 builder: glib::object::Object::builder(),
1105 }
1106 }
1107
1108 pub fn alignment(self, alignment: f32) -> Self {
1109 Self {
1110 builder: self.builder.property("alignment", alignment),
1111 }
1112 }
1113
1114 pub fn cell_area(self, cell_area: &impl IsA<CellArea>) -> Self {
1115 Self {
1116 builder: self
1117 .builder
1118 .property("cell-area", cell_area.clone().upcast()),
1119 }
1120 }
1121
1122 pub fn clickable(self, clickable: bool) -> Self {
1123 Self {
1124 builder: self.builder.property("clickable", clickable),
1125 }
1126 }
1127
1128 pub fn expand(self, expand: bool) -> Self {
1129 Self {
1130 builder: self.builder.property("expand", expand),
1131 }
1132 }
1133
1134 pub fn fixed_width(self, fixed_width: i32) -> Self {
1135 Self {
1136 builder: self.builder.property("fixed-width", fixed_width),
1137 }
1138 }
1139
1140 pub fn max_width(self, max_width: i32) -> Self {
1141 Self {
1142 builder: self.builder.property("max-width", max_width),
1143 }
1144 }
1145
1146 pub fn min_width(self, min_width: i32) -> Self {
1147 Self {
1148 builder: self.builder.property("min-width", min_width),
1149 }
1150 }
1151
1152 pub fn reorderable(self, reorderable: bool) -> Self {
1153 Self {
1154 builder: self.builder.property("reorderable", reorderable),
1155 }
1156 }
1157
1158 pub fn resizable(self, resizable: bool) -> Self {
1159 Self {
1160 builder: self.builder.property("resizable", resizable),
1161 }
1162 }
1163
1164 pub fn sizing(self, sizing: TreeViewColumnSizing) -> Self {
1165 Self {
1166 builder: self.builder.property("sizing", sizing),
1167 }
1168 }
1169
1170 pub fn sort_column_id(self, sort_column_id: i32) -> Self {
1171 Self {
1172 builder: self.builder.property("sort-column-id", sort_column_id),
1173 }
1174 }
1175
1176 pub fn sort_indicator(self, sort_indicator: bool) -> Self {
1177 Self {
1178 builder: self.builder.property("sort-indicator", sort_indicator),
1179 }
1180 }
1181
1182 pub fn sort_order(self, sort_order: SortType) -> Self {
1183 Self {
1184 builder: self.builder.property("sort-order", sort_order),
1185 }
1186 }
1187
1188 pub fn spacing(self, spacing: i32) -> Self {
1189 Self {
1190 builder: self.builder.property("spacing", spacing),
1191 }
1192 }
1193
1194 pub fn title(self, title: impl Into<glib::GString>) -> Self {
1195 Self {
1196 builder: self.builder.property("title", title.into()),
1197 }
1198 }
1199
1200 pub fn visible(self, visible: bool) -> Self {
1201 Self {
1202 builder: self.builder.property("visible", visible),
1203 }
1204 }
1205
1206 pub fn widget(self, widget: &impl IsA<Widget>) -> Self {
1207 Self {
1208 builder: self.builder.property("widget", widget.clone().upcast()),
1209 }
1210 }
1211
1212 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1215 pub fn build(self) -> TreeViewColumn {
1216 assert_initialized_main_thread!();
1217 self.builder.build()
1218 }
1219}