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