1use crate::{
6 Buildable, CellArea, CellLayout, CellRenderer, SortType, TreeIter, TreeModel,
7 TreeViewColumnSizing, Widget, ffi,
8};
9use glib::{
10 object::ObjectType as _,
11 prelude::*,
12 signal::{SignalHandlerId, connect_raw},
13 translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18 #[doc(alias = "GtkTreeViewColumn")]
122 pub struct TreeViewColumn(Object<ffi::GtkTreeViewColumn, ffi::GtkTreeViewColumnClass>) @implements Buildable, CellLayout;
123
124 match fn {
125 type_ => || ffi::gtk_tree_view_column_get_type(),
126 }
127}
128
129impl TreeViewColumn {
130 pub const NONE: Option<&'static TreeViewColumn> = None;
131
132 #[doc(alias = "gtk_tree_view_column_new")]
138 pub fn new() -> TreeViewColumn {
139 assert_initialized_main_thread!();
140 unsafe { from_glib_none(ffi::gtk_tree_view_column_new()) }
141 }
142
143 #[doc(alias = "gtk_tree_view_column_new_with_area")]
151 #[doc(alias = "new_with_area")]
152 pub fn with_area(area: &impl IsA<CellArea>) -> TreeViewColumn {
153 skip_assert_initialized!();
154 unsafe {
155 from_glib_none(ffi::gtk_tree_view_column_new_with_area(
156 area.as_ref().to_glib_none().0,
157 ))
158 }
159 }
160
161 pub fn builder() -> TreeViewColumnBuilder {
166 TreeViewColumnBuilder::new()
167 }
168}
169
170impl Default for TreeViewColumn {
171 fn default() -> Self {
172 Self::new()
173 }
174}
175
176#[must_use = "The builder must be built to be used"]
181pub struct TreeViewColumnBuilder {
182 builder: glib::object::ObjectBuilder<'static, TreeViewColumn>,
183}
184
185impl TreeViewColumnBuilder {
186 fn new() -> Self {
187 Self {
188 builder: glib::object::Object::builder(),
189 }
190 }
191
192 pub fn alignment(self, alignment: f32) -> Self {
193 Self {
194 builder: self.builder.property("alignment", alignment),
195 }
196 }
197
198 pub fn cell_area(self, cell_area: &impl IsA<CellArea>) -> Self {
203 Self {
204 builder: self
205 .builder
206 .property("cell-area", cell_area.clone().upcast()),
207 }
208 }
209
210 pub fn clickable(self, clickable: bool) -> Self {
211 Self {
212 builder: self.builder.property("clickable", clickable),
213 }
214 }
215
216 pub fn expand(self, expand: bool) -> Self {
217 Self {
218 builder: self.builder.property("expand", expand),
219 }
220 }
221
222 pub fn fixed_width(self, fixed_width: i32) -> Self {
223 Self {
224 builder: self.builder.property("fixed-width", fixed_width),
225 }
226 }
227
228 pub fn max_width(self, max_width: i32) -> Self {
229 Self {
230 builder: self.builder.property("max-width", max_width),
231 }
232 }
233
234 pub fn min_width(self, min_width: i32) -> Self {
235 Self {
236 builder: self.builder.property("min-width", min_width),
237 }
238 }
239
240 pub fn reorderable(self, reorderable: bool) -> Self {
241 Self {
242 builder: self.builder.property("reorderable", reorderable),
243 }
244 }
245
246 pub fn resizable(self, resizable: bool) -> Self {
247 Self {
248 builder: self.builder.property("resizable", resizable),
249 }
250 }
251
252 pub fn sizing(self, sizing: TreeViewColumnSizing) -> Self {
253 Self {
254 builder: self.builder.property("sizing", sizing),
255 }
256 }
257
258 pub fn sort_column_id(self, sort_column_id: i32) -> Self {
261 Self {
262 builder: self.builder.property("sort-column-id", sort_column_id),
263 }
264 }
265
266 pub fn sort_indicator(self, sort_indicator: bool) -> Self {
267 Self {
268 builder: self.builder.property("sort-indicator", sort_indicator),
269 }
270 }
271
272 pub fn sort_order(self, sort_order: SortType) -> Self {
273 Self {
274 builder: self.builder.property("sort-order", sort_order),
275 }
276 }
277
278 pub fn spacing(self, spacing: i32) -> Self {
279 Self {
280 builder: self.builder.property("spacing", spacing),
281 }
282 }
283
284 pub fn title(self, title: impl Into<glib::GString>) -> Self {
285 Self {
286 builder: self.builder.property("title", title.into()),
287 }
288 }
289
290 pub fn visible(self, visible: bool) -> Self {
291 Self {
292 builder: self.builder.property("visible", visible),
293 }
294 }
295
296 pub fn widget(self, widget: &impl IsA<Widget>) -> Self {
297 Self {
298 builder: self.builder.property("widget", widget.clone().upcast()),
299 }
300 }
301
302 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
305 pub fn build(self) -> TreeViewColumn {
306 assert_initialized_main_thread!();
307 self.builder.build()
308 }
309}
310
311pub trait TreeViewColumnExt: IsA<TreeViewColumn> + 'static {
317 #[doc(alias = "gtk_tree_view_column_add_attribute")]
330 fn add_attribute(&self, cell_renderer: &impl IsA<CellRenderer>, attribute: &str, column: i32) {
331 unsafe {
332 ffi::gtk_tree_view_column_add_attribute(
333 self.as_ref().to_glib_none().0,
334 cell_renderer.as_ref().to_glib_none().0,
335 attribute.to_glib_none().0,
336 column,
337 );
338 }
339 }
340
341 #[doc(alias = "gtk_tree_view_column_cell_get_position")]
359 fn cell_get_position(&self, cell_renderer: &impl IsA<CellRenderer>) -> Option<(i32, i32)> {
360 unsafe {
361 let mut x_offset = std::mem::MaybeUninit::uninit();
362 let mut width = std::mem::MaybeUninit::uninit();
363 let ret = from_glib(ffi::gtk_tree_view_column_cell_get_position(
364 self.as_ref().to_glib_none().0,
365 cell_renderer.as_ref().to_glib_none().0,
366 x_offset.as_mut_ptr(),
367 width.as_mut_ptr(),
368 ));
369 if ret {
370 Some((x_offset.assume_init(), width.assume_init()))
371 } else {
372 None
373 }
374 }
375 }
376
377 #[doc(alias = "gtk_tree_view_column_cell_get_size")]
397 fn cell_get_size(&self, cell_area: Option<&gdk::Rectangle>) -> (i32, i32, i32, i32) {
398 unsafe {
399 let mut x_offset = std::mem::MaybeUninit::uninit();
400 let mut y_offset = std::mem::MaybeUninit::uninit();
401 let mut width = std::mem::MaybeUninit::uninit();
402 let mut height = std::mem::MaybeUninit::uninit();
403 ffi::gtk_tree_view_column_cell_get_size(
404 self.as_ref().to_glib_none().0,
405 cell_area.to_glib_none().0,
406 x_offset.as_mut_ptr(),
407 y_offset.as_mut_ptr(),
408 width.as_mut_ptr(),
409 height.as_mut_ptr(),
410 );
411 (
412 x_offset.assume_init(),
413 y_offset.assume_init(),
414 width.assume_init(),
415 height.assume_init(),
416 )
417 }
418 }
419
420 #[doc(alias = "gtk_tree_view_column_cell_is_visible")]
428 fn cell_is_visible(&self) -> bool {
429 unsafe {
430 from_glib(ffi::gtk_tree_view_column_cell_is_visible(
431 self.as_ref().to_glib_none().0,
432 ))
433 }
434 }
435
436 #[doc(alias = "gtk_tree_view_column_cell_set_cell_data")]
449 fn cell_set_cell_data(
450 &self,
451 tree_model: &impl IsA<TreeModel>,
452 iter: &TreeIter,
453 is_expander: bool,
454 is_expanded: bool,
455 ) {
456 unsafe {
457 ffi::gtk_tree_view_column_cell_set_cell_data(
458 self.as_ref().to_glib_none().0,
459 tree_model.as_ref().to_glib_none().0,
460 mut_override(iter.to_glib_none().0),
461 is_expander.into_glib(),
462 is_expanded.into_glib(),
463 );
464 }
465 }
466
467 #[doc(alias = "gtk_tree_view_column_clear")]
469 fn clear(&self) {
470 unsafe {
471 ffi::gtk_tree_view_column_clear(self.as_ref().to_glib_none().0);
472 }
473 }
474
475 #[doc(alias = "gtk_tree_view_column_clear_attributes")]
480 fn clear_attributes(&self, cell_renderer: &impl IsA<CellRenderer>) {
481 unsafe {
482 ffi::gtk_tree_view_column_clear_attributes(
483 self.as_ref().to_glib_none().0,
484 cell_renderer.as_ref().to_glib_none().0,
485 );
486 }
487 }
488
489 #[doc(alias = "gtk_tree_view_column_clicked")]
492 fn clicked(&self) {
493 unsafe {
494 ffi::gtk_tree_view_column_clicked(self.as_ref().to_glib_none().0);
495 }
496 }
497
498 #[doc(alias = "gtk_tree_view_column_focus_cell")]
503 fn focus_cell(&self, cell: &impl IsA<CellRenderer>) {
504 unsafe {
505 ffi::gtk_tree_view_column_focus_cell(
506 self.as_ref().to_glib_none().0,
507 cell.as_ref().to_glib_none().0,
508 );
509 }
510 }
511
512 #[doc(alias = "gtk_tree_view_column_get_alignment")]
519 #[doc(alias = "get_alignment")]
520 fn alignment(&self) -> f32 {
521 unsafe { ffi::gtk_tree_view_column_get_alignment(self.as_ref().to_glib_none().0) }
522 }
523
524 #[doc(alias = "gtk_tree_view_column_get_button")]
530 #[doc(alias = "get_button")]
531 fn button(&self) -> Option<Widget> {
532 unsafe {
533 from_glib_none(ffi::gtk_tree_view_column_get_button(
534 self.as_ref().to_glib_none().0,
535 ))
536 }
537 }
538
539 #[doc(alias = "gtk_tree_view_column_get_clickable")]
545 #[doc(alias = "get_clickable")]
546 #[doc(alias = "clickable")]
547 fn is_clickable(&self) -> bool {
548 unsafe {
549 from_glib(ffi::gtk_tree_view_column_get_clickable(
550 self.as_ref().to_glib_none().0,
551 ))
552 }
553 }
554
555 #[doc(alias = "gtk_tree_view_column_get_expand")]
561 #[doc(alias = "get_expand")]
562 #[doc(alias = "expand")]
563 fn expands(&self) -> bool {
564 unsafe {
565 from_glib(ffi::gtk_tree_view_column_get_expand(
566 self.as_ref().to_glib_none().0,
567 ))
568 }
569 }
570
571 #[doc(alias = "gtk_tree_view_column_get_fixed_width")]
578 #[doc(alias = "get_fixed_width")]
579 #[doc(alias = "fixed-width")]
580 fn fixed_width(&self) -> i32 {
581 unsafe { ffi::gtk_tree_view_column_get_fixed_width(self.as_ref().to_glib_none().0) }
582 }
583
584 #[doc(alias = "gtk_tree_view_column_get_max_width")]
591 #[doc(alias = "get_max_width")]
592 #[doc(alias = "max-width")]
593 fn max_width(&self) -> i32 {
594 unsafe { ffi::gtk_tree_view_column_get_max_width(self.as_ref().to_glib_none().0) }
595 }
596
597 #[doc(alias = "gtk_tree_view_column_get_min_width")]
604 #[doc(alias = "get_min_width")]
605 #[doc(alias = "min-width")]
606 fn min_width(&self) -> i32 {
607 unsafe { ffi::gtk_tree_view_column_get_min_width(self.as_ref().to_glib_none().0) }
608 }
609
610 #[doc(alias = "gtk_tree_view_column_get_reorderable")]
616 #[doc(alias = "get_reorderable")]
617 #[doc(alias = "reorderable")]
618 fn is_reorderable(&self) -> bool {
619 unsafe {
620 from_glib(ffi::gtk_tree_view_column_get_reorderable(
621 self.as_ref().to_glib_none().0,
622 ))
623 }
624 }
625
626 #[doc(alias = "gtk_tree_view_column_get_resizable")]
632 #[doc(alias = "get_resizable")]
633 #[doc(alias = "resizable")]
634 fn is_resizable(&self) -> bool {
635 unsafe {
636 from_glib(ffi::gtk_tree_view_column_get_resizable(
637 self.as_ref().to_glib_none().0,
638 ))
639 }
640 }
641
642 #[doc(alias = "gtk_tree_view_column_get_sizing")]
648 #[doc(alias = "get_sizing")]
649 fn sizing(&self) -> TreeViewColumnSizing {
650 unsafe {
651 from_glib(ffi::gtk_tree_view_column_get_sizing(
652 self.as_ref().to_glib_none().0,
653 ))
654 }
655 }
656
657 #[doc(alias = "gtk_tree_view_column_get_sort_column_id")]
666 #[doc(alias = "get_sort_column_id")]
667 #[doc(alias = "sort-column-id")]
668 fn sort_column_id(&self) -> i32 {
669 unsafe { ffi::gtk_tree_view_column_get_sort_column_id(self.as_ref().to_glib_none().0) }
670 }
671
672 #[doc(alias = "gtk_tree_view_column_get_sort_indicator")]
678 #[doc(alias = "get_sort_indicator")]
679 #[doc(alias = "sort-indicator")]
680 fn is_sort_indicator(&self) -> bool {
681 unsafe {
682 from_glib(ffi::gtk_tree_view_column_get_sort_indicator(
683 self.as_ref().to_glib_none().0,
684 ))
685 }
686 }
687
688 #[doc(alias = "gtk_tree_view_column_get_sort_order")]
694 #[doc(alias = "get_sort_order")]
695 #[doc(alias = "sort-order")]
696 fn sort_order(&self) -> SortType {
697 unsafe {
698 from_glib(ffi::gtk_tree_view_column_get_sort_order(
699 self.as_ref().to_glib_none().0,
700 ))
701 }
702 }
703
704 #[doc(alias = "gtk_tree_view_column_get_spacing")]
710 #[doc(alias = "get_spacing")]
711 fn spacing(&self) -> i32 {
712 unsafe { ffi::gtk_tree_view_column_get_spacing(self.as_ref().to_glib_none().0) }
713 }
714
715 #[doc(alias = "gtk_tree_view_column_get_title")]
722 #[doc(alias = "get_title")]
723 fn title(&self) -> Option<glib::GString> {
724 unsafe {
725 from_glib_none(ffi::gtk_tree_view_column_get_title(
726 self.as_ref().to_glib_none().0,
727 ))
728 }
729 }
730
731 #[doc(alias = "gtk_tree_view_column_get_tree_view")]
740 #[doc(alias = "get_tree_view")]
741 fn tree_view(&self) -> Option<Widget> {
742 unsafe {
743 from_glib_none(ffi::gtk_tree_view_column_get_tree_view(
744 self.as_ref().to_glib_none().0,
745 ))
746 }
747 }
748
749 #[doc(alias = "gtk_tree_view_column_get_visible")]
756 #[doc(alias = "get_visible")]
757 #[doc(alias = "visible")]
758 fn is_visible(&self) -> bool {
759 unsafe {
760 from_glib(ffi::gtk_tree_view_column_get_visible(
761 self.as_ref().to_glib_none().0,
762 ))
763 }
764 }
765
766 #[doc(alias = "gtk_tree_view_column_get_widget")]
774 #[doc(alias = "get_widget")]
775 fn widget(&self) -> Option<Widget> {
776 unsafe {
777 from_glib_none(ffi::gtk_tree_view_column_get_widget(
778 self.as_ref().to_glib_none().0,
779 ))
780 }
781 }
782
783 #[doc(alias = "gtk_tree_view_column_get_width")]
789 #[doc(alias = "get_width")]
790 fn width(&self) -> i32 {
791 unsafe { ffi::gtk_tree_view_column_get_width(self.as_ref().to_glib_none().0) }
792 }
793
794 #[doc(alias = "gtk_tree_view_column_get_x_offset")]
800 #[doc(alias = "get_x_offset")]
801 #[doc(alias = "x-offset")]
802 fn x_offset(&self) -> i32 {
803 unsafe { ffi::gtk_tree_view_column_get_x_offset(self.as_ref().to_glib_none().0) }
804 }
805
806 #[doc(alias = "gtk_tree_view_column_pack_end")]
814 fn pack_end(&self, cell: &impl IsA<CellRenderer>, expand: bool) {
815 unsafe {
816 ffi::gtk_tree_view_column_pack_end(
817 self.as_ref().to_glib_none().0,
818 cell.as_ref().to_glib_none().0,
819 expand.into_glib(),
820 );
821 }
822 }
823
824 #[doc(alias = "gtk_tree_view_column_pack_start")]
832 fn pack_start(&self, cell: &impl IsA<CellRenderer>, expand: bool) {
833 unsafe {
834 ffi::gtk_tree_view_column_pack_start(
835 self.as_ref().to_glib_none().0,
836 cell.as_ref().to_glib_none().0,
837 expand.into_glib(),
838 );
839 }
840 }
841
842 #[doc(alias = "gtk_tree_view_column_queue_resize")]
845 fn queue_resize(&self) {
846 unsafe {
847 ffi::gtk_tree_view_column_queue_resize(self.as_ref().to_glib_none().0);
848 }
849 }
850
851 #[doc(alias = "gtk_tree_view_column_set_alignment")]
857 #[doc(alias = "alignment")]
858 fn set_alignment(&self, xalign: f32) {
859 unsafe {
860 ffi::gtk_tree_view_column_set_alignment(self.as_ref().to_glib_none().0, xalign);
861 }
862 }
863
864 #[doc(alias = "gtk_tree_view_column_set_cell_data_func")]
881 fn set_cell_data_func(
882 &self,
883 cell_renderer: &impl IsA<CellRenderer>,
884 func: Option<Box_<dyn Fn(&TreeViewColumn, &CellRenderer, &TreeModel, &TreeIter) + 'static>>,
885 ) {
886 let func_data: Box_<
887 Option<Box_<dyn Fn(&TreeViewColumn, &CellRenderer, &TreeModel, &TreeIter) + 'static>>,
888 > = Box_::new(func);
889 unsafe extern "C" fn func_func(
890 tree_column: *mut ffi::GtkTreeViewColumn,
891 cell: *mut ffi::GtkCellRenderer,
892 tree_model: *mut ffi::GtkTreeModel,
893 iter: *mut ffi::GtkTreeIter,
894 data: glib::ffi::gpointer,
895 ) {
896 unsafe {
897 let tree_column = from_glib_borrow(tree_column);
898 let cell = from_glib_borrow(cell);
899 let tree_model = from_glib_borrow(tree_model);
900 let iter = from_glib_borrow(iter);
901 let callback = &*(data as *mut Option<
902 Box_<dyn Fn(&TreeViewColumn, &CellRenderer, &TreeModel, &TreeIter) + 'static>,
903 >);
904 if let Some(ref callback) = *callback {
905 callback(&tree_column, &cell, &tree_model, &iter)
906 } else {
907 panic!("cannot get closure...")
908 }
909 }
910 }
911 let func = if func_data.is_some() {
912 Some(func_func as _)
913 } else {
914 None
915 };
916 unsafe extern "C" fn destroy_func(data: glib::ffi::gpointer) {
917 unsafe {
918 let _callback = Box_::from_raw(
919 data as *mut Option<
920 Box_<
921 dyn Fn(&TreeViewColumn, &CellRenderer, &TreeModel, &TreeIter) + 'static,
922 >,
923 >,
924 );
925 }
926 }
927 let destroy_call4 = Some(destroy_func as _);
928 let super_callback0: Box_<
929 Option<Box_<dyn Fn(&TreeViewColumn, &CellRenderer, &TreeModel, &TreeIter) + 'static>>,
930 > = func_data;
931 unsafe {
932 ffi::gtk_tree_view_column_set_cell_data_func(
933 self.as_ref().to_glib_none().0,
934 cell_renderer.as_ref().to_glib_none().0,
935 func,
936 Box_::into_raw(super_callback0) as *mut _,
937 destroy_call4,
938 );
939 }
940 }
941
942 #[doc(alias = "gtk_tree_view_column_set_clickable")]
947 #[doc(alias = "clickable")]
948 fn set_clickable(&self, clickable: bool) {
949 unsafe {
950 ffi::gtk_tree_view_column_set_clickable(
951 self.as_ref().to_glib_none().0,
952 clickable.into_glib(),
953 );
954 }
955 }
956
957 #[doc(alias = "gtk_tree_view_column_set_expand")]
967 #[doc(alias = "expand")]
968 fn set_expand(&self, expand: bool) {
969 unsafe {
970 ffi::gtk_tree_view_column_set_expand(
971 self.as_ref().to_glib_none().0,
972 expand.into_glib(),
973 );
974 }
975 }
976
977 #[doc(alias = "gtk_tree_view_column_set_fixed_width")]
991 #[doc(alias = "fixed-width")]
992 fn set_fixed_width(&self, fixed_width: i32) {
993 unsafe {
994 ffi::gtk_tree_view_column_set_fixed_width(self.as_ref().to_glib_none().0, fixed_width);
995 }
996 }
997
998 #[doc(alias = "gtk_tree_view_column_set_max_width")]
1005 #[doc(alias = "max-width")]
1006 fn set_max_width(&self, max_width: i32) {
1007 unsafe {
1008 ffi::gtk_tree_view_column_set_max_width(self.as_ref().to_glib_none().0, max_width);
1009 }
1010 }
1011
1012 #[doc(alias = "gtk_tree_view_column_set_min_width")]
1017 #[doc(alias = "min-width")]
1018 fn set_min_width(&self, min_width: i32) {
1019 unsafe {
1020 ffi::gtk_tree_view_column_set_min_width(self.as_ref().to_glib_none().0, min_width);
1021 }
1022 }
1023
1024 #[doc(alias = "gtk_tree_view_column_set_reorderable")]
1029 #[doc(alias = "reorderable")]
1030 fn set_reorderable(&self, reorderable: bool) {
1031 unsafe {
1032 ffi::gtk_tree_view_column_set_reorderable(
1033 self.as_ref().to_glib_none().0,
1034 reorderable.into_glib(),
1035 );
1036 }
1037 }
1038
1039 #[doc(alias = "gtk_tree_view_column_set_resizable")]
1046 #[doc(alias = "resizable")]
1047 fn set_resizable(&self, resizable: bool) {
1048 unsafe {
1049 ffi::gtk_tree_view_column_set_resizable(
1050 self.as_ref().to_glib_none().0,
1051 resizable.into_glib(),
1052 );
1053 }
1054 }
1055
1056 #[doc(alias = "gtk_tree_view_column_set_sizing")]
1060 #[doc(alias = "sizing")]
1061 fn set_sizing(&self, type_: TreeViewColumnSizing) {
1062 unsafe {
1063 ffi::gtk_tree_view_column_set_sizing(self.as_ref().to_glib_none().0, type_.into_glib());
1064 }
1065 }
1066
1067 #[doc(alias = "gtk_tree_view_column_set_sort_column_id")]
1072 #[doc(alias = "sort-column-id")]
1073 fn set_sort_column_id(&self, sort_column_id: i32) {
1074 unsafe {
1075 ffi::gtk_tree_view_column_set_sort_column_id(
1076 self.as_ref().to_glib_none().0,
1077 sort_column_id,
1078 );
1079 }
1080 }
1081
1082 #[doc(alias = "gtk_tree_view_column_set_sort_indicator")]
1089 #[doc(alias = "sort-indicator")]
1090 fn set_sort_indicator(&self, setting: bool) {
1091 unsafe {
1092 ffi::gtk_tree_view_column_set_sort_indicator(
1093 self.as_ref().to_glib_none().0,
1094 setting.into_glib(),
1095 );
1096 }
1097 }
1098
1099 #[doc(alias = "gtk_tree_view_column_set_sort_order")]
1113 #[doc(alias = "sort-order")]
1114 fn set_sort_order(&self, order: SortType) {
1115 unsafe {
1116 ffi::gtk_tree_view_column_set_sort_order(
1117 self.as_ref().to_glib_none().0,
1118 order.into_glib(),
1119 );
1120 }
1121 }
1122
1123 #[doc(alias = "gtk_tree_view_column_set_spacing")]
1128 #[doc(alias = "spacing")]
1129 fn set_spacing(&self, spacing: i32) {
1130 unsafe {
1131 ffi::gtk_tree_view_column_set_spacing(self.as_ref().to_glib_none().0, spacing);
1132 }
1133 }
1134
1135 #[doc(alias = "gtk_tree_view_column_set_title")]
1140 #[doc(alias = "title")]
1141 fn set_title(&self, title: &str) {
1142 unsafe {
1143 ffi::gtk_tree_view_column_set_title(
1144 self.as_ref().to_glib_none().0,
1145 title.to_glib_none().0,
1146 );
1147 }
1148 }
1149
1150 #[doc(alias = "gtk_tree_view_column_set_visible")]
1154 #[doc(alias = "visible")]
1155 fn set_visible(&self, visible: bool) {
1156 unsafe {
1157 ffi::gtk_tree_view_column_set_visible(
1158 self.as_ref().to_glib_none().0,
1159 visible.into_glib(),
1160 );
1161 }
1162 }
1163
1164 #[doc(alias = "gtk_tree_view_column_set_widget")]
1169 #[doc(alias = "widget")]
1170 fn set_widget(&self, widget: Option<&impl IsA<Widget>>) {
1171 unsafe {
1172 ffi::gtk_tree_view_column_set_widget(
1173 self.as_ref().to_glib_none().0,
1174 widget.map(|p| p.as_ref()).to_glib_none().0,
1175 );
1176 }
1177 }
1178
1179 #[doc(alias = "cell-area")]
1184 fn cell_area(&self) -> Option<CellArea> {
1185 ObjectExt::property(self.as_ref(), "cell-area")
1186 }
1187
1188 #[doc(alias = "clicked")]
1189 fn connect_clicked<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1190 unsafe extern "C" fn clicked_trampoline<P: IsA<TreeViewColumn>, F: Fn(&P) + 'static>(
1191 this: *mut ffi::GtkTreeViewColumn,
1192 f: glib::ffi::gpointer,
1193 ) {
1194 unsafe {
1195 let f: &F = &*(f as *const F);
1196 f(TreeViewColumn::from_glib_borrow(this).unsafe_cast_ref())
1197 }
1198 }
1199 unsafe {
1200 let f: Box_<F> = Box_::new(f);
1201 connect_raw(
1202 self.as_ptr() as *mut _,
1203 c"clicked".as_ptr(),
1204 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1205 clicked_trampoline::<Self, F> as *const (),
1206 )),
1207 Box_::into_raw(f),
1208 )
1209 }
1210 }
1211
1212 #[doc(alias = "alignment")]
1213 fn connect_alignment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1214 unsafe extern "C" fn notify_alignment_trampoline<
1215 P: IsA<TreeViewColumn>,
1216 F: Fn(&P) + 'static,
1217 >(
1218 this: *mut ffi::GtkTreeViewColumn,
1219 _param_spec: glib::ffi::gpointer,
1220 f: glib::ffi::gpointer,
1221 ) {
1222 unsafe {
1223 let f: &F = &*(f as *const F);
1224 f(TreeViewColumn::from_glib_borrow(this).unsafe_cast_ref())
1225 }
1226 }
1227 unsafe {
1228 let f: Box_<F> = Box_::new(f);
1229 connect_raw(
1230 self.as_ptr() as *mut _,
1231 c"notify::alignment".as_ptr(),
1232 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1233 notify_alignment_trampoline::<Self, F> as *const (),
1234 )),
1235 Box_::into_raw(f),
1236 )
1237 }
1238 }
1239
1240 #[doc(alias = "clickable")]
1241 fn connect_clickable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1242 unsafe extern "C" fn notify_clickable_trampoline<
1243 P: IsA<TreeViewColumn>,
1244 F: Fn(&P) + 'static,
1245 >(
1246 this: *mut ffi::GtkTreeViewColumn,
1247 _param_spec: glib::ffi::gpointer,
1248 f: glib::ffi::gpointer,
1249 ) {
1250 unsafe {
1251 let f: &F = &*(f as *const F);
1252 f(TreeViewColumn::from_glib_borrow(this).unsafe_cast_ref())
1253 }
1254 }
1255 unsafe {
1256 let f: Box_<F> = Box_::new(f);
1257 connect_raw(
1258 self.as_ptr() as *mut _,
1259 c"notify::clickable".as_ptr(),
1260 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1261 notify_clickable_trampoline::<Self, F> as *const (),
1262 )),
1263 Box_::into_raw(f),
1264 )
1265 }
1266 }
1267
1268 #[doc(alias = "expand")]
1269 fn connect_expand_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1270 unsafe extern "C" fn notify_expand_trampoline<
1271 P: IsA<TreeViewColumn>,
1272 F: Fn(&P) + 'static,
1273 >(
1274 this: *mut ffi::GtkTreeViewColumn,
1275 _param_spec: glib::ffi::gpointer,
1276 f: glib::ffi::gpointer,
1277 ) {
1278 unsafe {
1279 let f: &F = &*(f as *const F);
1280 f(TreeViewColumn::from_glib_borrow(this).unsafe_cast_ref())
1281 }
1282 }
1283 unsafe {
1284 let f: Box_<F> = Box_::new(f);
1285 connect_raw(
1286 self.as_ptr() as *mut _,
1287 c"notify::expand".as_ptr(),
1288 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1289 notify_expand_trampoline::<Self, F> as *const (),
1290 )),
1291 Box_::into_raw(f),
1292 )
1293 }
1294 }
1295
1296 #[doc(alias = "fixed-width")]
1297 fn connect_fixed_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1298 unsafe extern "C" fn notify_fixed_width_trampoline<
1299 P: IsA<TreeViewColumn>,
1300 F: Fn(&P) + 'static,
1301 >(
1302 this: *mut ffi::GtkTreeViewColumn,
1303 _param_spec: glib::ffi::gpointer,
1304 f: glib::ffi::gpointer,
1305 ) {
1306 unsafe {
1307 let f: &F = &*(f as *const F);
1308 f(TreeViewColumn::from_glib_borrow(this).unsafe_cast_ref())
1309 }
1310 }
1311 unsafe {
1312 let f: Box_<F> = Box_::new(f);
1313 connect_raw(
1314 self.as_ptr() as *mut _,
1315 c"notify::fixed-width".as_ptr(),
1316 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1317 notify_fixed_width_trampoline::<Self, F> as *const (),
1318 )),
1319 Box_::into_raw(f),
1320 )
1321 }
1322 }
1323
1324 #[doc(alias = "max-width")]
1325 fn connect_max_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1326 unsafe extern "C" fn notify_max_width_trampoline<
1327 P: IsA<TreeViewColumn>,
1328 F: Fn(&P) + 'static,
1329 >(
1330 this: *mut ffi::GtkTreeViewColumn,
1331 _param_spec: glib::ffi::gpointer,
1332 f: glib::ffi::gpointer,
1333 ) {
1334 unsafe {
1335 let f: &F = &*(f as *const F);
1336 f(TreeViewColumn::from_glib_borrow(this).unsafe_cast_ref())
1337 }
1338 }
1339 unsafe {
1340 let f: Box_<F> = Box_::new(f);
1341 connect_raw(
1342 self.as_ptr() as *mut _,
1343 c"notify::max-width".as_ptr(),
1344 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1345 notify_max_width_trampoline::<Self, F> as *const (),
1346 )),
1347 Box_::into_raw(f),
1348 )
1349 }
1350 }
1351
1352 #[doc(alias = "min-width")]
1353 fn connect_min_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1354 unsafe extern "C" fn notify_min_width_trampoline<
1355 P: IsA<TreeViewColumn>,
1356 F: Fn(&P) + 'static,
1357 >(
1358 this: *mut ffi::GtkTreeViewColumn,
1359 _param_spec: glib::ffi::gpointer,
1360 f: glib::ffi::gpointer,
1361 ) {
1362 unsafe {
1363 let f: &F = &*(f as *const F);
1364 f(TreeViewColumn::from_glib_borrow(this).unsafe_cast_ref())
1365 }
1366 }
1367 unsafe {
1368 let f: Box_<F> = Box_::new(f);
1369 connect_raw(
1370 self.as_ptr() as *mut _,
1371 c"notify::min-width".as_ptr(),
1372 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1373 notify_min_width_trampoline::<Self, F> as *const (),
1374 )),
1375 Box_::into_raw(f),
1376 )
1377 }
1378 }
1379
1380 #[doc(alias = "reorderable")]
1381 fn connect_reorderable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1382 unsafe extern "C" fn notify_reorderable_trampoline<
1383 P: IsA<TreeViewColumn>,
1384 F: Fn(&P) + 'static,
1385 >(
1386 this: *mut ffi::GtkTreeViewColumn,
1387 _param_spec: glib::ffi::gpointer,
1388 f: glib::ffi::gpointer,
1389 ) {
1390 unsafe {
1391 let f: &F = &*(f as *const F);
1392 f(TreeViewColumn::from_glib_borrow(this).unsafe_cast_ref())
1393 }
1394 }
1395 unsafe {
1396 let f: Box_<F> = Box_::new(f);
1397 connect_raw(
1398 self.as_ptr() as *mut _,
1399 c"notify::reorderable".as_ptr(),
1400 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1401 notify_reorderable_trampoline::<Self, F> as *const (),
1402 )),
1403 Box_::into_raw(f),
1404 )
1405 }
1406 }
1407
1408 #[doc(alias = "resizable")]
1409 fn connect_resizable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1410 unsafe extern "C" fn notify_resizable_trampoline<
1411 P: IsA<TreeViewColumn>,
1412 F: Fn(&P) + 'static,
1413 >(
1414 this: *mut ffi::GtkTreeViewColumn,
1415 _param_spec: glib::ffi::gpointer,
1416 f: glib::ffi::gpointer,
1417 ) {
1418 unsafe {
1419 let f: &F = &*(f as *const F);
1420 f(TreeViewColumn::from_glib_borrow(this).unsafe_cast_ref())
1421 }
1422 }
1423 unsafe {
1424 let f: Box_<F> = Box_::new(f);
1425 connect_raw(
1426 self.as_ptr() as *mut _,
1427 c"notify::resizable".as_ptr(),
1428 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1429 notify_resizable_trampoline::<Self, F> as *const (),
1430 )),
1431 Box_::into_raw(f),
1432 )
1433 }
1434 }
1435
1436 #[doc(alias = "sizing")]
1437 fn connect_sizing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1438 unsafe extern "C" fn notify_sizing_trampoline<
1439 P: IsA<TreeViewColumn>,
1440 F: Fn(&P) + 'static,
1441 >(
1442 this: *mut ffi::GtkTreeViewColumn,
1443 _param_spec: glib::ffi::gpointer,
1444 f: glib::ffi::gpointer,
1445 ) {
1446 unsafe {
1447 let f: &F = &*(f as *const F);
1448 f(TreeViewColumn::from_glib_borrow(this).unsafe_cast_ref())
1449 }
1450 }
1451 unsafe {
1452 let f: Box_<F> = Box_::new(f);
1453 connect_raw(
1454 self.as_ptr() as *mut _,
1455 c"notify::sizing".as_ptr(),
1456 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1457 notify_sizing_trampoline::<Self, F> as *const (),
1458 )),
1459 Box_::into_raw(f),
1460 )
1461 }
1462 }
1463
1464 #[doc(alias = "sort-column-id")]
1465 fn connect_sort_column_id_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1466 unsafe extern "C" fn notify_sort_column_id_trampoline<
1467 P: IsA<TreeViewColumn>,
1468 F: Fn(&P) + 'static,
1469 >(
1470 this: *mut ffi::GtkTreeViewColumn,
1471 _param_spec: glib::ffi::gpointer,
1472 f: glib::ffi::gpointer,
1473 ) {
1474 unsafe {
1475 let f: &F = &*(f as *const F);
1476 f(TreeViewColumn::from_glib_borrow(this).unsafe_cast_ref())
1477 }
1478 }
1479 unsafe {
1480 let f: Box_<F> = Box_::new(f);
1481 connect_raw(
1482 self.as_ptr() as *mut _,
1483 c"notify::sort-column-id".as_ptr(),
1484 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1485 notify_sort_column_id_trampoline::<Self, F> as *const (),
1486 )),
1487 Box_::into_raw(f),
1488 )
1489 }
1490 }
1491
1492 #[doc(alias = "sort-indicator")]
1493 fn connect_sort_indicator_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1494 unsafe extern "C" fn notify_sort_indicator_trampoline<
1495 P: IsA<TreeViewColumn>,
1496 F: Fn(&P) + 'static,
1497 >(
1498 this: *mut ffi::GtkTreeViewColumn,
1499 _param_spec: glib::ffi::gpointer,
1500 f: glib::ffi::gpointer,
1501 ) {
1502 unsafe {
1503 let f: &F = &*(f as *const F);
1504 f(TreeViewColumn::from_glib_borrow(this).unsafe_cast_ref())
1505 }
1506 }
1507 unsafe {
1508 let f: Box_<F> = Box_::new(f);
1509 connect_raw(
1510 self.as_ptr() as *mut _,
1511 c"notify::sort-indicator".as_ptr(),
1512 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1513 notify_sort_indicator_trampoline::<Self, F> as *const (),
1514 )),
1515 Box_::into_raw(f),
1516 )
1517 }
1518 }
1519
1520 #[doc(alias = "sort-order")]
1521 fn connect_sort_order_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1522 unsafe extern "C" fn notify_sort_order_trampoline<
1523 P: IsA<TreeViewColumn>,
1524 F: Fn(&P) + 'static,
1525 >(
1526 this: *mut ffi::GtkTreeViewColumn,
1527 _param_spec: glib::ffi::gpointer,
1528 f: glib::ffi::gpointer,
1529 ) {
1530 unsafe {
1531 let f: &F = &*(f as *const F);
1532 f(TreeViewColumn::from_glib_borrow(this).unsafe_cast_ref())
1533 }
1534 }
1535 unsafe {
1536 let f: Box_<F> = Box_::new(f);
1537 connect_raw(
1538 self.as_ptr() as *mut _,
1539 c"notify::sort-order".as_ptr(),
1540 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1541 notify_sort_order_trampoline::<Self, F> as *const (),
1542 )),
1543 Box_::into_raw(f),
1544 )
1545 }
1546 }
1547
1548 #[doc(alias = "spacing")]
1549 fn connect_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1550 unsafe extern "C" fn notify_spacing_trampoline<
1551 P: IsA<TreeViewColumn>,
1552 F: Fn(&P) + 'static,
1553 >(
1554 this: *mut ffi::GtkTreeViewColumn,
1555 _param_spec: glib::ffi::gpointer,
1556 f: glib::ffi::gpointer,
1557 ) {
1558 unsafe {
1559 let f: &F = &*(f as *const F);
1560 f(TreeViewColumn::from_glib_borrow(this).unsafe_cast_ref())
1561 }
1562 }
1563 unsafe {
1564 let f: Box_<F> = Box_::new(f);
1565 connect_raw(
1566 self.as_ptr() as *mut _,
1567 c"notify::spacing".as_ptr(),
1568 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1569 notify_spacing_trampoline::<Self, F> as *const (),
1570 )),
1571 Box_::into_raw(f),
1572 )
1573 }
1574 }
1575
1576 #[doc(alias = "title")]
1577 fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1578 unsafe extern "C" fn notify_title_trampoline<
1579 P: IsA<TreeViewColumn>,
1580 F: Fn(&P) + 'static,
1581 >(
1582 this: *mut ffi::GtkTreeViewColumn,
1583 _param_spec: glib::ffi::gpointer,
1584 f: glib::ffi::gpointer,
1585 ) {
1586 unsafe {
1587 let f: &F = &*(f as *const F);
1588 f(TreeViewColumn::from_glib_borrow(this).unsafe_cast_ref())
1589 }
1590 }
1591 unsafe {
1592 let f: Box_<F> = Box_::new(f);
1593 connect_raw(
1594 self.as_ptr() as *mut _,
1595 c"notify::title".as_ptr(),
1596 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1597 notify_title_trampoline::<Self, F> as *const (),
1598 )),
1599 Box_::into_raw(f),
1600 )
1601 }
1602 }
1603
1604 #[doc(alias = "visible")]
1605 fn connect_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1606 unsafe extern "C" fn notify_visible_trampoline<
1607 P: IsA<TreeViewColumn>,
1608 F: Fn(&P) + 'static,
1609 >(
1610 this: *mut ffi::GtkTreeViewColumn,
1611 _param_spec: glib::ffi::gpointer,
1612 f: glib::ffi::gpointer,
1613 ) {
1614 unsafe {
1615 let f: &F = &*(f as *const F);
1616 f(TreeViewColumn::from_glib_borrow(this).unsafe_cast_ref())
1617 }
1618 }
1619 unsafe {
1620 let f: Box_<F> = Box_::new(f);
1621 connect_raw(
1622 self.as_ptr() as *mut _,
1623 c"notify::visible".as_ptr(),
1624 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1625 notify_visible_trampoline::<Self, F> as *const (),
1626 )),
1627 Box_::into_raw(f),
1628 )
1629 }
1630 }
1631
1632 #[doc(alias = "widget")]
1633 fn connect_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1634 unsafe extern "C" fn notify_widget_trampoline<
1635 P: IsA<TreeViewColumn>,
1636 F: Fn(&P) + 'static,
1637 >(
1638 this: *mut ffi::GtkTreeViewColumn,
1639 _param_spec: glib::ffi::gpointer,
1640 f: glib::ffi::gpointer,
1641 ) {
1642 unsafe {
1643 let f: &F = &*(f as *const F);
1644 f(TreeViewColumn::from_glib_borrow(this).unsafe_cast_ref())
1645 }
1646 }
1647 unsafe {
1648 let f: Box_<F> = Box_::new(f);
1649 connect_raw(
1650 self.as_ptr() as *mut _,
1651 c"notify::widget".as_ptr(),
1652 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1653 notify_widget_trampoline::<Self, F> as *const (),
1654 )),
1655 Box_::into_raw(f),
1656 )
1657 }
1658 }
1659
1660 #[doc(alias = "width")]
1661 fn connect_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1662 unsafe extern "C" fn notify_width_trampoline<
1663 P: IsA<TreeViewColumn>,
1664 F: Fn(&P) + 'static,
1665 >(
1666 this: *mut ffi::GtkTreeViewColumn,
1667 _param_spec: glib::ffi::gpointer,
1668 f: glib::ffi::gpointer,
1669 ) {
1670 unsafe {
1671 let f: &F = &*(f as *const F);
1672 f(TreeViewColumn::from_glib_borrow(this).unsafe_cast_ref())
1673 }
1674 }
1675 unsafe {
1676 let f: Box_<F> = Box_::new(f);
1677 connect_raw(
1678 self.as_ptr() as *mut _,
1679 c"notify::width".as_ptr(),
1680 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1681 notify_width_trampoline::<Self, F> as *const (),
1682 )),
1683 Box_::into_raw(f),
1684 )
1685 }
1686 }
1687
1688 #[doc(alias = "x-offset")]
1689 fn connect_x_offset_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1690 unsafe extern "C" fn notify_x_offset_trampoline<
1691 P: IsA<TreeViewColumn>,
1692 F: Fn(&P) + 'static,
1693 >(
1694 this: *mut ffi::GtkTreeViewColumn,
1695 _param_spec: glib::ffi::gpointer,
1696 f: glib::ffi::gpointer,
1697 ) {
1698 unsafe {
1699 let f: &F = &*(f as *const F);
1700 f(TreeViewColumn::from_glib_borrow(this).unsafe_cast_ref())
1701 }
1702 }
1703 unsafe {
1704 let f: Box_<F> = Box_::new(f);
1705 connect_raw(
1706 self.as_ptr() as *mut _,
1707 c"notify::x-offset".as_ptr(),
1708 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1709 notify_x_offset_trampoline::<Self, F> as *const (),
1710 )),
1711 Box_::into_raw(f),
1712 )
1713 }
1714 }
1715}
1716
1717impl<O: IsA<TreeViewColumn>> TreeViewColumnExt for O {}