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