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