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