gtk/auto/icon_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, CellArea, CellLayout, CellRenderer, Container,
7 IconViewDropPosition, MovementStep, Orientation, ResizeMode, Scrollable, ScrollablePolicy,
8 SelectionMode, Tooltip, TreeIter, TreeModel, TreePath, 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 /// [`IconView`][crate::IconView] provides an alternative view on a [`TreeModel`][crate::TreeModel].
20 /// It displays the model as a grid of icons with labels. Like
21 /// [`TreeView`][crate::TreeView], it allows to select one or multiple items
22 /// (depending on the selection mode, see [`IconViewExt::set_selection_mode()`][crate::prelude::IconViewExt::set_selection_mode()]).
23 /// In addition to selection with the arrow keys, [`IconView`][crate::IconView] supports
24 /// rubberband selection, which is controlled by dragging the pointer.
25 ///
26 /// Note that if the tree model is backed by an actual tree store (as
27 /// opposed to a flat list where the mapping to icons is obvious),
28 /// [`IconView`][crate::IconView] will only display the first level of the tree and
29 /// ignore the tree’s branches.
30 ///
31 /// # CSS nodes
32 ///
33 ///
34 ///
35 /// **⚠️ The following code is in plain ⚠️**
36 ///
37 /// ```plain
38 /// iconview.view
39 /// ╰── [rubberband]
40 /// ```
41 ///
42 /// GtkIconView has a single CSS node with name iconview and style class .view.
43 /// For rubberband selection, a subnode with name rubberband is used.
44 ///
45 /// ## Properties
46 ///
47 ///
48 /// #### `activate-on-single-click`
49 /// The activate-on-single-click property specifies whether the "item-activated" signal
50 /// will be emitted after a single click.
51 ///
52 /// Readable | Writable
53 ///
54 ///
55 /// #### `cell-area`
56 /// The [`CellArea`][crate::CellArea] used to layout cell renderers for this view.
57 ///
58 /// If no area is specified when creating the icon view with [`IconView::with_area()`][crate::IconView::with_area()]
59 /// a [`CellAreaBox`][crate::CellAreaBox] will be used.
60 ///
61 /// Readable | Writable | Construct Only
62 ///
63 ///
64 /// #### `column-spacing`
65 /// The column-spacing property specifies the space which is inserted between
66 /// the columns of the icon view.
67 ///
68 /// Readable | Writable
69 ///
70 ///
71 /// #### `columns`
72 /// The columns property contains the number of the columns in which the
73 /// items should be displayed. If it is -1, the number of columns will
74 /// be chosen automatically to fill the available area.
75 ///
76 /// Readable | Writable
77 ///
78 ///
79 /// #### `item-orientation`
80 /// The item-orientation property specifies how the cells (i.e. the icon and
81 /// the text) of the item are positioned relative to each other.
82 ///
83 /// Readable | Writable
84 ///
85 ///
86 /// #### `item-padding`
87 /// The item-padding property specifies the padding around each
88 /// of the icon view's item.
89 ///
90 /// Readable | Writable
91 ///
92 ///
93 /// #### `item-width`
94 /// The item-width property specifies the width to use for each item.
95 /// If it is set to -1, the icon view will automatically determine a
96 /// suitable item size.
97 ///
98 /// Readable | Writable
99 ///
100 ///
101 /// #### `margin`
102 /// The margin property specifies the space which is inserted
103 /// at the edges of the icon view.
104 ///
105 /// Readable | Writable
106 ///
107 ///
108 /// #### `markup-column`
109 /// The ::markup-column property contains the number of the model column
110 /// containing markup information to be displayed. The markup column must be
111 /// of type `G_TYPE_STRING`. If this property and the :text-column property
112 /// are both set to column numbers, it overrides the text column.
113 /// If both are set to -1, no texts are displayed.
114 ///
115 /// Readable | Writable
116 ///
117 ///
118 /// #### `model`
119 /// Readable | Writable
120 ///
121 ///
122 /// #### `pixbuf-column`
123 /// The ::pixbuf-column property contains the number of the model column
124 /// containing the pixbufs which are displayed. The pixbuf column must be
125 /// of type `GDK_TYPE_PIXBUF`. Setting this property to -1 turns off the
126 /// display of pixbufs.
127 ///
128 /// Readable | Writable
129 ///
130 ///
131 /// #### `reorderable`
132 /// The reorderable property specifies if the items can be reordered
133 /// by DND.
134 ///
135 /// Readable | Writable
136 ///
137 ///
138 /// #### `row-spacing`
139 /// The row-spacing property specifies the space which is inserted between
140 /// the rows of the icon view.
141 ///
142 /// Readable | Writable
143 ///
144 ///
145 /// #### `selection-mode`
146 /// The ::selection-mode property specifies the selection mode of
147 /// icon view. If the mode is [`SelectionMode::Multiple`][crate::SelectionMode::Multiple], rubberband selection
148 /// is enabled, for the other modes, only keyboard selection is possible.
149 ///
150 /// Readable | Writable
151 ///
152 ///
153 /// #### `spacing`
154 /// The spacing property specifies the space which is inserted between
155 /// the cells (i.e. the icon and the text) of an item.
156 ///
157 /// Readable | Writable
158 ///
159 ///
160 /// #### `text-column`
161 /// The ::text-column property contains the number of the model column
162 /// containing the texts which are displayed. The text column must be
163 /// of type `G_TYPE_STRING`. If this property and the :markup-column
164 /// property are both set to -1, no texts are displayed.
165 ///
166 /// Readable | Writable
167 ///
168 ///
169 /// #### `tooltip-column`
170 /// Readable | Writable
171 /// <details><summary><h4>Container</h4></summary>
172 ///
173 ///
174 /// #### `border-width`
175 /// Readable | Writable
176 ///
177 ///
178 /// #### `child`
179 /// Writable
180 ///
181 ///
182 /// #### `resize-mode`
183 /// Readable | Writable
184 /// </details>
185 /// <details><summary><h4>Widget</h4></summary>
186 ///
187 ///
188 /// #### `app-paintable`
189 /// Readable | Writable
190 ///
191 ///
192 /// #### `can-default`
193 /// Readable | Writable
194 ///
195 ///
196 /// #### `can-focus`
197 /// Readable | Writable
198 ///
199 ///
200 /// #### `composite-child`
201 /// Readable
202 ///
203 ///
204 /// #### `double-buffered`
205 /// Whether the widget is double buffered.
206 ///
207 /// Readable | Writable
208 ///
209 ///
210 /// #### `events`
211 /// Readable | Writable
212 ///
213 ///
214 /// #### `expand`
215 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
216 ///
217 /// Readable | Writable
218 ///
219 ///
220 /// #### `focus-on-click`
221 /// Whether the widget should grab focus when it is clicked with the mouse.
222 ///
223 /// This property is only relevant for widgets that can take focus.
224 ///
225 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
226 /// GtkComboBox) implemented this property individually.
227 ///
228 /// Readable | Writable
229 ///
230 ///
231 /// #### `halign`
232 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
233 ///
234 /// Readable | Writable
235 ///
236 ///
237 /// #### `has-default`
238 /// Readable | Writable
239 ///
240 ///
241 /// #### `has-focus`
242 /// Readable | Writable
243 ///
244 ///
245 /// #### `has-tooltip`
246 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
247 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
248 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
249 /// whether it will provide a tooltip or not.
250 ///
251 /// Note that setting this property to [`true`] for the first time will change
252 /// the event masks of the GdkWindows of this widget to include leave-notify
253 /// and motion-notify events. This cannot and will not be undone when the
254 /// property is set to [`false`] again.
255 ///
256 /// Readable | Writable
257 ///
258 ///
259 /// #### `height-request`
260 /// Readable | Writable
261 ///
262 ///
263 /// #### `hexpand`
264 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
265 ///
266 /// Readable | Writable
267 ///
268 ///
269 /// #### `hexpand-set`
270 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
271 ///
272 /// Readable | Writable
273 ///
274 ///
275 /// #### `is-focus`
276 /// Readable | Writable
277 ///
278 ///
279 /// #### `margin`
280 /// Sets all four sides' margin at once. If read, returns max
281 /// margin on any side.
282 ///
283 /// Readable | Writable
284 ///
285 ///
286 /// #### `margin-bottom`
287 /// Margin on bottom side of widget.
288 ///
289 /// This property adds margin outside of the widget's normal size
290 /// request, the margin will be added in addition to the size from
291 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
292 ///
293 /// Readable | Writable
294 ///
295 ///
296 /// #### `margin-end`
297 /// Margin on end of widget, horizontally. This property supports
298 /// left-to-right and right-to-left text directions.
299 ///
300 /// This property adds margin outside of the widget's normal size
301 /// request, the margin will be added in addition to the size from
302 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
303 ///
304 /// Readable | Writable
305 ///
306 ///
307 /// #### `margin-left`
308 /// Margin on left side of widget.
309 ///
310 /// This property adds margin outside of the widget's normal size
311 /// request, the margin will be added in addition to the size from
312 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
313 ///
314 /// Readable | Writable
315 ///
316 ///
317 /// #### `margin-right`
318 /// Margin on right side of widget.
319 ///
320 /// This property adds margin outside of the widget's normal size
321 /// request, the margin will be added in addition to the size from
322 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
323 ///
324 /// Readable | Writable
325 ///
326 ///
327 /// #### `margin-start`
328 /// Margin on start of widget, horizontally. This property supports
329 /// left-to-right and right-to-left text directions.
330 ///
331 /// This property adds margin outside of the widget's normal size
332 /// request, the margin will be added in addition to the size from
333 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
334 ///
335 /// Readable | Writable
336 ///
337 ///
338 /// #### `margin-top`
339 /// Margin on top side of widget.
340 ///
341 /// This property adds margin outside of the widget's normal size
342 /// request, the margin will be added in addition to the size from
343 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
344 ///
345 /// Readable | Writable
346 ///
347 ///
348 /// #### `name`
349 /// Readable | Writable
350 ///
351 ///
352 /// #### `no-show-all`
353 /// Readable | Writable
354 ///
355 ///
356 /// #### `opacity`
357 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
358 /// more details about window opacity.
359 ///
360 /// Before 3.8 this was only available in GtkWindow
361 ///
362 /// Readable | Writable
363 ///
364 ///
365 /// #### `parent`
366 /// Readable | Writable
367 ///
368 ///
369 /// #### `receives-default`
370 /// Readable | Writable
371 ///
372 ///
373 /// #### `scale-factor`
374 /// The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
375 /// more details about widget scaling.
376 ///
377 /// Readable
378 ///
379 ///
380 /// #### `sensitive`
381 /// Readable | Writable
382 ///
383 ///
384 /// #### `style`
385 /// The style of the widget, which contains information about how it will look (colors, etc).
386 ///
387 /// Readable | Writable
388 ///
389 ///
390 /// #### `tooltip-markup`
391 /// Sets the text of tooltip to be the given string, which is marked up
392 /// with the [Pango text markup language][PangoMarkupFormat].
393 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
394 ///
395 /// This is a convenience property which will take care of getting the
396 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
397 /// will automatically be set to [`true`] and there will be taken care of
398 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
399 ///
400 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
401 /// are set, the last one wins.
402 ///
403 /// Readable | Writable
404 ///
405 ///
406 /// #### `tooltip-text`
407 /// Sets the text of tooltip to be the given string.
408 ///
409 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
410 ///
411 /// This is a convenience property which will take care of getting the
412 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
413 /// will automatically be set to [`true`] and there will be taken care of
414 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
415 ///
416 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
417 /// are set, the last one wins.
418 ///
419 /// Readable | Writable
420 ///
421 ///
422 /// #### `valign`
423 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
424 ///
425 /// Readable | Writable
426 ///
427 ///
428 /// #### `vexpand`
429 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
430 ///
431 /// Readable | Writable
432 ///
433 ///
434 /// #### `vexpand-set`
435 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
436 ///
437 /// Readable | Writable
438 ///
439 ///
440 /// #### `visible`
441 /// Readable | Writable
442 ///
443 ///
444 /// #### `width-request`
445 /// Readable | Writable
446 ///
447 ///
448 /// #### `window`
449 /// The widget's window if it is realized, [`None`] otherwise.
450 ///
451 /// Readable
452 /// </details>
453 /// <details><summary><h4>Scrollable</h4></summary>
454 ///
455 ///
456 /// #### `hadjustment`
457 /// Horizontal [`Adjustment`][crate::Adjustment] of the scrollable widget. This adjustment is
458 /// shared between the scrollable widget and its parent.
459 ///
460 /// Readable | Writable | Construct
461 ///
462 ///
463 /// #### `hscroll-policy`
464 /// Determines whether horizontal scrolling should start once the scrollable
465 /// widget is allocated less than its minimum width or less than its natural width.
466 ///
467 /// Readable | Writable
468 ///
469 ///
470 /// #### `vadjustment`
471 /// Verical [`Adjustment`][crate::Adjustment] of the scrollable widget. This adjustment is shared
472 /// between the scrollable widget and its parent.
473 ///
474 /// Readable | Writable | Construct
475 ///
476 ///
477 /// #### `vscroll-policy`
478 /// Determines whether vertical scrolling should start once the scrollable
479 /// widget is allocated less than its minimum height or less than its natural height.
480 ///
481 /// Readable | Writable
482 /// </details>
483 ///
484 /// ## Signals
485 ///
486 ///
487 /// #### `activate-cursor-item`
488 /// A [keybinding signal][GtkBindingSignal]
489 /// which gets emitted when the user activates the currently
490 /// focused item.
491 ///
492 /// Applications should not connect to it, but may emit it with
493 /// `g_signal_emit_by_name()` if they need to control activation
494 /// programmatically.
495 ///
496 /// The default bindings for this signal are Space, Return and Enter.
497 ///
498 /// Action
499 ///
500 ///
501 /// #### `item-activated`
502 /// The ::item-activated signal is emitted when the method
503 /// [`IconViewExt::item_activated()`][crate::prelude::IconViewExt::item_activated()] is called, when the user double
504 /// clicks an item with the "activate-on-single-click" property set
505 /// to [`false`], or when the user single clicks an item when the
506 /// "activate-on-single-click" property set to [`true`]. It is also
507 /// emitted when a non-editable item is selected and one of the keys:
508 /// Space, Return or Enter is pressed.
509 ///
510 ///
511 ///
512 ///
513 /// #### `move-cursor`
514 /// The ::move-cursor signal is a
515 /// [keybinding signal][GtkBindingSignal]
516 /// which gets emitted when the user initiates a cursor movement.
517 ///
518 /// Applications should not connect to it, but may emit it with
519 /// `g_signal_emit_by_name()` if they need to control the cursor
520 /// programmatically.
521 ///
522 /// The default bindings for this signal include
523 /// - Arrow keys which move by individual steps
524 /// - Home/End keys which move to the first/last item
525 /// - PageUp/PageDown which move by "pages"
526 /// All of these will extend the selection when combined with
527 /// the Shift modifier.
528 ///
529 /// Action
530 ///
531 ///
532 /// #### `select-all`
533 /// A [keybinding signal][GtkBindingSignal]
534 /// which gets emitted when the user selects all items.
535 ///
536 /// Applications should not connect to it, but may emit it with
537 /// `g_signal_emit_by_name()` if they need to control selection
538 /// programmatically.
539 ///
540 /// The default binding for this signal is Ctrl-a.
541 ///
542 /// Action
543 ///
544 ///
545 /// #### `select-cursor-item`
546 /// A [keybinding signal][GtkBindingSignal]
547 /// which gets emitted when the user selects the item that is currently
548 /// focused.
549 ///
550 /// Applications should not connect to it, but may emit it with
551 /// `g_signal_emit_by_name()` if they need to control selection
552 /// programmatically.
553 ///
554 /// There is no default binding for this signal.
555 ///
556 /// Action
557 ///
558 ///
559 /// #### `selection-changed`
560 /// The ::selection-changed signal is emitted when the selection
561 /// (i.e. the set of selected items) changes.
562 ///
563 ///
564 ///
565 ///
566 /// #### `toggle-cursor-item`
567 /// A [keybinding signal][GtkBindingSignal]
568 /// which gets emitted when the user toggles whether the currently
569 /// focused item is selected or not. The exact effect of this
570 /// depend on the selection mode.
571 ///
572 /// Applications should not connect to it, but may emit it with
573 /// `g_signal_emit_by_name()` if they need to control selection
574 /// programmatically.
575 ///
576 /// There is no default binding for this signal is Ctrl-Space.
577 ///
578 /// Action
579 ///
580 ///
581 /// #### `unselect-all`
582 /// A [keybinding signal][GtkBindingSignal]
583 /// which gets emitted when the user unselects all items.
584 ///
585 /// Applications should not connect to it, but may emit it with
586 /// `g_signal_emit_by_name()` if they need to control selection
587 /// programmatically.
588 ///
589 /// The default binding for this signal is Ctrl-Shift-a.
590 ///
591 /// Action
592 /// <details><summary><h4>Container</h4></summary>
593 ///
594 ///
595 /// #### `add`
596 ///
597 ///
598 ///
599 /// #### `check-resize`
600 ///
601 ///
602 ///
603 /// #### `remove`
604 ///
605 ///
606 ///
607 /// #### `set-focus-child`
608 ///
609 /// </details>
610 /// <details><summary><h4>Widget</h4></summary>
611 ///
612 ///
613 /// #### `accel-closures-changed`
614 ///
615 ///
616 ///
617 /// #### `button-press-event`
618 /// The ::button-press-event signal will be emitted when a button
619 /// (typically from a mouse) is pressed.
620 ///
621 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
622 /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
623 ///
624 /// This signal will be sent to the grab widget if there is one.
625 ///
626 ///
627 ///
628 ///
629 /// #### `button-release-event`
630 /// The ::button-release-event signal will be emitted when a button
631 /// (typically from a mouse) is released.
632 ///
633 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
634 /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
635 ///
636 /// This signal will be sent to the grab widget if there is one.
637 ///
638 ///
639 ///
640 ///
641 /// #### `can-activate-accel`
642 /// Determines whether an accelerator that activates the signal
643 /// identified by `signal_id` can currently be activated.
644 /// This signal is present to allow applications and derived
645 /// widgets to override the default [`Widget`][crate::Widget] handling
646 /// for determining whether an accelerator can be activated.
647 ///
648 ///
649 ///
650 ///
651 /// #### `child-notify`
652 /// The ::child-notify signal is emitted for each
653 /// [child property][child-properties] that has
654 /// changed on an object. The signal's detail holds the property name.
655 ///
656 /// Detailed
657 ///
658 ///
659 /// #### `composited-changed`
660 /// The ::composited-changed signal is emitted when the composited
661 /// status of `widgets` screen changes.
662 /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
663 ///
664 /// Action
665 ///
666 ///
667 /// #### `configure-event`
668 /// The ::configure-event signal will be emitted when the size, position or
669 /// stacking of the `widget`'s window has changed.
670 ///
671 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
672 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
673 /// automatically for all new windows.
674 ///
675 ///
676 ///
677 ///
678 /// #### `damage-event`
679 /// Emitted when a redirected window belonging to `widget` gets drawn into.
680 /// The region/area members of the event shows what area of the redirected
681 /// drawable was drawn into.
682 ///
683 ///
684 ///
685 ///
686 /// #### `delete-event`
687 /// The ::delete-event signal is emitted if a user requests that
688 /// a toplevel window is closed. The default handler for this signal
689 /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
690 /// this signal will cause the window to be hidden instead, so that
691 /// it can later be shown again without reconstructing it.
692 ///
693 ///
694 ///
695 ///
696 /// #### `destroy`
697 /// Signals that all holders of a reference to the widget should release
698 /// the reference that they hold. May result in finalization of the widget
699 /// if all references are released.
700 ///
701 /// This signal is not suitable for saving widget state.
702 ///
703 ///
704 ///
705 ///
706 /// #### `destroy-event`
707 /// The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
708 /// You rarely get this signal, because most widgets disconnect themselves
709 /// from their window before they destroy it, so no widget owns the
710 /// window at destroy time.
711 ///
712 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
713 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
714 /// automatically for all new windows.
715 ///
716 ///
717 ///
718 ///
719 /// #### `direction-changed`
720 /// The ::direction-changed signal is emitted when the text direction
721 /// of a widget changes.
722 ///
723 ///
724 ///
725 ///
726 /// #### `drag-begin`
727 /// The ::drag-begin signal is emitted on the drag source when a drag is
728 /// started. A typical reason to connect to this signal is to set up a
729 /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
730 ///
731 /// Note that some widgets set up a drag icon in the default handler of
732 /// this signal, so you may have to use `g_signal_connect_after()` to
733 /// override what the default handler did.
734 ///
735 ///
736 ///
737 ///
738 /// #### `drag-data-delete`
739 /// The ::drag-data-delete signal is emitted on the drag source when a drag
740 /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
741 /// handler is responsible for deleting the data that has been dropped. What
742 /// "delete" means depends on the context of the drag operation.
743 ///
744 ///
745 ///
746 ///
747 /// #### `drag-data-get`
748 /// The ::drag-data-get signal is emitted on the drag source when the drop
749 /// site requests the data which is dragged. It is the responsibility of
750 /// the signal handler to fill `data` with the data in the format which
751 /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
752 /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
753 ///
754 ///
755 ///
756 ///
757 /// #### `drag-data-received`
758 /// The ::drag-data-received signal is emitted on the drop site when the
759 /// dragged data has been received. If the data was received in order to
760 /// determine whether the drop will be accepted, the handler is expected
761 /// to call `gdk_drag_status()` and not finish the drag.
762 /// If the data was received in response to a [`drag-drop`][struct@crate::Widget#drag-drop] signal
763 /// (and this is the last target to be received), the handler for this
764 /// signal is expected to process the received data and then call
765 /// `gtk_drag_finish()`, setting the `success` parameter depending on
766 /// whether the data was processed successfully.
767 ///
768 /// Applications must create some means to determine why the signal was emitted
769 /// and therefore whether to call `gdk_drag_status()` or `gtk_drag_finish()`.
770 ///
771 /// The handler may inspect the selected action with
772 /// [`DragContext::selected_action()`][crate::gdk::DragContext::selected_action()] before calling
773 /// `gtk_drag_finish()`, e.g. to implement [`gdk::DragAction::ASK`][crate::gdk::DragAction::ASK] as
774 /// shown in the following example:
775 ///
776 ///
777 /// **⚠️ The following code is in C ⚠️**
778 ///
779 /// ```C
780 /// void
781 /// drag_data_received (GtkWidget *widget,
782 /// GdkDragContext *context,
783 /// gint x,
784 /// gint y,
785 /// GtkSelectionData *data,
786 /// guint info,
787 /// guint time)
788 /// {
789 /// if ((data->length >= 0) && (data->format == 8))
790 /// {
791 /// GdkDragAction action;
792 ///
793 /// // handle data here
794 ///
795 /// action = gdk_drag_context_get_selected_action (context);
796 /// if (action == GDK_ACTION_ASK)
797 /// {
798 /// GtkWidget *dialog;
799 /// gint response;
800 ///
801 /// dialog = gtk_message_dialog_new (NULL,
802 /// GTK_DIALOG_MODAL |
803 /// GTK_DIALOG_DESTROY_WITH_PARENT,
804 /// GTK_MESSAGE_INFO,
805 /// GTK_BUTTONS_YES_NO,
806 /// "Move the data ?\n");
807 /// response = gtk_dialog_run (GTK_DIALOG (dialog));
808 /// gtk_widget_destroy (dialog);
809 ///
810 /// if (response == GTK_RESPONSE_YES)
811 /// action = GDK_ACTION_MOVE;
812 /// else
813 /// action = GDK_ACTION_COPY;
814 /// }
815 ///
816 /// gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
817 /// }
818 /// else
819 /// gtk_drag_finish (context, FALSE, FALSE, time);
820 /// }
821 /// ```
822 ///
823 ///
824 ///
825 ///
826 /// #### `drag-drop`
827 /// The ::drag-drop signal is emitted on the drop site when the user drops
828 /// the data onto the widget. The signal handler must determine whether
829 /// the cursor position is in a drop zone or not. If it is not in a drop
830 /// zone, it returns [`false`] and no further processing is necessary.
831 /// Otherwise, the handler returns [`true`]. In this case, the handler must
832 /// ensure that `gtk_drag_finish()` is called to let the source know that
833 /// the drop is done. The call to `gtk_drag_finish()` can be done either
834 /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
835 /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
836 /// or more of the supported targets.
837 ///
838 ///
839 ///
840 ///
841 /// #### `drag-end`
842 /// The ::drag-end signal is emitted on the drag source when a drag is
843 /// finished. A typical reason to connect to this signal is to undo
844 /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
845 ///
846 ///
847 ///
848 ///
849 /// #### `drag-failed`
850 /// The ::drag-failed signal is emitted on the drag source when a drag has
851 /// failed. The signal handler may hook custom code to handle a failed DnD
852 /// operation based on the type of error, it returns [`true`] is the failure has
853 /// been already handled (not showing the default "drag operation failed"
854 /// animation), otherwise it returns [`false`].
855 ///
856 ///
857 ///
858 ///
859 /// #### `drag-leave`
860 /// The ::drag-leave signal is emitted on the drop site when the cursor
861 /// leaves the widget. A typical reason to connect to this signal is to
862 /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
863 /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
864 ///
865 ///
866 /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
867 /// ::drag-drop signal, for instance to allow cleaning up of a preview item
868 /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
869 ///
870 ///
871 ///
872 ///
873 /// #### `drag-motion`
874 /// The ::drag-motion signal is emitted on the drop site when the user
875 /// moves the cursor over the widget during a drag. The signal handler
876 /// must determine whether the cursor position is in a drop zone or not.
877 /// If it is not in a drop zone, it returns [`false`] and no further processing
878 /// is necessary. Otherwise, the handler returns [`true`]. In this case, the
879 /// handler is responsible for providing the necessary information for
880 /// displaying feedback to the user, by calling `gdk_drag_status()`.
881 ///
882 /// If the decision whether the drop will be accepted or rejected can't be
883 /// made based solely on the cursor position and the type of the data, the
884 /// handler may inspect the dragged data by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] and
885 /// defer the `gdk_drag_status()` call to the [`drag-data-received`][struct@crate::Widget#drag-data-received]
886 /// handler. Note that you must pass [`DestDefaults::DROP`][crate::DestDefaults::DROP],
887 /// [`DestDefaults::MOTION`][crate::DestDefaults::MOTION] or [`DestDefaults::ALL`][crate::DestDefaults::ALL] to [`WidgetExtManual::drag_dest_set()`][crate::prelude::WidgetExtManual::drag_dest_set()]
888 /// when using the drag-motion signal that way.
889 ///
890 /// Also note that there is no drag-enter signal. The drag receiver has to
891 /// keep track of whether he has received any drag-motion signals since the
892 /// last [`drag-leave`][struct@crate::Widget#drag-leave] and if not, treat the drag-motion signal as
893 /// an "enter" signal. Upon an "enter", the handler will typically highlight
894 /// the drop site with [`WidgetExt::drag_highlight()`][crate::prelude::WidgetExt::drag_highlight()].
895 ///
896 ///
897 /// **⚠️ The following code is in C ⚠️**
898 ///
899 /// ```C
900 /// static void
901 /// drag_motion (GtkWidget *widget,
902 /// GdkDragContext *context,
903 /// gint x,
904 /// gint y,
905 /// guint time)
906 /// {
907 /// GdkAtom target;
908 ///
909 /// PrivateData *private_data = GET_PRIVATE_DATA (widget);
910 ///
911 /// if (!private_data->drag_highlight)
912 /// {
913 /// private_data->drag_highlight = 1;
914 /// gtk_drag_highlight (widget);
915 /// }
916 ///
917 /// target = gtk_drag_dest_find_target (widget, context, NULL);
918 /// if (target == GDK_NONE)
919 /// gdk_drag_status (context, 0, time);
920 /// else
921 /// {
922 /// private_data->pending_status
923 /// = gdk_drag_context_get_suggested_action (context);
924 /// gtk_drag_get_data (widget, context, target, time);
925 /// }
926 ///
927 /// return TRUE;
928 /// }
929 ///
930 /// static void
931 /// drag_data_received (GtkWidget *widget,
932 /// GdkDragContext *context,
933 /// gint x,
934 /// gint y,
935 /// GtkSelectionData *selection_data,
936 /// guint info,
937 /// guint time)
938 /// {
939 /// PrivateData *private_data = GET_PRIVATE_DATA (widget);
940 ///
941 /// if (private_data->suggested_action)
942 /// {
943 /// private_data->suggested_action = 0;
944 ///
945 /// // We are getting this data due to a request in drag_motion,
946 /// // rather than due to a request in drag_drop, so we are just
947 /// // supposed to call gdk_drag_status(), not actually paste in
948 /// // the data.
949 ///
950 /// str = gtk_selection_data_get_text (selection_data);
951 /// if (!data_is_acceptable (str))
952 /// gdk_drag_status (context, 0, time);
953 /// else
954 /// gdk_drag_status (context,
955 /// private_data->suggested_action,
956 /// time);
957 /// }
958 /// else
959 /// {
960 /// // accept the drop
961 /// }
962 /// }
963 /// ```
964 ///
965 ///
966 ///
967 ///
968 /// #### `draw`
969 /// This signal is emitted when a widget is supposed to render itself.
970 /// The `widget`'s top left corner must be painted at the origin of
971 /// the passed in context and be sized to the values returned by
972 /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
973 /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
974 ///
975 /// Signal handlers connected to this signal can modify the cairo
976 /// context passed as `cr` in any way they like and don't need to
977 /// restore it. The signal emission takes care of calling `cairo_save()`
978 /// before and `cairo_restore()` after invoking the handler.
979 ///
980 /// The signal handler will get a `cr` with a clip region already set to the
981 /// widget's dirty region, i.e. to the area that needs repainting. Complicated
982 /// widgets that want to avoid redrawing themselves completely can get the full
983 /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
984 /// get a finer-grained representation of the dirty region with
985 /// `cairo_copy_clip_rectangle_list()`.
986 ///
987 ///
988 ///
989 ///
990 /// #### `enter-notify-event`
991 /// The ::enter-notify-event will be emitted when the pointer enters
992 /// the `widget`'s window.
993 ///
994 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
995 /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
996 ///
997 /// This signal will be sent to the grab widget if there is one.
998 ///
999 ///
1000 ///
1001 ///
1002 /// #### `event`
1003 /// The GTK+ main loop will emit three signals for each GDK event delivered
1004 /// to a widget: one generic ::event signal, another, more specific,
1005 /// signal that matches the type of event delivered (e.g.
1006 /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
1007 /// [`event-after`][struct@crate::Widget#event-after] signal.
1008 ///
1009 ///
1010 ///
1011 ///
1012 /// #### `event-after`
1013 /// After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
1014 /// the second more specific signal, ::event-after will be emitted
1015 /// regardless of the previous two signals handlers return values.
1016 ///
1017 ///
1018 ///
1019 ///
1020 /// #### `focus`
1021 ///
1022 ///
1023 ///
1024 /// #### `focus-in-event`
1025 /// The ::focus-in-event signal will be emitted when the keyboard focus
1026 /// enters the `widget`'s window.
1027 ///
1028 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1029 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
1030 ///
1031 ///
1032 ///
1033 ///
1034 /// #### `focus-out-event`
1035 /// The ::focus-out-event signal will be emitted when the keyboard focus
1036 /// leaves the `widget`'s window.
1037 ///
1038 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1039 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
1040 ///
1041 ///
1042 ///
1043 ///
1044 /// #### `grab-broken-event`
1045 /// Emitted when a pointer or keyboard grab on a window belonging
1046 /// to `widget` gets broken.
1047 ///
1048 /// On X11, this happens when the grab window becomes unviewable
1049 /// (i.e. it or one of its ancestors is unmapped), or if the same
1050 /// application grabs the pointer or keyboard again.
1051 ///
1052 ///
1053 ///
1054 ///
1055 /// #### `grab-focus`
1056 /// Action
1057 ///
1058 ///
1059 /// #### `grab-notify`
1060 /// The ::grab-notify signal is emitted when a widget becomes
1061 /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
1062 /// another widget, or when it becomes unshadowed due to a grab
1063 /// being removed.
1064 ///
1065 /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
1066 /// grab widget in the grab stack of its window group is not
1067 /// its ancestor.
1068 ///
1069 ///
1070 ///
1071 ///
1072 /// #### `hide`
1073 /// The ::hide signal is emitted when `widget` is hidden, for example with
1074 /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
1075 ///
1076 ///
1077 ///
1078 ///
1079 /// #### `hierarchy-changed`
1080 /// The ::hierarchy-changed signal is emitted when the
1081 /// anchored state of a widget changes. A widget is
1082 /// “anchored” when its toplevel
1083 /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
1084 /// a widget changes from un-anchored to anchored or vice-versa.
1085 ///
1086 ///
1087 ///
1088 ///
1089 /// #### `key-press-event`
1090 /// The ::key-press-event signal is emitted when a key is pressed. The signal
1091 /// emission will reoccur at the key-repeat rate when the key is kept pressed.
1092 ///
1093 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1094 /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
1095 ///
1096 /// This signal will be sent to the grab widget if there is one.
1097 ///
1098 ///
1099 ///
1100 ///
1101 /// #### `key-release-event`
1102 /// The ::key-release-event signal is emitted when a key is released.
1103 ///
1104 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1105 /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
1106 ///
1107 /// This signal will be sent to the grab widget if there is one.
1108 ///
1109 ///
1110 ///
1111 ///
1112 /// #### `keynav-failed`
1113 /// Gets emitted if keyboard navigation fails.
1114 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
1115 ///
1116 ///
1117 ///
1118 ///
1119 /// #### `leave-notify-event`
1120 /// The ::leave-notify-event will be emitted when the pointer leaves
1121 /// the `widget`'s window.
1122 ///
1123 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1124 /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
1125 ///
1126 /// This signal will be sent to the grab widget if there is one.
1127 ///
1128 ///
1129 ///
1130 ///
1131 /// #### `map`
1132 /// The ::map signal is emitted when `widget` is going to be mapped, that is
1133 /// when the widget is visible (which is controlled with
1134 /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
1135 /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
1136 /// be emitted.
1137 ///
1138 /// The ::map signal can be used to determine whether a widget will be drawn,
1139 /// for instance it can resume an animation that was stopped during the
1140 /// emission of [`unmap`][struct@crate::Widget#unmap].
1141 ///
1142 ///
1143 ///
1144 ///
1145 /// #### `map-event`
1146 /// The ::map-event signal will be emitted when the `widget`'s window is
1147 /// mapped. A window is mapped when it becomes visible on the screen.
1148 ///
1149 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1150 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1151 /// automatically for all new windows.
1152 ///
1153 ///
1154 ///
1155 ///
1156 /// #### `mnemonic-activate`
1157 /// The default handler for this signal activates `widget` if `group_cycling`
1158 /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
1159 ///
1160 ///
1161 ///
1162 ///
1163 /// #### `motion-notify-event`
1164 /// The ::motion-notify-event signal is emitted when the pointer moves
1165 /// over the widget's [`gdk::Window`][crate::gdk::Window].
1166 ///
1167 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
1168 /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
1169 ///
1170 /// This signal will be sent to the grab widget if there is one.
1171 ///
1172 ///
1173 ///
1174 ///
1175 /// #### `move-focus`
1176 /// Action
1177 ///
1178 ///
1179 /// #### `parent-set`
1180 /// The ::parent-set signal is emitted when a new parent
1181 /// has been set on a widget.
1182 ///
1183 ///
1184 ///
1185 ///
1186 /// #### `popup-menu`
1187 /// This signal gets emitted whenever a widget should pop up a context
1188 /// menu. This usually happens through the standard key binding mechanism;
1189 /// by pressing a certain key while a widget is focused, the user can cause
1190 /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
1191 /// a menu with clipboard commands. See the
1192 /// [Popup Menu Migration Checklist][checklist-popup-menu]
1193 /// for an example of how to use this signal.
1194 ///
1195 /// Action
1196 ///
1197 ///
1198 /// #### `property-notify-event`
1199 /// The ::property-notify-event signal will be emitted when a property on
1200 /// the `widget`'s window has been changed or deleted.
1201 ///
1202 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1203 /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
1204 ///
1205 ///
1206 ///
1207 ///
1208 /// #### `proximity-in-event`
1209 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1210 /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
1211 ///
1212 /// This signal will be sent to the grab widget if there is one.
1213 ///
1214 ///
1215 ///
1216 ///
1217 /// #### `proximity-out-event`
1218 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1219 /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
1220 ///
1221 /// This signal will be sent to the grab widget if there is one.
1222 ///
1223 ///
1224 ///
1225 ///
1226 /// #### `query-tooltip`
1227 /// Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
1228 /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
1229 /// focus in keyboard mode.
1230 ///
1231 /// Using the given coordinates, the signal handler should determine
1232 /// whether a tooltip should be shown for `widget`. If this is the case
1233 /// [`true`] should be returned, [`false`] otherwise. Note that if
1234 /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
1235 /// should not be used.
1236 ///
1237 /// The signal handler is free to manipulate `tooltip` with the therefore
1238 /// destined function calls.
1239 ///
1240 ///
1241 ///
1242 ///
1243 /// #### `realize`
1244 /// The ::realize signal is emitted when `widget` is associated with a
1245 /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
1246 /// widget has been mapped (that is, it is going to be drawn).
1247 ///
1248 ///
1249 ///
1250 ///
1251 /// #### `screen-changed`
1252 /// The ::screen-changed signal gets emitted when the
1253 /// screen of a widget has changed.
1254 ///
1255 ///
1256 ///
1257 ///
1258 /// #### `scroll-event`
1259 /// The ::scroll-event signal is emitted when a button in the 4 to 7
1260 /// range is pressed. Wheel mice are usually configured to generate
1261 /// button press events for buttons 4 and 5 when the wheel is turned.
1262 ///
1263 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1264 /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
1265 ///
1266 /// This signal will be sent to the grab widget if there is one.
1267 ///
1268 ///
1269 ///
1270 ///
1271 /// #### `selection-clear-event`
1272 /// The ::selection-clear-event signal will be emitted when the
1273 /// the `widget`'s window has lost ownership of a selection.
1274 ///
1275 ///
1276 ///
1277 ///
1278 /// #### `selection-get`
1279 ///
1280 ///
1281 ///
1282 /// #### `selection-notify-event`
1283 ///
1284 ///
1285 ///
1286 /// #### `selection-received`
1287 ///
1288 ///
1289 ///
1290 /// #### `selection-request-event`
1291 /// The ::selection-request-event signal will be emitted when
1292 /// another client requests ownership of the selection owned by
1293 /// the `widget`'s window.
1294 ///
1295 ///
1296 ///
1297 ///
1298 /// #### `show`
1299 /// The ::show signal is emitted when `widget` is shown, for example with
1300 /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
1301 ///
1302 ///
1303 ///
1304 ///
1305 /// #### `show-help`
1306 /// Action
1307 ///
1308 ///
1309 /// #### `size-allocate`
1310 ///
1311 ///
1312 ///
1313 /// #### `state-changed`
1314 /// The ::state-changed signal is emitted when the widget state changes.
1315 /// See `gtk_widget_get_state()`.
1316 ///
1317 ///
1318 ///
1319 ///
1320 /// #### `state-flags-changed`
1321 /// The ::state-flags-changed signal is emitted when the widget state
1322 /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
1323 ///
1324 ///
1325 ///
1326 ///
1327 /// #### `style-set`
1328 /// The ::style-set signal is emitted when a new style has been set
1329 /// on a widget. Note that style-modifying functions like
1330 /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1331 ///
1332 /// Note that this signal is emitted for changes to the deprecated
1333 /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1334 /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1335 ///
1336 ///
1337 ///
1338 ///
1339 /// #### `style-updated`
1340 /// The ::style-updated signal is a convenience signal that is emitted when the
1341 /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1342 /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1343 ///
1344 /// Note that style-modifying functions like `gtk_widget_override_color()` also
1345 /// cause this signal to be emitted.
1346 ///
1347 ///
1348 ///
1349 ///
1350 /// #### `touch-event`
1351 ///
1352 ///
1353 ///
1354 /// #### `unmap`
1355 /// The ::unmap signal is emitted when `widget` is going to be unmapped, which
1356 /// means that either it or any of its parents up to the toplevel widget have
1357 /// been set as hidden.
1358 ///
1359 /// As ::unmap indicates that a widget will not be shown any longer, it can be
1360 /// used to, for example, stop an animation on the widget.
1361 ///
1362 ///
1363 ///
1364 ///
1365 /// #### `unmap-event`
1366 /// The ::unmap-event signal will be emitted when the `widget`'s window is
1367 /// unmapped. A window is unmapped when it becomes invisible on the screen.
1368 ///
1369 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1370 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1371 /// automatically for all new windows.
1372 ///
1373 ///
1374 ///
1375 ///
1376 /// #### `unrealize`
1377 /// The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1378 /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1379 /// called or the widget has been unmapped (that is, it is going to be
1380 /// hidden).
1381 ///
1382 ///
1383 ///
1384 ///
1385 /// #### `visibility-notify-event`
1386 /// The ::visibility-notify-event will be emitted when the `widget`'s
1387 /// window is obscured or unobscured.
1388 ///
1389 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1390 /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1391 ///
1392 ///
1393 ///
1394 ///
1395 /// #### `window-state-event`
1396 /// The ::window-state-event will be emitted when the state of the
1397 /// toplevel window associated to the `widget` changes.
1398 ///
1399 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1400 /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1401 /// this mask automatically for all new windows.
1402 ///
1403 ///
1404 /// </details>
1405 ///
1406 /// # Implements
1407 ///
1408 /// [`IconViewExt`][trait@crate::prelude::IconViewExt], [`ContainerExt`][trait@crate::prelude::ContainerExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`CellLayoutExt`][trait@crate::prelude::CellLayoutExt], [`ScrollableExt`][trait@crate::prelude::ScrollableExt], [`ContainerExtManual`][trait@crate::prelude::ContainerExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
1409 #[doc(alias = "GtkIconView")]
1410 pub struct IconView(Object<ffi::GtkIconView, ffi::GtkIconViewClass>) @extends Container, Widget, @implements Buildable, CellLayout, Scrollable;
1411
1412 match fn {
1413 type_ => || ffi::gtk_icon_view_get_type(),
1414 }
1415}
1416
1417impl IconView {
1418 pub const NONE: Option<&'static IconView> = None;
1419
1420 /// Creates a new [`IconView`][crate::IconView] widget
1421 ///
1422 /// # Returns
1423 ///
1424 /// A newly created [`IconView`][crate::IconView] widget
1425 #[doc(alias = "gtk_icon_view_new")]
1426 pub fn new() -> IconView {
1427 assert_initialized_main_thread!();
1428 unsafe { Widget::from_glib_none(ffi::gtk_icon_view_new()).unsafe_cast() }
1429 }
1430
1431 /// Creates a new [`IconView`][crate::IconView] widget using the
1432 /// specified `area` to layout cells inside the icons.
1433 /// ## `area`
1434 /// the [`CellArea`][crate::CellArea] to use to layout cells
1435 ///
1436 /// # Returns
1437 ///
1438 /// A newly created [`IconView`][crate::IconView] widget
1439 #[doc(alias = "gtk_icon_view_new_with_area")]
1440 #[doc(alias = "new_with_area")]
1441 pub fn with_area(area: &impl IsA<CellArea>) -> IconView {
1442 skip_assert_initialized!();
1443 unsafe {
1444 Widget::from_glib_none(ffi::gtk_icon_view_new_with_area(
1445 area.as_ref().to_glib_none().0,
1446 ))
1447 .unsafe_cast()
1448 }
1449 }
1450
1451 /// Creates a new [`IconView`][crate::IconView] widget with the model `model`.
1452 /// ## `model`
1453 /// The model.
1454 ///
1455 /// # Returns
1456 ///
1457 /// A newly created [`IconView`][crate::IconView] widget.
1458 #[doc(alias = "gtk_icon_view_new_with_model")]
1459 #[doc(alias = "new_with_model")]
1460 pub fn with_model(model: &impl IsA<TreeModel>) -> IconView {
1461 skip_assert_initialized!();
1462 unsafe {
1463 Widget::from_glib_none(ffi::gtk_icon_view_new_with_model(
1464 model.as_ref().to_glib_none().0,
1465 ))
1466 .unsafe_cast()
1467 }
1468 }
1469
1470 // rustdoc-stripper-ignore-next
1471 /// Creates a new builder-pattern struct instance to construct [`IconView`] objects.
1472 ///
1473 /// This method returns an instance of [`IconViewBuilder`](crate::builders::IconViewBuilder) which can be used to create [`IconView`] objects.
1474 pub fn builder() -> IconViewBuilder {
1475 IconViewBuilder::new()
1476 }
1477}
1478
1479impl Default for IconView {
1480 fn default() -> Self {
1481 Self::new()
1482 }
1483}
1484
1485// rustdoc-stripper-ignore-next
1486/// A [builder-pattern] type to construct [`IconView`] objects.
1487///
1488/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1489#[must_use = "The builder must be built to be used"]
1490pub struct IconViewBuilder {
1491 builder: glib::object::ObjectBuilder<'static, IconView>,
1492}
1493
1494impl IconViewBuilder {
1495 fn new() -> Self {
1496 Self {
1497 builder: glib::object::Object::builder(),
1498 }
1499 }
1500
1501 /// The activate-on-single-click property specifies whether the "item-activated" signal
1502 /// will be emitted after a single click.
1503 pub fn activate_on_single_click(self, activate_on_single_click: bool) -> Self {
1504 Self {
1505 builder: self
1506 .builder
1507 .property("activate-on-single-click", activate_on_single_click),
1508 }
1509 }
1510
1511 /// The [`CellArea`][crate::CellArea] used to layout cell renderers for this view.
1512 ///
1513 /// If no area is specified when creating the icon view with [`IconView::with_area()`][crate::IconView::with_area()]
1514 /// a [`CellAreaBox`][crate::CellAreaBox] will be used.
1515 pub fn cell_area(self, cell_area: &impl IsA<CellArea>) -> Self {
1516 Self {
1517 builder: self
1518 .builder
1519 .property("cell-area", cell_area.clone().upcast()),
1520 }
1521 }
1522
1523 /// The column-spacing property specifies the space which is inserted between
1524 /// the columns of the icon view.
1525 pub fn column_spacing(self, column_spacing: i32) -> Self {
1526 Self {
1527 builder: self.builder.property("column-spacing", column_spacing),
1528 }
1529 }
1530
1531 /// The columns property contains the number of the columns in which the
1532 /// items should be displayed. If it is -1, the number of columns will
1533 /// be chosen automatically to fill the available area.
1534 pub fn columns(self, columns: i32) -> Self {
1535 Self {
1536 builder: self.builder.property("columns", columns),
1537 }
1538 }
1539
1540 /// The item-orientation property specifies how the cells (i.e. the icon and
1541 /// the text) of the item are positioned relative to each other.
1542 pub fn item_orientation(self, item_orientation: Orientation) -> Self {
1543 Self {
1544 builder: self.builder.property("item-orientation", item_orientation),
1545 }
1546 }
1547
1548 /// The item-padding property specifies the padding around each
1549 /// of the icon view's item.
1550 pub fn item_padding(self, item_padding: i32) -> Self {
1551 Self {
1552 builder: self.builder.property("item-padding", item_padding),
1553 }
1554 }
1555
1556 /// The item-width property specifies the width to use for each item.
1557 /// If it is set to -1, the icon view will automatically determine a
1558 /// suitable item size.
1559 pub fn item_width(self, item_width: i32) -> Self {
1560 Self {
1561 builder: self.builder.property("item-width", item_width),
1562 }
1563 }
1564
1565 /// The margin property specifies the space which is inserted
1566 /// at the edges of the icon view.
1567 pub fn margin(self, margin: i32) -> Self {
1568 Self {
1569 builder: self.builder.property("margin", margin),
1570 }
1571 }
1572
1573 /// The ::markup-column property contains the number of the model column
1574 /// containing markup information to be displayed. The markup column must be
1575 /// of type `G_TYPE_STRING`. If this property and the :text-column property
1576 /// are both set to column numbers, it overrides the text column.
1577 /// If both are set to -1, no texts are displayed.
1578 pub fn markup_column(self, markup_column: i32) -> Self {
1579 Self {
1580 builder: self.builder.property("markup-column", markup_column),
1581 }
1582 }
1583
1584 pub fn model(self, model: &impl IsA<TreeModel>) -> Self {
1585 Self {
1586 builder: self.builder.property("model", model.clone().upcast()),
1587 }
1588 }
1589
1590 /// The ::pixbuf-column property contains the number of the model column
1591 /// containing the pixbufs which are displayed. The pixbuf column must be
1592 /// of type `GDK_TYPE_PIXBUF`. Setting this property to -1 turns off the
1593 /// display of pixbufs.
1594 pub fn pixbuf_column(self, pixbuf_column: i32) -> Self {
1595 Self {
1596 builder: self.builder.property("pixbuf-column", pixbuf_column),
1597 }
1598 }
1599
1600 /// The reorderable property specifies if the items can be reordered
1601 /// by DND.
1602 pub fn reorderable(self, reorderable: bool) -> Self {
1603 Self {
1604 builder: self.builder.property("reorderable", reorderable),
1605 }
1606 }
1607
1608 /// The row-spacing property specifies the space which is inserted between
1609 /// the rows of the icon view.
1610 pub fn row_spacing(self, row_spacing: i32) -> Self {
1611 Self {
1612 builder: self.builder.property("row-spacing", row_spacing),
1613 }
1614 }
1615
1616 /// The ::selection-mode property specifies the selection mode of
1617 /// icon view. If the mode is [`SelectionMode::Multiple`][crate::SelectionMode::Multiple], rubberband selection
1618 /// is enabled, for the other modes, only keyboard selection is possible.
1619 pub fn selection_mode(self, selection_mode: SelectionMode) -> Self {
1620 Self {
1621 builder: self.builder.property("selection-mode", selection_mode),
1622 }
1623 }
1624
1625 /// The spacing property specifies the space which is inserted between
1626 /// the cells (i.e. the icon and the text) of an item.
1627 pub fn spacing(self, spacing: i32) -> Self {
1628 Self {
1629 builder: self.builder.property("spacing", spacing),
1630 }
1631 }
1632
1633 /// The ::text-column property contains the number of the model column
1634 /// containing the texts which are displayed. The text column must be
1635 /// of type `G_TYPE_STRING`. If this property and the :markup-column
1636 /// property are both set to -1, no texts are displayed.
1637 pub fn text_column(self, text_column: i32) -> Self {
1638 Self {
1639 builder: self.builder.property("text-column", text_column),
1640 }
1641 }
1642
1643 pub fn tooltip_column(self, tooltip_column: i32) -> Self {
1644 Self {
1645 builder: self.builder.property("tooltip-column", tooltip_column),
1646 }
1647 }
1648
1649 pub fn border_width(self, border_width: u32) -> Self {
1650 Self {
1651 builder: self.builder.property("border-width", border_width),
1652 }
1653 }
1654
1655 pub fn child(self, child: &impl IsA<Widget>) -> Self {
1656 Self {
1657 builder: self.builder.property("child", child.clone().upcast()),
1658 }
1659 }
1660
1661 pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
1662 Self {
1663 builder: self.builder.property("resize-mode", resize_mode),
1664 }
1665 }
1666
1667 pub fn app_paintable(self, app_paintable: bool) -> Self {
1668 Self {
1669 builder: self.builder.property("app-paintable", app_paintable),
1670 }
1671 }
1672
1673 pub fn can_default(self, can_default: bool) -> Self {
1674 Self {
1675 builder: self.builder.property("can-default", can_default),
1676 }
1677 }
1678
1679 pub fn can_focus(self, can_focus: bool) -> Self {
1680 Self {
1681 builder: self.builder.property("can-focus", can_focus),
1682 }
1683 }
1684
1685 pub fn events(self, events: gdk::EventMask) -> Self {
1686 Self {
1687 builder: self.builder.property("events", events),
1688 }
1689 }
1690
1691 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1692 pub fn expand(self, expand: bool) -> Self {
1693 Self {
1694 builder: self.builder.property("expand", expand),
1695 }
1696 }
1697
1698 /// Whether the widget should grab focus when it is clicked with the mouse.
1699 ///
1700 /// This property is only relevant for widgets that can take focus.
1701 ///
1702 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1703 /// GtkComboBox) implemented this property individually.
1704 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1705 Self {
1706 builder: self.builder.property("focus-on-click", focus_on_click),
1707 }
1708 }
1709
1710 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1711 pub fn halign(self, halign: Align) -> Self {
1712 Self {
1713 builder: self.builder.property("halign", halign),
1714 }
1715 }
1716
1717 pub fn has_default(self, has_default: bool) -> Self {
1718 Self {
1719 builder: self.builder.property("has-default", has_default),
1720 }
1721 }
1722
1723 pub fn has_focus(self, has_focus: bool) -> Self {
1724 Self {
1725 builder: self.builder.property("has-focus", has_focus),
1726 }
1727 }
1728
1729 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1730 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1731 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1732 /// whether it will provide a tooltip or not.
1733 ///
1734 /// Note that setting this property to [`true`] for the first time will change
1735 /// the event masks of the GdkWindows of this widget to include leave-notify
1736 /// and motion-notify events. This cannot and will not be undone when the
1737 /// property is set to [`false`] again.
1738 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1739 Self {
1740 builder: self.builder.property("has-tooltip", has_tooltip),
1741 }
1742 }
1743
1744 pub fn height_request(self, height_request: i32) -> Self {
1745 Self {
1746 builder: self.builder.property("height-request", height_request),
1747 }
1748 }
1749
1750 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1751 pub fn hexpand(self, hexpand: bool) -> Self {
1752 Self {
1753 builder: self.builder.property("hexpand", hexpand),
1754 }
1755 }
1756
1757 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1758 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1759 Self {
1760 builder: self.builder.property("hexpand-set", hexpand_set),
1761 }
1762 }
1763
1764 pub fn is_focus(self, is_focus: bool) -> Self {
1765 Self {
1766 builder: self.builder.property("is-focus", is_focus),
1767 }
1768 }
1769
1770 /// Margin on bottom side of widget.
1771 ///
1772 /// This property adds margin outside of the widget's normal size
1773 /// request, the margin will be added in addition to the size from
1774 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1775 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1776 Self {
1777 builder: self.builder.property("margin-bottom", margin_bottom),
1778 }
1779 }
1780
1781 /// Margin on end of widget, horizontally. This property supports
1782 /// left-to-right and right-to-left text directions.
1783 ///
1784 /// This property adds margin outside of the widget's normal size
1785 /// request, the margin will be added in addition to the size from
1786 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1787 pub fn margin_end(self, margin_end: i32) -> Self {
1788 Self {
1789 builder: self.builder.property("margin-end", margin_end),
1790 }
1791 }
1792
1793 /// Margin on start of widget, horizontally. This property supports
1794 /// left-to-right and right-to-left text directions.
1795 ///
1796 /// This property adds margin outside of the widget's normal size
1797 /// request, the margin will be added in addition to the size from
1798 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1799 pub fn margin_start(self, margin_start: i32) -> Self {
1800 Self {
1801 builder: self.builder.property("margin-start", margin_start),
1802 }
1803 }
1804
1805 /// Margin on top side of widget.
1806 ///
1807 /// This property adds margin outside of the widget's normal size
1808 /// request, the margin will be added in addition to the size from
1809 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1810 pub fn margin_top(self, margin_top: i32) -> Self {
1811 Self {
1812 builder: self.builder.property("margin-top", margin_top),
1813 }
1814 }
1815
1816 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1817 Self {
1818 builder: self.builder.property("name", name.into()),
1819 }
1820 }
1821
1822 pub fn no_show_all(self, no_show_all: bool) -> Self {
1823 Self {
1824 builder: self.builder.property("no-show-all", no_show_all),
1825 }
1826 }
1827
1828 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1829 /// more details about window opacity.
1830 ///
1831 /// Before 3.8 this was only available in GtkWindow
1832 pub fn opacity(self, opacity: f64) -> Self {
1833 Self {
1834 builder: self.builder.property("opacity", opacity),
1835 }
1836 }
1837
1838 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1839 Self {
1840 builder: self.builder.property("parent", parent.clone().upcast()),
1841 }
1842 }
1843
1844 pub fn receives_default(self, receives_default: bool) -> Self {
1845 Self {
1846 builder: self.builder.property("receives-default", receives_default),
1847 }
1848 }
1849
1850 pub fn sensitive(self, sensitive: bool) -> Self {
1851 Self {
1852 builder: self.builder.property("sensitive", sensitive),
1853 }
1854 }
1855
1856 /// Sets the text of tooltip to be the given string, which is marked up
1857 /// with the [Pango text markup language][PangoMarkupFormat].
1858 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1859 ///
1860 /// This is a convenience property which will take care of getting the
1861 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1862 /// will automatically be set to [`true`] and there will be taken care of
1863 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1864 ///
1865 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1866 /// are set, the last one wins.
1867 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1868 Self {
1869 builder: self
1870 .builder
1871 .property("tooltip-markup", tooltip_markup.into()),
1872 }
1873 }
1874
1875 /// Sets the text of tooltip to be the given string.
1876 ///
1877 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1878 ///
1879 /// This is a convenience property which will take care of getting the
1880 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1881 /// will automatically be set to [`true`] and there will be taken care of
1882 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1883 ///
1884 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1885 /// are set, the last one wins.
1886 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1887 Self {
1888 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1889 }
1890 }
1891
1892 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1893 pub fn valign(self, valign: Align) -> Self {
1894 Self {
1895 builder: self.builder.property("valign", valign),
1896 }
1897 }
1898
1899 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1900 pub fn vexpand(self, vexpand: bool) -> Self {
1901 Self {
1902 builder: self.builder.property("vexpand", vexpand),
1903 }
1904 }
1905
1906 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1907 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1908 Self {
1909 builder: self.builder.property("vexpand-set", vexpand_set),
1910 }
1911 }
1912
1913 pub fn visible(self, visible: bool) -> Self {
1914 Self {
1915 builder: self.builder.property("visible", visible),
1916 }
1917 }
1918
1919 pub fn width_request(self, width_request: i32) -> Self {
1920 Self {
1921 builder: self.builder.property("width-request", width_request),
1922 }
1923 }
1924
1925 /// Horizontal [`Adjustment`][crate::Adjustment] of the scrollable widget. This adjustment is
1926 /// shared between the scrollable widget and its parent.
1927 pub fn hadjustment(self, hadjustment: &impl IsA<Adjustment>) -> Self {
1928 Self {
1929 builder: self
1930 .builder
1931 .property("hadjustment", hadjustment.clone().upcast()),
1932 }
1933 }
1934
1935 /// Determines whether horizontal scrolling should start once the scrollable
1936 /// widget is allocated less than its minimum width or less than its natural width.
1937 pub fn hscroll_policy(self, hscroll_policy: ScrollablePolicy) -> Self {
1938 Self {
1939 builder: self.builder.property("hscroll-policy", hscroll_policy),
1940 }
1941 }
1942
1943 /// Verical [`Adjustment`][crate::Adjustment] of the scrollable widget. This adjustment is shared
1944 /// between the scrollable widget and its parent.
1945 pub fn vadjustment(self, vadjustment: &impl IsA<Adjustment>) -> Self {
1946 Self {
1947 builder: self
1948 .builder
1949 .property("vadjustment", vadjustment.clone().upcast()),
1950 }
1951 }
1952
1953 /// Determines whether vertical scrolling should start once the scrollable
1954 /// widget is allocated less than its minimum height or less than its natural height.
1955 pub fn vscroll_policy(self, vscroll_policy: ScrollablePolicy) -> Self {
1956 Self {
1957 builder: self.builder.property("vscroll-policy", vscroll_policy),
1958 }
1959 }
1960
1961 // rustdoc-stripper-ignore-next
1962 /// Build the [`IconView`].
1963 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1964 pub fn build(self) -> IconView {
1965 assert_initialized_main_thread!();
1966 self.builder.build()
1967 }
1968}
1969
1970/// Trait containing all [`struct@IconView`] methods.
1971///
1972/// # Implementors
1973///
1974/// [`IconView`][struct@crate::IconView]
1975pub trait IconViewExt: IsA<IconView> + 'static {
1976 /// Converts widget coordinates to coordinates for the bin_window,
1977 /// as expected by e.g. [`path_at_pos()`][Self::path_at_pos()].
1978 /// ## `wx`
1979 /// X coordinate relative to the widget
1980 /// ## `wy`
1981 /// Y coordinate relative to the widget
1982 ///
1983 /// # Returns
1984 ///
1985 ///
1986 /// ## `bx`
1987 /// return location for bin_window X coordinate
1988 ///
1989 /// ## `by`
1990 /// return location for bin_window Y coordinate
1991 #[doc(alias = "gtk_icon_view_convert_widget_to_bin_window_coords")]
1992 fn convert_widget_to_bin_window_coords(&self, wx: i32, wy: i32) -> (i32, i32) {
1993 unsafe {
1994 let mut bx = std::mem::MaybeUninit::uninit();
1995 let mut by = std::mem::MaybeUninit::uninit();
1996 ffi::gtk_icon_view_convert_widget_to_bin_window_coords(
1997 self.as_ref().to_glib_none().0,
1998 wx,
1999 wy,
2000 bx.as_mut_ptr(),
2001 by.as_mut_ptr(),
2002 );
2003 (bx.assume_init(), by.assume_init())
2004 }
2005 }
2006
2007 /// Creates a [`cairo::Surface`][crate::cairo::Surface] representation of the item at `path`.
2008 /// This image is used for a drag icon.
2009 /// ## `path`
2010 /// a [`TreePath`][crate::TreePath] in `self`
2011 ///
2012 /// # Returns
2013 ///
2014 /// a newly-allocated surface of the drag icon.
2015 #[doc(alias = "gtk_icon_view_create_drag_icon")]
2016 fn create_drag_icon(&self, path: &TreePath) -> Option<cairo::Surface> {
2017 unsafe {
2018 from_glib_full(ffi::gtk_icon_view_create_drag_icon(
2019 self.as_ref().to_glib_none().0,
2020 mut_override(path.to_glib_none().0),
2021 ))
2022 }
2023 }
2024
2025 /// Gets the setting set by [`set_activate_on_single_click()`][Self::set_activate_on_single_click()].
2026 ///
2027 /// # Returns
2028 ///
2029 /// [`true`] if item-activated will be emitted on a single click
2030 #[doc(alias = "gtk_icon_view_get_activate_on_single_click")]
2031 #[doc(alias = "get_activate_on_single_click")]
2032 #[doc(alias = "activate-on-single-click")]
2033 fn activates_on_single_click(&self) -> bool {
2034 unsafe {
2035 from_glib(ffi::gtk_icon_view_get_activate_on_single_click(
2036 self.as_ref().to_glib_none().0,
2037 ))
2038 }
2039 }
2040
2041 /// Fills the bounding rectangle in widget coordinates for the cell specified by
2042 /// `path` and `cell`. If `cell` is [`None`] the main cell area is used.
2043 ///
2044 /// This function is only valid if `self` is realized.
2045 /// ## `path`
2046 /// a [`TreePath`][crate::TreePath]
2047 /// ## `cell`
2048 /// a [`CellRenderer`][crate::CellRenderer] or [`None`]
2049 ///
2050 /// # Returns
2051 ///
2052 /// [`false`] if there is no such item, [`true`] otherwise
2053 ///
2054 /// ## `rect`
2055 /// rectangle to fill with cell rect
2056 #[doc(alias = "gtk_icon_view_get_cell_rect")]
2057 #[doc(alias = "get_cell_rect")]
2058 fn cell_rect(
2059 &self,
2060 path: &TreePath,
2061 cell: Option<&impl IsA<CellRenderer>>,
2062 ) -> Option<gdk::Rectangle> {
2063 unsafe {
2064 let mut rect = gdk::Rectangle::uninitialized();
2065 let ret = from_glib(ffi::gtk_icon_view_get_cell_rect(
2066 self.as_ref().to_glib_none().0,
2067 mut_override(path.to_glib_none().0),
2068 cell.map(|p| p.as_ref()).to_glib_none().0,
2069 rect.to_glib_none_mut().0,
2070 ));
2071 if ret { Some(rect) } else { None }
2072 }
2073 }
2074
2075 /// Returns the value of the ::column-spacing property.
2076 ///
2077 /// # Returns
2078 ///
2079 /// the space between columns
2080 #[doc(alias = "gtk_icon_view_get_column_spacing")]
2081 #[doc(alias = "get_column_spacing")]
2082 #[doc(alias = "column-spacing")]
2083 fn column_spacing(&self) -> i32 {
2084 unsafe { ffi::gtk_icon_view_get_column_spacing(self.as_ref().to_glib_none().0) }
2085 }
2086
2087 /// Returns the value of the ::columns property.
2088 ///
2089 /// # Returns
2090 ///
2091 /// the number of columns, or -1
2092 #[doc(alias = "gtk_icon_view_get_columns")]
2093 #[doc(alias = "get_columns")]
2094 fn columns(&self) -> i32 {
2095 unsafe { ffi::gtk_icon_view_get_columns(self.as_ref().to_glib_none().0) }
2096 }
2097
2098 /// Fills in `path` and `cell` with the current cursor path and cell.
2099 /// If the cursor isn’t currently set, then *`path` will be [`None`].
2100 /// If no cell currently has focus, then *`cell` will be [`None`].
2101 ///
2102 /// The returned [`TreePath`][crate::TreePath] must be freed with `gtk_tree_path_free()`.
2103 ///
2104 /// # Returns
2105 ///
2106 /// [`true`] if the cursor is set.
2107 ///
2108 /// ## `path`
2109 /// Return location for the current
2110 /// cursor path, or [`None`]
2111 ///
2112 /// ## `cell`
2113 /// Return location the current
2114 /// focus cell, or [`None`]
2115 #[doc(alias = "gtk_icon_view_get_cursor")]
2116 #[doc(alias = "get_cursor")]
2117 fn cursor(&self) -> Option<(TreePath, CellRenderer)> {
2118 unsafe {
2119 let mut path = std::ptr::null_mut();
2120 let mut cell = std::ptr::null_mut();
2121 let ret = from_glib(ffi::gtk_icon_view_get_cursor(
2122 self.as_ref().to_glib_none().0,
2123 &mut path,
2124 &mut cell,
2125 ));
2126 if ret {
2127 Some((from_glib_full(path), from_glib_none(cell)))
2128 } else {
2129 None
2130 }
2131 }
2132 }
2133
2134 /// Determines the destination item for a given position.
2135 /// ## `drag_x`
2136 /// the position to determine the destination item for
2137 /// ## `drag_y`
2138 /// the position to determine the destination item for
2139 ///
2140 /// # Returns
2141 ///
2142 /// whether there is an item at the given position.
2143 ///
2144 /// ## `path`
2145 /// Return location for the path of the item,
2146 /// or [`None`].
2147 ///
2148 /// ## `pos`
2149 /// Return location for the drop position, or [`None`]
2150 #[doc(alias = "gtk_icon_view_get_dest_item_at_pos")]
2151 #[doc(alias = "get_dest_item_at_pos")]
2152 fn dest_item_at_pos(
2153 &self,
2154 drag_x: i32,
2155 drag_y: i32,
2156 ) -> Option<(TreePath, IconViewDropPosition)> {
2157 unsafe {
2158 let mut path = std::ptr::null_mut();
2159 let mut pos = std::mem::MaybeUninit::uninit();
2160 let ret = from_glib(ffi::gtk_icon_view_get_dest_item_at_pos(
2161 self.as_ref().to_glib_none().0,
2162 drag_x,
2163 drag_y,
2164 &mut path,
2165 pos.as_mut_ptr(),
2166 ));
2167 if ret {
2168 Some((from_glib_full(path), from_glib(pos.assume_init())))
2169 } else {
2170 None
2171 }
2172 }
2173 }
2174
2175 /// Gets information about the item that is highlighted for feedback.
2176 ///
2177 /// # Returns
2178 ///
2179 ///
2180 /// ## `path`
2181 /// Return location for the path of
2182 /// the highlighted item, or [`None`].
2183 ///
2184 /// ## `pos`
2185 /// Return location for the drop position, or [`None`]
2186 #[doc(alias = "gtk_icon_view_get_drag_dest_item")]
2187 #[doc(alias = "get_drag_dest_item")]
2188 fn drag_dest_item(&self) -> (TreePath, IconViewDropPosition) {
2189 unsafe {
2190 let mut path = std::ptr::null_mut();
2191 let mut pos = std::mem::MaybeUninit::uninit();
2192 ffi::gtk_icon_view_get_drag_dest_item(
2193 self.as_ref().to_glib_none().0,
2194 &mut path,
2195 pos.as_mut_ptr(),
2196 );
2197 (from_glib_full(path), from_glib(pos.assume_init()))
2198 }
2199 }
2200
2201 /// Finds the path at the point (`x`, `y`), relative to bin_window coordinates.
2202 /// In contrast to [`path_at_pos()`][Self::path_at_pos()], this function also
2203 /// obtains the cell at the specified position. The returned path should
2204 /// be freed with `gtk_tree_path_free()`.
2205 /// See [`convert_widget_to_bin_window_coords()`][Self::convert_widget_to_bin_window_coords()] for converting
2206 /// widget coordinates to bin_window coordinates.
2207 /// ## `x`
2208 /// The x position to be identified
2209 /// ## `y`
2210 /// The y position to be identified
2211 ///
2212 /// # Returns
2213 ///
2214 /// [`true`] if an item exists at the specified position
2215 ///
2216 /// ## `path`
2217 /// Return location for the path, or [`None`]
2218 ///
2219 /// ## `cell`
2220 /// Return location for the renderer
2221 /// responsible for the cell at (`x`, `y`), or [`None`]
2222 #[doc(alias = "gtk_icon_view_get_item_at_pos")]
2223 #[doc(alias = "get_item_at_pos")]
2224 fn item_at_pos(&self, x: i32, y: i32) -> Option<(TreePath, CellRenderer)> {
2225 unsafe {
2226 let mut path = std::ptr::null_mut();
2227 let mut cell = std::ptr::null_mut();
2228 let ret = from_glib(ffi::gtk_icon_view_get_item_at_pos(
2229 self.as_ref().to_glib_none().0,
2230 x,
2231 y,
2232 &mut path,
2233 &mut cell,
2234 ));
2235 if ret {
2236 Some((from_glib_full(path), from_glib_none(cell)))
2237 } else {
2238 None
2239 }
2240 }
2241 }
2242
2243 /// Gets the column in which the item `path` is currently
2244 /// displayed. Column numbers start at 0.
2245 /// ## `path`
2246 /// the [`TreePath`][crate::TreePath] of the item
2247 ///
2248 /// # Returns
2249 ///
2250 /// The column in which the item is displayed
2251 #[doc(alias = "gtk_icon_view_get_item_column")]
2252 #[doc(alias = "get_item_column")]
2253 fn item_column(&self, path: &TreePath) -> i32 {
2254 unsafe {
2255 ffi::gtk_icon_view_get_item_column(
2256 self.as_ref().to_glib_none().0,
2257 mut_override(path.to_glib_none().0),
2258 )
2259 }
2260 }
2261
2262 /// Returns the value of the ::item-orientation property which determines
2263 /// whether the labels are drawn beside the icons instead of below.
2264 ///
2265 /// # Returns
2266 ///
2267 /// the relative position of texts and icons
2268 #[doc(alias = "gtk_icon_view_get_item_orientation")]
2269 #[doc(alias = "get_item_orientation")]
2270 #[doc(alias = "item-orientation")]
2271 fn item_orientation(&self) -> Orientation {
2272 unsafe {
2273 from_glib(ffi::gtk_icon_view_get_item_orientation(
2274 self.as_ref().to_glib_none().0,
2275 ))
2276 }
2277 }
2278
2279 /// Returns the value of the ::item-padding property.
2280 ///
2281 /// # Returns
2282 ///
2283 /// the padding around items
2284 #[doc(alias = "gtk_icon_view_get_item_padding")]
2285 #[doc(alias = "get_item_padding")]
2286 #[doc(alias = "item-padding")]
2287 fn item_padding(&self) -> i32 {
2288 unsafe { ffi::gtk_icon_view_get_item_padding(self.as_ref().to_glib_none().0) }
2289 }
2290
2291 /// Gets the row in which the item `path` is currently
2292 /// displayed. Row numbers start at 0.
2293 /// ## `path`
2294 /// the [`TreePath`][crate::TreePath] of the item
2295 ///
2296 /// # Returns
2297 ///
2298 /// The row in which the item is displayed
2299 #[doc(alias = "gtk_icon_view_get_item_row")]
2300 #[doc(alias = "get_item_row")]
2301 fn item_row(&self, path: &TreePath) -> i32 {
2302 unsafe {
2303 ffi::gtk_icon_view_get_item_row(
2304 self.as_ref().to_glib_none().0,
2305 mut_override(path.to_glib_none().0),
2306 )
2307 }
2308 }
2309
2310 /// Returns the value of the ::item-width property.
2311 ///
2312 /// # Returns
2313 ///
2314 /// the width of a single item, or -1
2315 #[doc(alias = "gtk_icon_view_get_item_width")]
2316 #[doc(alias = "get_item_width")]
2317 #[doc(alias = "item-width")]
2318 fn item_width(&self) -> i32 {
2319 unsafe { ffi::gtk_icon_view_get_item_width(self.as_ref().to_glib_none().0) }
2320 }
2321
2322 /// Returns the value of the ::margin property.
2323 ///
2324 /// # Returns
2325 ///
2326 /// the space at the borders
2327 #[doc(alias = "gtk_icon_view_get_margin")]
2328 #[doc(alias = "get_margin")]
2329 fn margin(&self) -> i32 {
2330 unsafe { ffi::gtk_icon_view_get_margin(self.as_ref().to_glib_none().0) }
2331 }
2332
2333 /// Returns the column with markup text for `self`.
2334 ///
2335 /// # Returns
2336 ///
2337 /// the markup column, or -1 if it’s unset.
2338 #[doc(alias = "gtk_icon_view_get_markup_column")]
2339 #[doc(alias = "get_markup_column")]
2340 #[doc(alias = "markup-column")]
2341 fn markup_column(&self) -> i32 {
2342 unsafe { ffi::gtk_icon_view_get_markup_column(self.as_ref().to_glib_none().0) }
2343 }
2344
2345 /// Returns the model the [`IconView`][crate::IconView] is based on. Returns [`None`] if the
2346 /// model is unset.
2347 ///
2348 /// # Returns
2349 ///
2350 /// A [`TreeModel`][crate::TreeModel], or [`None`] if none is
2351 /// currently being used.
2352 #[doc(alias = "gtk_icon_view_get_model")]
2353 #[doc(alias = "get_model")]
2354 fn model(&self) -> Option<TreeModel> {
2355 unsafe { from_glib_none(ffi::gtk_icon_view_get_model(self.as_ref().to_glib_none().0)) }
2356 }
2357
2358 /// Finds the path at the point (`x`, `y`), relative to bin_window coordinates.
2359 /// See [`item_at_pos()`][Self::item_at_pos()], if you are also interested in
2360 /// the cell at the specified position.
2361 /// See [`convert_widget_to_bin_window_coords()`][Self::convert_widget_to_bin_window_coords()] for converting
2362 /// widget coordinates to bin_window coordinates.
2363 /// ## `x`
2364 /// The x position to be identified
2365 /// ## `y`
2366 /// The y position to be identified
2367 ///
2368 /// # Returns
2369 ///
2370 /// The [`TreePath`][crate::TreePath] corresponding
2371 /// to the icon or [`None`] if no icon exists at that position.
2372 #[doc(alias = "gtk_icon_view_get_path_at_pos")]
2373 #[doc(alias = "get_path_at_pos")]
2374 fn path_at_pos(&self, x: i32, y: i32) -> Option<TreePath> {
2375 unsafe {
2376 from_glib_full(ffi::gtk_icon_view_get_path_at_pos(
2377 self.as_ref().to_glib_none().0,
2378 x,
2379 y,
2380 ))
2381 }
2382 }
2383
2384 /// Returns the column with pixbufs for `self`.
2385 ///
2386 /// # Returns
2387 ///
2388 /// the pixbuf column, or -1 if it’s unset.
2389 #[doc(alias = "gtk_icon_view_get_pixbuf_column")]
2390 #[doc(alias = "get_pixbuf_column")]
2391 #[doc(alias = "pixbuf-column")]
2392 fn pixbuf_column(&self) -> i32 {
2393 unsafe { ffi::gtk_icon_view_get_pixbuf_column(self.as_ref().to_glib_none().0) }
2394 }
2395
2396 /// Retrieves whether the user can reorder the list via drag-and-drop.
2397 /// See [`set_reorderable()`][Self::set_reorderable()].
2398 ///
2399 /// # Returns
2400 ///
2401 /// [`true`] if the list can be reordered.
2402 #[doc(alias = "gtk_icon_view_get_reorderable")]
2403 #[doc(alias = "get_reorderable")]
2404 #[doc(alias = "reorderable")]
2405 fn is_reorderable(&self) -> bool {
2406 unsafe {
2407 from_glib(ffi::gtk_icon_view_get_reorderable(
2408 self.as_ref().to_glib_none().0,
2409 ))
2410 }
2411 }
2412
2413 /// Returns the value of the ::row-spacing property.
2414 ///
2415 /// # Returns
2416 ///
2417 /// the space between rows
2418 #[doc(alias = "gtk_icon_view_get_row_spacing")]
2419 #[doc(alias = "get_row_spacing")]
2420 #[doc(alias = "row-spacing")]
2421 fn row_spacing(&self) -> i32 {
2422 unsafe { ffi::gtk_icon_view_get_row_spacing(self.as_ref().to_glib_none().0) }
2423 }
2424
2425 /// Creates a list of paths of all selected items. Additionally, if you are
2426 /// planning on modifying the model after calling this function, you may
2427 /// want to convert the returned list into a list of `GtkTreeRowReferences`.
2428 /// To do this, you can use [`TreeRowReference::new()`][crate::TreeRowReference::new()].
2429 ///
2430 /// To free the return value, use:
2431 ///
2432 ///
2433 /// **⚠️ The following code is in C ⚠️**
2434 ///
2435 /// ```C
2436 /// g_list_free_full (list, (GDestroyNotify) gtk_tree_path_free);
2437 /// ```
2438 ///
2439 /// # Returns
2440 ///
2441 /// A `GList` containing a [`TreePath`][crate::TreePath] for each selected row.
2442 #[doc(alias = "gtk_icon_view_get_selected_items")]
2443 #[doc(alias = "get_selected_items")]
2444 fn selected_items(&self) -> Vec<TreePath> {
2445 unsafe {
2446 FromGlibPtrContainer::from_glib_full(ffi::gtk_icon_view_get_selected_items(
2447 self.as_ref().to_glib_none().0,
2448 ))
2449 }
2450 }
2451
2452 /// Gets the selection mode of the `self`.
2453 ///
2454 /// # Returns
2455 ///
2456 /// the current selection mode
2457 #[doc(alias = "gtk_icon_view_get_selection_mode")]
2458 #[doc(alias = "get_selection_mode")]
2459 #[doc(alias = "selection-mode")]
2460 fn selection_mode(&self) -> SelectionMode {
2461 unsafe {
2462 from_glib(ffi::gtk_icon_view_get_selection_mode(
2463 self.as_ref().to_glib_none().0,
2464 ))
2465 }
2466 }
2467
2468 /// Returns the value of the ::spacing property.
2469 ///
2470 /// # Returns
2471 ///
2472 /// the space between cells
2473 #[doc(alias = "gtk_icon_view_get_spacing")]
2474 #[doc(alias = "get_spacing")]
2475 fn spacing(&self) -> i32 {
2476 unsafe { ffi::gtk_icon_view_get_spacing(self.as_ref().to_glib_none().0) }
2477 }
2478
2479 /// Returns the column with text for `self`.
2480 ///
2481 /// # Returns
2482 ///
2483 /// the text column, or -1 if it’s unset.
2484 #[doc(alias = "gtk_icon_view_get_text_column")]
2485 #[doc(alias = "get_text_column")]
2486 #[doc(alias = "text-column")]
2487 fn text_column(&self) -> i32 {
2488 unsafe { ffi::gtk_icon_view_get_text_column(self.as_ref().to_glib_none().0) }
2489 }
2490
2491 /// Returns the column of `self`’s model which is being used for
2492 /// displaying tooltips on `self`’s rows.
2493 ///
2494 /// # Returns
2495 ///
2496 /// the index of the tooltip column that is currently being
2497 /// used, or -1 if this is disabled.
2498 #[doc(alias = "gtk_icon_view_get_tooltip_column")]
2499 #[doc(alias = "get_tooltip_column")]
2500 #[doc(alias = "tooltip-column")]
2501 fn tooltip_column(&self) -> i32 {
2502 unsafe { ffi::gtk_icon_view_get_tooltip_column(self.as_ref().to_glib_none().0) }
2503 }
2504
2505 /// This function is supposed to be used in a [`query-tooltip`][struct@crate::Widget#query-tooltip]
2506 /// signal handler for [`IconView`][crate::IconView]. The `x`, `y` and `keyboard_tip` values
2507 /// which are received in the signal handler, should be passed to this
2508 /// function without modification.
2509 ///
2510 /// The return value indicates whether there is an icon view item at the given
2511 /// coordinates ([`true`]) or not ([`false`]) for mouse tooltips. For keyboard
2512 /// tooltips the item returned will be the cursor item. When [`true`], then any of
2513 /// `model`, `path` and `iter` which have been provided will be set to point to
2514 /// that row and the corresponding model. `x` and `y` will always be converted
2515 /// to be relative to `self`’s bin_window if `keyboard_tooltip` is [`false`].
2516 /// ## `keyboard_tip`
2517 /// whether this is a keyboard tooltip or not
2518 ///
2519 /// # Returns
2520 ///
2521 /// whether or not the given tooltip context points to a item
2522 ///
2523 /// ## `x`
2524 /// the x coordinate (relative to widget coordinates)
2525 ///
2526 /// ## `y`
2527 /// the y coordinate (relative to widget coordinates)
2528 ///
2529 /// ## `model`
2530 /// a pointer to receive a
2531 /// [`TreeModel`][crate::TreeModel] or [`None`]
2532 ///
2533 /// ## `path`
2534 /// a pointer to receive a [`TreePath`][crate::TreePath] or [`None`]
2535 ///
2536 /// ## `iter`
2537 /// a pointer to receive a [`TreeIter`][crate::TreeIter] or [`None`]
2538 #[doc(alias = "gtk_icon_view_get_tooltip_context")]
2539 #[doc(alias = "get_tooltip_context")]
2540 fn tooltip_context(
2541 &self,
2542 x: &mut i32,
2543 y: &mut i32,
2544 keyboard_tip: bool,
2545 ) -> Option<(TreeModel, TreePath, TreeIter)> {
2546 unsafe {
2547 let mut model = std::ptr::null_mut();
2548 let mut path = std::ptr::null_mut();
2549 let mut iter = TreeIter::uninitialized();
2550 let ret = from_glib(ffi::gtk_icon_view_get_tooltip_context(
2551 self.as_ref().to_glib_none().0,
2552 x,
2553 y,
2554 keyboard_tip.into_glib(),
2555 &mut model,
2556 &mut path,
2557 iter.to_glib_none_mut().0,
2558 ));
2559 if ret {
2560 Some((from_glib_none(model), from_glib_full(path), iter))
2561 } else {
2562 None
2563 }
2564 }
2565 }
2566
2567 /// Sets `start_path` and `end_path` to be the first and last visible path.
2568 /// Note that there may be invisible paths in between.
2569 ///
2570 /// Both paths should be freed with `gtk_tree_path_free()` after use.
2571 ///
2572 /// # Returns
2573 ///
2574 /// [`true`], if valid paths were placed in `start_path` and `end_path`
2575 ///
2576 /// ## `start_path`
2577 /// Return location for start of region,
2578 /// or [`None`]
2579 ///
2580 /// ## `end_path`
2581 /// Return location for end of region, or [`None`]
2582 #[doc(alias = "gtk_icon_view_get_visible_range")]
2583 #[doc(alias = "get_visible_range")]
2584 fn visible_range(&self) -> Option<(TreePath, TreePath)> {
2585 unsafe {
2586 let mut start_path = std::ptr::null_mut();
2587 let mut end_path = std::ptr::null_mut();
2588 let ret = from_glib(ffi::gtk_icon_view_get_visible_range(
2589 self.as_ref().to_glib_none().0,
2590 &mut start_path,
2591 &mut end_path,
2592 ));
2593 if ret {
2594 Some((from_glib_full(start_path), from_glib_full(end_path)))
2595 } else {
2596 None
2597 }
2598 }
2599 }
2600
2601 /// Activates the item determined by `path`.
2602 /// ## `path`
2603 /// The [`TreePath`][crate::TreePath] to be activated
2604 #[doc(alias = "gtk_icon_view_item_activated")]
2605 fn item_activated(&self, path: &TreePath) {
2606 unsafe {
2607 ffi::gtk_icon_view_item_activated(
2608 self.as_ref().to_glib_none().0,
2609 mut_override(path.to_glib_none().0),
2610 );
2611 }
2612 }
2613
2614 /// Returns [`true`] if the icon pointed to by `path` is currently
2615 /// selected. If `path` does not point to a valid location, [`false`] is returned.
2616 /// ## `path`
2617 /// A [`TreePath`][crate::TreePath] to check selection on.
2618 ///
2619 /// # Returns
2620 ///
2621 /// [`true`] if `path` is selected.
2622 #[doc(alias = "gtk_icon_view_path_is_selected")]
2623 fn path_is_selected(&self, path: &TreePath) -> bool {
2624 unsafe {
2625 from_glib(ffi::gtk_icon_view_path_is_selected(
2626 self.as_ref().to_glib_none().0,
2627 mut_override(path.to_glib_none().0),
2628 ))
2629 }
2630 }
2631
2632 /// Moves the alignments of `self` to the position specified by `path`.
2633 /// `row_align` determines where the row is placed, and `col_align` determines
2634 /// where `column` is placed. Both are expected to be between 0.0 and 1.0.
2635 /// 0.0 means left/top alignment, 1.0 means right/bottom alignment, 0.5 means
2636 /// center.
2637 ///
2638 /// If `use_align` is [`false`], then the alignment arguments are ignored, and the
2639 /// tree does the minimum amount of work to scroll the item onto the screen.
2640 /// This means that the item will be scrolled to the edge closest to its current
2641 /// position. If the item is currently visible on the screen, nothing is done.
2642 ///
2643 /// This function only works if the model is set, and `path` is a valid row on
2644 /// the model. If the model changes before the `self` is realized, the
2645 /// centered path will be modified to reflect this change.
2646 /// ## `path`
2647 /// The path of the item to move to.
2648 /// ## `use_align`
2649 /// whether to use alignment arguments, or [`false`].
2650 /// ## `row_align`
2651 /// The vertical alignment of the item specified by `path`.
2652 /// ## `col_align`
2653 /// The horizontal alignment of the item specified by `path`.
2654 #[doc(alias = "gtk_icon_view_scroll_to_path")]
2655 fn scroll_to_path(&self, path: &TreePath, use_align: bool, row_align: f32, col_align: f32) {
2656 unsafe {
2657 ffi::gtk_icon_view_scroll_to_path(
2658 self.as_ref().to_glib_none().0,
2659 mut_override(path.to_glib_none().0),
2660 use_align.into_glib(),
2661 row_align,
2662 col_align,
2663 );
2664 }
2665 }
2666
2667 /// Selects all the icons. `self` must has its selection mode set
2668 /// to [`SelectionMode::Multiple`][crate::SelectionMode::Multiple].
2669 #[doc(alias = "gtk_icon_view_select_all")]
2670 fn select_all(&self) {
2671 unsafe {
2672 ffi::gtk_icon_view_select_all(self.as_ref().to_glib_none().0);
2673 }
2674 }
2675
2676 /// Selects the row at `path`.
2677 /// ## `path`
2678 /// The [`TreePath`][crate::TreePath] to be selected.
2679 #[doc(alias = "gtk_icon_view_select_path")]
2680 fn select_path(&self, path: &TreePath) {
2681 unsafe {
2682 ffi::gtk_icon_view_select_path(
2683 self.as_ref().to_glib_none().0,
2684 mut_override(path.to_glib_none().0),
2685 );
2686 }
2687 }
2688
2689 /// Calls a function for each selected icon. Note that the model or
2690 /// selection cannot be modified from within this function.
2691 /// ## `func`
2692 /// The function to call for each selected icon.
2693 #[doc(alias = "gtk_icon_view_selected_foreach")]
2694 fn selected_foreach<P: FnMut(&IconView, &TreePath)>(&self, func: P) {
2695 let mut func_data: P = func;
2696 unsafe extern "C" fn func_func<P: FnMut(&IconView, &TreePath)>(
2697 icon_view: *mut ffi::GtkIconView,
2698 path: *mut ffi::GtkTreePath,
2699 data: glib::ffi::gpointer,
2700 ) {
2701 unsafe {
2702 let icon_view = from_glib_borrow(icon_view);
2703 let path = from_glib_borrow(path);
2704 let callback = data as *mut P;
2705 (*callback)(&icon_view, &path)
2706 }
2707 }
2708 let func = Some(func_func::<P> as _);
2709 let super_callback0: &mut P = &mut func_data;
2710 unsafe {
2711 ffi::gtk_icon_view_selected_foreach(
2712 self.as_ref().to_glib_none().0,
2713 func,
2714 super_callback0 as *mut _ as *mut _,
2715 );
2716 }
2717 }
2718
2719 /// Causes the [`item-activated`][struct@crate::IconView#item-activated] signal to be emitted on
2720 /// a single click instead of a double click.
2721 /// ## `single`
2722 /// [`true`] to emit item-activated on a single click
2723 #[doc(alias = "gtk_icon_view_set_activate_on_single_click")]
2724 #[doc(alias = "activate-on-single-click")]
2725 fn set_activate_on_single_click(&self, single: bool) {
2726 unsafe {
2727 ffi::gtk_icon_view_set_activate_on_single_click(
2728 self.as_ref().to_glib_none().0,
2729 single.into_glib(),
2730 );
2731 }
2732 }
2733
2734 /// Sets the ::column-spacing property which specifies the space
2735 /// which is inserted between the columns of the icon view.
2736 /// ## `column_spacing`
2737 /// the column spacing
2738 #[doc(alias = "gtk_icon_view_set_column_spacing")]
2739 #[doc(alias = "column-spacing")]
2740 fn set_column_spacing(&self, column_spacing: i32) {
2741 unsafe {
2742 ffi::gtk_icon_view_set_column_spacing(self.as_ref().to_glib_none().0, column_spacing);
2743 }
2744 }
2745
2746 /// Sets the ::columns property which determines in how
2747 /// many columns the icons are arranged. If `columns` is
2748 /// -1, the number of columns will be chosen automatically
2749 /// to fill the available area.
2750 /// ## `columns`
2751 /// the number of columns
2752 #[doc(alias = "gtk_icon_view_set_columns")]
2753 #[doc(alias = "columns")]
2754 fn set_columns(&self, columns: i32) {
2755 unsafe {
2756 ffi::gtk_icon_view_set_columns(self.as_ref().to_glib_none().0, columns);
2757 }
2758 }
2759
2760 /// Sets the current keyboard focus to be at `path`, and selects it. This is
2761 /// useful when you want to focus the user’s attention on a particular item.
2762 /// If `cell` is not [`None`], then focus is given to the cell specified by
2763 /// it. Additionally, if `start_editing` is [`true`], then editing should be
2764 /// started in the specified cell.
2765 ///
2766 /// This function is often followed by `gtk_widget_grab_focus
2767 /// (icon_view)` in order to give keyboard focus to the widget.
2768 /// Please note that editing can only happen when the widget is realized.
2769 /// ## `path`
2770 /// A [`TreePath`][crate::TreePath]
2771 /// ## `cell`
2772 /// One of the cell renderers of `self`, or [`None`]
2773 /// ## `start_editing`
2774 /// [`true`] if the specified cell should start being edited.
2775 #[doc(alias = "gtk_icon_view_set_cursor")]
2776 fn set_cursor(
2777 &self,
2778 path: &TreePath,
2779 cell: Option<&impl IsA<CellRenderer>>,
2780 start_editing: bool,
2781 ) {
2782 unsafe {
2783 ffi::gtk_icon_view_set_cursor(
2784 self.as_ref().to_glib_none().0,
2785 mut_override(path.to_glib_none().0),
2786 cell.map(|p| p.as_ref()).to_glib_none().0,
2787 start_editing.into_glib(),
2788 );
2789 }
2790 }
2791
2792 /// Sets the item that is highlighted for feedback.
2793 /// ## `path`
2794 /// The path of the item to highlight, or [`None`].
2795 /// ## `pos`
2796 /// Specifies where to drop, relative to the item
2797 #[doc(alias = "gtk_icon_view_set_drag_dest_item")]
2798 fn set_drag_dest_item(&self, path: Option<&TreePath>, pos: IconViewDropPosition) {
2799 unsafe {
2800 ffi::gtk_icon_view_set_drag_dest_item(
2801 self.as_ref().to_glib_none().0,
2802 mut_override(path.to_glib_none().0),
2803 pos.into_glib(),
2804 );
2805 }
2806 }
2807
2808 /// Sets the ::item-orientation property which determines whether the labels
2809 /// are drawn beside the icons instead of below.
2810 /// ## `orientation`
2811 /// the relative position of texts and icons
2812 #[doc(alias = "gtk_icon_view_set_item_orientation")]
2813 #[doc(alias = "item-orientation")]
2814 fn set_item_orientation(&self, orientation: Orientation) {
2815 unsafe {
2816 ffi::gtk_icon_view_set_item_orientation(
2817 self.as_ref().to_glib_none().0,
2818 orientation.into_glib(),
2819 );
2820 }
2821 }
2822
2823 /// Sets the [`item-padding`][struct@crate::IconView#item-padding] property which specifies the padding
2824 /// around each of the icon view’s items.
2825 /// ## `item_padding`
2826 /// the item padding
2827 #[doc(alias = "gtk_icon_view_set_item_padding")]
2828 #[doc(alias = "item-padding")]
2829 fn set_item_padding(&self, item_padding: i32) {
2830 unsafe {
2831 ffi::gtk_icon_view_set_item_padding(self.as_ref().to_glib_none().0, item_padding);
2832 }
2833 }
2834
2835 /// Sets the ::item-width property which specifies the width
2836 /// to use for each item. If it is set to -1, the icon view will
2837 /// automatically determine a suitable item size.
2838 /// ## `item_width`
2839 /// the width for each item
2840 #[doc(alias = "gtk_icon_view_set_item_width")]
2841 #[doc(alias = "item-width")]
2842 fn set_item_width(&self, item_width: i32) {
2843 unsafe {
2844 ffi::gtk_icon_view_set_item_width(self.as_ref().to_glib_none().0, item_width);
2845 }
2846 }
2847
2848 /// Sets the ::margin property which specifies the space
2849 /// which is inserted at the top, bottom, left and right
2850 /// of the icon view.
2851 /// ## `margin`
2852 /// the margin
2853 #[doc(alias = "gtk_icon_view_set_margin")]
2854 #[doc(alias = "margin")]
2855 fn set_margin(&self, margin: i32) {
2856 unsafe {
2857 ffi::gtk_icon_view_set_margin(self.as_ref().to_glib_none().0, margin);
2858 }
2859 }
2860
2861 /// Sets the column with markup information for `self` to be
2862 /// `column`. The markup column must be of type `G_TYPE_STRING`.
2863 /// If the markup column is set to something, it overrides
2864 /// the text column set by [`set_text_column()`][Self::set_text_column()].
2865 /// ## `column`
2866 /// A column in the currently used model, or -1 to display no text
2867 #[doc(alias = "gtk_icon_view_set_markup_column")]
2868 #[doc(alias = "markup-column")]
2869 fn set_markup_column(&self, column: i32) {
2870 unsafe {
2871 ffi::gtk_icon_view_set_markup_column(self.as_ref().to_glib_none().0, column);
2872 }
2873 }
2874
2875 /// Sets the model for a [`IconView`][crate::IconView].
2876 /// If the `self` already has a model set, it will remove
2877 /// it before setting the new model. If `model` is [`None`], then
2878 /// it will unset the old model.
2879 /// ## `model`
2880 /// The model.
2881 #[doc(alias = "gtk_icon_view_set_model")]
2882 #[doc(alias = "model")]
2883 fn set_model(&self, model: Option<&impl IsA<TreeModel>>) {
2884 unsafe {
2885 ffi::gtk_icon_view_set_model(
2886 self.as_ref().to_glib_none().0,
2887 model.map(|p| p.as_ref()).to_glib_none().0,
2888 );
2889 }
2890 }
2891
2892 /// Sets the column with pixbufs for `self` to be `column`. The pixbuf
2893 /// column must be of type `GDK_TYPE_PIXBUF`
2894 /// ## `column`
2895 /// A column in the currently used model, or -1 to disable
2896 #[doc(alias = "gtk_icon_view_set_pixbuf_column")]
2897 #[doc(alias = "pixbuf-column")]
2898 fn set_pixbuf_column(&self, column: i32) {
2899 unsafe {
2900 ffi::gtk_icon_view_set_pixbuf_column(self.as_ref().to_glib_none().0, column);
2901 }
2902 }
2903
2904 /// This function is a convenience function to allow you to reorder models that
2905 /// support the `GtkTreeDragSourceIface` and the `GtkTreeDragDestIface`. Both
2906 /// [`TreeStore`][crate::TreeStore] and [`ListStore`][crate::ListStore] support these. If `reorderable` is [`true`], then
2907 /// the user can reorder the model by dragging and dropping rows. The
2908 /// developer can listen to these changes by connecting to the model's
2909 /// row_inserted and row_deleted signals. The reordering is implemented by setting up
2910 /// the icon view as a drag source and destination. Therefore, drag and
2911 /// drop can not be used in a reorderable view for any other purpose.
2912 ///
2913 /// This function does not give you any degree of control over the order -- any
2914 /// reordering is allowed. If more control is needed, you should probably
2915 /// handle drag and drop manually.
2916 /// ## `reorderable`
2917 /// [`true`], if the list of items can be reordered.
2918 #[doc(alias = "gtk_icon_view_set_reorderable")]
2919 #[doc(alias = "reorderable")]
2920 fn set_reorderable(&self, reorderable: bool) {
2921 unsafe {
2922 ffi::gtk_icon_view_set_reorderable(
2923 self.as_ref().to_glib_none().0,
2924 reorderable.into_glib(),
2925 );
2926 }
2927 }
2928
2929 /// Sets the ::row-spacing property which specifies the space
2930 /// which is inserted between the rows of the icon view.
2931 /// ## `row_spacing`
2932 /// the row spacing
2933 #[doc(alias = "gtk_icon_view_set_row_spacing")]
2934 #[doc(alias = "row-spacing")]
2935 fn set_row_spacing(&self, row_spacing: i32) {
2936 unsafe {
2937 ffi::gtk_icon_view_set_row_spacing(self.as_ref().to_glib_none().0, row_spacing);
2938 }
2939 }
2940
2941 /// Sets the selection mode of the `self`.
2942 /// ## `mode`
2943 /// The selection mode
2944 #[doc(alias = "gtk_icon_view_set_selection_mode")]
2945 #[doc(alias = "selection-mode")]
2946 fn set_selection_mode(&self, mode: SelectionMode) {
2947 unsafe {
2948 ffi::gtk_icon_view_set_selection_mode(self.as_ref().to_glib_none().0, mode.into_glib());
2949 }
2950 }
2951
2952 /// Sets the ::spacing property which specifies the space
2953 /// which is inserted between the cells (i.e. the icon and
2954 /// the text) of an item.
2955 /// ## `spacing`
2956 /// the spacing
2957 #[doc(alias = "gtk_icon_view_set_spacing")]
2958 #[doc(alias = "spacing")]
2959 fn set_spacing(&self, spacing: i32) {
2960 unsafe {
2961 ffi::gtk_icon_view_set_spacing(self.as_ref().to_glib_none().0, spacing);
2962 }
2963 }
2964
2965 /// Sets the column with text for `self` to be `column`. The text
2966 /// column must be of type `G_TYPE_STRING`.
2967 /// ## `column`
2968 /// A column in the currently used model, or -1 to display no text
2969 #[doc(alias = "gtk_icon_view_set_text_column")]
2970 #[doc(alias = "text-column")]
2971 fn set_text_column(&self, column: i32) {
2972 unsafe {
2973 ffi::gtk_icon_view_set_text_column(self.as_ref().to_glib_none().0, column);
2974 }
2975 }
2976
2977 /// Sets the tip area of `tooltip` to the area which `cell` occupies in
2978 /// the item pointed to by `path`. See also [`Tooltip::set_tip_area()`][crate::Tooltip::set_tip_area()].
2979 ///
2980 /// See also [`set_tooltip_column()`][Self::set_tooltip_column()] for a simpler alternative.
2981 /// ## `tooltip`
2982 /// a [`Tooltip`][crate::Tooltip]
2983 /// ## `path`
2984 /// a [`TreePath`][crate::TreePath]
2985 /// ## `cell`
2986 /// a [`CellRenderer`][crate::CellRenderer] or [`None`]
2987 #[doc(alias = "gtk_icon_view_set_tooltip_cell")]
2988 fn set_tooltip_cell(
2989 &self,
2990 tooltip: &Tooltip,
2991 path: &TreePath,
2992 cell: Option<&impl IsA<CellRenderer>>,
2993 ) {
2994 unsafe {
2995 ffi::gtk_icon_view_set_tooltip_cell(
2996 self.as_ref().to_glib_none().0,
2997 tooltip.to_glib_none().0,
2998 mut_override(path.to_glib_none().0),
2999 cell.map(|p| p.as_ref()).to_glib_none().0,
3000 );
3001 }
3002 }
3003
3004 /// If you only plan to have simple (text-only) tooltips on full items, you
3005 /// can use this function to have [`IconView`][crate::IconView] handle these automatically
3006 /// for you. `column` should be set to the column in `self`’s model
3007 /// containing the tooltip texts, or -1 to disable this feature.
3008 ///
3009 /// When enabled, [`has-tooltip`][struct@crate::Widget#has-tooltip] will be set to [`true`] and
3010 /// `self` will connect a [`query-tooltip`][struct@crate::Widget#query-tooltip] signal handler.
3011 ///
3012 /// Note that the signal handler sets the text with [`Tooltip::set_markup()`][crate::Tooltip::set_markup()],
3013 /// so &, <, etc have to be escaped in the text.
3014 /// ## `column`
3015 /// an integer, which is a valid column number for `self`’s model
3016 #[doc(alias = "gtk_icon_view_set_tooltip_column")]
3017 #[doc(alias = "tooltip-column")]
3018 fn set_tooltip_column(&self, column: i32) {
3019 unsafe {
3020 ffi::gtk_icon_view_set_tooltip_column(self.as_ref().to_glib_none().0, column);
3021 }
3022 }
3023
3024 /// Sets the tip area of `tooltip` to be the area covered by the item at `path`.
3025 /// See also [`set_tooltip_column()`][Self::set_tooltip_column()] for a simpler alternative.
3026 /// See also [`Tooltip::set_tip_area()`][crate::Tooltip::set_tip_area()].
3027 /// ## `tooltip`
3028 /// a [`Tooltip`][crate::Tooltip]
3029 /// ## `path`
3030 /// a [`TreePath`][crate::TreePath]
3031 #[doc(alias = "gtk_icon_view_set_tooltip_item")]
3032 fn set_tooltip_item(&self, tooltip: &Tooltip, path: &TreePath) {
3033 unsafe {
3034 ffi::gtk_icon_view_set_tooltip_item(
3035 self.as_ref().to_glib_none().0,
3036 tooltip.to_glib_none().0,
3037 mut_override(path.to_glib_none().0),
3038 );
3039 }
3040 }
3041
3042 /// Unselects all the icons.
3043 #[doc(alias = "gtk_icon_view_unselect_all")]
3044 fn unselect_all(&self) {
3045 unsafe {
3046 ffi::gtk_icon_view_unselect_all(self.as_ref().to_glib_none().0);
3047 }
3048 }
3049
3050 /// Unselects the row at `path`.
3051 /// ## `path`
3052 /// The [`TreePath`][crate::TreePath] to be unselected.
3053 #[doc(alias = "gtk_icon_view_unselect_path")]
3054 fn unselect_path(&self, path: &TreePath) {
3055 unsafe {
3056 ffi::gtk_icon_view_unselect_path(
3057 self.as_ref().to_glib_none().0,
3058 mut_override(path.to_glib_none().0),
3059 );
3060 }
3061 }
3062
3063 /// Undoes the effect of `gtk_icon_view_enable_model_drag_dest()`. Calling this
3064 /// method sets [`reorderable`][struct@crate::IconView#reorderable] to [`false`].
3065 #[doc(alias = "gtk_icon_view_unset_model_drag_dest")]
3066 fn unset_model_drag_dest(&self) {
3067 unsafe {
3068 ffi::gtk_icon_view_unset_model_drag_dest(self.as_ref().to_glib_none().0);
3069 }
3070 }
3071
3072 /// Undoes the effect of `gtk_icon_view_enable_model_drag_source()`. Calling this
3073 /// method sets [`reorderable`][struct@crate::IconView#reorderable] to [`false`].
3074 #[doc(alias = "gtk_icon_view_unset_model_drag_source")]
3075 fn unset_model_drag_source(&self) {
3076 unsafe {
3077 ffi::gtk_icon_view_unset_model_drag_source(self.as_ref().to_glib_none().0);
3078 }
3079 }
3080
3081 /// The [`CellArea`][crate::CellArea] used to layout cell renderers for this view.
3082 ///
3083 /// If no area is specified when creating the icon view with [`IconView::with_area()`][crate::IconView::with_area()]
3084 /// a [`CellAreaBox`][crate::CellAreaBox] will be used.
3085 #[doc(alias = "cell-area")]
3086 fn cell_area(&self) -> Option<CellArea> {
3087 ObjectExt::property(self.as_ref(), "cell-area")
3088 }
3089
3090 /// A [keybinding signal][GtkBindingSignal]
3091 /// which gets emitted when the user activates the currently
3092 /// focused item.
3093 ///
3094 /// Applications should not connect to it, but may emit it with
3095 /// `g_signal_emit_by_name()` if they need to control activation
3096 /// programmatically.
3097 ///
3098 /// The default bindings for this signal are Space, Return and Enter.
3099 #[doc(alias = "activate-cursor-item")]
3100 fn connect_activate_cursor_item<F: Fn(&Self) -> bool + 'static>(
3101 &self,
3102 f: F,
3103 ) -> SignalHandlerId {
3104 unsafe extern "C" fn activate_cursor_item_trampoline<
3105 P: IsA<IconView>,
3106 F: Fn(&P) -> bool + 'static,
3107 >(
3108 this: *mut ffi::GtkIconView,
3109 f: glib::ffi::gpointer,
3110 ) -> glib::ffi::gboolean {
3111 unsafe {
3112 let f: &F = &*(f as *const F);
3113 f(IconView::from_glib_borrow(this).unsafe_cast_ref()).into_glib()
3114 }
3115 }
3116 unsafe {
3117 let f: Box_<F> = Box_::new(f);
3118 connect_raw(
3119 self.as_ptr() as *mut _,
3120 c"activate-cursor-item".as_ptr(),
3121 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3122 activate_cursor_item_trampoline::<Self, F> as *const (),
3123 )),
3124 Box_::into_raw(f),
3125 )
3126 }
3127 }
3128
3129 fn emit_activate_cursor_item(&self) -> bool {
3130 self.emit_by_name("activate-cursor-item", &[])
3131 }
3132
3133 /// The ::item-activated signal is emitted when the method
3134 /// [`item_activated()`][Self::item_activated()] is called, when the user double
3135 /// clicks an item with the "activate-on-single-click" property set
3136 /// to [`false`], or when the user single clicks an item when the
3137 /// "activate-on-single-click" property set to [`true`]. It is also
3138 /// emitted when a non-editable item is selected and one of the keys:
3139 /// Space, Return or Enter is pressed.
3140 /// ## `path`
3141 /// the [`TreePath`][crate::TreePath] for the activated item
3142 #[doc(alias = "item-activated")]
3143 fn connect_item_activated<F: Fn(&Self, &TreePath) + 'static>(&self, f: F) -> SignalHandlerId {
3144 unsafe extern "C" fn item_activated_trampoline<
3145 P: IsA<IconView>,
3146 F: Fn(&P, &TreePath) + 'static,
3147 >(
3148 this: *mut ffi::GtkIconView,
3149 path: *mut ffi::GtkTreePath,
3150 f: glib::ffi::gpointer,
3151 ) {
3152 unsafe {
3153 let f: &F = &*(f as *const F);
3154 f(
3155 IconView::from_glib_borrow(this).unsafe_cast_ref(),
3156 &from_glib_borrow(path),
3157 )
3158 }
3159 }
3160 unsafe {
3161 let f: Box_<F> = Box_::new(f);
3162 connect_raw(
3163 self.as_ptr() as *mut _,
3164 c"item-activated".as_ptr(),
3165 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3166 item_activated_trampoline::<Self, F> as *const (),
3167 )),
3168 Box_::into_raw(f),
3169 )
3170 }
3171 }
3172
3173 /// The ::move-cursor signal is a
3174 /// [keybinding signal][GtkBindingSignal]
3175 /// which gets emitted when the user initiates a cursor movement.
3176 ///
3177 /// Applications should not connect to it, but may emit it with
3178 /// `g_signal_emit_by_name()` if they need to control the cursor
3179 /// programmatically.
3180 ///
3181 /// The default bindings for this signal include
3182 /// - Arrow keys which move by individual steps
3183 /// - Home/End keys which move to the first/last item
3184 /// - PageUp/PageDown which move by "pages"
3185 /// All of these will extend the selection when combined with
3186 /// the Shift modifier.
3187 /// ## `step`
3188 /// the granularity of the move, as a [`MovementStep`][crate::MovementStep]
3189 /// ## `count`
3190 /// the number of `step` units to move
3191 #[doc(alias = "move-cursor")]
3192 fn connect_move_cursor<F: Fn(&Self, MovementStep, i32) -> bool + 'static>(
3193 &self,
3194 f: F,
3195 ) -> SignalHandlerId {
3196 unsafe extern "C" fn move_cursor_trampoline<
3197 P: IsA<IconView>,
3198 F: Fn(&P, MovementStep, i32) -> bool + 'static,
3199 >(
3200 this: *mut ffi::GtkIconView,
3201 step: ffi::GtkMovementStep,
3202 count: std::ffi::c_int,
3203 f: glib::ffi::gpointer,
3204 ) -> glib::ffi::gboolean {
3205 unsafe {
3206 let f: &F = &*(f as *const F);
3207 f(
3208 IconView::from_glib_borrow(this).unsafe_cast_ref(),
3209 from_glib(step),
3210 count,
3211 )
3212 .into_glib()
3213 }
3214 }
3215 unsafe {
3216 let f: Box_<F> = Box_::new(f);
3217 connect_raw(
3218 self.as_ptr() as *mut _,
3219 c"move-cursor".as_ptr(),
3220 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3221 move_cursor_trampoline::<Self, F> as *const (),
3222 )),
3223 Box_::into_raw(f),
3224 )
3225 }
3226 }
3227
3228 fn emit_move_cursor(&self, step: MovementStep, count: i32) -> bool {
3229 self.emit_by_name("move-cursor", &[&step, &count])
3230 }
3231
3232 /// A [keybinding signal][GtkBindingSignal]
3233 /// which gets emitted when the user selects all items.
3234 ///
3235 /// Applications should not connect to it, but may emit it with
3236 /// `g_signal_emit_by_name()` if they need to control selection
3237 /// programmatically.
3238 ///
3239 /// The default binding for this signal is Ctrl-a.
3240 #[doc(alias = "select-all")]
3241 fn connect_select_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3242 unsafe extern "C" fn select_all_trampoline<P: IsA<IconView>, F: Fn(&P) + 'static>(
3243 this: *mut ffi::GtkIconView,
3244 f: glib::ffi::gpointer,
3245 ) {
3246 unsafe {
3247 let f: &F = &*(f as *const F);
3248 f(IconView::from_glib_borrow(this).unsafe_cast_ref())
3249 }
3250 }
3251 unsafe {
3252 let f: Box_<F> = Box_::new(f);
3253 connect_raw(
3254 self.as_ptr() as *mut _,
3255 c"select-all".as_ptr(),
3256 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3257 select_all_trampoline::<Self, F> as *const (),
3258 )),
3259 Box_::into_raw(f),
3260 )
3261 }
3262 }
3263
3264 fn emit_select_all(&self) {
3265 self.emit_by_name::<()>("select-all", &[]);
3266 }
3267
3268 /// A [keybinding signal][GtkBindingSignal]
3269 /// which gets emitted when the user selects the item that is currently
3270 /// focused.
3271 ///
3272 /// Applications should not connect to it, but may emit it with
3273 /// `g_signal_emit_by_name()` if they need to control selection
3274 /// programmatically.
3275 ///
3276 /// There is no default binding for this signal.
3277 #[doc(alias = "select-cursor-item")]
3278 fn connect_select_cursor_item<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3279 unsafe extern "C" fn select_cursor_item_trampoline<
3280 P: IsA<IconView>,
3281 F: Fn(&P) + 'static,
3282 >(
3283 this: *mut ffi::GtkIconView,
3284 f: glib::ffi::gpointer,
3285 ) {
3286 unsafe {
3287 let f: &F = &*(f as *const F);
3288 f(IconView::from_glib_borrow(this).unsafe_cast_ref())
3289 }
3290 }
3291 unsafe {
3292 let f: Box_<F> = Box_::new(f);
3293 connect_raw(
3294 self.as_ptr() as *mut _,
3295 c"select-cursor-item".as_ptr(),
3296 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3297 select_cursor_item_trampoline::<Self, F> as *const (),
3298 )),
3299 Box_::into_raw(f),
3300 )
3301 }
3302 }
3303
3304 fn emit_select_cursor_item(&self) {
3305 self.emit_by_name::<()>("select-cursor-item", &[]);
3306 }
3307
3308 /// The ::selection-changed signal is emitted when the selection
3309 /// (i.e. the set of selected items) changes.
3310 #[doc(alias = "selection-changed")]
3311 fn connect_selection_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3312 unsafe extern "C" fn selection_changed_trampoline<P: IsA<IconView>, F: Fn(&P) + 'static>(
3313 this: *mut ffi::GtkIconView,
3314 f: glib::ffi::gpointer,
3315 ) {
3316 unsafe {
3317 let f: &F = &*(f as *const F);
3318 f(IconView::from_glib_borrow(this).unsafe_cast_ref())
3319 }
3320 }
3321 unsafe {
3322 let f: Box_<F> = Box_::new(f);
3323 connect_raw(
3324 self.as_ptr() as *mut _,
3325 c"selection-changed".as_ptr(),
3326 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3327 selection_changed_trampoline::<Self, F> as *const (),
3328 )),
3329 Box_::into_raw(f),
3330 )
3331 }
3332 }
3333
3334 /// A [keybinding signal][GtkBindingSignal]
3335 /// which gets emitted when the user toggles whether the currently
3336 /// focused item is selected or not. The exact effect of this
3337 /// depend on the selection mode.
3338 ///
3339 /// Applications should not connect to it, but may emit it with
3340 /// `g_signal_emit_by_name()` if they need to control selection
3341 /// programmatically.
3342 ///
3343 /// There is no default binding for this signal is Ctrl-Space.
3344 #[doc(alias = "toggle-cursor-item")]
3345 fn connect_toggle_cursor_item<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3346 unsafe extern "C" fn toggle_cursor_item_trampoline<
3347 P: IsA<IconView>,
3348 F: Fn(&P) + 'static,
3349 >(
3350 this: *mut ffi::GtkIconView,
3351 f: glib::ffi::gpointer,
3352 ) {
3353 unsafe {
3354 let f: &F = &*(f as *const F);
3355 f(IconView::from_glib_borrow(this).unsafe_cast_ref())
3356 }
3357 }
3358 unsafe {
3359 let f: Box_<F> = Box_::new(f);
3360 connect_raw(
3361 self.as_ptr() as *mut _,
3362 c"toggle-cursor-item".as_ptr(),
3363 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3364 toggle_cursor_item_trampoline::<Self, F> as *const (),
3365 )),
3366 Box_::into_raw(f),
3367 )
3368 }
3369 }
3370
3371 fn emit_toggle_cursor_item(&self) {
3372 self.emit_by_name::<()>("toggle-cursor-item", &[]);
3373 }
3374
3375 /// A [keybinding signal][GtkBindingSignal]
3376 /// which gets emitted when the user unselects all items.
3377 ///
3378 /// Applications should not connect to it, but may emit it with
3379 /// `g_signal_emit_by_name()` if they need to control selection
3380 /// programmatically.
3381 ///
3382 /// The default binding for this signal is Ctrl-Shift-a.
3383 #[doc(alias = "unselect-all")]
3384 fn connect_unselect_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3385 unsafe extern "C" fn unselect_all_trampoline<P: IsA<IconView>, F: Fn(&P) + 'static>(
3386 this: *mut ffi::GtkIconView,
3387 f: glib::ffi::gpointer,
3388 ) {
3389 unsafe {
3390 let f: &F = &*(f as *const F);
3391 f(IconView::from_glib_borrow(this).unsafe_cast_ref())
3392 }
3393 }
3394 unsafe {
3395 let f: Box_<F> = Box_::new(f);
3396 connect_raw(
3397 self.as_ptr() as *mut _,
3398 c"unselect-all".as_ptr(),
3399 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3400 unselect_all_trampoline::<Self, F> as *const (),
3401 )),
3402 Box_::into_raw(f),
3403 )
3404 }
3405 }
3406
3407 fn emit_unselect_all(&self) {
3408 self.emit_by_name::<()>("unselect-all", &[]);
3409 }
3410
3411 #[doc(alias = "activate-on-single-click")]
3412 fn connect_activate_on_single_click_notify<F: Fn(&Self) + 'static>(
3413 &self,
3414 f: F,
3415 ) -> SignalHandlerId {
3416 unsafe extern "C" fn notify_activate_on_single_click_trampoline<
3417 P: IsA<IconView>,
3418 F: Fn(&P) + 'static,
3419 >(
3420 this: *mut ffi::GtkIconView,
3421 _param_spec: glib::ffi::gpointer,
3422 f: glib::ffi::gpointer,
3423 ) {
3424 unsafe {
3425 let f: &F = &*(f as *const F);
3426 f(IconView::from_glib_borrow(this).unsafe_cast_ref())
3427 }
3428 }
3429 unsafe {
3430 let f: Box_<F> = Box_::new(f);
3431 connect_raw(
3432 self.as_ptr() as *mut _,
3433 c"notify::activate-on-single-click".as_ptr(),
3434 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3435 notify_activate_on_single_click_trampoline::<Self, F> as *const (),
3436 )),
3437 Box_::into_raw(f),
3438 )
3439 }
3440 }
3441
3442 #[doc(alias = "column-spacing")]
3443 fn connect_column_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3444 unsafe extern "C" fn notify_column_spacing_trampoline<
3445 P: IsA<IconView>,
3446 F: Fn(&P) + 'static,
3447 >(
3448 this: *mut ffi::GtkIconView,
3449 _param_spec: glib::ffi::gpointer,
3450 f: glib::ffi::gpointer,
3451 ) {
3452 unsafe {
3453 let f: &F = &*(f as *const F);
3454 f(IconView::from_glib_borrow(this).unsafe_cast_ref())
3455 }
3456 }
3457 unsafe {
3458 let f: Box_<F> = Box_::new(f);
3459 connect_raw(
3460 self.as_ptr() as *mut _,
3461 c"notify::column-spacing".as_ptr(),
3462 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3463 notify_column_spacing_trampoline::<Self, F> as *const (),
3464 )),
3465 Box_::into_raw(f),
3466 )
3467 }
3468 }
3469
3470 #[doc(alias = "columns")]
3471 fn connect_columns_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3472 unsafe extern "C" fn notify_columns_trampoline<P: IsA<IconView>, F: Fn(&P) + 'static>(
3473 this: *mut ffi::GtkIconView,
3474 _param_spec: glib::ffi::gpointer,
3475 f: glib::ffi::gpointer,
3476 ) {
3477 unsafe {
3478 let f: &F = &*(f as *const F);
3479 f(IconView::from_glib_borrow(this).unsafe_cast_ref())
3480 }
3481 }
3482 unsafe {
3483 let f: Box_<F> = Box_::new(f);
3484 connect_raw(
3485 self.as_ptr() as *mut _,
3486 c"notify::columns".as_ptr(),
3487 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3488 notify_columns_trampoline::<Self, F> as *const (),
3489 )),
3490 Box_::into_raw(f),
3491 )
3492 }
3493 }
3494
3495 #[doc(alias = "item-orientation")]
3496 fn connect_item_orientation_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3497 unsafe extern "C" fn notify_item_orientation_trampoline<
3498 P: IsA<IconView>,
3499 F: Fn(&P) + 'static,
3500 >(
3501 this: *mut ffi::GtkIconView,
3502 _param_spec: glib::ffi::gpointer,
3503 f: glib::ffi::gpointer,
3504 ) {
3505 unsafe {
3506 let f: &F = &*(f as *const F);
3507 f(IconView::from_glib_borrow(this).unsafe_cast_ref())
3508 }
3509 }
3510 unsafe {
3511 let f: Box_<F> = Box_::new(f);
3512 connect_raw(
3513 self.as_ptr() as *mut _,
3514 c"notify::item-orientation".as_ptr(),
3515 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3516 notify_item_orientation_trampoline::<Self, F> as *const (),
3517 )),
3518 Box_::into_raw(f),
3519 )
3520 }
3521 }
3522
3523 #[doc(alias = "item-padding")]
3524 fn connect_item_padding_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3525 unsafe extern "C" fn notify_item_padding_trampoline<
3526 P: IsA<IconView>,
3527 F: Fn(&P) + 'static,
3528 >(
3529 this: *mut ffi::GtkIconView,
3530 _param_spec: glib::ffi::gpointer,
3531 f: glib::ffi::gpointer,
3532 ) {
3533 unsafe {
3534 let f: &F = &*(f as *const F);
3535 f(IconView::from_glib_borrow(this).unsafe_cast_ref())
3536 }
3537 }
3538 unsafe {
3539 let f: Box_<F> = Box_::new(f);
3540 connect_raw(
3541 self.as_ptr() as *mut _,
3542 c"notify::item-padding".as_ptr(),
3543 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3544 notify_item_padding_trampoline::<Self, F> as *const (),
3545 )),
3546 Box_::into_raw(f),
3547 )
3548 }
3549 }
3550
3551 #[doc(alias = "item-width")]
3552 fn connect_item_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3553 unsafe extern "C" fn notify_item_width_trampoline<P: IsA<IconView>, F: Fn(&P) + 'static>(
3554 this: *mut ffi::GtkIconView,
3555 _param_spec: glib::ffi::gpointer,
3556 f: glib::ffi::gpointer,
3557 ) {
3558 unsafe {
3559 let f: &F = &*(f as *const F);
3560 f(IconView::from_glib_borrow(this).unsafe_cast_ref())
3561 }
3562 }
3563 unsafe {
3564 let f: Box_<F> = Box_::new(f);
3565 connect_raw(
3566 self.as_ptr() as *mut _,
3567 c"notify::item-width".as_ptr(),
3568 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3569 notify_item_width_trampoline::<Self, F> as *const (),
3570 )),
3571 Box_::into_raw(f),
3572 )
3573 }
3574 }
3575
3576 #[doc(alias = "markup-column")]
3577 fn connect_markup_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3578 unsafe extern "C" fn notify_markup_column_trampoline<
3579 P: IsA<IconView>,
3580 F: Fn(&P) + 'static,
3581 >(
3582 this: *mut ffi::GtkIconView,
3583 _param_spec: glib::ffi::gpointer,
3584 f: glib::ffi::gpointer,
3585 ) {
3586 unsafe {
3587 let f: &F = &*(f as *const F);
3588 f(IconView::from_glib_borrow(this).unsafe_cast_ref())
3589 }
3590 }
3591 unsafe {
3592 let f: Box_<F> = Box_::new(f);
3593 connect_raw(
3594 self.as_ptr() as *mut _,
3595 c"notify::markup-column".as_ptr(),
3596 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3597 notify_markup_column_trampoline::<Self, F> as *const (),
3598 )),
3599 Box_::into_raw(f),
3600 )
3601 }
3602 }
3603
3604 #[doc(alias = "model")]
3605 fn connect_model_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3606 unsafe extern "C" fn notify_model_trampoline<P: IsA<IconView>, F: Fn(&P) + 'static>(
3607 this: *mut ffi::GtkIconView,
3608 _param_spec: glib::ffi::gpointer,
3609 f: glib::ffi::gpointer,
3610 ) {
3611 unsafe {
3612 let f: &F = &*(f as *const F);
3613 f(IconView::from_glib_borrow(this).unsafe_cast_ref())
3614 }
3615 }
3616 unsafe {
3617 let f: Box_<F> = Box_::new(f);
3618 connect_raw(
3619 self.as_ptr() as *mut _,
3620 c"notify::model".as_ptr(),
3621 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3622 notify_model_trampoline::<Self, F> as *const (),
3623 )),
3624 Box_::into_raw(f),
3625 )
3626 }
3627 }
3628
3629 #[doc(alias = "pixbuf-column")]
3630 fn connect_pixbuf_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3631 unsafe extern "C" fn notify_pixbuf_column_trampoline<
3632 P: IsA<IconView>,
3633 F: Fn(&P) + 'static,
3634 >(
3635 this: *mut ffi::GtkIconView,
3636 _param_spec: glib::ffi::gpointer,
3637 f: glib::ffi::gpointer,
3638 ) {
3639 unsafe {
3640 let f: &F = &*(f as *const F);
3641 f(IconView::from_glib_borrow(this).unsafe_cast_ref())
3642 }
3643 }
3644 unsafe {
3645 let f: Box_<F> = Box_::new(f);
3646 connect_raw(
3647 self.as_ptr() as *mut _,
3648 c"notify::pixbuf-column".as_ptr(),
3649 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3650 notify_pixbuf_column_trampoline::<Self, F> as *const (),
3651 )),
3652 Box_::into_raw(f),
3653 )
3654 }
3655 }
3656
3657 #[doc(alias = "reorderable")]
3658 fn connect_reorderable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3659 unsafe extern "C" fn notify_reorderable_trampoline<
3660 P: IsA<IconView>,
3661 F: Fn(&P) + 'static,
3662 >(
3663 this: *mut ffi::GtkIconView,
3664 _param_spec: glib::ffi::gpointer,
3665 f: glib::ffi::gpointer,
3666 ) {
3667 unsafe {
3668 let f: &F = &*(f as *const F);
3669 f(IconView::from_glib_borrow(this).unsafe_cast_ref())
3670 }
3671 }
3672 unsafe {
3673 let f: Box_<F> = Box_::new(f);
3674 connect_raw(
3675 self.as_ptr() as *mut _,
3676 c"notify::reorderable".as_ptr(),
3677 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3678 notify_reorderable_trampoline::<Self, F> as *const (),
3679 )),
3680 Box_::into_raw(f),
3681 )
3682 }
3683 }
3684
3685 #[doc(alias = "row-spacing")]
3686 fn connect_row_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3687 unsafe extern "C" fn notify_row_spacing_trampoline<
3688 P: IsA<IconView>,
3689 F: Fn(&P) + 'static,
3690 >(
3691 this: *mut ffi::GtkIconView,
3692 _param_spec: glib::ffi::gpointer,
3693 f: glib::ffi::gpointer,
3694 ) {
3695 unsafe {
3696 let f: &F = &*(f as *const F);
3697 f(IconView::from_glib_borrow(this).unsafe_cast_ref())
3698 }
3699 }
3700 unsafe {
3701 let f: Box_<F> = Box_::new(f);
3702 connect_raw(
3703 self.as_ptr() as *mut _,
3704 c"notify::row-spacing".as_ptr(),
3705 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3706 notify_row_spacing_trampoline::<Self, F> as *const (),
3707 )),
3708 Box_::into_raw(f),
3709 )
3710 }
3711 }
3712
3713 #[doc(alias = "selection-mode")]
3714 fn connect_selection_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3715 unsafe extern "C" fn notify_selection_mode_trampoline<
3716 P: IsA<IconView>,
3717 F: Fn(&P) + 'static,
3718 >(
3719 this: *mut ffi::GtkIconView,
3720 _param_spec: glib::ffi::gpointer,
3721 f: glib::ffi::gpointer,
3722 ) {
3723 unsafe {
3724 let f: &F = &*(f as *const F);
3725 f(IconView::from_glib_borrow(this).unsafe_cast_ref())
3726 }
3727 }
3728 unsafe {
3729 let f: Box_<F> = Box_::new(f);
3730 connect_raw(
3731 self.as_ptr() as *mut _,
3732 c"notify::selection-mode".as_ptr(),
3733 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3734 notify_selection_mode_trampoline::<Self, F> as *const (),
3735 )),
3736 Box_::into_raw(f),
3737 )
3738 }
3739 }
3740
3741 #[doc(alias = "spacing")]
3742 fn connect_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3743 unsafe extern "C" fn notify_spacing_trampoline<P: IsA<IconView>, F: Fn(&P) + 'static>(
3744 this: *mut ffi::GtkIconView,
3745 _param_spec: glib::ffi::gpointer,
3746 f: glib::ffi::gpointer,
3747 ) {
3748 unsafe {
3749 let f: &F = &*(f as *const F);
3750 f(IconView::from_glib_borrow(this).unsafe_cast_ref())
3751 }
3752 }
3753 unsafe {
3754 let f: Box_<F> = Box_::new(f);
3755 connect_raw(
3756 self.as_ptr() as *mut _,
3757 c"notify::spacing".as_ptr(),
3758 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3759 notify_spacing_trampoline::<Self, F> as *const (),
3760 )),
3761 Box_::into_raw(f),
3762 )
3763 }
3764 }
3765
3766 #[doc(alias = "text-column")]
3767 fn connect_text_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3768 unsafe extern "C" fn notify_text_column_trampoline<
3769 P: IsA<IconView>,
3770 F: Fn(&P) + 'static,
3771 >(
3772 this: *mut ffi::GtkIconView,
3773 _param_spec: glib::ffi::gpointer,
3774 f: glib::ffi::gpointer,
3775 ) {
3776 unsafe {
3777 let f: &F = &*(f as *const F);
3778 f(IconView::from_glib_borrow(this).unsafe_cast_ref())
3779 }
3780 }
3781 unsafe {
3782 let f: Box_<F> = Box_::new(f);
3783 connect_raw(
3784 self.as_ptr() as *mut _,
3785 c"notify::text-column".as_ptr(),
3786 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3787 notify_text_column_trampoline::<Self, F> as *const (),
3788 )),
3789 Box_::into_raw(f),
3790 )
3791 }
3792 }
3793
3794 #[doc(alias = "tooltip-column")]
3795 fn connect_tooltip_column_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
3796 unsafe extern "C" fn notify_tooltip_column_trampoline<
3797 P: IsA<IconView>,
3798 F: Fn(&P) + 'static,
3799 >(
3800 this: *mut ffi::GtkIconView,
3801 _param_spec: glib::ffi::gpointer,
3802 f: glib::ffi::gpointer,
3803 ) {
3804 unsafe {
3805 let f: &F = &*(f as *const F);
3806 f(IconView::from_glib_borrow(this).unsafe_cast_ref())
3807 }
3808 }
3809 unsafe {
3810 let f: Box_<F> = Box_::new(f);
3811 connect_raw(
3812 self.as_ptr() as *mut _,
3813 c"notify::tooltip-column".as_ptr(),
3814 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
3815 notify_tooltip_column_trampoline::<Self, F> as *const (),
3816 )),
3817 Box_::into_raw(f),
3818 )
3819 }
3820 }
3821}
3822
3823impl<O: IsA<IconView>> IconViewExt for O {}