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