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