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