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