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