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