gtk4/auto/tree_view.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4#![allow(deprecated)]
5
6#[cfg(feature = "v4_10")]
7#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
8use crate::Accessible;
9use crate::{
10 AccessibleRole, Adjustment, Align, Buildable, CellRenderer, ConstraintTarget, Editable,
11 LayoutManager, MovementStep, Overflow, Scrollable, ScrollablePolicy, Tooltip, TreeIter,
12 TreeModel, TreePath, TreeSelection, TreeViewColumn, TreeViewDropPosition, TreeViewGridLines,
13 Widget, ffi,
14};
15use glib::{
16 object::ObjectType as _,
17 prelude::*,
18 signal::{SignalHandlerId, connect_raw},
19 translate::*,
20};
21use std::boxed::Box as Box_;
22
23#[cfg(feature = "v4_10")]
24#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
25glib::wrapper! {
26 /// Use [`ListView`][crate::ListView] for lists, and [`ColumnView`][crate::ColumnView]
27 /// for tabular lists
28 /// [dndtarget]
29 /// ```text
30 ///
31 /// [`TreeView`][crate::TreeView] has a main CSS node with name `treeview` and style class `.view`.
32 /// It has a subnode with name `header`, which is the parent for all the column
33 /// header widgets' CSS nodes.
34 ///
35 /// Each column header consists of a `button`, which among other content, has a
36 /// child with name `sort-indicator`, which carries the `.ascending` or `.descending`
37 /// style classes when the column header should show a sort indicator. The CSS
38 /// is expected to provide a suitable image using the `-gtk-icon-source` property.
39 ///
40 /// For rubberband selection, a subnode with name `rubberband` is used.
41 ///
42 /// For the drop target location during DND, a subnode with name `dndtarget` is used.
43 ///
44 /// ## Properties
45 ///
46 ///
47 /// #### `activate-on-single-click`
48 /// The activate-on-single-click property specifies whether the "row-activated" signal
49 /// will be emitted after a single click.
50 ///
51 /// Readable | Writable
52 ///
53 ///
54 /// #### `enable-grid-lines`
55 /// Readable | Writable
56 ///
57 ///
58 /// #### `enable-search`
59 /// Readable | Writable
60 ///
61 ///
62 /// #### `enable-tree-lines`
63 /// Readable | Writable
64 ///
65 ///
66 /// #### `expander-column`
67 /// Readable | Writable
68 ///
69 ///
70 /// #### `fixed-height-mode`
71 /// Setting the ::fixed-height-mode property to [`true`] speeds up
72 /// [`TreeView`][crate::TreeView] by assuming that all rows have the same height.
73 /// Only enable this option if all rows are the same height.
74 /// Please see gtk_tree_view_set_fixed_height_mode() for more
75 /// information on this option.
76 ///
77 /// Readable | Writable
78 ///
79 ///
80 /// #### `headers-clickable`
81 /// Readable | Writable
82 ///
83 ///
84 /// #### `headers-visible`
85 /// Readable | Writable
86 ///
87 ///
88 /// #### `hover-expand`
89 /// Enables or disables the hover expansion mode of @tree_view.
90 /// Hover expansion makes rows expand or collapse if the pointer moves
91 /// over them.
92 ///
93 /// This mode is primarily intended for treeviews in popups, e.g.
94 /// in [`ComboBox`][crate::ComboBox] or [`EntryCompletion`][crate::EntryCompletion].
95 ///
96 /// Readable | Writable
97 ///
98 ///
99 /// #### `hover-selection`
100 /// Enables or disables the hover selection mode of @tree_view.
101 /// Hover selection makes the selected row follow the pointer.
102 /// Currently, this works only for the selection modes
103 /// [`SelectionMode::Single`][crate::SelectionMode::Single] and [`SelectionMode::Browse`][crate::SelectionMode::Browse].
104 ///
105 /// This mode is primarily intended for treeviews in popups, e.g.
106 /// in [`ComboBox`][crate::ComboBox] or [`EntryCompletion`][crate::EntryCompletion].
107 ///
108 /// Readable | Writable
109 ///
110 ///
111 /// #### `level-indentation`
112 /// Extra indentation for each level.
113 ///
114 /// Readable | Writable
115 ///
116 ///
117 /// #### `model`
118 /// Readable | Writable
119 ///
120 ///
121 /// #### `reorderable`
122 /// Readable | Writable
123 ///
124 ///
125 /// #### `rubber-banding`
126 /// Readable | Writable
127 ///
128 ///
129 /// #### `search-column`
130 /// Readable | Writable
131 ///
132 ///
133 /// #### `show-expanders`
134 /// [`true`] if the view has expanders.
135 ///
136 /// Readable | Writable
137 ///
138 ///
139 /// #### `tooltip-column`
140 /// Readable | Writable
141 /// <details><summary><h4>Widget</h4></summary>
142 ///
143 ///
144 /// #### `can-focus`
145 /// Whether the widget or any of its descendents can accept
146 /// the input focus.
147 ///
148 /// This property is meant to be set by widget implementations,
149 /// typically in their instance init function.
150 ///
151 /// Readable | Writable
152 ///
153 ///
154 /// #### `can-target`
155 /// Whether the widget can receive pointer events.
156 ///
157 /// Readable | Writable
158 ///
159 ///
160 /// #### `css-classes`
161 /// A list of css classes applied to this widget.
162 ///
163 /// Readable | Writable
164 ///
165 ///
166 /// #### `css-name`
167 /// The name of this widget in the CSS tree.
168 ///
169 /// This property is meant to be set by widget implementations,
170 /// typically in their instance init function.
171 ///
172 /// Readable | Writable | Construct Only
173 ///
174 ///
175 /// #### `cursor`
176 /// The cursor used by @widget.
177 ///
178 /// Readable | Writable
179 ///
180 ///
181 /// #### `focus-on-click`
182 /// Whether the widget should grab focus when it is clicked with the mouse.
183 ///
184 /// This property is only relevant for widgets that can take focus.
185 ///
186 /// Readable | Writable
187 ///
188 ///
189 /// #### `focusable`
190 /// Whether this widget itself will accept the input focus.
191 ///
192 /// Readable | Writable
193 ///
194 ///
195 /// #### `halign`
196 /// How to distribute horizontal space if widget gets extra space.
197 ///
198 /// Readable | Writable
199 ///
200 ///
201 /// #### `has-default`
202 /// Whether the widget is the default widget.
203 ///
204 /// Readable
205 ///
206 ///
207 /// #### `has-focus`
208 /// Whether the widget has the input focus.
209 ///
210 /// Readable
211 ///
212 ///
213 /// #### `has-tooltip`
214 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
215 /// signal on @widget.
216 ///
217 /// A true value indicates that @widget can have a tooltip, in this case
218 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
219 /// determine whether it will provide a tooltip or not.
220 ///
221 /// Readable | Writable
222 ///
223 ///
224 /// #### `height-request`
225 /// Overrides for height request of the widget.
226 ///
227 /// If this is -1, the natural request will be used.
228 ///
229 /// Readable | Writable
230 ///
231 ///
232 /// #### `hexpand`
233 /// Whether to expand horizontally.
234 ///
235 /// Readable | Writable
236 ///
237 ///
238 /// #### `hexpand-set`
239 /// Whether to use the `hexpand` property.
240 ///
241 /// Readable | Writable
242 ///
243 ///
244 /// #### `layout-manager`
245 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
246 /// the preferred size of the widget, and allocate its children.
247 ///
248 /// This property is meant to be set by widget implementations,
249 /// typically in their instance init function.
250 ///
251 /// Readable | Writable
252 ///
253 ///
254 /// #### `limit-events`
255 /// Makes this widget act like a modal dialog, with respect to
256 /// event delivery.
257 ///
258 /// Global event controllers will not handle events with targets
259 /// inside the widget, unless they are set up to ignore propagation
260 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
261 ///
262 /// Readable | Writable
263 ///
264 ///
265 /// #### `margin-bottom`
266 /// Margin on bottom side of widget.
267 ///
268 /// This property adds margin outside of the widget's normal size
269 /// request, the margin will be added in addition to the size from
270 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
271 ///
272 /// Readable | Writable
273 ///
274 ///
275 /// #### `margin-end`
276 /// Margin on end of widget, horizontally.
277 ///
278 /// This property supports left-to-right and right-to-left text
279 /// directions.
280 ///
281 /// This property adds margin outside of the widget's normal size
282 /// request, the margin will be added in addition to the size from
283 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
284 ///
285 /// Readable | Writable
286 ///
287 ///
288 /// #### `margin-start`
289 /// Margin on start of widget, horizontally.
290 ///
291 /// This property supports left-to-right and right-to-left text
292 /// directions.
293 ///
294 /// This property adds margin outside of the widget's normal size
295 /// request, the margin will be added in addition to the size from
296 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
297 ///
298 /// Readable | Writable
299 ///
300 ///
301 /// #### `margin-top`
302 /// Margin on top side of widget.
303 ///
304 /// This property adds margin outside of the widget's normal size
305 /// request, the margin will be added in addition to the size from
306 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
307 ///
308 /// Readable | Writable
309 ///
310 ///
311 /// #### `name`
312 /// The name of the widget.
313 ///
314 /// Readable | Writable
315 ///
316 ///
317 /// #### `opacity`
318 /// The requested opacity of the widget.
319 ///
320 /// Readable | Writable
321 ///
322 ///
323 /// #### `overflow`
324 /// How content outside the widget's content area is treated.
325 ///
326 /// This property is meant to be set by widget implementations,
327 /// typically in their instance init function.
328 ///
329 /// Readable | Writable
330 ///
331 ///
332 /// #### `parent`
333 /// The parent widget of this widget.
334 ///
335 /// Readable
336 ///
337 ///
338 /// #### `receives-default`
339 /// Whether the widget will receive the default action when it is focused.
340 ///
341 /// Readable | Writable
342 ///
343 ///
344 /// #### `root`
345 /// The [`Root`][crate::Root] widget of the widget tree containing this widget.
346 ///
347 /// This will be `NULL` if the widget is not contained in a root widget.
348 ///
349 /// Readable
350 ///
351 ///
352 /// #### `scale-factor`
353 /// The scale factor of the widget.
354 ///
355 /// Readable
356 ///
357 ///
358 /// #### `sensitive`
359 /// Whether the widget responds to input.
360 ///
361 /// Readable | Writable
362 ///
363 ///
364 /// #### `tooltip-markup`
365 /// Sets the text of tooltip to be the given string, which is marked up
366 /// with Pango markup.
367 ///
368 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
369 ///
370 /// This is a convenience property which will take care of getting the
371 /// tooltip shown if the given string is not `NULL`:
372 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
373 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
374 /// the default signal handler.
375 ///
376 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
377 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
378 ///
379 /// Readable | Writable
380 ///
381 ///
382 /// #### `tooltip-text`
383 /// Sets the text of tooltip to be the given string.
384 ///
385 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
386 ///
387 /// This is a convenience property which will take care of getting the
388 /// tooltip shown if the given string is not `NULL`:
389 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
390 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
391 /// the default signal handler.
392 ///
393 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
394 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
395 ///
396 /// Readable | Writable
397 ///
398 ///
399 /// #### `valign`
400 /// How to distribute vertical space if widget gets extra space.
401 ///
402 /// Readable | Writable
403 ///
404 ///
405 /// #### `vexpand`
406 /// Whether to expand vertically.
407 ///
408 /// Readable | Writable
409 ///
410 ///
411 /// #### `vexpand-set`
412 /// Whether to use the `vexpand` property.
413 ///
414 /// Readable | Writable
415 ///
416 ///
417 /// #### `visible`
418 /// Whether the widget is visible.
419 ///
420 /// Readable | Writable
421 ///
422 ///
423 /// #### `width-request`
424 /// Overrides for width request of the widget.
425 ///
426 /// If this is -1, the natural request will be used.
427 ///
428 /// Readable | Writable
429 /// </details>
430 /// <details><summary><h4>Accessible</h4></summary>
431 ///
432 ///
433 /// #### `accessible-role`
434 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
435 ///
436 /// The accessible role cannot be changed once set.
437 ///
438 /// Readable | Writable
439 /// </details>
440 /// <details><summary><h4>Scrollable</h4></summary>
441 ///
442 ///
443 /// #### `hadjustment`
444 /// Horizontal [`Adjustment`][crate::Adjustment] of the scrollable widget.
445 ///
446 /// This adjustment is shared between the scrollable widget and its parent.
447 ///
448 /// Readable | Writable | Construct
449 ///
450 ///
451 /// #### `hscroll-policy`
452 /// Determines when horizontal scrolling should start.
453 ///
454 /// Readable | Writable
455 ///
456 ///
457 /// #### `vadjustment`
458 /// Vertical [`Adjustment`][crate::Adjustment] of the scrollable widget.
459 ///
460 /// This adjustment is shared between the scrollable widget and its parent.
461 ///
462 /// Readable | Writable | Construct
463 ///
464 ///
465 /// #### `vscroll-policy`
466 /// Determines when vertical scrolling should start.
467 ///
468 /// Readable | Writable
469 /// </details>
470 ///
471 /// ## Signals
472 ///
473 ///
474 /// #### `columns-changed`
475 /// The number of columns of the treeview has changed.
476 ///
477 ///
478 ///
479 ///
480 /// #### `cursor-changed`
481 /// The position of the cursor (focused cell) has changed.
482 ///
483 ///
484 ///
485 ///
486 /// #### `expand-collapse-cursor-row`
487 /// Action
488 ///
489 ///
490 /// #### `move-cursor`
491 /// The [`TreeView`][crate::TreeView]::move-cursor signal is a [keybinding
492 /// signal][`SignalAction`][crate::SignalAction] which gets emitted when the user
493 /// presses one of the cursor keys.
494 ///
495 /// Applications should not connect to it, but may emit it with
496 /// g_signal_emit_by_name() if they need to control the cursor
497 /// programmatically. In contrast to gtk_tree_view_set_cursor() and
498 /// gtk_tree_view_set_cursor_on_cell() when moving horizontally
499 /// [`TreeView`][crate::TreeView]::move-cursor does not reset the current selection.
500 ///
501 /// Action
502 ///
503 ///
504 /// #### `row-activated`
505 /// is pressed.
506 ///
507 /// For selection handling refer to the
508 /// [tree widget conceptual overview](section-tree-widget.html)
509 /// as well as [`TreeSelection`][crate::TreeSelection].
510 ///
511 /// Action
512 ///
513 ///
514 /// #### `row-collapsed`
515 /// The given row has been collapsed (child nodes are hidden).
516 ///
517 ///
518 ///
519 ///
520 /// #### `row-expanded`
521 /// The given row has been expanded (child nodes are shown).
522 ///
523 ///
524 ///
525 ///
526 /// #### `select-all`
527 /// Action
528 ///
529 ///
530 /// #### `select-cursor-parent`
531 /// Action
532 ///
533 ///
534 /// #### `select-cursor-row`
535 /// Action
536 ///
537 ///
538 /// #### `start-interactive-search`
539 /// Action
540 ///
541 ///
542 /// #### `test-collapse-row`
543 /// The given row is about to be collapsed (hide its children nodes). Use this
544 /// signal if you need to control the collapsibility of individual rows.
545 ///
546 ///
547 ///
548 ///
549 /// #### `test-expand-row`
550 /// The given row is about to be expanded (show its children nodes). Use this
551 /// signal if you need to control the expandability of individual rows.
552 ///
553 ///
554 ///
555 ///
556 /// #### `toggle-cursor-row`
557 /// Action
558 ///
559 ///
560 /// #### `unselect-all`
561 /// Action
562 /// <details><summary><h4>Widget</h4></summary>
563 ///
564 ///
565 /// #### `destroy`
566 /// Signals that all holders of a reference to the widget should release
567 /// the reference that they hold.
568 ///
569 /// May result in finalization of the widget if all references are released.
570 ///
571 /// This signal is not suitable for saving widget state.
572 ///
573 ///
574 ///
575 ///
576 /// #### `direction-changed`
577 /// Emitted when the text direction of a widget changes.
578 ///
579 ///
580 ///
581 ///
582 /// #### `hide`
583 /// Emitted when @widget is hidden.
584 ///
585 ///
586 ///
587 ///
588 /// #### `keynav-failed`
589 /// Emitted if keyboard navigation fails.
590 ///
591 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
592 ///
593 ///
594 ///
595 ///
596 /// #### `map`
597 /// Emitted when @widget is going to be mapped.
598 ///
599 /// A widget is mapped when the widget is visible (which is controlled with
600 /// [`visible`][struct@crate::Widget#visible]) and all its parents up to the toplevel widget
601 /// are also visible.
602 ///
603 /// The `::map` signal can be used to determine whether a widget will be drawn,
604 /// for instance it can resume an animation that was stopped during the
605 /// emission of [`unmap`][struct@crate::Widget#unmap].
606 ///
607 ///
608 ///
609 ///
610 /// #### `mnemonic-activate`
611 /// Emitted when a widget is activated via a mnemonic.
612 ///
613 /// The default handler for this signal activates @widget if @group_cycling
614 /// is false, or just makes @widget grab focus if @group_cycling is true.
615 ///
616 ///
617 ///
618 ///
619 /// #### `move-focus`
620 /// to move backward.
621 ///
622 /// Action
623 ///
624 ///
625 /// #### `query-tooltip`
626 /// s tooltip is about to be shown.
627 ///
628 /// This happens when the [`has-tooltip`][struct@crate::Widget#has-tooltip] property
629 /// is true and the hover timeout has expired with the cursor hovering
630 /// above @widget; or emitted when @widget got focus in keyboard mode.
631 ///
632 /// Using the given coordinates, the signal handler should determine
633 /// whether a tooltip should be shown for @widget. If this is the case
634 /// true should be returned, false otherwise. Note that if @keyboard_mode
635 /// is true, the values of @x and @y are undefined and should not be used.
636 ///
637 /// The signal handler is free to manipulate @tooltip with the therefore
638 /// destined function calls.
639 ///
640 ///
641 ///
642 ///
643 /// #### `realize`
644 /// Emitted when @widget is associated with a [`gdk::Surface`][crate::gdk::Surface].
645 ///
646 /// This means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called
647 /// or the widget has been mapped (that is, it is going to be drawn).
648 ///
649 ///
650 ///
651 ///
652 /// #### `show`
653 /// Emitted when @widget is shown.
654 ///
655 ///
656 ///
657 ///
658 /// #### `state-flags-changed`
659 /// Emitted when the widget state changes.
660 ///
661 /// See [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
662 ///
663 ///
664 ///
665 ///
666 /// #### `unmap`
667 /// Emitted when @widget is going to be unmapped.
668 ///
669 /// A widget is unmapped when either it or any of its parents up to the
670 /// toplevel widget have been set as hidden.
671 ///
672 /// As `::unmap` indicates that a widget will not be shown any longer,
673 /// it can be used to, for example, stop an animation on the widget.
674 ///
675 ///
676 ///
677 ///
678 /// #### `unrealize`
679 /// Emitted when the [`gdk::Surface`][crate::gdk::Surface] associated with @widget is destroyed.
680 ///
681 /// This means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been called
682 /// or the widget has been unmapped (that is, it is going to be hidden).
683 ///
684 ///
685 /// </details>
686 ///
687 /// # Implements
688 ///
689 /// [`TreeViewExt`][trait@crate::prelude::TreeViewExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`ScrollableExt`][trait@crate::prelude::ScrollableExt], [`TreeViewExtManual`][trait@crate::prelude::TreeViewExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual]
690 #[doc(alias = "GtkTreeView")]
691 pub struct TreeView(Object<ffi::GtkTreeView, ffi::GtkTreeViewClass>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, Scrollable;
692
693 match fn {
694 type_ => || ffi::gtk_tree_view_get_type(),
695 }
696}
697
698#[cfg(not(feature = "v4_10"))]
699glib::wrapper! {
700 #[doc(alias = "GtkTreeView")]
701 pub struct TreeView(Object<ffi::GtkTreeView, ffi::GtkTreeViewClass>) @extends Widget, @implements Buildable, ConstraintTarget, Scrollable;
702
703 match fn {
704 type_ => || ffi::gtk_tree_view_get_type(),
705 }
706}
707
708impl TreeView {
709 pub const NONE: Option<&'static TreeView> = None;
710
711 /// Creates a new [`TreeView`][crate::TreeView] widget.
712 ///
713 /// # Deprecated since 4.10
714 ///
715 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
716 ///
717 /// # Returns
718 ///
719 /// A newly created [`TreeView`][crate::TreeView] widget.
720 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
721 #[allow(deprecated)]
722 #[doc(alias = "gtk_tree_view_new")]
723 pub fn new() -> TreeView {
724 assert_initialized_main_thread!();
725 unsafe { Widget::from_glib_none(ffi::gtk_tree_view_new()).unsafe_cast() }
726 }
727
728 /// Creates a new [`TreeView`][crate::TreeView] widget with the model initialized to @model.
729 ///
730 /// # Deprecated since 4.10
731 ///
732 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
733 /// ## `model`
734 /// the model.
735 ///
736 /// # Returns
737 ///
738 /// A newly created [`TreeView`][crate::TreeView] widget.
739 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
740 #[allow(deprecated)]
741 #[doc(alias = "gtk_tree_view_new_with_model")]
742 #[doc(alias = "new_with_model")]
743 pub fn with_model(model: &impl IsA<TreeModel>) -> TreeView {
744 skip_assert_initialized!();
745 unsafe {
746 Widget::from_glib_none(ffi::gtk_tree_view_new_with_model(
747 model.as_ref().to_glib_none().0,
748 ))
749 .unsafe_cast()
750 }
751 }
752
753 // rustdoc-stripper-ignore-next
754 /// Creates a new builder-pattern struct instance to construct [`TreeView`] objects.
755 ///
756 /// This method returns an instance of [`TreeViewBuilder`](crate::builders::TreeViewBuilder) which can be used to create [`TreeView`] objects.
757 pub fn builder() -> TreeViewBuilder {
758 TreeViewBuilder::new()
759 }
760}
761
762impl Default for TreeView {
763 fn default() -> Self {
764 Self::new()
765 }
766}
767
768// rustdoc-stripper-ignore-next
769/// A [builder-pattern] type to construct [`TreeView`] objects.
770///
771/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
772#[must_use = "The builder must be built to be used"]
773pub struct TreeViewBuilder {
774 builder: glib::object::ObjectBuilder<'static, TreeView>,
775}
776
777impl TreeViewBuilder {
778 fn new() -> Self {
779 Self {
780 builder: glib::object::Object::builder(),
781 }
782 }
783
784 /// The activate-on-single-click property specifies whether the "row-activated" signal
785 /// will be emitted after a single click.
786 pub fn activate_on_single_click(self, activate_on_single_click: bool) -> Self {
787 Self {
788 builder: self
789 .builder
790 .property("activate-on-single-click", activate_on_single_click),
791 }
792 }
793
794 pub fn enable_grid_lines(self, enable_grid_lines: TreeViewGridLines) -> Self {
795 Self {
796 builder: self
797 .builder
798 .property("enable-grid-lines", enable_grid_lines),
799 }
800 }
801
802 pub fn enable_search(self, enable_search: bool) -> Self {
803 Self {
804 builder: self.builder.property("enable-search", enable_search),
805 }
806 }
807
808 pub fn enable_tree_lines(self, enable_tree_lines: bool) -> Self {
809 Self {
810 builder: self
811 .builder
812 .property("enable-tree-lines", enable_tree_lines),
813 }
814 }
815
816 pub fn expander_column(self, expander_column: &TreeViewColumn) -> Self {
817 Self {
818 builder: self
819 .builder
820 .property("expander-column", expander_column.clone()),
821 }
822 }
823
824 /// Setting the ::fixed-height-mode property to [`true`] speeds up
825 /// [`TreeView`][crate::TreeView] by assuming that all rows have the same height.
826 /// Only enable this option if all rows are the same height.
827 /// Please see gtk_tree_view_set_fixed_height_mode() for more
828 /// information on this option.
829 pub fn fixed_height_mode(self, fixed_height_mode: bool) -> Self {
830 Self {
831 builder: self
832 .builder
833 .property("fixed-height-mode", fixed_height_mode),
834 }
835 }
836
837 pub fn headers_clickable(self, headers_clickable: bool) -> Self {
838 Self {
839 builder: self
840 .builder
841 .property("headers-clickable", headers_clickable),
842 }
843 }
844
845 pub fn headers_visible(self, headers_visible: bool) -> Self {
846 Self {
847 builder: self.builder.property("headers-visible", headers_visible),
848 }
849 }
850
851 /// Enables or disables the hover expansion mode of @tree_view.
852 /// Hover expansion makes rows expand or collapse if the pointer moves
853 /// over them.
854 ///
855 /// This mode is primarily intended for treeviews in popups, e.g.
856 /// in [`ComboBox`][crate::ComboBox] or [`EntryCompletion`][crate::EntryCompletion].
857 pub fn hover_expand(self, hover_expand: bool) -> Self {
858 Self {
859 builder: self.builder.property("hover-expand", hover_expand),
860 }
861 }
862
863 /// Enables or disables the hover selection mode of @tree_view.
864 /// Hover selection makes the selected row follow the pointer.
865 /// Currently, this works only for the selection modes
866 /// [`SelectionMode::Single`][crate::SelectionMode::Single] and [`SelectionMode::Browse`][crate::SelectionMode::Browse].
867 ///
868 /// This mode is primarily intended for treeviews in popups, e.g.
869 /// in [`ComboBox`][crate::ComboBox] or [`EntryCompletion`][crate::EntryCompletion].
870 pub fn hover_selection(self, hover_selection: bool) -> Self {
871 Self {
872 builder: self.builder.property("hover-selection", hover_selection),
873 }
874 }
875
876 /// Extra indentation for each level.
877 pub fn level_indentation(self, level_indentation: i32) -> Self {
878 Self {
879 builder: self
880 .builder
881 .property("level-indentation", level_indentation),
882 }
883 }
884
885 pub fn model(self, model: &impl IsA<TreeModel>) -> Self {
886 Self {
887 builder: self.builder.property("model", model.clone().upcast()),
888 }
889 }
890
891 pub fn reorderable(self, reorderable: bool) -> Self {
892 Self {
893 builder: self.builder.property("reorderable", reorderable),
894 }
895 }
896
897 pub fn rubber_banding(self, rubber_banding: bool) -> Self {
898 Self {
899 builder: self.builder.property("rubber-banding", rubber_banding),
900 }
901 }
902
903 pub fn search_column(self, search_column: i32) -> Self {
904 Self {
905 builder: self.builder.property("search-column", search_column),
906 }
907 }
908
909 /// [`true`] if the view has expanders.
910 pub fn show_expanders(self, show_expanders: bool) -> Self {
911 Self {
912 builder: self.builder.property("show-expanders", show_expanders),
913 }
914 }
915
916 pub fn tooltip_column(self, tooltip_column: i32) -> Self {
917 Self {
918 builder: self.builder.property("tooltip-column", tooltip_column),
919 }
920 }
921
922 /// Whether the widget or any of its descendents can accept
923 /// the input focus.
924 ///
925 /// This property is meant to be set by widget implementations,
926 /// typically in their instance init function.
927 pub fn can_focus(self, can_focus: bool) -> Self {
928 Self {
929 builder: self.builder.property("can-focus", can_focus),
930 }
931 }
932
933 /// Whether the widget can receive pointer events.
934 pub fn can_target(self, can_target: bool) -> Self {
935 Self {
936 builder: self.builder.property("can-target", can_target),
937 }
938 }
939
940 /// A list of css classes applied to this widget.
941 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
942 Self {
943 builder: self.builder.property("css-classes", css_classes.into()),
944 }
945 }
946
947 /// The name of this widget in the CSS tree.
948 ///
949 /// This property is meant to be set by widget implementations,
950 /// typically in their instance init function.
951 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
952 Self {
953 builder: self.builder.property("css-name", css_name.into()),
954 }
955 }
956
957 /// The cursor used by @widget.
958 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
959 Self {
960 builder: self.builder.property("cursor", cursor.clone()),
961 }
962 }
963
964 /// Whether the widget should grab focus when it is clicked with the mouse.
965 ///
966 /// This property is only relevant for widgets that can take focus.
967 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
968 Self {
969 builder: self.builder.property("focus-on-click", focus_on_click),
970 }
971 }
972
973 /// Whether this widget itself will accept the input focus.
974 pub fn focusable(self, focusable: bool) -> Self {
975 Self {
976 builder: self.builder.property("focusable", focusable),
977 }
978 }
979
980 /// How to distribute horizontal space if widget gets extra space.
981 pub fn halign(self, halign: Align) -> Self {
982 Self {
983 builder: self.builder.property("halign", halign),
984 }
985 }
986
987 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
988 /// signal on @widget.
989 ///
990 /// A true value indicates that @widget can have a tooltip, in this case
991 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
992 /// determine whether it will provide a tooltip or not.
993 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
994 Self {
995 builder: self.builder.property("has-tooltip", has_tooltip),
996 }
997 }
998
999 /// Overrides for height request of the widget.
1000 ///
1001 /// If this is -1, the natural request will be used.
1002 pub fn height_request(self, height_request: i32) -> Self {
1003 Self {
1004 builder: self.builder.property("height-request", height_request),
1005 }
1006 }
1007
1008 /// Whether to expand horizontally.
1009 pub fn hexpand(self, hexpand: bool) -> Self {
1010 Self {
1011 builder: self.builder.property("hexpand", hexpand),
1012 }
1013 }
1014
1015 /// Whether to use the `hexpand` property.
1016 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1017 Self {
1018 builder: self.builder.property("hexpand-set", hexpand_set),
1019 }
1020 }
1021
1022 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1023 /// the preferred size of the widget, and allocate its children.
1024 ///
1025 /// This property is meant to be set by widget implementations,
1026 /// typically in their instance init function.
1027 pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1028 Self {
1029 builder: self
1030 .builder
1031 .property("layout-manager", layout_manager.clone().upcast()),
1032 }
1033 }
1034
1035 /// Makes this widget act like a modal dialog, with respect to
1036 /// event delivery.
1037 ///
1038 /// Global event controllers will not handle events with targets
1039 /// inside the widget, unless they are set up to ignore propagation
1040 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1041 #[cfg(feature = "v4_18")]
1042 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1043 pub fn limit_events(self, limit_events: bool) -> Self {
1044 Self {
1045 builder: self.builder.property("limit-events", limit_events),
1046 }
1047 }
1048
1049 /// Margin on bottom side of widget.
1050 ///
1051 /// This property adds margin outside of the widget's normal size
1052 /// request, the margin will be added in addition to the size from
1053 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1054 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1055 Self {
1056 builder: self.builder.property("margin-bottom", margin_bottom),
1057 }
1058 }
1059
1060 /// Margin on end of widget, horizontally.
1061 ///
1062 /// This property supports left-to-right and right-to-left text
1063 /// directions.
1064 ///
1065 /// This property adds margin outside of the widget's normal size
1066 /// request, the margin will be added in addition to the size from
1067 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1068 pub fn margin_end(self, margin_end: i32) -> Self {
1069 Self {
1070 builder: self.builder.property("margin-end", margin_end),
1071 }
1072 }
1073
1074 /// Margin on start of widget, horizontally.
1075 ///
1076 /// This property supports left-to-right and right-to-left text
1077 /// directions.
1078 ///
1079 /// This property adds margin outside of the widget's normal size
1080 /// request, the margin will be added in addition to the size from
1081 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1082 pub fn margin_start(self, margin_start: i32) -> Self {
1083 Self {
1084 builder: self.builder.property("margin-start", margin_start),
1085 }
1086 }
1087
1088 /// Margin on top side of widget.
1089 ///
1090 /// This property adds margin outside of the widget's normal size
1091 /// request, the margin will be added in addition to the size from
1092 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1093 pub fn margin_top(self, margin_top: i32) -> Self {
1094 Self {
1095 builder: self.builder.property("margin-top", margin_top),
1096 }
1097 }
1098
1099 /// The name of the widget.
1100 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1101 Self {
1102 builder: self.builder.property("name", name.into()),
1103 }
1104 }
1105
1106 /// The requested opacity of the widget.
1107 pub fn opacity(self, opacity: f64) -> Self {
1108 Self {
1109 builder: self.builder.property("opacity", opacity),
1110 }
1111 }
1112
1113 /// How content outside the widget's content area is treated.
1114 ///
1115 /// This property is meant to be set by widget implementations,
1116 /// typically in their instance init function.
1117 pub fn overflow(self, overflow: Overflow) -> Self {
1118 Self {
1119 builder: self.builder.property("overflow", overflow),
1120 }
1121 }
1122
1123 /// Whether the widget will receive the default action when it is focused.
1124 pub fn receives_default(self, receives_default: bool) -> Self {
1125 Self {
1126 builder: self.builder.property("receives-default", receives_default),
1127 }
1128 }
1129
1130 /// Whether the widget responds to input.
1131 pub fn sensitive(self, sensitive: bool) -> Self {
1132 Self {
1133 builder: self.builder.property("sensitive", sensitive),
1134 }
1135 }
1136
1137 /// Sets the text of tooltip to be the given string, which is marked up
1138 /// with Pango markup.
1139 ///
1140 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1141 ///
1142 /// This is a convenience property which will take care of getting the
1143 /// tooltip shown if the given string is not `NULL`:
1144 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1145 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1146 /// the default signal handler.
1147 ///
1148 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1149 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1150 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1151 Self {
1152 builder: self
1153 .builder
1154 .property("tooltip-markup", tooltip_markup.into()),
1155 }
1156 }
1157
1158 /// Sets the text of tooltip to be the given string.
1159 ///
1160 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1161 ///
1162 /// This is a convenience property which will take care of getting the
1163 /// tooltip shown if the given string is not `NULL`:
1164 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1165 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1166 /// the default signal handler.
1167 ///
1168 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1169 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1170 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1171 Self {
1172 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1173 }
1174 }
1175
1176 /// How to distribute vertical space if widget gets extra space.
1177 pub fn valign(self, valign: Align) -> Self {
1178 Self {
1179 builder: self.builder.property("valign", valign),
1180 }
1181 }
1182
1183 /// Whether to expand vertically.
1184 pub fn vexpand(self, vexpand: bool) -> Self {
1185 Self {
1186 builder: self.builder.property("vexpand", vexpand),
1187 }
1188 }
1189
1190 /// Whether to use the `vexpand` property.
1191 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1192 Self {
1193 builder: self.builder.property("vexpand-set", vexpand_set),
1194 }
1195 }
1196
1197 /// Whether the widget is visible.
1198 pub fn visible(self, visible: bool) -> Self {
1199 Self {
1200 builder: self.builder.property("visible", visible),
1201 }
1202 }
1203
1204 /// Overrides for width request of the widget.
1205 ///
1206 /// If this is -1, the natural request will be used.
1207 pub fn width_request(self, width_request: i32) -> Self {
1208 Self {
1209 builder: self.builder.property("width-request", width_request),
1210 }
1211 }
1212
1213 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1214 ///
1215 /// The accessible role cannot be changed once set.
1216 pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1217 Self {
1218 builder: self.builder.property("accessible-role", accessible_role),
1219 }
1220 }
1221
1222 /// Horizontal [`Adjustment`][crate::Adjustment] of the scrollable widget.
1223 ///
1224 /// This adjustment is shared between the scrollable widget and its parent.
1225 pub fn hadjustment(self, hadjustment: &impl IsA<Adjustment>) -> Self {
1226 Self {
1227 builder: self
1228 .builder
1229 .property("hadjustment", hadjustment.clone().upcast()),
1230 }
1231 }
1232
1233 /// Determines when horizontal scrolling should start.
1234 pub fn hscroll_policy(self, hscroll_policy: ScrollablePolicy) -> Self {
1235 Self {
1236 builder: self.builder.property("hscroll-policy", hscroll_policy),
1237 }
1238 }
1239
1240 /// Vertical [`Adjustment`][crate::Adjustment] of the scrollable widget.
1241 ///
1242 /// This adjustment is shared between the scrollable widget and its parent.
1243 pub fn vadjustment(self, vadjustment: &impl IsA<Adjustment>) -> Self {
1244 Self {
1245 builder: self
1246 .builder
1247 .property("vadjustment", vadjustment.clone().upcast()),
1248 }
1249 }
1250
1251 /// Determines when vertical scrolling should start.
1252 pub fn vscroll_policy(self, vscroll_policy: ScrollablePolicy) -> Self {
1253 Self {
1254 builder: self.builder.property("vscroll-policy", vscroll_policy),
1255 }
1256 }
1257
1258 // rustdoc-stripper-ignore-next
1259 /// Build the [`TreeView`].
1260 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1261 pub fn build(self) -> TreeView {
1262 assert_initialized_main_thread!();
1263 self.builder.build()
1264 }
1265}
1266
1267/// Trait containing all [`struct@TreeView`] methods.
1268///
1269/// # Implementors
1270///
1271/// [`TreeView`][struct@crate::TreeView]
1272pub trait TreeViewExt: IsA<TreeView> + 'static {
1273 /// property set to be
1274 /// GTK_TREE_VIEW_COLUMN_FIXED.
1275 ///
1276 /// # Deprecated since 4.10
1277 ///
1278 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
1279 /// ## `column`
1280 /// The [`TreeViewColumn`][crate::TreeViewColumn] to add.
1281 ///
1282 /// # Returns
1283 ///
1284 /// The number of columns in @self after appending.
1285 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1286 #[allow(deprecated)]
1287 #[doc(alias = "gtk_tree_view_append_column")]
1288 fn append_column(&self, column: &TreeViewColumn) -> i32 {
1289 unsafe {
1290 ffi::gtk_tree_view_append_column(
1291 self.as_ref().to_glib_none().0,
1292 column.to_glib_none().0,
1293 )
1294 }
1295 }
1296
1297 /// Recursively collapses all visible, expanded nodes in @self.
1298 ///
1299 /// # Deprecated since 4.10
1300 ///
1301 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
1302 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1303 #[allow(deprecated)]
1304 #[doc(alias = "gtk_tree_view_collapse_all")]
1305 fn collapse_all(&self) {
1306 unsafe {
1307 ffi::gtk_tree_view_collapse_all(self.as_ref().to_glib_none().0);
1308 }
1309 }
1310
1311 /// Collapses a row (hides its child rows, if they exist).
1312 ///
1313 /// # Deprecated since 4.10
1314 ///
1315 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
1316 /// ## `path`
1317 /// path to a row in the @self
1318 ///
1319 /// # Returns
1320 ///
1321 /// [`true`] if the row was collapsed.
1322 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1323 #[allow(deprecated)]
1324 #[doc(alias = "gtk_tree_view_collapse_row")]
1325 fn collapse_row(&self, path: &TreePath) -> bool {
1326 unsafe {
1327 from_glib(ffi::gtk_tree_view_collapse_row(
1328 self.as_ref().to_glib_none().0,
1329 mut_override(path.to_glib_none().0),
1330 ))
1331 }
1332 }
1333
1334 /// Resizes all columns to their optimal width. Only works after the
1335 /// treeview has been realized.
1336 ///
1337 /// # Deprecated since 4.10
1338 ///
1339 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
1340 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1341 #[allow(deprecated)]
1342 #[doc(alias = "gtk_tree_view_columns_autosize")]
1343 fn columns_autosize(&self) {
1344 unsafe {
1345 ffi::gtk_tree_view_columns_autosize(self.as_ref().to_glib_none().0);
1346 }
1347 }
1348
1349 /// Converts bin_window coordinates to coordinates for the
1350 /// tree (the full scrollable area of the tree).
1351 ///
1352 /// # Deprecated since 4.10
1353 ///
1354 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
1355 /// ## `bx`
1356 /// X coordinate relative to bin_window
1357 /// ## `by`
1358 /// Y coordinate relative to bin_window
1359 ///
1360 /// # Returns
1361 ///
1362 ///
1363 /// ## `tx`
1364 /// return location for tree X coordinate
1365 ///
1366 /// ## `ty`
1367 /// return location for tree Y coordinate
1368 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1369 #[allow(deprecated)]
1370 #[doc(alias = "gtk_tree_view_convert_bin_window_to_tree_coords")]
1371 fn convert_bin_window_to_tree_coords(&self, bx: i32, by: i32) -> (i32, i32) {
1372 unsafe {
1373 let mut tx = std::mem::MaybeUninit::uninit();
1374 let mut ty = std::mem::MaybeUninit::uninit();
1375 ffi::gtk_tree_view_convert_bin_window_to_tree_coords(
1376 self.as_ref().to_glib_none().0,
1377 bx,
1378 by,
1379 tx.as_mut_ptr(),
1380 ty.as_mut_ptr(),
1381 );
1382 (tx.assume_init(), ty.assume_init())
1383 }
1384 }
1385
1386 /// Converts bin_window coordinates to widget relative coordinates.
1387 ///
1388 /// # Deprecated since 4.10
1389 ///
1390 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
1391 /// ## `bx`
1392 /// bin_window X coordinate
1393 /// ## `by`
1394 /// bin_window Y coordinate
1395 ///
1396 /// # Returns
1397 ///
1398 ///
1399 /// ## `wx`
1400 /// return location for widget X coordinate
1401 ///
1402 /// ## `wy`
1403 /// return location for widget Y coordinate
1404 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1405 #[allow(deprecated)]
1406 #[doc(alias = "gtk_tree_view_convert_bin_window_to_widget_coords")]
1407 fn convert_bin_window_to_widget_coords(&self, bx: i32, by: i32) -> (i32, i32) {
1408 unsafe {
1409 let mut wx = std::mem::MaybeUninit::uninit();
1410 let mut wy = std::mem::MaybeUninit::uninit();
1411 ffi::gtk_tree_view_convert_bin_window_to_widget_coords(
1412 self.as_ref().to_glib_none().0,
1413 bx,
1414 by,
1415 wx.as_mut_ptr(),
1416 wy.as_mut_ptr(),
1417 );
1418 (wx.assume_init(), wy.assume_init())
1419 }
1420 }
1421
1422 /// Converts tree coordinates (coordinates in full scrollable area of the tree)
1423 /// to bin_window coordinates.
1424 ///
1425 /// # Deprecated since 4.10
1426 ///
1427 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
1428 /// ## `tx`
1429 /// tree X coordinate
1430 /// ## `ty`
1431 /// tree Y coordinate
1432 ///
1433 /// # Returns
1434 ///
1435 ///
1436 /// ## `bx`
1437 /// return location for X coordinate relative to bin_window
1438 ///
1439 /// ## `by`
1440 /// return location for Y coordinate relative to bin_window
1441 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1442 #[allow(deprecated)]
1443 #[doc(alias = "gtk_tree_view_convert_tree_to_bin_window_coords")]
1444 fn convert_tree_to_bin_window_coords(&self, tx: i32, ty: i32) -> (i32, i32) {
1445 unsafe {
1446 let mut bx = std::mem::MaybeUninit::uninit();
1447 let mut by = std::mem::MaybeUninit::uninit();
1448 ffi::gtk_tree_view_convert_tree_to_bin_window_coords(
1449 self.as_ref().to_glib_none().0,
1450 tx,
1451 ty,
1452 bx.as_mut_ptr(),
1453 by.as_mut_ptr(),
1454 );
1455 (bx.assume_init(), by.assume_init())
1456 }
1457 }
1458
1459 /// Converts tree coordinates (coordinates in full scrollable area of the tree)
1460 /// to widget coordinates.
1461 ///
1462 /// # Deprecated since 4.10
1463 ///
1464 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
1465 /// ## `tx`
1466 /// X coordinate relative to the tree
1467 /// ## `ty`
1468 /// Y coordinate relative to the tree
1469 ///
1470 /// # Returns
1471 ///
1472 ///
1473 /// ## `wx`
1474 /// return location for widget X coordinate
1475 ///
1476 /// ## `wy`
1477 /// return location for widget Y coordinate
1478 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1479 #[allow(deprecated)]
1480 #[doc(alias = "gtk_tree_view_convert_tree_to_widget_coords")]
1481 fn convert_tree_to_widget_coords(&self, tx: i32, ty: i32) -> (i32, i32) {
1482 unsafe {
1483 let mut wx = std::mem::MaybeUninit::uninit();
1484 let mut wy = std::mem::MaybeUninit::uninit();
1485 ffi::gtk_tree_view_convert_tree_to_widget_coords(
1486 self.as_ref().to_glib_none().0,
1487 tx,
1488 ty,
1489 wx.as_mut_ptr(),
1490 wy.as_mut_ptr(),
1491 );
1492 (wx.assume_init(), wy.assume_init())
1493 }
1494 }
1495
1496 /// Converts widget coordinates to coordinates for the bin_window.
1497 ///
1498 /// # Deprecated since 4.10
1499 ///
1500 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
1501 /// ## `wx`
1502 /// X coordinate relative to the widget
1503 /// ## `wy`
1504 /// Y coordinate relative to the widget
1505 ///
1506 /// # Returns
1507 ///
1508 ///
1509 /// ## `bx`
1510 /// return location for bin_window X coordinate
1511 ///
1512 /// ## `by`
1513 /// return location for bin_window Y coordinate
1514 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1515 #[allow(deprecated)]
1516 #[doc(alias = "gtk_tree_view_convert_widget_to_bin_window_coords")]
1517 fn convert_widget_to_bin_window_coords(&self, wx: i32, wy: i32) -> (i32, i32) {
1518 unsafe {
1519 let mut bx = std::mem::MaybeUninit::uninit();
1520 let mut by = std::mem::MaybeUninit::uninit();
1521 ffi::gtk_tree_view_convert_widget_to_bin_window_coords(
1522 self.as_ref().to_glib_none().0,
1523 wx,
1524 wy,
1525 bx.as_mut_ptr(),
1526 by.as_mut_ptr(),
1527 );
1528 (bx.assume_init(), by.assume_init())
1529 }
1530 }
1531
1532 /// Converts widget coordinates to coordinates for the
1533 /// tree (the full scrollable area of the tree).
1534 ///
1535 /// # Deprecated since 4.10
1536 ///
1537 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
1538 /// ## `wx`
1539 /// X coordinate relative to the widget
1540 /// ## `wy`
1541 /// Y coordinate relative to the widget
1542 ///
1543 /// # Returns
1544 ///
1545 ///
1546 /// ## `tx`
1547 /// return location for tree X coordinate
1548 ///
1549 /// ## `ty`
1550 /// return location for tree Y coordinate
1551 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1552 #[allow(deprecated)]
1553 #[doc(alias = "gtk_tree_view_convert_widget_to_tree_coords")]
1554 fn convert_widget_to_tree_coords(&self, wx: i32, wy: i32) -> (i32, i32) {
1555 unsafe {
1556 let mut tx = std::mem::MaybeUninit::uninit();
1557 let mut ty = std::mem::MaybeUninit::uninit();
1558 ffi::gtk_tree_view_convert_widget_to_tree_coords(
1559 self.as_ref().to_glib_none().0,
1560 wx,
1561 wy,
1562 tx.as_mut_ptr(),
1563 ty.as_mut_ptr(),
1564 );
1565 (tx.assume_init(), ty.assume_init())
1566 }
1567 }
1568
1569 /// Creates a [`cairo::Surface`][crate::cairo::Surface] representation of the row at @path.
1570 /// This image is used for a drag icon.
1571 ///
1572 /// # Deprecated since 4.10
1573 ///
1574 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
1575 /// ## `path`
1576 /// a [`TreePath`][crate::TreePath] in @self
1577 ///
1578 /// # Returns
1579 ///
1580 /// a newly-allocated surface of the drag icon.
1581 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1582 #[allow(deprecated)]
1583 #[doc(alias = "gtk_tree_view_create_row_drag_icon")]
1584 fn create_row_drag_icon(&self, path: &TreePath) -> Option<gdk::Paintable> {
1585 unsafe {
1586 from_glib_full(ffi::gtk_tree_view_create_row_drag_icon(
1587 self.as_ref().to_glib_none().0,
1588 mut_override(path.to_glib_none().0),
1589 ))
1590 }
1591 }
1592
1593 /// Turns @self into a drop destination for automatic DND. Calling
1594 /// this method sets [`TreeView`][crate::TreeView]:reorderable to [`false`].
1595 ///
1596 /// # Deprecated since 4.10
1597 ///
1598 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
1599 /// ## `formats`
1600 /// the target formats that the drag will support
1601 /// ## `actions`
1602 /// the bitmask of possible actions for a drag from this
1603 /// widget
1604 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1605 #[allow(deprecated)]
1606 #[doc(alias = "gtk_tree_view_enable_model_drag_dest")]
1607 fn enable_model_drag_dest(&self, formats: &gdk::ContentFormats, actions: gdk::DragAction) {
1608 unsafe {
1609 ffi::gtk_tree_view_enable_model_drag_dest(
1610 self.as_ref().to_glib_none().0,
1611 formats.to_glib_none().0,
1612 actions.into_glib(),
1613 );
1614 }
1615 }
1616
1617 /// Turns @self into a drag source for automatic DND. Calling this
1618 /// method sets [`TreeView`][crate::TreeView]:reorderable to [`false`].
1619 ///
1620 /// # Deprecated since 4.10
1621 ///
1622 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
1623 /// ## `start_button_mask`
1624 /// Mask of allowed buttons to start drag
1625 /// ## `formats`
1626 /// the target formats that the drag will support
1627 /// ## `actions`
1628 /// the bitmask of possible actions for a drag from this
1629 /// widget
1630 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1631 #[allow(deprecated)]
1632 #[doc(alias = "gtk_tree_view_enable_model_drag_source")]
1633 fn enable_model_drag_source(
1634 &self,
1635 start_button_mask: gdk::ModifierType,
1636 formats: &gdk::ContentFormats,
1637 actions: gdk::DragAction,
1638 ) {
1639 unsafe {
1640 ffi::gtk_tree_view_enable_model_drag_source(
1641 self.as_ref().to_glib_none().0,
1642 start_button_mask.into_glib(),
1643 formats.to_glib_none().0,
1644 actions.into_glib(),
1645 );
1646 }
1647 }
1648
1649 /// Recursively expands all nodes in the @self.
1650 ///
1651 /// # Deprecated since 4.10
1652 ///
1653 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
1654 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1655 #[allow(deprecated)]
1656 #[doc(alias = "gtk_tree_view_expand_all")]
1657 fn expand_all(&self) {
1658 unsafe {
1659 ffi::gtk_tree_view_expand_all(self.as_ref().to_glib_none().0);
1660 }
1661 }
1662
1663 /// Opens the row so its children are visible.
1664 ///
1665 /// # Deprecated since 4.10
1666 ///
1667 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
1668 /// ## `path`
1669 /// path to a row
1670 /// ## `open_all`
1671 /// whether to recursively expand, or just expand immediate children
1672 ///
1673 /// # Returns
1674 ///
1675 /// [`true`] if the row existed and had children
1676 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1677 #[allow(deprecated)]
1678 #[doc(alias = "gtk_tree_view_expand_row")]
1679 fn expand_row(&self, path: &TreePath, open_all: bool) -> bool {
1680 unsafe {
1681 from_glib(ffi::gtk_tree_view_expand_row(
1682 self.as_ref().to_glib_none().0,
1683 mut_override(path.to_glib_none().0),
1684 open_all.into_glib(),
1685 ))
1686 }
1687 }
1688
1689 /// Expands the row at @path. This will also expand all parent rows of
1690 /// @path as necessary.
1691 ///
1692 /// # Deprecated since 4.10
1693 ///
1694 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
1695 /// ## `path`
1696 /// path to a row.
1697 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1698 #[allow(deprecated)]
1699 #[doc(alias = "gtk_tree_view_expand_to_path")]
1700 fn expand_to_path(&self, path: &TreePath) {
1701 unsafe {
1702 ffi::gtk_tree_view_expand_to_path(
1703 self.as_ref().to_glib_none().0,
1704 mut_override(path.to_glib_none().0),
1705 );
1706 }
1707 }
1708
1709 /// Gets the setting set by gtk_tree_view_set_activate_on_single_click().
1710 ///
1711 /// # Deprecated since 4.10
1712 ///
1713 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
1714 ///
1715 /// # Returns
1716 ///
1717 /// [`true`] if row-activated will be emitted on a single click
1718 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1719 #[allow(deprecated)]
1720 #[doc(alias = "gtk_tree_view_get_activate_on_single_click")]
1721 #[doc(alias = "get_activate_on_single_click")]
1722 #[doc(alias = "activate-on-single-click")]
1723 fn activates_on_single_click(&self) -> bool {
1724 unsafe {
1725 from_glib(ffi::gtk_tree_view_get_activate_on_single_click(
1726 self.as_ref().to_glib_none().0,
1727 ))
1728 }
1729 }
1730
1731 /// Fills the bounding rectangle in bin_window coordinates for the cell at the
1732 /// row specified by @path and the column specified by @column. If @path is
1733 /// [`None`], or points to a node not found in the tree, the @y and @height fields of
1734 /// the rectangle will be filled with 0. If @column is [`None`], the @x and @width
1735 /// fields will be filled with 0. The returned rectangle is equivalent to the
1736 /// @background_area passed to gtk_cell_renderer_render(). These background
1737 /// areas tile to cover the entire bin window. Contrast with the @cell_area,
1738 /// returned by gtk_tree_view_get_cell_area(), which returns only the cell
1739 /// itself, excluding surrounding borders and the tree expander area.
1740 ///
1741 /// # Deprecated since 4.10
1742 ///
1743 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
1744 /// ## `path`
1745 /// a [`TreePath`][crate::TreePath] for the row, or [`None`] to get only horizontal coordinates
1746 /// ## `column`
1747 /// a [`TreeViewColumn`][crate::TreeViewColumn] for the column, or [`None`] to get only vertical coordinates
1748 ///
1749 /// # Returns
1750 ///
1751 ///
1752 /// ## `rect`
1753 /// rectangle to fill with cell background rect
1754 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1755 #[allow(deprecated)]
1756 #[doc(alias = "gtk_tree_view_get_background_area")]
1757 #[doc(alias = "get_background_area")]
1758 fn background_area(
1759 &self,
1760 path: Option<&TreePath>,
1761 column: Option<&TreeViewColumn>,
1762 ) -> gdk::Rectangle {
1763 unsafe {
1764 let mut rect = gdk::Rectangle::uninitialized();
1765 ffi::gtk_tree_view_get_background_area(
1766 self.as_ref().to_glib_none().0,
1767 mut_override(path.to_glib_none().0),
1768 column.to_glib_none().0,
1769 rect.to_glib_none_mut().0,
1770 );
1771 rect
1772 }
1773 }
1774
1775 /// Fills the bounding rectangle in bin_window coordinates for the cell at the
1776 /// row specified by @path and the column specified by @column. If @path is
1777 /// [`None`], or points to a path not currently displayed, the @y and @height fields
1778 /// of the rectangle will be filled with 0. If @column is [`None`], the @x and @width
1779 /// fields will be filled with 0. The sum of all cell rects does not cover the
1780 /// entire tree; there are extra pixels in between rows, for example. The
1781 /// returned rectangle is equivalent to the @cell_area passed to
1782 /// gtk_cell_renderer_render(). This function is only valid if @self is
1783 /// realized.
1784 ///
1785 /// # Deprecated since 4.10
1786 ///
1787 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
1788 /// ## `path`
1789 /// a [`TreePath`][crate::TreePath] for the row, or [`None`] to get only horizontal coordinates
1790 /// ## `column`
1791 /// a [`TreeViewColumn`][crate::TreeViewColumn] for the column, or [`None`] to get only vertical coordinates
1792 ///
1793 /// # Returns
1794 ///
1795 ///
1796 /// ## `rect`
1797 /// rectangle to fill with cell rect
1798 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1799 #[allow(deprecated)]
1800 #[doc(alias = "gtk_tree_view_get_cell_area")]
1801 #[doc(alias = "get_cell_area")]
1802 fn cell_area(
1803 &self,
1804 path: Option<&TreePath>,
1805 column: Option<&TreeViewColumn>,
1806 ) -> gdk::Rectangle {
1807 unsafe {
1808 let mut rect = gdk::Rectangle::uninitialized();
1809 ffi::gtk_tree_view_get_cell_area(
1810 self.as_ref().to_glib_none().0,
1811 mut_override(path.to_glib_none().0),
1812 column.to_glib_none().0,
1813 rect.to_glib_none_mut().0,
1814 );
1815 rect
1816 }
1817 }
1818
1819 /// Gets the [`TreeViewColumn`][crate::TreeViewColumn] at the given position in the #tree_view.
1820 ///
1821 /// # Deprecated since 4.10
1822 ///
1823 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
1824 /// ## `n`
1825 /// The position of the column, counting from 0.
1826 ///
1827 /// # Returns
1828 ///
1829 /// The [`TreeViewColumn`][crate::TreeViewColumn], or [`None`] if the
1830 /// position is outside the range of columns.
1831 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1832 #[allow(deprecated)]
1833 #[doc(alias = "gtk_tree_view_get_column")]
1834 #[doc(alias = "get_column")]
1835 fn column(&self, n: i32) -> Option<TreeViewColumn> {
1836 unsafe {
1837 from_glib_none(ffi::gtk_tree_view_get_column(
1838 self.as_ref().to_glib_none().0,
1839 n,
1840 ))
1841 }
1842 }
1843
1844 /// Returns a `GList` of all the [`TreeViewColumn`][crate::TreeViewColumn]s currently in @self.
1845 /// The returned list must be freed with g_list_free ().
1846 ///
1847 /// # Deprecated since 4.10
1848 ///
1849 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
1850 ///
1851 /// # Returns
1852 ///
1853 /// A list of [`TreeViewColumn`][crate::TreeViewColumn]s
1854 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1855 #[allow(deprecated)]
1856 #[doc(alias = "gtk_tree_view_get_columns")]
1857 #[doc(alias = "get_columns")]
1858 fn columns(&self) -> Vec<TreeViewColumn> {
1859 unsafe {
1860 FromGlibPtrContainer::from_glib_container(ffi::gtk_tree_view_get_columns(
1861 self.as_ref().to_glib_none().0,
1862 ))
1863 }
1864 }
1865
1866 /// t currently set, then *@path will be [`None`]. If no column
1867 /// currently has focus, then *@focus_column will be [`None`].
1868 ///
1869 /// The returned [`TreePath`][crate::TreePath] must be freed with gtk_tree_path_free() when
1870 /// you are done with it.
1871 ///
1872 /// # Deprecated since 4.10
1873 ///
1874 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
1875 ///
1876 /// # Returns
1877 ///
1878 ///
1879 /// ## `path`
1880 /// A pointer to be
1881 /// filled with the current cursor path
1882 ///
1883 /// ## `focus_column`
1884 /// A
1885 /// pointer to be filled with the current focus column
1886 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1887 #[allow(deprecated)]
1888 #[doc(alias = "gtk_tree_view_get_cursor")]
1889 #[doc(alias = "get_cursor")]
1890 fn cursor(&self) -> (Option<TreePath>, Option<TreeViewColumn>) {
1891 unsafe {
1892 let mut path = std::ptr::null_mut();
1893 let mut focus_column = std::ptr::null_mut();
1894 ffi::gtk_tree_view_get_cursor(
1895 self.as_ref().to_glib_none().0,
1896 &mut path,
1897 &mut focus_column,
1898 );
1899 (from_glib_full(path), from_glib_none(focus_column))
1900 }
1901 }
1902
1903 /// Determines the destination row for a given position. @drag_x and
1904 /// @drag_y are expected to be in widget coordinates. This function is only
1905 /// meaningful if @self is realized. Therefore this function will always
1906 /// return [`false`] if @self is not realized or does not have a model.
1907 ///
1908 /// # Deprecated since 4.10
1909 ///
1910 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
1911 /// ## `drag_x`
1912 /// the position to determine the destination row for
1913 /// ## `drag_y`
1914 /// the position to determine the destination row for
1915 ///
1916 /// # Returns
1917 ///
1918 /// whether there is a row at the given position, [`true`] if this
1919 /// is indeed the case.
1920 ///
1921 /// ## `path`
1922 /// Return location for the path of
1923 /// the highlighted row
1924 ///
1925 /// ## `pos`
1926 /// Return location for the drop position, or
1927 /// [`None`]
1928 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1929 #[allow(deprecated)]
1930 #[doc(alias = "gtk_tree_view_get_dest_row_at_pos")]
1931 #[doc(alias = "get_dest_row_at_pos")]
1932 fn dest_row_at_pos(
1933 &self,
1934 drag_x: i32,
1935 drag_y: i32,
1936 ) -> Option<(Option<TreePath>, TreeViewDropPosition)> {
1937 unsafe {
1938 let mut path = std::ptr::null_mut();
1939 let mut pos = std::mem::MaybeUninit::uninit();
1940 let ret = from_glib(ffi::gtk_tree_view_get_dest_row_at_pos(
1941 self.as_ref().to_glib_none().0,
1942 drag_x,
1943 drag_y,
1944 &mut path,
1945 pos.as_mut_ptr(),
1946 ));
1947 if ret {
1948 Some((from_glib_full(path), from_glib(pos.assume_init())))
1949 } else {
1950 None
1951 }
1952 }
1953 }
1954
1955 /// Gets information about the row that is highlighted for feedback.
1956 ///
1957 /// # Deprecated since 4.10
1958 ///
1959 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
1960 ///
1961 /// # Returns
1962 ///
1963 ///
1964 /// ## `path`
1965 /// Return location for the path of the highlighted row
1966 ///
1967 /// ## `pos`
1968 /// Return location for the drop position
1969 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1970 #[allow(deprecated)]
1971 #[doc(alias = "gtk_tree_view_get_drag_dest_row")]
1972 #[doc(alias = "get_drag_dest_row")]
1973 fn drag_dest_row(&self) -> (Option<TreePath>, TreeViewDropPosition) {
1974 unsafe {
1975 let mut path = std::ptr::null_mut();
1976 let mut pos = std::mem::MaybeUninit::uninit();
1977 ffi::gtk_tree_view_get_drag_dest_row(
1978 self.as_ref().to_glib_none().0,
1979 &mut path,
1980 pos.as_mut_ptr(),
1981 );
1982 (from_glib_full(path), from_glib(pos.assume_init()))
1983 }
1984 }
1985
1986 /// Returns whether or not the tree allows to start interactive searching
1987 /// by typing in text.
1988 ///
1989 /// # Deprecated since 4.10
1990 ///
1991 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
1992 ///
1993 /// # Returns
1994 ///
1995 /// whether or not to let the user search interactively
1996 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
1997 #[allow(deprecated)]
1998 #[doc(alias = "gtk_tree_view_get_enable_search")]
1999 #[doc(alias = "get_enable_search")]
2000 #[doc(alias = "enable-search")]
2001 fn enables_search(&self) -> bool {
2002 unsafe {
2003 from_glib(ffi::gtk_tree_view_get_enable_search(
2004 self.as_ref().to_glib_none().0,
2005 ))
2006 }
2007 }
2008
2009 /// Returns whether or not tree lines are drawn in @self.
2010 ///
2011 /// # Deprecated since 4.10
2012 ///
2013 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
2014 ///
2015 /// # Returns
2016 ///
2017 /// [`true`] if tree lines are drawn in @self, [`false`]
2018 /// otherwise.
2019 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2020 #[allow(deprecated)]
2021 #[doc(alias = "gtk_tree_view_get_enable_tree_lines")]
2022 #[doc(alias = "get_enable_tree_lines")]
2023 #[doc(alias = "enable-tree-lines")]
2024 fn enables_tree_lines(&self) -> bool {
2025 unsafe {
2026 from_glib(ffi::gtk_tree_view_get_enable_tree_lines(
2027 self.as_ref().to_glib_none().0,
2028 ))
2029 }
2030 }
2031
2032 /// Returns the column that is the current expander column,
2033 /// or [`None`] if none has been set.
2034 /// This column has the expander arrow drawn next to it.
2035 ///
2036 /// # Deprecated since 4.10
2037 ///
2038 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
2039 ///
2040 /// # Returns
2041 ///
2042 /// The expander column.
2043 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2044 #[allow(deprecated)]
2045 #[doc(alias = "gtk_tree_view_get_expander_column")]
2046 #[doc(alias = "get_expander_column")]
2047 #[doc(alias = "expander-column")]
2048 fn expander_column(&self) -> Option<TreeViewColumn> {
2049 unsafe {
2050 from_glib_none(ffi::gtk_tree_view_get_expander_column(
2051 self.as_ref().to_glib_none().0,
2052 ))
2053 }
2054 }
2055
2056 /// Returns whether fixed height mode is turned on for @self.
2057 ///
2058 /// # Deprecated since 4.10
2059 ///
2060 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
2061 ///
2062 /// # Returns
2063 ///
2064 /// [`true`] if @self is in fixed height mode
2065 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2066 #[allow(deprecated)]
2067 #[doc(alias = "gtk_tree_view_get_fixed_height_mode")]
2068 #[doc(alias = "get_fixed_height_mode")]
2069 #[doc(alias = "fixed-height-mode")]
2070 fn is_fixed_height_mode(&self) -> bool {
2071 unsafe {
2072 from_glib(ffi::gtk_tree_view_get_fixed_height_mode(
2073 self.as_ref().to_glib_none().0,
2074 ))
2075 }
2076 }
2077
2078 /// Returns which grid lines are enabled in @self.
2079 ///
2080 /// # Deprecated since 4.10
2081 ///
2082 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
2083 ///
2084 /// # Returns
2085 ///
2086 /// a [`TreeView`][crate::TreeView]GridLines value indicating which grid lines
2087 /// are enabled.
2088 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2089 #[allow(deprecated)]
2090 #[doc(alias = "gtk_tree_view_get_grid_lines")]
2091 #[doc(alias = "get_grid_lines")]
2092 fn grid_lines(&self) -> TreeViewGridLines {
2093 unsafe {
2094 from_glib(ffi::gtk_tree_view_get_grid_lines(
2095 self.as_ref().to_glib_none().0,
2096 ))
2097 }
2098 }
2099
2100 /// Returns whether all header columns are clickable.
2101 ///
2102 /// # Deprecated since 4.10
2103 ///
2104 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
2105 ///
2106 /// # Returns
2107 ///
2108 /// [`true`] if all header columns are clickable, otherwise [`false`]
2109 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2110 #[allow(deprecated)]
2111 #[doc(alias = "gtk_tree_view_get_headers_clickable")]
2112 #[doc(alias = "get_headers_clickable")]
2113 #[doc(alias = "headers-clickable")]
2114 fn is_headers_clickable(&self) -> bool {
2115 unsafe {
2116 from_glib(ffi::gtk_tree_view_get_headers_clickable(
2117 self.as_ref().to_glib_none().0,
2118 ))
2119 }
2120 }
2121
2122 /// Returns [`true`] if the headers on the @self are visible.
2123 ///
2124 /// # Deprecated since 4.10
2125 ///
2126 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
2127 ///
2128 /// # Returns
2129 ///
2130 /// Whether the headers are visible or not.
2131 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2132 #[allow(deprecated)]
2133 #[doc(alias = "gtk_tree_view_get_headers_visible")]
2134 #[doc(alias = "get_headers_visible")]
2135 #[doc(alias = "headers-visible")]
2136 fn is_headers_visible(&self) -> bool {
2137 unsafe {
2138 from_glib(ffi::gtk_tree_view_get_headers_visible(
2139 self.as_ref().to_glib_none().0,
2140 ))
2141 }
2142 }
2143
2144 /// Returns whether hover expansion mode is turned on for @self.
2145 ///
2146 /// # Deprecated since 4.10
2147 ///
2148 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
2149 ///
2150 /// # Returns
2151 ///
2152 /// [`true`] if @self is in hover expansion mode
2153 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2154 #[allow(deprecated)]
2155 #[doc(alias = "gtk_tree_view_get_hover_expand")]
2156 #[doc(alias = "get_hover_expand")]
2157 #[doc(alias = "hover-expand")]
2158 fn hover_expands(&self) -> bool {
2159 unsafe {
2160 from_glib(ffi::gtk_tree_view_get_hover_expand(
2161 self.as_ref().to_glib_none().0,
2162 ))
2163 }
2164 }
2165
2166 /// Returns whether hover selection mode is turned on for @self.
2167 ///
2168 /// # Deprecated since 4.10
2169 ///
2170 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
2171 ///
2172 /// # Returns
2173 ///
2174 /// [`true`] if @self is in hover selection mode
2175 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2176 #[allow(deprecated)]
2177 #[doc(alias = "gtk_tree_view_get_hover_selection")]
2178 #[doc(alias = "get_hover_selection")]
2179 #[doc(alias = "hover-selection")]
2180 fn is_hover_selection(&self) -> bool {
2181 unsafe {
2182 from_glib(ffi::gtk_tree_view_get_hover_selection(
2183 self.as_ref().to_glib_none().0,
2184 ))
2185 }
2186 }
2187
2188 /// Returns the amount, in pixels, of extra indentation for child levels
2189 /// in @self.
2190 ///
2191 /// # Deprecated since 4.10
2192 ///
2193 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
2194 ///
2195 /// # Returns
2196 ///
2197 /// the amount of extra indentation for child levels in
2198 /// @self. A return value of 0 means that this feature is disabled.
2199 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2200 #[allow(deprecated)]
2201 #[doc(alias = "gtk_tree_view_get_level_indentation")]
2202 #[doc(alias = "get_level_indentation")]
2203 #[doc(alias = "level-indentation")]
2204 fn level_indentation(&self) -> i32 {
2205 unsafe { ffi::gtk_tree_view_get_level_indentation(self.as_ref().to_glib_none().0) }
2206 }
2207
2208 /// Returns the model the [`TreeView`][crate::TreeView] is based on. Returns [`None`] if the
2209 /// model is unset.
2210 ///
2211 /// # Deprecated since 4.10
2212 ///
2213 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
2214 ///
2215 /// # Returns
2216 ///
2217 /// A [`TreeModel`][crate::TreeModel]
2218 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2219 #[allow(deprecated)]
2220 #[doc(alias = "gtk_tree_view_get_model")]
2221 #[doc(alias = "get_model")]
2222 fn model(&self) -> Option<TreeModel> {
2223 unsafe { from_glib_none(ffi::gtk_tree_view_get_model(self.as_ref().to_glib_none().0)) }
2224 }
2225
2226 /// Queries the number of columns in the given @self.
2227 ///
2228 /// # Deprecated since 4.10
2229 ///
2230 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
2231 ///
2232 /// # Returns
2233 ///
2234 /// The number of columns in the @self
2235 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2236 #[allow(deprecated)]
2237 #[doc(alias = "gtk_tree_view_get_n_columns")]
2238 #[doc(alias = "get_n_columns")]
2239 fn n_columns(&self) -> u32 {
2240 unsafe { ffi::gtk_tree_view_get_n_columns(self.as_ref().to_glib_none().0) }
2241 }
2242
2243 /// Finds the path at the point (@x, @y), relative to bin_window coordinates.
2244 /// That is, @x and @y are relative to an events coordinates. Widget-relative
2245 /// coordinates must be converted using
2246 /// gtk_tree_view_convert_widget_to_bin_window_coords(). It is primarily for
2247 /// things like popup menus. If @path is non-[`None`], then it will be filled
2248 /// with the [`TreePath`][crate::TreePath] at that point. This path should be freed with
2249 /// gtk_tree_path_free(). If @column is non-[`None`], then it will be filled
2250 /// with the column at that point. @cell_x and @cell_y return the coordinates
2251 /// relative to the cell background (i.e. the @background_area passed to
2252 /// gtk_cell_renderer_render()). This function is only meaningful if
2253 /// @self is realized. Therefore this function will always return [`false`]
2254 /// if @self is not realized or does not have a model.
2255 ///
2256 /// For converting widget coordinates (eg. the ones you get from
2257 /// GtkWidget::query-tooltip), please see
2258 /// gtk_tree_view_convert_widget_to_bin_window_coords().
2259 ///
2260 /// # Deprecated since 4.10
2261 ///
2262 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
2263 /// ## `x`
2264 /// The x position to be identified (relative to bin_window).
2265 /// ## `y`
2266 /// The y position to be identified (relative to bin_window).
2267 ///
2268 /// # Returns
2269 ///
2270 /// [`true`] if a row exists at that coordinate.
2271 ///
2272 /// ## `path`
2273 /// A pointer to a [`TreePath`][crate::TreePath]
2274 /// pointer to be filled in
2275 ///
2276 /// ## `column`
2277 /// A pointer to
2278 /// a [`TreeViewColumn`][crate::TreeViewColumn] pointer to be filled in
2279 ///
2280 /// ## `cell_x`
2281 /// A pointer where the X coordinate
2282 /// relative to the cell can be placed
2283 ///
2284 /// ## `cell_y`
2285 /// A pointer where the Y coordinate
2286 /// relative to the cell can be placed
2287 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2288 #[allow(deprecated)]
2289 #[doc(alias = "gtk_tree_view_get_path_at_pos")]
2290 #[doc(alias = "get_path_at_pos")]
2291 fn path_at_pos(
2292 &self,
2293 x: i32,
2294 y: i32,
2295 ) -> Option<(Option<TreePath>, Option<TreeViewColumn>, i32, i32)> {
2296 unsafe {
2297 let mut path = std::ptr::null_mut();
2298 let mut column = std::ptr::null_mut();
2299 let mut cell_x = std::mem::MaybeUninit::uninit();
2300 let mut cell_y = std::mem::MaybeUninit::uninit();
2301 let ret = from_glib(ffi::gtk_tree_view_get_path_at_pos(
2302 self.as_ref().to_glib_none().0,
2303 x,
2304 y,
2305 &mut path,
2306 &mut column,
2307 cell_x.as_mut_ptr(),
2308 cell_y.as_mut_ptr(),
2309 ));
2310 if ret {
2311 Some((
2312 from_glib_full(path),
2313 from_glib_none(column),
2314 cell_x.assume_init(),
2315 cell_y.assume_init(),
2316 ))
2317 } else {
2318 None
2319 }
2320 }
2321 }
2322
2323 /// Retrieves whether the user can reorder the tree via drag-and-drop. See
2324 /// gtk_tree_view_set_reorderable().
2325 ///
2326 /// # Deprecated since 4.10
2327 ///
2328 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
2329 ///
2330 /// # Returns
2331 ///
2332 /// [`true`] if the tree can be reordered.
2333 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2334 #[allow(deprecated)]
2335 #[doc(alias = "gtk_tree_view_get_reorderable")]
2336 #[doc(alias = "get_reorderable")]
2337 #[doc(alias = "reorderable")]
2338 fn is_reorderable(&self) -> bool {
2339 unsafe {
2340 from_glib(ffi::gtk_tree_view_get_reorderable(
2341 self.as_ref().to_glib_none().0,
2342 ))
2343 }
2344 }
2345
2346 /// Returns whether rubber banding is turned on for @self. If the
2347 /// selection mode is [`SelectionMode::Multiple`][crate::SelectionMode::Multiple], rubber banding will allow the
2348 /// user to select multiple rows by dragging the mouse.
2349 ///
2350 /// # Deprecated since 4.10
2351 ///
2352 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
2353 ///
2354 /// # Returns
2355 ///
2356 /// [`true`] if rubber banding in @self is enabled.
2357 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2358 #[allow(deprecated)]
2359 #[doc(alias = "gtk_tree_view_get_rubber_banding")]
2360 #[doc(alias = "get_rubber_banding")]
2361 #[doc(alias = "rubber-banding")]
2362 fn is_rubber_banding(&self) -> bool {
2363 unsafe {
2364 from_glib(ffi::gtk_tree_view_get_rubber_banding(
2365 self.as_ref().to_glib_none().0,
2366 ))
2367 }
2368 }
2369
2370 /// Gets the column searched on by the interactive search code.
2371 ///
2372 /// # Deprecated since 4.10
2373 ///
2374 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
2375 ///
2376 /// # Returns
2377 ///
2378 /// the column the interactive search code searches in.
2379 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2380 #[allow(deprecated)]
2381 #[doc(alias = "gtk_tree_view_get_search_column")]
2382 #[doc(alias = "get_search_column")]
2383 #[doc(alias = "search-column")]
2384 fn search_column(&self) -> i32 {
2385 unsafe { ffi::gtk_tree_view_get_search_column(self.as_ref().to_glib_none().0) }
2386 }
2387
2388 /// Returns the [`Entry`][crate::Entry] which is currently in use as interactive search
2389 /// entry for @self. In case the built-in entry is being used, [`None`]
2390 /// will be returned.
2391 ///
2392 /// # Deprecated since 4.10
2393 ///
2394 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
2395 ///
2396 /// # Returns
2397 ///
2398 /// the entry currently in use as search entry.
2399 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2400 #[allow(deprecated)]
2401 #[doc(alias = "gtk_tree_view_get_search_entry")]
2402 #[doc(alias = "get_search_entry")]
2403 fn search_entry(&self) -> Option<Editable> {
2404 unsafe {
2405 from_glib_none(ffi::gtk_tree_view_get_search_entry(
2406 self.as_ref().to_glib_none().0,
2407 ))
2408 }
2409 }
2410
2411 /// Gets the [`TreeSelection`][crate::TreeSelection] associated with @self.
2412 ///
2413 /// # Deprecated since 4.10
2414 ///
2415 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
2416 ///
2417 /// # Returns
2418 ///
2419 /// A [`TreeSelection`][crate::TreeSelection] object.
2420 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2421 #[allow(deprecated)]
2422 #[doc(alias = "gtk_tree_view_get_selection")]
2423 #[doc(alias = "get_selection")]
2424 fn selection(&self) -> TreeSelection {
2425 unsafe {
2426 from_glib_none(ffi::gtk_tree_view_get_selection(
2427 self.as_ref().to_glib_none().0,
2428 ))
2429 }
2430 }
2431
2432 /// Returns whether or not expanders are drawn in @self.
2433 ///
2434 /// # Deprecated since 4.10
2435 ///
2436 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
2437 ///
2438 /// # Returns
2439 ///
2440 /// [`true`] if expanders are drawn in @self, [`false`]
2441 /// otherwise.
2442 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2443 #[allow(deprecated)]
2444 #[doc(alias = "gtk_tree_view_get_show_expanders")]
2445 #[doc(alias = "get_show_expanders")]
2446 #[doc(alias = "show-expanders")]
2447 fn shows_expanders(&self) -> bool {
2448 unsafe {
2449 from_glib(ffi::gtk_tree_view_get_show_expanders(
2450 self.as_ref().to_glib_none().0,
2451 ))
2452 }
2453 }
2454
2455 /// s rows.
2456 ///
2457 /// # Deprecated since 4.10
2458 ///
2459 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
2460 ///
2461 /// # Returns
2462 ///
2463 /// the index of the tooltip column that is currently being
2464 /// used, or -1 if this is disabled.
2465 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2466 #[allow(deprecated)]
2467 #[doc(alias = "gtk_tree_view_get_tooltip_column")]
2468 #[doc(alias = "get_tooltip_column")]
2469 #[doc(alias = "tooltip-column")]
2470 fn tooltip_column(&self) -> i32 {
2471 unsafe { ffi::gtk_tree_view_get_tooltip_column(self.as_ref().to_glib_none().0) }
2472 }
2473
2474 /// s bin_window if @keyboard_tooltip is [`false`].
2475 ///
2476 /// # Deprecated since 4.10
2477 ///
2478 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
2479 /// ## `x`
2480 /// the x coordinate (relative to widget coordinates)
2481 /// ## `y`
2482 /// the y coordinate (relative to widget coordinates)
2483 /// ## `keyboard_tip`
2484 /// whether this is a keyboard tooltip or not
2485 ///
2486 /// # Returns
2487 ///
2488 /// whether or not the given tooltip context points to a row
2489 ///
2490 /// ## `model`
2491 /// a pointer to
2492 /// receive a [`TreeModel`][crate::TreeModel]
2493 ///
2494 /// ## `path`
2495 /// a pointer to receive a [`TreePath`][crate::TreePath]
2496 ///
2497 /// ## `iter`
2498 /// a pointer to receive a [`TreeIter`][crate::TreeIter]
2499 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2500 #[allow(deprecated)]
2501 #[doc(alias = "gtk_tree_view_get_tooltip_context")]
2502 #[doc(alias = "get_tooltip_context")]
2503 fn tooltip_context(
2504 &self,
2505 x: i32,
2506 y: i32,
2507 keyboard_tip: bool,
2508 ) -> Option<(Option<TreeModel>, TreePath, TreeIter)> {
2509 unsafe {
2510 let mut model = std::ptr::null_mut();
2511 let mut path = std::ptr::null_mut();
2512 let mut iter = TreeIter::uninitialized();
2513 let ret = from_glib(ffi::gtk_tree_view_get_tooltip_context(
2514 self.as_ref().to_glib_none().0,
2515 x,
2516 y,
2517 keyboard_tip.into_glib(),
2518 &mut model,
2519 &mut path,
2520 iter.to_glib_none_mut().0,
2521 ));
2522 if ret {
2523 Some((from_glib_none(model), from_glib_full(path), iter))
2524 } else {
2525 None
2526 }
2527 }
2528 }
2529
2530 /// Sets @start_path and @end_path to be the first and last visible path.
2531 /// Note that there may be invisible paths in between.
2532 ///
2533 /// The paths should be freed with gtk_tree_path_free() after use.
2534 ///
2535 /// # Deprecated since 4.10
2536 ///
2537 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
2538 ///
2539 /// # Returns
2540 ///
2541 /// [`true`], if valid paths were placed in @start_path and @end_path.
2542 ///
2543 /// ## `start_path`
2544 /// Return location for start of region
2545 ///
2546 /// ## `end_path`
2547 /// Return location for end of region
2548 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2549 #[allow(deprecated)]
2550 #[doc(alias = "gtk_tree_view_get_visible_range")]
2551 #[doc(alias = "get_visible_range")]
2552 fn visible_range(&self) -> Option<(TreePath, TreePath)> {
2553 unsafe {
2554 let mut start_path = std::ptr::null_mut();
2555 let mut end_path = std::ptr::null_mut();
2556 let ret = from_glib(ffi::gtk_tree_view_get_visible_range(
2557 self.as_ref().to_glib_none().0,
2558 &mut start_path,
2559 &mut end_path,
2560 ));
2561 if ret {
2562 Some((from_glib_full(start_path), from_glib_full(end_path)))
2563 } else {
2564 None
2565 }
2566 }
2567 }
2568
2569 /// Fills @visible_rect with the currently-visible region of the
2570 /// buffer, in tree coordinates. Convert to bin_window coordinates with
2571 /// gtk_tree_view_convert_tree_to_bin_window_coords().
2572 /// Tree coordinates start at 0,0 for row 0 of the tree, and cover the entire
2573 /// scrollable area of the tree.
2574 ///
2575 /// # Deprecated since 4.10
2576 ///
2577 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
2578 ///
2579 /// # Returns
2580 ///
2581 ///
2582 /// ## `visible_rect`
2583 /// rectangle to fill
2584 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2585 #[allow(deprecated)]
2586 #[doc(alias = "gtk_tree_view_get_visible_rect")]
2587 #[doc(alias = "get_visible_rect")]
2588 fn visible_rect(&self) -> gdk::Rectangle {
2589 unsafe {
2590 let mut visible_rect = gdk::Rectangle::uninitialized();
2591 ffi::gtk_tree_view_get_visible_rect(
2592 self.as_ref().to_glib_none().0,
2593 visible_rect.to_glib_none_mut().0,
2594 );
2595 visible_rect
2596 }
2597 }
2598
2599 /// property
2600 /// set to be GTK_TREE_VIEW_COLUMN_FIXED.
2601 ///
2602 /// # Deprecated since 4.10
2603 ///
2604 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
2605 /// ## `column`
2606 /// The [`TreeViewColumn`][crate::TreeViewColumn] to be inserted.
2607 /// ## `position`
2608 /// The position to insert @column in.
2609 ///
2610 /// # Returns
2611 ///
2612 /// The number of columns in @self after insertion.
2613 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2614 #[allow(deprecated)]
2615 #[doc(alias = "gtk_tree_view_insert_column")]
2616 fn insert_column(&self, column: &TreeViewColumn, position: i32) -> i32 {
2617 unsafe {
2618 ffi::gtk_tree_view_insert_column(
2619 self.as_ref().to_glib_none().0,
2620 column.to_glib_none().0,
2621 position,
2622 )
2623 }
2624 }
2625
2626 /// property set to be GTK_TREE_VIEW_COLUMN_FIXED.
2627 ///
2628 /// # Deprecated since 4.10
2629 ///
2630 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
2631 /// ## `position`
2632 /// Position to insert, -1 for append
2633 /// ## `title`
2634 /// column title
2635 /// ## `cell`
2636 /// cell renderer for column
2637 /// ## `func`
2638 /// function to set attributes of cell renderer
2639 ///
2640 /// # Returns
2641 ///
2642 /// number of columns in the tree view post-insert
2643 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2644 #[allow(deprecated)]
2645 #[doc(alias = "gtk_tree_view_insert_column_with_data_func")]
2646 fn insert_column_with_data_func<
2647 P: Fn(&TreeViewColumn, &CellRenderer, &TreeModel, &TreeIter) + 'static,
2648 >(
2649 &self,
2650 position: i32,
2651 title: &str,
2652 cell: &impl IsA<CellRenderer>,
2653 func: P,
2654 ) -> i32 {
2655 let func_data: Box_<P> = Box_::new(func);
2656 unsafe extern "C" fn func_func<
2657 P: Fn(&TreeViewColumn, &CellRenderer, &TreeModel, &TreeIter) + 'static,
2658 >(
2659 tree_column: *mut ffi::GtkTreeViewColumn,
2660 cell: *mut ffi::GtkCellRenderer,
2661 tree_model: *mut ffi::GtkTreeModel,
2662 iter: *mut ffi::GtkTreeIter,
2663 data: glib::ffi::gpointer,
2664 ) {
2665 unsafe {
2666 let tree_column = from_glib_borrow(tree_column);
2667 let cell = from_glib_borrow(cell);
2668 let tree_model = from_glib_borrow(tree_model);
2669 let iter = from_glib_borrow(iter);
2670 let callback = &*(data as *mut P);
2671 (*callback)(&tree_column, &cell, &tree_model, &iter)
2672 }
2673 }
2674 let func = Some(func_func::<P> as _);
2675 unsafe extern "C" fn dnotify_func<
2676 P: Fn(&TreeViewColumn, &CellRenderer, &TreeModel, &TreeIter) + 'static,
2677 >(
2678 data: glib::ffi::gpointer,
2679 ) {
2680 unsafe {
2681 let _callback = Box_::from_raw(data as *mut P);
2682 }
2683 }
2684 let destroy_call6 = Some(dnotify_func::<P> as _);
2685 let super_callback0: Box_<P> = func_data;
2686 unsafe {
2687 ffi::gtk_tree_view_insert_column_with_data_func(
2688 self.as_ref().to_glib_none().0,
2689 position,
2690 title.to_glib_none().0,
2691 cell.as_ref().to_glib_none().0,
2692 func,
2693 Box_::into_raw(super_callback0) as *mut _,
2694 destroy_call6,
2695 )
2696 }
2697 }
2698
2699 /// Determine whether the point (@x, @y) in @self is blank, that is no
2700 /// cell content nor an expander arrow is drawn at the location. If so, the
2701 /// location can be considered as the background. You might wish to take
2702 /// special action on clicks on the background, such as clearing a current
2703 /// selection, having a custom context menu or starting rubber banding.
2704 ///
2705 /// The @x and @y coordinate that are provided must be relative to bin_window
2706 /// coordinates. Widget-relative coordinates must be converted using
2707 /// gtk_tree_view_convert_widget_to_bin_window_coords().
2708 ///
2709 /// For converting widget coordinates (eg. the ones you get from
2710 /// GtkWidget::query-tooltip), please see
2711 /// gtk_tree_view_convert_widget_to_bin_window_coords().
2712 ///
2713 /// The @path, @column, @cell_x and @cell_y arguments will be filled in
2714 /// likewise as for gtk_tree_view_get_path_at_pos(). Please see
2715 /// gtk_tree_view_get_path_at_pos() for more information.
2716 ///
2717 /// # Deprecated since 4.10
2718 ///
2719 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
2720 /// ## `x`
2721 /// The x position to be identified (relative to bin_window)
2722 /// ## `y`
2723 /// The y position to be identified (relative to bin_window)
2724 ///
2725 /// # Returns
2726 ///
2727 /// [`true`] if the area at the given coordinates is blank,
2728 /// [`false`] otherwise.
2729 ///
2730 /// ## `path`
2731 /// A pointer to a [`TreePath`][crate::TreePath] pointer to
2732 /// be filled in
2733 ///
2734 /// ## `column`
2735 /// A pointer to a
2736 /// [`TreeViewColumn`][crate::TreeViewColumn] pointer to be filled in
2737 ///
2738 /// ## `cell_x`
2739 /// A pointer where the X coordinate relative to the
2740 /// cell can be placed
2741 ///
2742 /// ## `cell_y`
2743 /// A pointer where the Y coordinate relative to the
2744 /// cell can be placed
2745 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2746 #[allow(deprecated)]
2747 #[doc(alias = "gtk_tree_view_is_blank_at_pos")]
2748 fn is_blank_at_pos(
2749 &self,
2750 x: i32,
2751 y: i32,
2752 ) -> Option<(Option<TreePath>, Option<TreeViewColumn>, i32, i32)> {
2753 unsafe {
2754 let mut path = std::ptr::null_mut();
2755 let mut column = std::ptr::null_mut();
2756 let mut cell_x = std::mem::MaybeUninit::uninit();
2757 let mut cell_y = std::mem::MaybeUninit::uninit();
2758 let ret = from_glib(ffi::gtk_tree_view_is_blank_at_pos(
2759 self.as_ref().to_glib_none().0,
2760 x,
2761 y,
2762 &mut path,
2763 &mut column,
2764 cell_x.as_mut_ptr(),
2765 cell_y.as_mut_ptr(),
2766 ));
2767 if ret {
2768 Some((
2769 from_glib_full(path),
2770 from_glib_none(column),
2771 cell_x.assume_init(),
2772 cell_y.assume_init(),
2773 ))
2774 } else {
2775 None
2776 }
2777 }
2778 }
2779
2780 /// Returns whether a rubber banding operation is currently being done
2781 /// in @self.
2782 ///
2783 /// # Deprecated since 4.10
2784 ///
2785 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
2786 ///
2787 /// # Returns
2788 ///
2789 /// [`true`] if a rubber banding operation is currently being
2790 /// done in @self.
2791 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2792 #[allow(deprecated)]
2793 #[doc(alias = "gtk_tree_view_is_rubber_banding_active")]
2794 fn is_rubber_banding_active(&self) -> bool {
2795 unsafe {
2796 from_glib(ffi::gtk_tree_view_is_rubber_banding_active(
2797 self.as_ref().to_glib_none().0,
2798 ))
2799 }
2800 }
2801
2802 /// Calls @func on all expanded rows.
2803 ///
2804 /// # Deprecated since 4.10
2805 ///
2806 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
2807 /// ## `func`
2808 /// A function to be called
2809 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2810 #[allow(deprecated)]
2811 #[doc(alias = "gtk_tree_view_map_expanded_rows")]
2812 fn map_expanded_rows<P: FnMut(&TreeView, &TreePath)>(&self, func: P) {
2813 let mut func_data: P = func;
2814 unsafe extern "C" fn func_func<P: FnMut(&TreeView, &TreePath)>(
2815 tree_view: *mut ffi::GtkTreeView,
2816 path: *mut ffi::GtkTreePath,
2817 user_data: glib::ffi::gpointer,
2818 ) {
2819 unsafe {
2820 let tree_view = from_glib_borrow(tree_view);
2821 let path = from_glib_borrow(path);
2822 let callback = user_data as *mut P;
2823 (*callback)(&tree_view, &path)
2824 }
2825 }
2826 let func = Some(func_func::<P> as _);
2827 let super_callback0: &mut P = &mut func_data;
2828 unsafe {
2829 ffi::gtk_tree_view_map_expanded_rows(
2830 self.as_ref().to_glib_none().0,
2831 func,
2832 super_callback0 as *mut _ as *mut _,
2833 );
2834 }
2835 }
2836
2837 /// Moves @column to be after to @base_column. If @base_column is [`None`], then
2838 /// @column is placed in the first position.
2839 ///
2840 /// # Deprecated since 4.10
2841 ///
2842 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
2843 /// ## `column`
2844 /// The [`TreeViewColumn`][crate::TreeViewColumn] to be moved.
2845 /// ## `base_column`
2846 /// The [`TreeViewColumn`][crate::TreeViewColumn] to be moved relative to
2847 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2848 #[allow(deprecated)]
2849 #[doc(alias = "gtk_tree_view_move_column_after")]
2850 fn move_column_after(&self, column: &TreeViewColumn, base_column: Option<&TreeViewColumn>) {
2851 unsafe {
2852 ffi::gtk_tree_view_move_column_after(
2853 self.as_ref().to_glib_none().0,
2854 column.to_glib_none().0,
2855 base_column.to_glib_none().0,
2856 );
2857 }
2858 }
2859
2860 /// Removes @column from @self.
2861 ///
2862 /// # Deprecated since 4.10
2863 ///
2864 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
2865 /// ## `column`
2866 /// The [`TreeViewColumn`][crate::TreeViewColumn] to remove.
2867 ///
2868 /// # Returns
2869 ///
2870 /// The number of columns in @self after removing.
2871 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2872 #[allow(deprecated)]
2873 #[doc(alias = "gtk_tree_view_remove_column")]
2874 fn remove_column(&self, column: &TreeViewColumn) -> i32 {
2875 unsafe {
2876 ffi::gtk_tree_view_remove_column(
2877 self.as_ref().to_glib_none().0,
2878 column.to_glib_none().0,
2879 )
2880 }
2881 }
2882
2883 /// Activates the cell determined by @path and @column.
2884 ///
2885 /// # Deprecated since 4.10
2886 ///
2887 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
2888 /// ## `path`
2889 /// The [`TreePath`][crate::TreePath] to be activated.
2890 /// ## `column`
2891 /// The [`TreeViewColumn`][crate::TreeViewColumn] to be activated.
2892 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2893 #[allow(deprecated)]
2894 #[doc(alias = "gtk_tree_view_row_activated")]
2895 fn row_activated(&self, path: &TreePath, column: Option<&TreeViewColumn>) {
2896 unsafe {
2897 ffi::gtk_tree_view_row_activated(
2898 self.as_ref().to_glib_none().0,
2899 mut_override(path.to_glib_none().0),
2900 column.to_glib_none().0,
2901 );
2902 }
2903 }
2904
2905 /// Returns [`true`] if the node pointed to by @path is expanded in @self.
2906 ///
2907 /// # Deprecated since 4.10
2908 ///
2909 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
2910 /// ## `path`
2911 /// A [`TreePath`][crate::TreePath] to test expansion state.
2912 ///
2913 /// # Returns
2914 ///
2915 /// [`true`] if #path is expanded.
2916 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2917 #[allow(deprecated)]
2918 #[doc(alias = "gtk_tree_view_row_expanded")]
2919 fn row_expanded(&self, path: &TreePath) -> bool {
2920 unsafe {
2921 from_glib(ffi::gtk_tree_view_row_expanded(
2922 self.as_ref().to_glib_none().0,
2923 mut_override(path.to_glib_none().0),
2924 ))
2925 }
2926 }
2927
2928 /// Moves the alignments of @self to the position specified by @column and
2929 /// @path. If @column is [`None`], then no horizontal scrolling occurs. Likewise,
2930 /// if @path is [`None`] no vertical scrolling occurs. At a minimum, one of @column
2931 /// or @path need to be non-[`None`]. @row_align determines where the row is
2932 /// placed, and @col_align determines where @column is placed. Both are expected
2933 /// to be between 0.0 and 1.0. 0.0 means left/top alignment, 1.0 means
2934 /// right/bottom alignment, 0.5 means center.
2935 ///
2936 /// If @use_align is [`false`], then the alignment arguments are ignored, and the
2937 /// tree does the minimum amount of work to scroll the cell onto the screen.
2938 /// This means that the cell will be scrolled to the edge closest to its current
2939 /// position. If the cell is currently visible on the screen, nothing is done.
2940 ///
2941 /// This function only works if the model is set, and @path is a valid row on the
2942 /// model. If the model changes before the @self is realized, the centered
2943 /// path will be modified to reflect this change.
2944 ///
2945 /// # Deprecated since 4.10
2946 ///
2947 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
2948 /// ## `path`
2949 /// The path of the row to move to
2950 /// ## `column`
2951 /// The [`TreeViewColumn`][crate::TreeViewColumn] to move horizontally to
2952 /// ## `use_align`
2953 /// whether to use alignment arguments, or [`false`].
2954 /// ## `row_align`
2955 /// The vertical alignment of the row specified by @path.
2956 /// ## `col_align`
2957 /// The horizontal alignment of the column specified by @column.
2958 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2959 #[allow(deprecated)]
2960 #[doc(alias = "gtk_tree_view_scroll_to_cell")]
2961 fn scroll_to_cell(
2962 &self,
2963 path: Option<&TreePath>,
2964 column: Option<&TreeViewColumn>,
2965 use_align: bool,
2966 row_align: f32,
2967 col_align: f32,
2968 ) {
2969 unsafe {
2970 ffi::gtk_tree_view_scroll_to_cell(
2971 self.as_ref().to_glib_none().0,
2972 mut_override(path.to_glib_none().0),
2973 column.to_glib_none().0,
2974 use_align.into_glib(),
2975 row_align,
2976 col_align,
2977 );
2978 }
2979 }
2980
2981 /// t scrolled.
2982 ///
2983 /// # Deprecated since 4.10
2984 ///
2985 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
2986 /// ## `tree_x`
2987 /// X coordinate of new top-left pixel of visible area, or -1
2988 /// ## `tree_y`
2989 /// Y coordinate of new top-left pixel of visible area, or -1
2990 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
2991 #[allow(deprecated)]
2992 #[doc(alias = "gtk_tree_view_scroll_to_point")]
2993 fn scroll_to_point(&self, tree_x: i32, tree_y: i32) {
2994 unsafe {
2995 ffi::gtk_tree_view_scroll_to_point(self.as_ref().to_glib_none().0, tree_x, tree_y);
2996 }
2997 }
2998
2999 /// Cause the [`TreeView`][crate::TreeView]::row-activated signal to be emitted
3000 /// on a single click instead of a double click.
3001 ///
3002 /// # Deprecated since 4.10
3003 ///
3004 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
3005 /// ## `single`
3006 /// [`true`] to emit row-activated on a single click
3007 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
3008 #[allow(deprecated)]
3009 #[doc(alias = "gtk_tree_view_set_activate_on_single_click")]
3010 #[doc(alias = "activate-on-single-click")]
3011 fn set_activate_on_single_click(&self, single: bool) {
3012 unsafe {
3013 ffi::gtk_tree_view_set_activate_on_single_click(
3014 self.as_ref().to_glib_none().0,
3015 single.into_glib(),
3016 );
3017 }
3018 }
3019
3020 /// Sets a user function for determining where a column may be dropped when
3021 /// dragged. This function is called on every column pair in turn at the
3022 /// beginning of a column drag to determine where a drop can take place. The
3023 /// arguments passed to @func are: the @self, the [`TreeViewColumn`][crate::TreeViewColumn] being
3024 /// dragged, the two [`TreeViewColumn`][crate::TreeViewColumn]s determining the drop spot, and
3025 /// @user_data. If either of the [`TreeViewColumn`][crate::TreeViewColumn] arguments for the drop spot
3026 /// are [`None`], then they indicate an edge. If @func is set to be [`None`], then
3027 /// @self reverts to the default behavior of allowing all columns to be
3028 /// dropped everywhere.
3029 ///
3030 /// # Deprecated since 4.10
3031 ///
3032 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
3033 /// ## `func`
3034 /// A function to determine which columns are reorderable
3035 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
3036 #[allow(deprecated)]
3037 #[doc(alias = "gtk_tree_view_set_column_drag_function")]
3038 fn set_column_drag_function(
3039 &self,
3040 func: Option<
3041 Box_<
3042 dyn Fn(&TreeView, &TreeViewColumn, &TreeViewColumn, &TreeViewColumn) -> bool
3043 + 'static,
3044 >,
3045 >,
3046 ) {
3047 let func_data: Box_<
3048 Option<
3049 Box_<
3050 dyn Fn(&TreeView, &TreeViewColumn, &TreeViewColumn, &TreeViewColumn) -> bool
3051 + 'static,
3052 >,
3053 >,
3054 > = Box_::new(func);
3055 unsafe extern "C" fn func_func(
3056 tree_view: *mut ffi::GtkTreeView,
3057 column: *mut ffi::GtkTreeViewColumn,
3058 prev_column: *mut ffi::GtkTreeViewColumn,
3059 next_column: *mut ffi::GtkTreeViewColumn,
3060 data: glib::ffi::gpointer,
3061 ) -> glib::ffi::gboolean {
3062 unsafe {
3063 let tree_view = from_glib_borrow(tree_view);
3064 let column = from_glib_borrow(column);
3065 let prev_column = from_glib_borrow(prev_column);
3066 let next_column = from_glib_borrow(next_column);
3067 let callback = &*(data as *mut Option<
3068 Box_<
3069 dyn Fn(&TreeView, &TreeViewColumn, &TreeViewColumn, &TreeViewColumn) -> bool
3070 + 'static,
3071 >,
3072 >);
3073 if let Some(ref callback) = *callback {
3074 callback(&tree_view, &column, &prev_column, &next_column)
3075 } else {
3076 panic!("cannot get closure...")
3077 }
3078 .into_glib()
3079 }
3080 }
3081 let func = if func_data.is_some() {
3082 Some(func_func as _)
3083 } else {
3084 None
3085 };
3086 unsafe extern "C" fn destroy_func(data: glib::ffi::gpointer) {
3087 unsafe {
3088 let _callback = Box_::from_raw(
3089 data as *mut Option<
3090 Box_<
3091 dyn Fn(
3092 &TreeView,
3093 &TreeViewColumn,
3094 &TreeViewColumn,
3095 &TreeViewColumn,
3096 ) -> bool
3097 + 'static,
3098 >,
3099 >,
3100 );
3101 }
3102 }
3103 let destroy_call3 = Some(destroy_func as _);
3104 let super_callback0: Box_<
3105 Option<
3106 Box_<
3107 dyn Fn(&TreeView, &TreeViewColumn, &TreeViewColumn, &TreeViewColumn) -> bool
3108 + 'static,
3109 >,
3110 >,
3111 > = func_data;
3112 unsafe {
3113 ffi::gtk_tree_view_set_column_drag_function(
3114 self.as_ref().to_glib_none().0,
3115 func,
3116 Box_::into_raw(super_callback0) as *mut _,
3117 destroy_call3,
3118 );
3119 }
3120 }
3121
3122 /// s attention on a particular row. If
3123 /// @focus_column is not [`None`], then focus is given to the column specified by
3124 /// it. Additionally, if @focus_column is specified, and @start_editing is
3125 /// [`true`], then editing should be started in the specified cell.
3126 /// This function is often followed by @gtk_widget_grab_focus (@self)
3127 /// in order to give keyboard focus to the widget. Please note that editing
3128 /// can only happen when the widget is realized.
3129 ///
3130 /// If @path is invalid for @model, the current cursor (if any) will be unset
3131 /// and the function will return without failing.
3132 ///
3133 /// # Deprecated since 4.10
3134 ///
3135 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
3136 /// ## `path`
3137 /// A [`TreePath`][crate::TreePath]
3138 /// ## `focus_column`
3139 /// A [`TreeViewColumn`][crate::TreeViewColumn]
3140 /// ## `start_editing`
3141 /// [`true`] if the specified cell should start being edited.
3142 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
3143 #[allow(deprecated)]
3144 #[doc(alias = "gtk_tree_view_set_cursor")]
3145 fn set_cursor(
3146 &self,
3147 path: &TreePath,
3148 focus_column: Option<&TreeViewColumn>,
3149 start_editing: bool,
3150 ) {
3151 unsafe {
3152 ffi::gtk_tree_view_set_cursor(
3153 self.as_ref().to_glib_none().0,
3154 mut_override(path.to_glib_none().0),
3155 focus_column.to_glib_none().0,
3156 start_editing.into_glib(),
3157 );
3158 }
3159 }
3160
3161 /// s attention on a particular row. If
3162 /// @focus_column is not [`None`], then focus is given to the column specified by
3163 /// it. If @focus_column and @focus_cell are not [`None`], and @focus_column
3164 /// contains 2 or more editable or activatable cells, then focus is given to
3165 /// the cell specified by @focus_cell. Additionally, if @focus_column is
3166 /// specified, and @start_editing is [`true`], then editing should be started in
3167 /// the specified cell. This function is often followed by
3168 /// @gtk_widget_grab_focus (@self) in order to give keyboard focus to the
3169 /// widget. Please note that editing can only happen when the widget is
3170 /// realized.
3171 ///
3172 /// If @path is invalid for @model, the current cursor (if any) will be unset
3173 /// and the function will return without failing.
3174 ///
3175 /// # Deprecated since 4.10
3176 ///
3177 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
3178 /// ## `path`
3179 /// A [`TreePath`][crate::TreePath]
3180 /// ## `focus_column`
3181 /// A [`TreeViewColumn`][crate::TreeViewColumn]
3182 /// ## `focus_cell`
3183 /// A [`CellRenderer`][crate::CellRenderer]
3184 /// ## `start_editing`
3185 /// [`true`] if the specified cell should start being edited.
3186 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
3187 #[allow(deprecated)]
3188 #[doc(alias = "gtk_tree_view_set_cursor_on_cell")]
3189 fn set_cursor_on_cell(
3190 &self,
3191 path: &TreePath,
3192 focus_column: Option<&TreeViewColumn>,
3193 focus_cell: Option<&impl IsA<CellRenderer>>,
3194 start_editing: bool,
3195 ) {
3196 unsafe {
3197 ffi::gtk_tree_view_set_cursor_on_cell(
3198 self.as_ref().to_glib_none().0,
3199 mut_override(path.to_glib_none().0),
3200 focus_column.to_glib_none().0,
3201 focus_cell.map(|p| p.as_ref()).to_glib_none().0,
3202 start_editing.into_glib(),
3203 );
3204 }
3205 }
3206
3207 /// Sets the row that is highlighted for feedback.
3208 /// If @path is [`None`], an existing highlight is removed.
3209 ///
3210 /// # Deprecated since 4.10
3211 ///
3212 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
3213 /// ## `path`
3214 /// The path of the row to highlight
3215 /// ## `pos`
3216 /// Specifies whether to drop before, after or into the row
3217 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
3218 #[allow(deprecated)]
3219 #[doc(alias = "gtk_tree_view_set_drag_dest_row")]
3220 fn set_drag_dest_row(&self, path: Option<&TreePath>, pos: TreeViewDropPosition) {
3221 unsafe {
3222 ffi::gtk_tree_view_set_drag_dest_row(
3223 self.as_ref().to_glib_none().0,
3224 mut_override(path.to_glib_none().0),
3225 pos.into_glib(),
3226 );
3227 }
3228 }
3229
3230 /// key binding.
3231 ///
3232 /// # Deprecated since 4.10
3233 ///
3234 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
3235 /// ## `enable_search`
3236 /// [`true`], if the user can search interactively
3237 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
3238 #[allow(deprecated)]
3239 #[doc(alias = "gtk_tree_view_set_enable_search")]
3240 #[doc(alias = "enable-search")]
3241 fn set_enable_search(&self, enable_search: bool) {
3242 unsafe {
3243 ffi::gtk_tree_view_set_enable_search(
3244 self.as_ref().to_glib_none().0,
3245 enable_search.into_glib(),
3246 );
3247 }
3248 }
3249
3250 /// Sets whether to draw lines interconnecting the expanders in @self.
3251 /// This does not have any visible effects for lists.
3252 ///
3253 /// # Deprecated since 4.10
3254 ///
3255 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
3256 /// ## `enabled`
3257 /// [`true`] to enable tree line drawing, [`false`] otherwise.
3258 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
3259 #[allow(deprecated)]
3260 #[doc(alias = "gtk_tree_view_set_enable_tree_lines")]
3261 #[doc(alias = "enable-tree-lines")]
3262 fn set_enable_tree_lines(&self, enabled: bool) {
3263 unsafe {
3264 ffi::gtk_tree_view_set_enable_tree_lines(
3265 self.as_ref().to_glib_none().0,
3266 enabled.into_glib(),
3267 );
3268 }
3269 }
3270
3271 /// Sets the column to draw the expander arrow at. It must be in @self.
3272 /// If @column is [`None`], then the expander arrow is always at the first
3273 /// visible column.
3274 ///
3275 /// If you do not want expander arrow to appear in your tree, set the
3276 /// expander column to a hidden column.
3277 ///
3278 /// # Deprecated since 4.10
3279 ///
3280 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
3281 /// ## `column`
3282 /// [`None`], or the column to draw the expander arrow at.
3283 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
3284 #[allow(deprecated)]
3285 #[doc(alias = "gtk_tree_view_set_expander_column")]
3286 #[doc(alias = "expander-column")]
3287 fn set_expander_column(&self, column: Option<&TreeViewColumn>) {
3288 unsafe {
3289 ffi::gtk_tree_view_set_expander_column(
3290 self.as_ref().to_glib_none().0,
3291 column.to_glib_none().0,
3292 );
3293 }
3294 }
3295
3296 /// Enables or disables the fixed height mode of @self.
3297 /// Fixed height mode speeds up [`TreeView`][crate::TreeView] by assuming that all
3298 /// rows have the same height.
3299 /// Only enable this option if all rows are the same height and all
3300 /// columns are of type [`TreeViewColumnSizing::Fixed`][crate::TreeViewColumnSizing::Fixed].
3301 ///
3302 /// # Deprecated since 4.10
3303 ///
3304 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
3305 /// ## `enable`
3306 /// [`true`] to enable fixed height mode
3307 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
3308 #[allow(deprecated)]
3309 #[doc(alias = "gtk_tree_view_set_fixed_height_mode")]
3310 #[doc(alias = "fixed-height-mode")]
3311 fn set_fixed_height_mode(&self, enable: bool) {
3312 unsafe {
3313 ffi::gtk_tree_view_set_fixed_height_mode(
3314 self.as_ref().to_glib_none().0,
3315 enable.into_glib(),
3316 );
3317 }
3318 }
3319
3320 /// Sets which grid lines to draw in @self.
3321 ///
3322 /// # Deprecated since 4.10
3323 ///
3324 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
3325 /// ## `grid_lines`
3326 /// a [`TreeView`][crate::TreeView]GridLines value indicating which grid lines to
3327 /// enable.
3328 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
3329 #[allow(deprecated)]
3330 #[doc(alias = "gtk_tree_view_set_grid_lines")]
3331 fn set_grid_lines(&self, grid_lines: TreeViewGridLines) {
3332 unsafe {
3333 ffi::gtk_tree_view_set_grid_lines(
3334 self.as_ref().to_glib_none().0,
3335 grid_lines.into_glib(),
3336 );
3337 }
3338 }
3339
3340 /// Allow the column title buttons to be clicked.
3341 ///
3342 /// # Deprecated since 4.10
3343 ///
3344 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
3345 /// ## `setting`
3346 /// [`true`] if the columns are clickable.
3347 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
3348 #[allow(deprecated)]
3349 #[doc(alias = "gtk_tree_view_set_headers_clickable")]
3350 #[doc(alias = "headers-clickable")]
3351 fn set_headers_clickable(&self, setting: bool) {
3352 unsafe {
3353 ffi::gtk_tree_view_set_headers_clickable(
3354 self.as_ref().to_glib_none().0,
3355 setting.into_glib(),
3356 );
3357 }
3358 }
3359
3360 /// Sets the visibility state of the headers.
3361 ///
3362 /// # Deprecated since 4.10
3363 ///
3364 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
3365 /// ## `headers_visible`
3366 /// [`true`] if the headers are visible
3367 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
3368 #[allow(deprecated)]
3369 #[doc(alias = "gtk_tree_view_set_headers_visible")]
3370 #[doc(alias = "headers-visible")]
3371 fn set_headers_visible(&self, headers_visible: bool) {
3372 unsafe {
3373 ffi::gtk_tree_view_set_headers_visible(
3374 self.as_ref().to_glib_none().0,
3375 headers_visible.into_glib(),
3376 );
3377 }
3378 }
3379
3380 /// Enables or disables the hover expansion mode of @self.
3381 /// Hover expansion makes rows expand or collapse if the pointer
3382 /// moves over them.
3383 ///
3384 /// # Deprecated since 4.10
3385 ///
3386 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
3387 /// ## `expand`
3388 /// [`true`] to enable hover selection mode
3389 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
3390 #[allow(deprecated)]
3391 #[doc(alias = "gtk_tree_view_set_hover_expand")]
3392 #[doc(alias = "hover-expand")]
3393 fn set_hover_expand(&self, expand: bool) {
3394 unsafe {
3395 ffi::gtk_tree_view_set_hover_expand(self.as_ref().to_glib_none().0, expand.into_glib());
3396 }
3397 }
3398
3399 /// Enables or disables the hover selection mode of @self.
3400 /// Hover selection makes the selected row follow the pointer.
3401 /// Currently, this works only for the selection modes
3402 /// [`SelectionMode::Single`][crate::SelectionMode::Single] and [`SelectionMode::Browse`][crate::SelectionMode::Browse].
3403 ///
3404 /// # Deprecated since 4.10
3405 ///
3406 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
3407 /// ## `hover`
3408 /// [`true`] to enable hover selection mode
3409 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
3410 #[allow(deprecated)]
3411 #[doc(alias = "gtk_tree_view_set_hover_selection")]
3412 #[doc(alias = "hover-selection")]
3413 fn set_hover_selection(&self, hover: bool) {
3414 unsafe {
3415 ffi::gtk_tree_view_set_hover_selection(
3416 self.as_ref().to_glib_none().0,
3417 hover.into_glib(),
3418 );
3419 }
3420 }
3421
3422 /// Sets the amount of extra indentation for child levels to use in @self
3423 /// in addition to the default indentation. The value should be specified in
3424 /// pixels, a value of 0 disables this feature and in this case only the default
3425 /// indentation will be used.
3426 /// This does not have any visible effects for lists.
3427 ///
3428 /// # Deprecated since 4.10
3429 ///
3430 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
3431 /// ## `indentation`
3432 /// the amount, in pixels, of extra indentation in @self.
3433 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
3434 #[allow(deprecated)]
3435 #[doc(alias = "gtk_tree_view_set_level_indentation")]
3436 #[doc(alias = "level-indentation")]
3437 fn set_level_indentation(&self, indentation: i32) {
3438 unsafe {
3439 ffi::gtk_tree_view_set_level_indentation(self.as_ref().to_glib_none().0, indentation);
3440 }
3441 }
3442
3443 /// Sets the model for a [`TreeView`][crate::TreeView]. If the @self already has a model
3444 /// set, it will remove it before setting the new model. If @model is [`None`],
3445 /// then it will unset the old model.
3446 ///
3447 /// # Deprecated since 4.10
3448 ///
3449 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
3450 /// ## `model`
3451 /// The model.
3452 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
3453 #[allow(deprecated)]
3454 #[doc(alias = "gtk_tree_view_set_model")]
3455 #[doc(alias = "model")]
3456 fn set_model(&self, model: Option<&impl IsA<TreeModel>>) {
3457 unsafe {
3458 ffi::gtk_tree_view_set_model(
3459 self.as_ref().to_glib_none().0,
3460 model.map(|p| p.as_ref()).to_glib_none().0,
3461 );
3462 }
3463 }
3464
3465 /// s `GtkTreeModel::row-inserted`
3466 /// and `GtkTreeModel::row-deleted` signals. The reordering is implemented
3467 /// by setting up the tree view as a drag source and destination.
3468 /// Therefore, drag and drop can not be used in a reorderable view for any
3469 /// other purpose.
3470 ///
3471 /// This function does not give you any degree of control over the order -- any
3472 /// reordering is allowed. If more control is needed, you should probably
3473 /// handle drag and drop manually.
3474 ///
3475 /// # Deprecated since 4.10
3476 ///
3477 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
3478 /// ## `reorderable`
3479 /// [`true`], if the tree can be reordered.
3480 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
3481 #[allow(deprecated)]
3482 #[doc(alias = "gtk_tree_view_set_reorderable")]
3483 #[doc(alias = "reorderable")]
3484 fn set_reorderable(&self, reorderable: bool) {
3485 unsafe {
3486 ffi::gtk_tree_view_set_reorderable(
3487 self.as_ref().to_glib_none().0,
3488 reorderable.into_glib(),
3489 );
3490 }
3491 }
3492
3493 /// Sets the row separator function, which is used to determine
3494 /// whether a row should be drawn as a separator. If the row separator
3495 /// function is [`None`], no separators are drawn. This is the default value.
3496 ///
3497 /// # Deprecated since 4.10
3498 ///
3499 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
3500 /// ## `func`
3501 /// a [`TreeView`][crate::TreeView]RowSeparatorFunc
3502 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
3503 #[allow(deprecated)]
3504 #[doc(alias = "gtk_tree_view_set_row_separator_func")]
3505 fn set_row_separator_func<P: Fn(&TreeModel, &TreeIter) -> bool + 'static>(&self, func: P) {
3506 let func_data: Box_<P> = Box_::new(func);
3507 unsafe extern "C" fn func_func<P: Fn(&TreeModel, &TreeIter) -> bool + 'static>(
3508 model: *mut ffi::GtkTreeModel,
3509 iter: *mut ffi::GtkTreeIter,
3510 data: glib::ffi::gpointer,
3511 ) -> glib::ffi::gboolean {
3512 unsafe {
3513 let model = from_glib_borrow(model);
3514 let iter = from_glib_borrow(iter);
3515 let callback = &*(data as *mut P);
3516 (*callback)(&model, &iter).into_glib()
3517 }
3518 }
3519 let func = Some(func_func::<P> as _);
3520 unsafe extern "C" fn destroy_func<P: Fn(&TreeModel, &TreeIter) -> bool + 'static>(
3521 data: glib::ffi::gpointer,
3522 ) {
3523 unsafe {
3524 let _callback = Box_::from_raw(data as *mut P);
3525 }
3526 }
3527 let destroy_call3 = Some(destroy_func::<P> as _);
3528 let super_callback0: Box_<P> = func_data;
3529 unsafe {
3530 ffi::gtk_tree_view_set_row_separator_func(
3531 self.as_ref().to_glib_none().0,
3532 func,
3533 Box_::into_raw(super_callback0) as *mut _,
3534 destroy_call3,
3535 );
3536 }
3537 }
3538
3539 /// Enables or disables rubber banding in @self. If the selection mode
3540 /// is [`SelectionMode::Multiple`][crate::SelectionMode::Multiple], rubber banding will allow the user to select
3541 /// multiple rows by dragging the mouse.
3542 ///
3543 /// # Deprecated since 4.10
3544 ///
3545 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
3546 /// ## `enable`
3547 /// [`true`] to enable rubber banding
3548 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
3549 #[allow(deprecated)]
3550 #[doc(alias = "gtk_tree_view_set_rubber_banding")]
3551 #[doc(alias = "rubber-banding")]
3552 fn set_rubber_banding(&self, enable: bool) {
3553 unsafe {
3554 ffi::gtk_tree_view_set_rubber_banding(
3555 self.as_ref().to_glib_none().0,
3556 enable.into_glib(),
3557 );
3558 }
3559 }
3560
3561 ///
3562 /// key binding to bring up search popup. The enable-search property controls
3563 /// whether simply typing text will also start an interactive search.
3564 ///
3565 /// Note that @column refers to a column of the current model. The search
3566 /// column is reset to -1 when the model is changed.
3567 ///
3568 /// # Deprecated since 4.10
3569 ///
3570 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
3571 /// ## `column`
3572 /// the column of the model to search in, or -1 to disable searching
3573 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
3574 #[allow(deprecated)]
3575 #[doc(alias = "gtk_tree_view_set_search_column")]
3576 #[doc(alias = "search-column")]
3577 fn set_search_column(&self, column: i32) {
3578 unsafe {
3579 ffi::gtk_tree_view_set_search_column(self.as_ref().to_glib_none().0, column);
3580 }
3581 }
3582
3583 /// Sets the entry which the interactive search code will use for this
3584 /// @self. This is useful when you want to provide a search entry
3585 /// in our interface at all time at a fixed position. Passing [`None`] for
3586 /// @entry will make the interactive search code use the built-in popup
3587 /// entry again.
3588 ///
3589 /// # Deprecated since 4.10
3590 ///
3591 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
3592 /// ## `entry`
3593 /// the entry the interactive search code of @self should use
3594 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
3595 #[allow(deprecated)]
3596 #[doc(alias = "gtk_tree_view_set_search_entry")]
3597 fn set_search_entry(&self, entry: Option<&impl IsA<Editable>>) {
3598 unsafe {
3599 ffi::gtk_tree_view_set_search_entry(
3600 self.as_ref().to_glib_none().0,
3601 entry.map(|p| p.as_ref()).to_glib_none().0,
3602 );
3603 }
3604 }
3605
3606 /// Sets the compare function for the interactive search capabilities; note
3607 /// that somewhat like strcmp() returning 0 for equality
3608 /// [`TreeView`][crate::TreeView]SearchEqualFunc returns [`false`] on matches.
3609 ///
3610 /// # Deprecated since 4.10
3611 ///
3612 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
3613 /// ## `search_equal_func`
3614 /// the compare function to use during the search
3615 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
3616 #[allow(deprecated)]
3617 #[doc(alias = "gtk_tree_view_set_search_equal_func")]
3618 fn set_search_equal_func<P: Fn(&TreeModel, i32, &str, &TreeIter) -> bool + 'static>(
3619 &self,
3620 search_equal_func: P,
3621 ) {
3622 let search_equal_func_data: Box_<P> = Box_::new(search_equal_func);
3623 unsafe extern "C" fn search_equal_func_func<
3624 P: Fn(&TreeModel, i32, &str, &TreeIter) -> bool + 'static,
3625 >(
3626 model: *mut ffi::GtkTreeModel,
3627 column: std::ffi::c_int,
3628 key: *const std::ffi::c_char,
3629 iter: *mut ffi::GtkTreeIter,
3630 search_data: glib::ffi::gpointer,
3631 ) -> glib::ffi::gboolean {
3632 unsafe {
3633 let model = from_glib_borrow(model);
3634 let key: Borrowed<glib::GString> = from_glib_borrow(key);
3635 let iter = from_glib_borrow(iter);
3636 let callback = &*(search_data as *mut P);
3637 (*callback)(&model, column, key.as_str(), &iter).into_glib()
3638 }
3639 }
3640 let search_equal_func = Some(search_equal_func_func::<P> as _);
3641 unsafe extern "C" fn search_destroy_func<
3642 P: Fn(&TreeModel, i32, &str, &TreeIter) -> bool + 'static,
3643 >(
3644 data: glib::ffi::gpointer,
3645 ) {
3646 unsafe {
3647 let _callback = Box_::from_raw(data as *mut P);
3648 }
3649 }
3650 let destroy_call3 = Some(search_destroy_func::<P> as _);
3651 let super_callback0: Box_<P> = search_equal_func_data;
3652 unsafe {
3653 ffi::gtk_tree_view_set_search_equal_func(
3654 self.as_ref().to_glib_none().0,
3655 search_equal_func,
3656 Box_::into_raw(super_callback0) as *mut _,
3657 destroy_call3,
3658 );
3659 }
3660 }
3661
3662 /// Sets whether to draw and enable expanders and indent child rows in
3663 /// @self. When disabled there will be no expanders visible in trees
3664 /// and there will be no way to expand and collapse rows by default. Also
3665 /// note that hiding the expanders will disable the default indentation. You
3666 /// can set a custom indentation in this case using
3667 /// gtk_tree_view_set_level_indentation().
3668 /// This does not have any visible effects for lists.
3669 ///
3670 /// # Deprecated since 4.10
3671 ///
3672 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
3673 /// ## `enabled`
3674 /// [`true`] to enable expander drawing, [`false`] otherwise.
3675 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
3676 #[allow(deprecated)]
3677 #[doc(alias = "gtk_tree_view_set_show_expanders")]
3678 #[doc(alias = "show-expanders")]
3679 fn set_show_expanders(&self, enabled: bool) {
3680 unsafe {
3681 ffi::gtk_tree_view_set_show_expanders(
3682 self.as_ref().to_glib_none().0,
3683 enabled.into_glib(),
3684 );
3685 }
3686 }
3687
3688 /// Sets the tip area of @tooltip to the area @path, @column and @cell have
3689 /// in common. For example if @path is [`None`] and @column is set, the tip
3690 /// area will be set to the full area covered by @column. See also
3691 /// gtk_tooltip_set_tip_area().
3692 ///
3693 /// Note that if @path is not specified and @cell is set and part of a column
3694 /// containing the expander, the tooltip might not show and hide at the correct
3695 /// position. In such cases @path must be set to the current node under the
3696 /// mouse cursor for this function to operate correctly.
3697 ///
3698 /// See also gtk_tree_view_set_tooltip_column() for a simpler alternative.
3699 ///
3700 /// # Deprecated since 4.10
3701 ///
3702 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
3703 /// ## `tooltip`
3704 /// a [`Tooltip`][crate::Tooltip]
3705 /// ## `path`
3706 /// a [`TreePath`][crate::TreePath]
3707 /// ## `column`
3708 /// a [`TreeViewColumn`][crate::TreeViewColumn]
3709 /// ## `cell`
3710 /// a [`CellRenderer`][crate::CellRenderer]
3711 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
3712 #[allow(deprecated)]
3713 #[doc(alias = "gtk_tree_view_set_tooltip_cell")]
3714 fn set_tooltip_cell(
3715 &self,
3716 tooltip: &Tooltip,
3717 path: Option<&TreePath>,
3718 column: Option<&TreeViewColumn>,
3719 cell: Option<&impl IsA<CellRenderer>>,
3720 ) {
3721 unsafe {
3722 ffi::gtk_tree_view_set_tooltip_cell(
3723 self.as_ref().to_glib_none().0,
3724 tooltip.to_glib_none().0,
3725 mut_override(path.to_glib_none().0),
3726 column.to_glib_none().0,
3727 cell.map(|p| p.as_ref()).to_glib_none().0,
3728 );
3729 }
3730 }
3731
3732 /// , etc have to be escaped in the text.
3733 ///
3734 /// # Deprecated since 4.10
3735 ///
3736 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
3737 /// ## `column`
3738 /// s model
3739 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
3740 #[allow(deprecated)]
3741 #[doc(alias = "gtk_tree_view_set_tooltip_column")]
3742 #[doc(alias = "tooltip-column")]
3743 fn set_tooltip_column(&self, column: i32) {
3744 unsafe {
3745 ffi::gtk_tree_view_set_tooltip_column(self.as_ref().to_glib_none().0, column);
3746 }
3747 }
3748
3749 /// Sets the tip area of @tooltip to be the area covered by the row at @path.
3750 /// See also gtk_tree_view_set_tooltip_column() for a simpler alternative.
3751 /// See also gtk_tooltip_set_tip_area().
3752 ///
3753 /// # Deprecated since 4.10
3754 ///
3755 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
3756 /// ## `tooltip`
3757 /// a [`Tooltip`][crate::Tooltip]
3758 /// ## `path`
3759 /// a [`TreePath`][crate::TreePath]
3760 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
3761 #[allow(deprecated)]
3762 #[doc(alias = "gtk_tree_view_set_tooltip_row")]
3763 fn set_tooltip_row(&self, tooltip: &Tooltip, path: &TreePath) {
3764 unsafe {
3765 ffi::gtk_tree_view_set_tooltip_row(
3766 self.as_ref().to_glib_none().0,
3767 tooltip.to_glib_none().0,
3768 mut_override(path.to_glib_none().0),
3769 );
3770 }
3771 }
3772
3773 /// Undoes the effect of
3774 /// gtk_tree_view_enable_model_drag_dest(). Calling this method sets
3775 /// [`TreeView`][crate::TreeView]:reorderable to [`false`].
3776 ///
3777 /// # Deprecated since 4.10
3778 ///
3779 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
3780 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
3781 #[allow(deprecated)]
3782 #[doc(alias = "gtk_tree_view_unset_rows_drag_dest")]
3783 fn unset_rows_drag_dest(&self) {
3784 unsafe {
3785 ffi::gtk_tree_view_unset_rows_drag_dest(self.as_ref().to_glib_none().0);
3786 }
3787 }
3788
3789 /// Undoes the effect of
3790 /// gtk_tree_view_enable_model_drag_source(). Calling this method sets
3791 /// [`TreeView`][crate::TreeView]:reorderable to [`false`].
3792 ///
3793 /// # Deprecated since 4.10
3794 ///
3795 /// Use [`ListView`][crate::ListView] or [`ColumnView`][crate::ColumnView] instead
3796 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
3797 #[allow(deprecated)]
3798 #[doc(alias = "gtk_tree_view_unset_rows_drag_source")]
3799 fn unset_rows_drag_source(&self) {
3800 unsafe {
3801 ffi::gtk_tree_view_unset_rows_drag_source(self.as_ref().to_glib_none().0);
3802 }
3803 }
3804
3805 #[doc(alias = "enable-grid-lines")]
3806 fn enable_grid_lines(&self) -> TreeViewGridLines {
3807 ObjectExt::property(self.as_ref(), "enable-grid-lines")
3808 }
3809
3810 #[doc(alias = "enable-grid-lines")]
3811 fn set_enable_grid_lines(&self, enable_grid_lines: TreeViewGridLines) {
3812 ObjectExt::set_property(self.as_ref(), "enable-grid-lines", enable_grid_lines)
3813 }
3814
3815 /// The number of columns of the treeview has changed.
3816 #[doc(alias = "columns-changed")]
3817 fn connect_columns_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3818 unsafe extern "C" fn columns_changed_trampoline<P: IsA<TreeView>, F: Fn(&P) + 'static>(
3819 this: *mut ffi::GtkTreeView,
3820 f: glib::ffi::gpointer,
3821 ) {
3822 unsafe {
3823 let f: &F = &*(f as *const F);
3824 f(TreeView::from_glib_borrow(this).unsafe_cast_ref())
3825 }
3826 }
3827 unsafe {
3828 let f: Box_<F> = Box_::new(f);
3829 connect_raw(
3830 self.as_ptr() as *mut _,
3831 c"columns-changed".as_ptr(),
3832 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3833 columns_changed_trampoline::<Self, F> as *const (),
3834 )),
3835 Box_::into_raw(f),
3836 )
3837 }
3838 }
3839
3840 /// The position of the cursor (focused cell) has changed.
3841 #[doc(alias = "cursor-changed")]
3842 fn connect_cursor_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3843 unsafe extern "C" fn cursor_changed_trampoline<P: IsA<TreeView>, F: Fn(&P) + 'static>(
3844 this: *mut ffi::GtkTreeView,
3845 f: glib::ffi::gpointer,
3846 ) {
3847 unsafe {
3848 let f: &F = &*(f as *const F);
3849 f(TreeView::from_glib_borrow(this).unsafe_cast_ref())
3850 }
3851 }
3852 unsafe {
3853 let f: Box_<F> = Box_::new(f);
3854 connect_raw(
3855 self.as_ptr() as *mut _,
3856 c"cursor-changed".as_ptr(),
3857 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3858 cursor_changed_trampoline::<Self, F> as *const (),
3859 )),
3860 Box_::into_raw(f),
3861 )
3862 }
3863 }
3864
3865 #[doc(alias = "expand-collapse-cursor-row")]
3866 fn connect_expand_collapse_cursor_row<F: Fn(&Self, bool, bool, bool) -> bool + 'static>(
3867 &self,
3868 f: F,
3869 ) -> SignalHandlerId {
3870 unsafe extern "C" fn expand_collapse_cursor_row_trampoline<
3871 P: IsA<TreeView>,
3872 F: Fn(&P, bool, bool, bool) -> bool + 'static,
3873 >(
3874 this: *mut ffi::GtkTreeView,
3875 object: glib::ffi::gboolean,
3876 p0: glib::ffi::gboolean,
3877 p1: glib::ffi::gboolean,
3878 f: glib::ffi::gpointer,
3879 ) -> glib::ffi::gboolean {
3880 unsafe {
3881 let f: &F = &*(f as *const F);
3882 f(
3883 TreeView::from_glib_borrow(this).unsafe_cast_ref(),
3884 from_glib(object),
3885 from_glib(p0),
3886 from_glib(p1),
3887 )
3888 .into_glib()
3889 }
3890 }
3891 unsafe {
3892 let f: Box_<F> = Box_::new(f);
3893 connect_raw(
3894 self.as_ptr() as *mut _,
3895 c"expand-collapse-cursor-row".as_ptr(),
3896 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3897 expand_collapse_cursor_row_trampoline::<Self, F> as *const (),
3898 )),
3899 Box_::into_raw(f),
3900 )
3901 }
3902 }
3903
3904 fn emit_expand_collapse_cursor_row(&self, object: bool, p0: bool, p1: bool) -> bool {
3905 self.emit_by_name("expand-collapse-cursor-row", &[&object, &p0, &p1])
3906 }
3907
3908 /// The [`TreeView`][crate::TreeView]::move-cursor signal is a [keybinding
3909 /// signal][`SignalAction`][crate::SignalAction] which gets emitted when the user
3910 /// presses one of the cursor keys.
3911 ///
3912 /// Applications should not connect to it, but may emit it with
3913 /// g_signal_emit_by_name() if they need to control the cursor
3914 /// programmatically. In contrast to gtk_tree_view_set_cursor() and
3915 /// gtk_tree_view_set_cursor_on_cell() when moving horizontally
3916 /// [`TreeView`][crate::TreeView]::move-cursor does not reset the current selection.
3917 /// ## `step`
3918 /// the granularity of the move, as a [`MovementStep`][crate::MovementStep].
3919 /// [`MovementStep::LogicalPositions`][crate::MovementStep::LogicalPositions], [`MovementStep::VisualPositions`][crate::MovementStep::VisualPositions],
3920 /// [`MovementStep::DisplayLines`][crate::MovementStep::DisplayLines], [`MovementStep::Pages`][crate::MovementStep::Pages] and
3921 /// [`MovementStep::BufferEnds`][crate::MovementStep::BufferEnds] are supported.
3922 /// [`MovementStep::LogicalPositions`][crate::MovementStep::LogicalPositions] and [`MovementStep::VisualPositions`][crate::MovementStep::VisualPositions]
3923 /// are treated identically.
3924 /// ## `direction`
3925 /// the direction to move: +1 to move forwards; -1 to move
3926 /// backwards. The resulting movement is undefined for all other values.
3927 /// ## `extend`
3928 /// whether to extend the selection
3929 /// ## `modify`
3930 /// whether to modify the selection
3931 ///
3932 /// # Returns
3933 ///
3934 /// [`true`] if @step is supported, [`false`] otherwise.
3935 #[doc(alias = "move-cursor")]
3936 fn connect_move_cursor<F: Fn(&Self, MovementStep, i32, bool, bool) -> bool + 'static>(
3937 &self,
3938 f: F,
3939 ) -> SignalHandlerId {
3940 unsafe extern "C" fn move_cursor_trampoline<
3941 P: IsA<TreeView>,
3942 F: Fn(&P, MovementStep, i32, bool, bool) -> bool + 'static,
3943 >(
3944 this: *mut ffi::GtkTreeView,
3945 step: ffi::GtkMovementStep,
3946 direction: std::ffi::c_int,
3947 extend: glib::ffi::gboolean,
3948 modify: glib::ffi::gboolean,
3949 f: glib::ffi::gpointer,
3950 ) -> glib::ffi::gboolean {
3951 unsafe {
3952 let f: &F = &*(f as *const F);
3953 f(
3954 TreeView::from_glib_borrow(this).unsafe_cast_ref(),
3955 from_glib(step),
3956 direction,
3957 from_glib(extend),
3958 from_glib(modify),
3959 )
3960 .into_glib()
3961 }
3962 }
3963 unsafe {
3964 let f: Box_<F> = Box_::new(f);
3965 connect_raw(
3966 self.as_ptr() as *mut _,
3967 c"move-cursor".as_ptr(),
3968 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3969 move_cursor_trampoline::<Self, F> as *const (),
3970 )),
3971 Box_::into_raw(f),
3972 )
3973 }
3974 }
3975
3976 fn emit_move_cursor(
3977 &self,
3978 step: MovementStep,
3979 direction: i32,
3980 extend: bool,
3981 modify: bool,
3982 ) -> bool {
3983 self.emit_by_name("move-cursor", &[&step, &direction, &extend, &modify])
3984 }
3985
3986 /// is pressed.
3987 ///
3988 /// For selection handling refer to the
3989 /// [tree widget conceptual overview](section-tree-widget.html)
3990 /// as well as [`TreeSelection`][crate::TreeSelection].
3991 /// ## `path`
3992 /// the [`TreePath`][crate::TreePath] for the activated row
3993 /// ## `column`
3994 /// the [`TreeViewColumn`][crate::TreeViewColumn] in which the activation occurred
3995 #[doc(alias = "row-activated")]
3996 fn connect_row_activated<F: Fn(&Self, &TreePath, Option<&TreeViewColumn>) + 'static>(
3997 &self,
3998 f: F,
3999 ) -> SignalHandlerId {
4000 unsafe extern "C" fn row_activated_trampoline<
4001 P: IsA<TreeView>,
4002 F: Fn(&P, &TreePath, Option<&TreeViewColumn>) + 'static,
4003 >(
4004 this: *mut ffi::GtkTreeView,
4005 path: *mut ffi::GtkTreePath,
4006 column: *mut ffi::GtkTreeViewColumn,
4007 f: glib::ffi::gpointer,
4008 ) {
4009 unsafe {
4010 let f: &F = &*(f as *const F);
4011 f(
4012 TreeView::from_glib_borrow(this).unsafe_cast_ref(),
4013 &from_glib_borrow(path),
4014 Option::<TreeViewColumn>::from_glib_borrow(column)
4015 .as_ref()
4016 .as_ref(),
4017 )
4018 }
4019 }
4020 unsafe {
4021 let f: Box_<F> = Box_::new(f);
4022 connect_raw(
4023 self.as_ptr() as *mut _,
4024 c"row-activated".as_ptr(),
4025 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4026 row_activated_trampoline::<Self, F> as *const (),
4027 )),
4028 Box_::into_raw(f),
4029 )
4030 }
4031 }
4032
4033 fn emit_row_activated(&self, path: &TreePath, column: Option<&TreeViewColumn>) {
4034 self.emit_by_name::<()>("row-activated", &[&path, &column]);
4035 }
4036
4037 /// The given row has been collapsed (child nodes are hidden).
4038 /// ## `iter`
4039 /// the tree iter of the collapsed row
4040 /// ## `path`
4041 /// a tree path that points to the row
4042 #[doc(alias = "row-collapsed")]
4043 fn connect_row_collapsed<F: Fn(&Self, &TreeIter, &TreePath) + 'static>(
4044 &self,
4045 f: F,
4046 ) -> SignalHandlerId {
4047 unsafe extern "C" fn row_collapsed_trampoline<
4048 P: IsA<TreeView>,
4049 F: Fn(&P, &TreeIter, &TreePath) + 'static,
4050 >(
4051 this: *mut ffi::GtkTreeView,
4052 iter: *mut ffi::GtkTreeIter,
4053 path: *mut ffi::GtkTreePath,
4054 f: glib::ffi::gpointer,
4055 ) {
4056 unsafe {
4057 let f: &F = &*(f as *const F);
4058 f(
4059 TreeView::from_glib_borrow(this).unsafe_cast_ref(),
4060 &from_glib_borrow(iter),
4061 &from_glib_borrow(path),
4062 )
4063 }
4064 }
4065 unsafe {
4066 let f: Box_<F> = Box_::new(f);
4067 connect_raw(
4068 self.as_ptr() as *mut _,
4069 c"row-collapsed".as_ptr(),
4070 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4071 row_collapsed_trampoline::<Self, F> as *const (),
4072 )),
4073 Box_::into_raw(f),
4074 )
4075 }
4076 }
4077
4078 /// The given row has been expanded (child nodes are shown).
4079 /// ## `iter`
4080 /// the tree iter of the expanded row
4081 /// ## `path`
4082 /// a tree path that points to the row
4083 #[doc(alias = "row-expanded")]
4084 fn connect_row_expanded<F: Fn(&Self, &TreeIter, &TreePath) + 'static>(
4085 &self,
4086 f: F,
4087 ) -> SignalHandlerId {
4088 unsafe extern "C" fn row_expanded_trampoline<
4089 P: IsA<TreeView>,
4090 F: Fn(&P, &TreeIter, &TreePath) + 'static,
4091 >(
4092 this: *mut ffi::GtkTreeView,
4093 iter: *mut ffi::GtkTreeIter,
4094 path: *mut ffi::GtkTreePath,
4095 f: glib::ffi::gpointer,
4096 ) {
4097 unsafe {
4098 let f: &F = &*(f as *const F);
4099 f(
4100 TreeView::from_glib_borrow(this).unsafe_cast_ref(),
4101 &from_glib_borrow(iter),
4102 &from_glib_borrow(path),
4103 )
4104 }
4105 }
4106 unsafe {
4107 let f: Box_<F> = Box_::new(f);
4108 connect_raw(
4109 self.as_ptr() as *mut _,
4110 c"row-expanded".as_ptr(),
4111 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4112 row_expanded_trampoline::<Self, F> as *const (),
4113 )),
4114 Box_::into_raw(f),
4115 )
4116 }
4117 }
4118
4119 #[doc(alias = "select-all")]
4120 fn connect_select_all<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId {
4121 unsafe extern "C" fn select_all_trampoline<
4122 P: IsA<TreeView>,
4123 F: Fn(&P) -> bool + 'static,
4124 >(
4125 this: *mut ffi::GtkTreeView,
4126 f: glib::ffi::gpointer,
4127 ) -> glib::ffi::gboolean {
4128 unsafe {
4129 let f: &F = &*(f as *const F);
4130 f(TreeView::from_glib_borrow(this).unsafe_cast_ref()).into_glib()
4131 }
4132 }
4133 unsafe {
4134 let f: Box_<F> = Box_::new(f);
4135 connect_raw(
4136 self.as_ptr() as *mut _,
4137 c"select-all".as_ptr(),
4138 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4139 select_all_trampoline::<Self, F> as *const (),
4140 )),
4141 Box_::into_raw(f),
4142 )
4143 }
4144 }
4145
4146 fn emit_select_all(&self) -> bool {
4147 self.emit_by_name("select-all", &[])
4148 }
4149
4150 #[doc(alias = "select-cursor-parent")]
4151 fn connect_select_cursor_parent<F: Fn(&Self) -> bool + 'static>(
4152 &self,
4153 f: F,
4154 ) -> SignalHandlerId {
4155 unsafe extern "C" fn select_cursor_parent_trampoline<
4156 P: IsA<TreeView>,
4157 F: Fn(&P) -> bool + 'static,
4158 >(
4159 this: *mut ffi::GtkTreeView,
4160 f: glib::ffi::gpointer,
4161 ) -> glib::ffi::gboolean {
4162 unsafe {
4163 let f: &F = &*(f as *const F);
4164 f(TreeView::from_glib_borrow(this).unsafe_cast_ref()).into_glib()
4165 }
4166 }
4167 unsafe {
4168 let f: Box_<F> = Box_::new(f);
4169 connect_raw(
4170 self.as_ptr() as *mut _,
4171 c"select-cursor-parent".as_ptr(),
4172 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4173 select_cursor_parent_trampoline::<Self, F> as *const (),
4174 )),
4175 Box_::into_raw(f),
4176 )
4177 }
4178 }
4179
4180 fn emit_select_cursor_parent(&self) -> bool {
4181 self.emit_by_name("select-cursor-parent", &[])
4182 }
4183
4184 #[doc(alias = "select-cursor-row")]
4185 fn connect_select_cursor_row<F: Fn(&Self, bool) -> bool + 'static>(
4186 &self,
4187 f: F,
4188 ) -> SignalHandlerId {
4189 unsafe extern "C" fn select_cursor_row_trampoline<
4190 P: IsA<TreeView>,
4191 F: Fn(&P, bool) -> bool + 'static,
4192 >(
4193 this: *mut ffi::GtkTreeView,
4194 object: glib::ffi::gboolean,
4195 f: glib::ffi::gpointer,
4196 ) -> glib::ffi::gboolean {
4197 unsafe {
4198 let f: &F = &*(f as *const F);
4199 f(
4200 TreeView::from_glib_borrow(this).unsafe_cast_ref(),
4201 from_glib(object),
4202 )
4203 .into_glib()
4204 }
4205 }
4206 unsafe {
4207 let f: Box_<F> = Box_::new(f);
4208 connect_raw(
4209 self.as_ptr() as *mut _,
4210 c"select-cursor-row".as_ptr(),
4211 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4212 select_cursor_row_trampoline::<Self, F> as *const (),
4213 )),
4214 Box_::into_raw(f),
4215 )
4216 }
4217 }
4218
4219 fn emit_select_cursor_row(&self, object: bool) -> bool {
4220 self.emit_by_name("select-cursor-row", &[&object])
4221 }
4222
4223 #[doc(alias = "start-interactive-search")]
4224 fn connect_start_interactive_search<F: Fn(&Self) -> bool + 'static>(
4225 &self,
4226 f: F,
4227 ) -> SignalHandlerId {
4228 unsafe extern "C" fn start_interactive_search_trampoline<
4229 P: IsA<TreeView>,
4230 F: Fn(&P) -> bool + 'static,
4231 >(
4232 this: *mut ffi::GtkTreeView,
4233 f: glib::ffi::gpointer,
4234 ) -> glib::ffi::gboolean {
4235 unsafe {
4236 let f: &F = &*(f as *const F);
4237 f(TreeView::from_glib_borrow(this).unsafe_cast_ref()).into_glib()
4238 }
4239 }
4240 unsafe {
4241 let f: Box_<F> = Box_::new(f);
4242 connect_raw(
4243 self.as_ptr() as *mut _,
4244 c"start-interactive-search".as_ptr(),
4245 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4246 start_interactive_search_trampoline::<Self, F> as *const (),
4247 )),
4248 Box_::into_raw(f),
4249 )
4250 }
4251 }
4252
4253 fn emit_start_interactive_search(&self) -> bool {
4254 self.emit_by_name("start-interactive-search", &[])
4255 }
4256
4257 /// The given row is about to be collapsed (hide its children nodes). Use this
4258 /// signal if you need to control the collapsibility of individual rows.
4259 /// ## `iter`
4260 /// the tree iter of the row to collapse
4261 /// ## `path`
4262 /// a tree path that points to the row
4263 ///
4264 /// # Returns
4265 ///
4266 /// [`false`] to allow collapsing, [`true`] to reject
4267 #[doc(alias = "test-collapse-row")]
4268 fn connect_test_collapse_row<
4269 F: Fn(&Self, &TreeIter, &TreePath) -> glib::Propagation + 'static,
4270 >(
4271 &self,
4272 f: F,
4273 ) -> SignalHandlerId {
4274 unsafe extern "C" fn test_collapse_row_trampoline<
4275 P: IsA<TreeView>,
4276 F: Fn(&P, &TreeIter, &TreePath) -> glib::Propagation + 'static,
4277 >(
4278 this: *mut ffi::GtkTreeView,
4279 iter: *mut ffi::GtkTreeIter,
4280 path: *mut ffi::GtkTreePath,
4281 f: glib::ffi::gpointer,
4282 ) -> glib::ffi::gboolean {
4283 unsafe {
4284 let f: &F = &*(f as *const F);
4285 f(
4286 TreeView::from_glib_borrow(this).unsafe_cast_ref(),
4287 &from_glib_borrow(iter),
4288 &from_glib_borrow(path),
4289 )
4290 .into_glib()
4291 }
4292 }
4293 unsafe {
4294 let f: Box_<F> = Box_::new(f);
4295 connect_raw(
4296 self.as_ptr() as *mut _,
4297 c"test-collapse-row".as_ptr(),
4298 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4299 test_collapse_row_trampoline::<Self, F> as *const (),
4300 )),
4301 Box_::into_raw(f),
4302 )
4303 }
4304 }
4305
4306 /// The given row is about to be expanded (show its children nodes). Use this
4307 /// signal if you need to control the expandability of individual rows.
4308 /// ## `iter`
4309 /// the tree iter of the row to expand
4310 /// ## `path`
4311 /// a tree path that points to the row
4312 ///
4313 /// # Returns
4314 ///
4315 /// [`false`] to allow expansion, [`true`] to reject
4316 #[doc(alias = "test-expand-row")]
4317 fn connect_test_expand_row<
4318 F: Fn(&Self, &TreeIter, &TreePath) -> glib::Propagation + 'static,
4319 >(
4320 &self,
4321 f: F,
4322 ) -> SignalHandlerId {
4323 unsafe extern "C" fn test_expand_row_trampoline<
4324 P: IsA<TreeView>,
4325 F: Fn(&P, &TreeIter, &TreePath) -> glib::Propagation + 'static,
4326 >(
4327 this: *mut ffi::GtkTreeView,
4328 iter: *mut ffi::GtkTreeIter,
4329 path: *mut ffi::GtkTreePath,
4330 f: glib::ffi::gpointer,
4331 ) -> glib::ffi::gboolean {
4332 unsafe {
4333 let f: &F = &*(f as *const F);
4334 f(
4335 TreeView::from_glib_borrow(this).unsafe_cast_ref(),
4336 &from_glib_borrow(iter),
4337 &from_glib_borrow(path),
4338 )
4339 .into_glib()
4340 }
4341 }
4342 unsafe {
4343 let f: Box_<F> = Box_::new(f);
4344 connect_raw(
4345 self.as_ptr() as *mut _,
4346 c"test-expand-row".as_ptr(),
4347 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4348 test_expand_row_trampoline::<Self, F> as *const (),
4349 )),
4350 Box_::into_raw(f),
4351 )
4352 }
4353 }
4354
4355 #[doc(alias = "toggle-cursor-row")]
4356 fn connect_toggle_cursor_row<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId {
4357 unsafe extern "C" fn toggle_cursor_row_trampoline<
4358 P: IsA<TreeView>,
4359 F: Fn(&P) -> bool + 'static,
4360 >(
4361 this: *mut ffi::GtkTreeView,
4362 f: glib::ffi::gpointer,
4363 ) -> glib::ffi::gboolean {
4364 unsafe {
4365 let f: &F = &*(f as *const F);
4366 f(TreeView::from_glib_borrow(this).unsafe_cast_ref()).into_glib()
4367 }
4368 }
4369 unsafe {
4370 let f: Box_<F> = Box_::new(f);
4371 connect_raw(
4372 self.as_ptr() as *mut _,
4373 c"toggle-cursor-row".as_ptr(),
4374 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4375 toggle_cursor_row_trampoline::<Self, F> as *const (),
4376 )),
4377 Box_::into_raw(f),
4378 )
4379 }
4380 }
4381
4382 fn emit_toggle_cursor_row(&self) -> bool {
4383 self.emit_by_name("toggle-cursor-row", &[])
4384 }
4385
4386 #[doc(alias = "unselect-all")]
4387 fn connect_unselect_all<F: Fn(&Self) -> bool + 'static>(&self, f: F) -> SignalHandlerId {
4388 unsafe extern "C" fn unselect_all_trampoline<
4389 P: IsA<TreeView>,
4390 F: Fn(&P) -> bool + 'static,
4391 >(
4392 this: *mut ffi::GtkTreeView,
4393 f: glib::ffi::gpointer,
4394 ) -> glib::ffi::gboolean {
4395 unsafe {
4396 let f: &F = &*(f as *const F);
4397 f(TreeView::from_glib_borrow(this).unsafe_cast_ref()).into_glib()
4398 }
4399 }
4400 unsafe {
4401 let f: Box_<F> = Box_::new(f);
4402 connect_raw(
4403 self.as_ptr() as *mut _,
4404 c"unselect-all".as_ptr(),
4405 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4406 unselect_all_trampoline::<Self, F> as *const (),
4407 )),
4408 Box_::into_raw(f),
4409 )
4410 }
4411 }
4412
4413 fn emit_unselect_all(&self) -> bool {
4414 self.emit_by_name("unselect-all", &[])
4415 }
4416
4417 #[doc(alias = "activate-on-single-click")]
4418 fn connect_activate_on_single_click_notify<F: Fn(&Self) + 'static>(
4419 &self,
4420 f: F,
4421 ) -> SignalHandlerId {
4422 unsafe extern "C" fn notify_activate_on_single_click_trampoline<
4423 P: IsA<TreeView>,
4424 F: Fn(&P) + 'static,
4425 >(
4426 this: *mut ffi::GtkTreeView,
4427 _param_spec: glib::ffi::gpointer,
4428 f: glib::ffi::gpointer,
4429 ) {
4430 unsafe {
4431 let f: &F = &*(f as *const F);
4432 f(TreeView::from_glib_borrow(this).unsafe_cast_ref())
4433 }
4434 }
4435 unsafe {
4436 let f: Box_<F> = Box_::new(f);
4437 connect_raw(
4438 self.as_ptr() as *mut _,
4439 c"notify::activate-on-single-click".as_ptr(),
4440 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4441 notify_activate_on_single_click_trampoline::<Self, F> as *const (),
4442 )),
4443 Box_::into_raw(f),
4444 )
4445 }
4446 }
4447
4448 #[doc(alias = "enable-grid-lines")]
4449 fn connect_enable_grid_lines_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4450 unsafe extern "C" fn notify_enable_grid_lines_trampoline<
4451 P: IsA<TreeView>,
4452 F: Fn(&P) + 'static,
4453 >(
4454 this: *mut ffi::GtkTreeView,
4455 _param_spec: glib::ffi::gpointer,
4456 f: glib::ffi::gpointer,
4457 ) {
4458 unsafe {
4459 let f: &F = &*(f as *const F);
4460 f(TreeView::from_glib_borrow(this).unsafe_cast_ref())
4461 }
4462 }
4463 unsafe {
4464 let f: Box_<F> = Box_::new(f);
4465 connect_raw(
4466 self.as_ptr() as *mut _,
4467 c"notify::enable-grid-lines".as_ptr(),
4468 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4469 notify_enable_grid_lines_trampoline::<Self, F> as *const (),
4470 )),
4471 Box_::into_raw(f),
4472 )
4473 }
4474 }
4475
4476 #[doc(alias = "enable-search")]
4477 fn connect_enable_search_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4478 unsafe extern "C" fn notify_enable_search_trampoline<
4479 P: IsA<TreeView>,
4480 F: Fn(&P) + 'static,
4481 >(
4482 this: *mut ffi::GtkTreeView,
4483 _param_spec: glib::ffi::gpointer,
4484 f: glib::ffi::gpointer,
4485 ) {
4486 unsafe {
4487 let f: &F = &*(f as *const F);
4488 f(TreeView::from_glib_borrow(this).unsafe_cast_ref())
4489 }
4490 }
4491 unsafe {
4492 let f: Box_<F> = Box_::new(f);
4493 connect_raw(
4494 self.as_ptr() as *mut _,
4495 c"notify::enable-search".as_ptr(),
4496 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4497 notify_enable_search_trampoline::<Self, F> as *const (),
4498 )),
4499 Box_::into_raw(f),
4500 )
4501 }
4502 }
4503
4504 #[doc(alias = "enable-tree-lines")]
4505 fn connect_enable_tree_lines_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4506 unsafe extern "C" fn notify_enable_tree_lines_trampoline<
4507 P: IsA<TreeView>,
4508 F: Fn(&P) + 'static,
4509 >(
4510 this: *mut ffi::GtkTreeView,
4511 _param_spec: glib::ffi::gpointer,
4512 f: glib::ffi::gpointer,
4513 ) {
4514 unsafe {
4515 let f: &F = &*(f as *const F);
4516 f(TreeView::from_glib_borrow(this).unsafe_cast_ref())
4517 }
4518 }
4519 unsafe {
4520 let f: Box_<F> = Box_::new(f);
4521 connect_raw(
4522 self.as_ptr() as *mut _,
4523 c"notify::enable-tree-lines".as_ptr(),
4524 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4525 notify_enable_tree_lines_trampoline::<Self, F> as *const (),
4526 )),
4527 Box_::into_raw(f),
4528 )
4529 }
4530 }
4531
4532 #[doc(alias = "expander-column")]
4533 fn connect_expander_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4534 unsafe extern "C" fn notify_expander_column_trampoline<
4535 P: IsA<TreeView>,
4536 F: Fn(&P) + 'static,
4537 >(
4538 this: *mut ffi::GtkTreeView,
4539 _param_spec: glib::ffi::gpointer,
4540 f: glib::ffi::gpointer,
4541 ) {
4542 unsafe {
4543 let f: &F = &*(f as *const F);
4544 f(TreeView::from_glib_borrow(this).unsafe_cast_ref())
4545 }
4546 }
4547 unsafe {
4548 let f: Box_<F> = Box_::new(f);
4549 connect_raw(
4550 self.as_ptr() as *mut _,
4551 c"notify::expander-column".as_ptr(),
4552 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4553 notify_expander_column_trampoline::<Self, F> as *const (),
4554 )),
4555 Box_::into_raw(f),
4556 )
4557 }
4558 }
4559
4560 #[doc(alias = "fixed-height-mode")]
4561 fn connect_fixed_height_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4562 unsafe extern "C" fn notify_fixed_height_mode_trampoline<
4563 P: IsA<TreeView>,
4564 F: Fn(&P) + 'static,
4565 >(
4566 this: *mut ffi::GtkTreeView,
4567 _param_spec: glib::ffi::gpointer,
4568 f: glib::ffi::gpointer,
4569 ) {
4570 unsafe {
4571 let f: &F = &*(f as *const F);
4572 f(TreeView::from_glib_borrow(this).unsafe_cast_ref())
4573 }
4574 }
4575 unsafe {
4576 let f: Box_<F> = Box_::new(f);
4577 connect_raw(
4578 self.as_ptr() as *mut _,
4579 c"notify::fixed-height-mode".as_ptr(),
4580 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4581 notify_fixed_height_mode_trampoline::<Self, F> as *const (),
4582 )),
4583 Box_::into_raw(f),
4584 )
4585 }
4586 }
4587
4588 #[doc(alias = "headers-clickable")]
4589 fn connect_headers_clickable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4590 unsafe extern "C" fn notify_headers_clickable_trampoline<
4591 P: IsA<TreeView>,
4592 F: Fn(&P) + 'static,
4593 >(
4594 this: *mut ffi::GtkTreeView,
4595 _param_spec: glib::ffi::gpointer,
4596 f: glib::ffi::gpointer,
4597 ) {
4598 unsafe {
4599 let f: &F = &*(f as *const F);
4600 f(TreeView::from_glib_borrow(this).unsafe_cast_ref())
4601 }
4602 }
4603 unsafe {
4604 let f: Box_<F> = Box_::new(f);
4605 connect_raw(
4606 self.as_ptr() as *mut _,
4607 c"notify::headers-clickable".as_ptr(),
4608 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4609 notify_headers_clickable_trampoline::<Self, F> as *const (),
4610 )),
4611 Box_::into_raw(f),
4612 )
4613 }
4614 }
4615
4616 #[doc(alias = "headers-visible")]
4617 fn connect_headers_visible_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4618 unsafe extern "C" fn notify_headers_visible_trampoline<
4619 P: IsA<TreeView>,
4620 F: Fn(&P) + 'static,
4621 >(
4622 this: *mut ffi::GtkTreeView,
4623 _param_spec: glib::ffi::gpointer,
4624 f: glib::ffi::gpointer,
4625 ) {
4626 unsafe {
4627 let f: &F = &*(f as *const F);
4628 f(TreeView::from_glib_borrow(this).unsafe_cast_ref())
4629 }
4630 }
4631 unsafe {
4632 let f: Box_<F> = Box_::new(f);
4633 connect_raw(
4634 self.as_ptr() as *mut _,
4635 c"notify::headers-visible".as_ptr(),
4636 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4637 notify_headers_visible_trampoline::<Self, F> as *const (),
4638 )),
4639 Box_::into_raw(f),
4640 )
4641 }
4642 }
4643
4644 #[doc(alias = "hover-expand")]
4645 fn connect_hover_expand_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4646 unsafe extern "C" fn notify_hover_expand_trampoline<
4647 P: IsA<TreeView>,
4648 F: Fn(&P) + 'static,
4649 >(
4650 this: *mut ffi::GtkTreeView,
4651 _param_spec: glib::ffi::gpointer,
4652 f: glib::ffi::gpointer,
4653 ) {
4654 unsafe {
4655 let f: &F = &*(f as *const F);
4656 f(TreeView::from_glib_borrow(this).unsafe_cast_ref())
4657 }
4658 }
4659 unsafe {
4660 let f: Box_<F> = Box_::new(f);
4661 connect_raw(
4662 self.as_ptr() as *mut _,
4663 c"notify::hover-expand".as_ptr(),
4664 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4665 notify_hover_expand_trampoline::<Self, F> as *const (),
4666 )),
4667 Box_::into_raw(f),
4668 )
4669 }
4670 }
4671
4672 #[doc(alias = "hover-selection")]
4673 fn connect_hover_selection_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4674 unsafe extern "C" fn notify_hover_selection_trampoline<
4675 P: IsA<TreeView>,
4676 F: Fn(&P) + 'static,
4677 >(
4678 this: *mut ffi::GtkTreeView,
4679 _param_spec: glib::ffi::gpointer,
4680 f: glib::ffi::gpointer,
4681 ) {
4682 unsafe {
4683 let f: &F = &*(f as *const F);
4684 f(TreeView::from_glib_borrow(this).unsafe_cast_ref())
4685 }
4686 }
4687 unsafe {
4688 let f: Box_<F> = Box_::new(f);
4689 connect_raw(
4690 self.as_ptr() as *mut _,
4691 c"notify::hover-selection".as_ptr(),
4692 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4693 notify_hover_selection_trampoline::<Self, F> as *const (),
4694 )),
4695 Box_::into_raw(f),
4696 )
4697 }
4698 }
4699
4700 #[doc(alias = "level-indentation")]
4701 fn connect_level_indentation_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4702 unsafe extern "C" fn notify_level_indentation_trampoline<
4703 P: IsA<TreeView>,
4704 F: Fn(&P) + 'static,
4705 >(
4706 this: *mut ffi::GtkTreeView,
4707 _param_spec: glib::ffi::gpointer,
4708 f: glib::ffi::gpointer,
4709 ) {
4710 unsafe {
4711 let f: &F = &*(f as *const F);
4712 f(TreeView::from_glib_borrow(this).unsafe_cast_ref())
4713 }
4714 }
4715 unsafe {
4716 let f: Box_<F> = Box_::new(f);
4717 connect_raw(
4718 self.as_ptr() as *mut _,
4719 c"notify::level-indentation".as_ptr(),
4720 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4721 notify_level_indentation_trampoline::<Self, F> as *const (),
4722 )),
4723 Box_::into_raw(f),
4724 )
4725 }
4726 }
4727
4728 #[doc(alias = "model")]
4729 fn connect_model_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4730 unsafe extern "C" fn notify_model_trampoline<P: IsA<TreeView>, F: Fn(&P) + 'static>(
4731 this: *mut ffi::GtkTreeView,
4732 _param_spec: glib::ffi::gpointer,
4733 f: glib::ffi::gpointer,
4734 ) {
4735 unsafe {
4736 let f: &F = &*(f as *const F);
4737 f(TreeView::from_glib_borrow(this).unsafe_cast_ref())
4738 }
4739 }
4740 unsafe {
4741 let f: Box_<F> = Box_::new(f);
4742 connect_raw(
4743 self.as_ptr() as *mut _,
4744 c"notify::model".as_ptr(),
4745 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4746 notify_model_trampoline::<Self, F> as *const (),
4747 )),
4748 Box_::into_raw(f),
4749 )
4750 }
4751 }
4752
4753 #[doc(alias = "reorderable")]
4754 fn connect_reorderable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4755 unsafe extern "C" fn notify_reorderable_trampoline<
4756 P: IsA<TreeView>,
4757 F: Fn(&P) + 'static,
4758 >(
4759 this: *mut ffi::GtkTreeView,
4760 _param_spec: glib::ffi::gpointer,
4761 f: glib::ffi::gpointer,
4762 ) {
4763 unsafe {
4764 let f: &F = &*(f as *const F);
4765 f(TreeView::from_glib_borrow(this).unsafe_cast_ref())
4766 }
4767 }
4768 unsafe {
4769 let f: Box_<F> = Box_::new(f);
4770 connect_raw(
4771 self.as_ptr() as *mut _,
4772 c"notify::reorderable".as_ptr(),
4773 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4774 notify_reorderable_trampoline::<Self, F> as *const (),
4775 )),
4776 Box_::into_raw(f),
4777 )
4778 }
4779 }
4780
4781 #[doc(alias = "rubber-banding")]
4782 fn connect_rubber_banding_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4783 unsafe extern "C" fn notify_rubber_banding_trampoline<
4784 P: IsA<TreeView>,
4785 F: Fn(&P) + 'static,
4786 >(
4787 this: *mut ffi::GtkTreeView,
4788 _param_spec: glib::ffi::gpointer,
4789 f: glib::ffi::gpointer,
4790 ) {
4791 unsafe {
4792 let f: &F = &*(f as *const F);
4793 f(TreeView::from_glib_borrow(this).unsafe_cast_ref())
4794 }
4795 }
4796 unsafe {
4797 let f: Box_<F> = Box_::new(f);
4798 connect_raw(
4799 self.as_ptr() as *mut _,
4800 c"notify::rubber-banding".as_ptr(),
4801 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4802 notify_rubber_banding_trampoline::<Self, F> as *const (),
4803 )),
4804 Box_::into_raw(f),
4805 )
4806 }
4807 }
4808
4809 #[doc(alias = "search-column")]
4810 fn connect_search_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4811 unsafe extern "C" fn notify_search_column_trampoline<
4812 P: IsA<TreeView>,
4813 F: Fn(&P) + 'static,
4814 >(
4815 this: *mut ffi::GtkTreeView,
4816 _param_spec: glib::ffi::gpointer,
4817 f: glib::ffi::gpointer,
4818 ) {
4819 unsafe {
4820 let f: &F = &*(f as *const F);
4821 f(TreeView::from_glib_borrow(this).unsafe_cast_ref())
4822 }
4823 }
4824 unsafe {
4825 let f: Box_<F> = Box_::new(f);
4826 connect_raw(
4827 self.as_ptr() as *mut _,
4828 c"notify::search-column".as_ptr(),
4829 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4830 notify_search_column_trampoline::<Self, F> as *const (),
4831 )),
4832 Box_::into_raw(f),
4833 )
4834 }
4835 }
4836
4837 #[doc(alias = "show-expanders")]
4838 fn connect_show_expanders_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4839 unsafe extern "C" fn notify_show_expanders_trampoline<
4840 P: IsA<TreeView>,
4841 F: Fn(&P) + 'static,
4842 >(
4843 this: *mut ffi::GtkTreeView,
4844 _param_spec: glib::ffi::gpointer,
4845 f: glib::ffi::gpointer,
4846 ) {
4847 unsafe {
4848 let f: &F = &*(f as *const F);
4849 f(TreeView::from_glib_borrow(this).unsafe_cast_ref())
4850 }
4851 }
4852 unsafe {
4853 let f: Box_<F> = Box_::new(f);
4854 connect_raw(
4855 self.as_ptr() as *mut _,
4856 c"notify::show-expanders".as_ptr(),
4857 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4858 notify_show_expanders_trampoline::<Self, F> as *const (),
4859 )),
4860 Box_::into_raw(f),
4861 )
4862 }
4863 }
4864
4865 #[doc(alias = "tooltip-column")]
4866 fn connect_tooltip_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
4867 unsafe extern "C" fn notify_tooltip_column_trampoline<
4868 P: IsA<TreeView>,
4869 F: Fn(&P) + 'static,
4870 >(
4871 this: *mut ffi::GtkTreeView,
4872 _param_spec: glib::ffi::gpointer,
4873 f: glib::ffi::gpointer,
4874 ) {
4875 unsafe {
4876 let f: &F = &*(f as *const F);
4877 f(TreeView::from_glib_borrow(this).unsafe_cast_ref())
4878 }
4879 }
4880 unsafe {
4881 let f: Box_<F> = Box_::new(f);
4882 connect_raw(
4883 self.as_ptr() as *mut _,
4884 c"notify::tooltip-column".as_ptr(),
4885 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
4886 notify_tooltip_column_trampoline::<Self, F> as *const (),
4887 )),
4888 Box_::into_raw(f),
4889 )
4890 }
4891 }
4892}
4893
4894impl<O: IsA<TreeView>> TreeViewExt for O {}