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