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