Skip to main content

gtk4/auto/
grid_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
5use crate::{
6    Accessible, AccessibleRole, Adjustment, Align, Buildable, ConstraintTarget, LayoutManager,
7    ListBase, ListItemFactory, Orientable, Orientation, Overflow, Scrollable, ScrollablePolicy,
8    SelectionModel, Widget, ffi,
9};
10#[cfg(feature = "v4_12")]
11#[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
12use crate::{ListScrollFlags, ListTabBehavior, ScrollInfo};
13use glib::{
14    object::ObjectType as _,
15    prelude::*,
16    signal::{SignalHandlerId, connect_raw},
17    translate::*,
18};
19use std::boxed::Box as Box_;
20
21glib::wrapper! {
22    /// Presents a large dynamic grid of items.
23    ///
24    /// [`GridView`][crate::GridView] uses its factory to generate one child widget for each
25    /// visible item and shows them in a grid. The orientation of the grid view
26    /// determines if the grid reflows vertically or horizontally.
27    ///
28    /// [`GridView`][crate::GridView] allows the user to select items according to the selection
29    /// characteristics of the model. For models that allow multiple selected items,
30    /// it is possible to turn on _rubberband selection_, using
31    /// [`enable-rubberband`][struct@crate::GridView#enable-rubberband].
32    ///
33    /// To learn more about the list widget framework, see the
34    /// [overview](section-list-widget.html).
35    ///
36    /// # Actions
37    ///
38    /// [`GridView`][crate::GridView] defines a set of built-in actions:
39    ///
40    /// - `list.activate-item` activates the item at given position by emitting the
41    ///   the [`activate`][struct@crate::GridView#activate] signal.
42    ///
43    /// # CSS nodes
44    ///
45    /// ```text
46    /// gridview
47    /// ├── child[.activatable]
48    /// │
49    /// ├── child[.activatable]
50    /// │
51    /// ┊
52    /// ╰── [rubberband]
53    /// ```
54    ///
55    /// [`GridView`][crate::GridView] uses a single CSS node with name `gridview`. Each child uses
56    /// a single CSS node with name `child`. If the [`activatable`][struct@crate::ListItem#activatable]
57    /// property is set, the corresponding row will have the `.activatable` style
58    /// class. For rubberband selection, a subnode with name `rubberband` is used.
59    ///
60    /// # Accessibility
61    ///
62    /// [`GridView`][crate::GridView] uses the [enum@Gtk.AccessibleRole.grid] role, and the items
63    /// use the [enum@Gtk.AccessibleRole.grid_cell] role.
64    ///
65    /// ## Properties
66    ///
67    ///
68    /// #### `enable-rubberband`
69    ///  Allow rubberband selection.
70    ///
71    /// Readable | Writeable
72    ///
73    ///
74    /// #### `factory`
75    ///  Factory for populating list items.
76    ///
77    /// The factory must be for configuring [`ListItem`][crate::ListItem] objects.
78    ///
79    /// Readable | Writeable
80    ///
81    ///
82    /// #### `max-columns`
83    ///  Maximum number of columns per row.
84    ///
85    /// If this number is smaller than [`min-columns`][struct@crate::GridView#min-columns],
86    /// that value is used instead.
87    ///
88    /// Readable | Writeable
89    ///
90    ///
91    /// #### `min-columns`
92    ///  Minimum number of columns per row.
93    ///
94    /// Readable | Writeable
95    ///
96    ///
97    /// #### `model`
98    ///  Model for the items displayed.
99    ///
100    /// Readable | Writeable
101    ///
102    ///
103    /// #### `single-click-activate`
104    ///  Activate rows on single click and select them on hover.
105    ///
106    /// Readable | Writeable
107    ///
108    ///
109    /// #### `tab-behavior`
110    ///  Behavior of the <kbd>Tab</kbd> key
111    ///
112    /// Readable | Writeable
113    /// <details><summary><h4>ListBase</h4></summary>
114    ///
115    ///
116    /// #### `orientation`
117    ///  The orientation of the list. See GtkOrientable:orientation
118    /// for details.
119    ///
120    /// Readable | Writeable
121    /// </details>
122    /// <details><summary><h4>Widget</h4></summary>
123    ///
124    ///
125    /// #### `can-focus`
126    ///  Whether the widget or any of its descendents can accept
127    /// the input focus.
128    ///
129    /// This property is meant to be set by widget implementations,
130    /// typically in their instance init function.
131    ///
132    /// Readable | Writeable
133    ///
134    ///
135    /// #### `can-target`
136    ///  Whether the widget can receive pointer events.
137    ///
138    /// Readable | Writeable
139    ///
140    ///
141    /// #### `css-classes`
142    ///  A list of css classes applied to this widget.
143    ///
144    /// Readable | Writeable
145    ///
146    ///
147    /// #### `css-name`
148    ///  The name of this widget in the CSS tree.
149    ///
150    /// This property is meant to be set by widget implementations,
151    /// typically in their instance init function.
152    ///
153    /// Readable | Writeable | Construct Only
154    ///
155    ///
156    /// #### `cursor`
157    ///  The cursor used by @widget.
158    ///
159    /// Readable | Writeable
160    ///
161    ///
162    /// #### `focus-on-click`
163    ///  Whether the widget should grab focus when it is clicked with the mouse.
164    ///
165    /// This property is only relevant for widgets that can take focus.
166    ///
167    /// Readable | Writeable
168    ///
169    ///
170    /// #### `focusable`
171    ///  Whether this widget itself will accept the input focus.
172    ///
173    /// Readable | Writeable
174    ///
175    ///
176    /// #### `halign`
177    ///  How to distribute horizontal space if widget gets extra space.
178    ///
179    /// Readable | Writeable
180    ///
181    ///
182    /// #### `has-default`
183    ///  Whether the widget is the default widget.
184    ///
185    /// Readable
186    ///
187    ///
188    /// #### `has-focus`
189    ///  Whether the widget has the input focus.
190    ///
191    /// Readable
192    ///
193    ///
194    /// #### `has-tooltip`
195    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
196    /// signal on @widget.
197    ///
198    /// A true value indicates that @widget can have a tooltip, in this case
199    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
200    /// determine whether it will provide a tooltip or not.
201    ///
202    /// Readable | Writeable
203    ///
204    ///
205    /// #### `height-request`
206    ///  Overrides for height request of the widget.
207    ///
208    /// If this is -1, the natural request will be used.
209    ///
210    /// Readable | Writeable
211    ///
212    ///
213    /// #### `hexpand`
214    ///  Whether to expand horizontally.
215    ///
216    /// Readable | Writeable
217    ///
218    ///
219    /// #### `hexpand-set`
220    ///  Whether to use the `hexpand` property.
221    ///
222    /// Readable | Writeable
223    ///
224    ///
225    /// #### `layout-manager`
226    ///  The [`LayoutManager`][crate::LayoutManager] instance to use to compute
227    /// the preferred size of the widget, and allocate its children.
228    ///
229    /// This property is meant to be set by widget implementations,
230    /// typically in their instance init function.
231    ///
232    /// Readable | Writeable
233    ///
234    ///
235    /// #### `limit-events`
236    ///  Makes this widget act like a modal dialog, with respect to
237    /// event delivery.
238    ///
239    /// Global event controllers will not handle events with targets
240    /// inside the widget, unless they are set up to ignore propagation
241    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
242    ///
243    /// Readable | Writeable
244    ///
245    ///
246    /// #### `margin-bottom`
247    ///  Margin on bottom side of widget.
248    ///
249    /// This property adds margin outside of the widget's normal size
250    /// request, the margin will be added in addition to the size from
251    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
252    ///
253    /// Readable | Writeable
254    ///
255    ///
256    /// #### `margin-end`
257    ///  Margin on end of widget, horizontally.
258    ///
259    /// This property supports left-to-right and right-to-left text
260    /// directions.
261    ///
262    /// This property adds margin outside of the widget's normal size
263    /// request, the margin will be added in addition to the size from
264    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
265    ///
266    /// Readable | Writeable
267    ///
268    ///
269    /// #### `margin-start`
270    ///  Margin on start of widget, horizontally.
271    ///
272    /// This property supports left-to-right and right-to-left text
273    /// directions.
274    ///
275    /// This property adds margin outside of the widget's normal size
276    /// request, the margin will be added in addition to the size from
277    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
278    ///
279    /// Readable | Writeable
280    ///
281    ///
282    /// #### `margin-top`
283    ///  Margin on top side of widget.
284    ///
285    /// This property adds margin outside of the widget's normal size
286    /// request, the margin will be added in addition to the size from
287    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
288    ///
289    /// Readable | Writeable
290    ///
291    ///
292    /// #### `name`
293    ///  The name of the widget.
294    ///
295    /// Readable | Writeable
296    ///
297    ///
298    /// #### `opacity`
299    ///  The requested opacity of the widget.
300    ///
301    /// Readable | Writeable
302    ///
303    ///
304    /// #### `overflow`
305    ///  How content outside the widget's content area is treated.
306    ///
307    /// This property is meant to be set by widget implementations,
308    /// typically in their instance init function.
309    ///
310    /// Readable | Writeable
311    ///
312    ///
313    /// #### `parent`
314    ///  The parent widget of this widget.
315    ///
316    /// Readable
317    ///
318    ///
319    /// #### `receives-default`
320    ///  Whether the widget will receive the default action when it is focused.
321    ///
322    /// Readable | Writeable
323    ///
324    ///
325    /// #### `root`
326    ///  The [`Root`][crate::Root] widget of the widget tree containing this widget.
327    ///
328    /// This will be `NULL` if the widget is not contained in a root widget.
329    ///
330    /// Readable
331    ///
332    ///
333    /// #### `scale-factor`
334    ///  The scale factor of the widget.
335    ///
336    /// Readable
337    ///
338    ///
339    /// #### `sensitive`
340    ///  Whether the widget responds to input.
341    ///
342    /// Readable | Writeable
343    ///
344    ///
345    /// #### `tooltip-markup`
346    ///  Sets the text of tooltip to be the given string, which is marked up
347    /// with Pango markup.
348    ///
349    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
350    ///
351    /// This is a convenience property which will take care of getting the
352    /// tooltip shown if the given string is not `NULL`:
353    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
354    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
355    /// the default signal handler.
356    ///
357    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
358    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
359    ///
360    /// Readable | Writeable
361    ///
362    ///
363    /// #### `tooltip-text`
364    ///  Sets the text of tooltip to be the given string.
365    ///
366    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
367    ///
368    /// This is a convenience property which will take care of getting the
369    /// tooltip shown if the given string is not `NULL`:
370    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
371    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
372    /// the default signal handler.
373    ///
374    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
375    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
376    ///
377    /// Readable | Writeable
378    ///
379    ///
380    /// #### `valign`
381    ///  How to distribute vertical space if widget gets extra space.
382    ///
383    /// Readable | Writeable
384    ///
385    ///
386    /// #### `vexpand`
387    ///  Whether to expand vertically.
388    ///
389    /// Readable | Writeable
390    ///
391    ///
392    /// #### `vexpand-set`
393    ///  Whether to use the `vexpand` property.
394    ///
395    /// Readable | Writeable
396    ///
397    ///
398    /// #### `visible`
399    ///  Whether the widget is visible.
400    ///
401    /// Readable | Writeable
402    ///
403    ///
404    /// #### `width-request`
405    ///  Overrides for width request of the widget.
406    ///
407    /// If this is -1, the natural request will be used.
408    ///
409    /// Readable | Writeable
410    /// </details>
411    /// <details><summary><h4>Accessible</h4></summary>
412    ///
413    ///
414    /// #### `accessible-role`
415    ///  The accessible role of the given [`Accessible`][crate::Accessible] implementation.
416    ///
417    /// The accessible role cannot be changed once set.
418    ///
419    /// Readable | Writeable
420    /// </details>
421    /// <details><summary><h4>Orientable</h4></summary>
422    ///
423    ///
424    /// #### `orientation`
425    ///  The orientation of the orientable.
426    ///
427    /// Readable | Writeable
428    /// </details>
429    /// <details><summary><h4>Scrollable</h4></summary>
430    ///
431    ///
432    /// #### `hadjustment`
433    ///  Horizontal [`Adjustment`][crate::Adjustment] of the scrollable widget.
434    ///
435    /// This adjustment is shared between the scrollable widget and its parent.
436    ///
437    /// Readable | Writeable | Construct
438    ///
439    ///
440    /// #### `hscroll-policy`
441    ///  Determines when horizontal scrolling should start.
442    ///
443    /// Readable | Writeable
444    ///
445    ///
446    /// #### `vadjustment`
447    ///  Vertical [`Adjustment`][crate::Adjustment] of the scrollable widget.
448    ///
449    /// This adjustment is shared between the scrollable widget and its parent.
450    ///
451    /// Readable | Writeable | Construct
452    ///
453    ///
454    /// #### `vscroll-policy`
455    ///  Determines when vertical scrolling should start.
456    ///
457    /// Readable | Writeable
458    /// </details>
459    ///
460    /// ## Signals
461    ///
462    ///
463    /// #### `activate`
464    ///  Emitted when a cell has been activated by the user,
465    /// usually via activating the GtkGridView|list.activate-item action.
466    ///
467    /// This allows for a convenient way to handle activation in a gridview.
468    /// See [`activatable`][struct@crate::ListItem#activatable] for details on how to use
469    /// this signal.
470    ///
471    ///
472    /// <details><summary><h4>Widget</h4></summary>
473    ///
474    ///
475    /// #### `destroy`
476    ///  Signals that all holders of a reference to the widget should release
477    /// the reference that they hold.
478    ///
479    /// May result in finalization of the widget if all references are released.
480    ///
481    /// This signal is not suitable for saving widget state.
482    ///
483    ///
484    ///
485    ///
486    /// #### `direction-changed`
487    ///  Emitted when the text direction of a widget changes.
488    ///
489    ///
490    ///
491    ///
492    /// #### `hide`
493    ///  Emitted when @widget is hidden.
494    ///
495    ///
496    ///
497    ///
498    /// #### `keynav-failed`
499    ///  Emitted if keyboard navigation fails.
500    ///
501    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
502    ///
503    ///
504    ///
505    ///
506    /// #### `map`
507    ///  Emitted when @widget is going to be mapped.
508    ///
509    /// A widget is mapped when the widget is visible (which is controlled with
510    /// [`visible`][struct@crate::Widget#visible]) and all its parents up to the toplevel widget
511    /// are also visible.
512    ///
513    /// The `::map` signal can be used to determine whether a widget will be drawn,
514    /// for instance it can resume an animation that was stopped during the
515    /// emission of [`unmap`][struct@crate::Widget#unmap].
516    ///
517    ///
518    ///
519    ///
520    /// #### `mnemonic-activate`
521    ///  Emitted when a widget is activated via a mnemonic.
522    ///
523    /// The default handler for this signal activates @widget if @group_cycling
524    /// is false, or just makes @widget grab focus if @group_cycling is true.
525    ///
526    ///
527    ///
528    ///
529    /// #### `move-focus`
530    ///  Emitted when the focus is moved.
531    ///
532    /// The `::move-focus` signal is a [keybinding signal](class.SignalAction.html).
533    ///
534    /// The default bindings for this signal are <kbd>Tab</kbd> to move forward,
535    /// and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move backward.
536    ///
537    /// Action
538    ///
539    ///
540    /// #### `query-tooltip`
541    ///  Emitted when the widget’s tooltip is about to be shown.
542    ///
543    /// This happens when the [`has-tooltip`][struct@crate::Widget#has-tooltip] property
544    /// is true and the hover timeout has expired with the cursor hovering
545    /// above @widget; or emitted when @widget got focus in keyboard mode.
546    ///
547    /// Using the given coordinates, the signal handler should determine
548    /// whether a tooltip should be shown for @widget. If this is the case
549    /// true should be returned, false otherwise. Note that if @keyboard_mode
550    /// is true, the values of @x and @y are undefined and should not be used.
551    ///
552    /// The signal handler is free to manipulate @tooltip with the therefore
553    /// destined function calls.
554    ///
555    ///
556    ///
557    ///
558    /// #### `realize`
559    ///  Emitted when @widget is associated with a [`gdk::Surface`][crate::gdk::Surface].
560    ///
561    /// This means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called
562    /// or the widget has been mapped (that is, it is going to be drawn).
563    ///
564    ///
565    ///
566    ///
567    /// #### `show`
568    ///  Emitted when @widget is shown.
569    ///
570    ///
571    ///
572    ///
573    /// #### `state-flags-changed`
574    ///  Emitted when the widget state changes.
575    ///
576    /// See [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
577    ///
578    ///
579    ///
580    ///
581    /// #### `unmap`
582    ///  Emitted when @widget is going to be unmapped.
583    ///
584    /// A widget is unmapped when either it or any of its parents up to the
585    /// toplevel widget have been set as hidden.
586    ///
587    /// As `::unmap` indicates that a widget will not be shown any longer,
588    /// it can be used to, for example, stop an animation on the widget.
589    ///
590    ///
591    ///
592    ///
593    /// #### `unrealize`
594    ///  Emitted when the [`gdk::Surface`][crate::gdk::Surface] associated with @widget is destroyed.
595    ///
596    /// This means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been called
597    /// or the widget has been unmapped (that is, it is going to be hidden).
598    ///
599    ///
600    /// </details>
601    ///
602    /// # Implements
603    ///
604    /// [`ListBaseExt`][trait@crate::prelude::ListBaseExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`OrientableExt`][trait@crate::prelude::OrientableExt], [`ScrollableExt`][trait@crate::prelude::ScrollableExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual]
605    #[doc(alias = "GtkGridView")]
606    pub struct GridView(Object<ffi::GtkGridView, ffi::GtkGridViewClass>) @extends ListBase, Widget, @implements Accessible, Buildable, ConstraintTarget, Orientable, Scrollable;
607
608    match fn {
609        type_ => || ffi::gtk_grid_view_get_type(),
610    }
611}
612
613impl GridView {
614    /// Creates a new [`GridView`][crate::GridView] that uses the given @factory for
615    /// mapping items to widgets.
616    ///
617    /// The function takes ownership of the
618    /// arguments, so you can write code like
619    /// **⚠️ The following code is in c ⚠️**
620    ///
621    /// ```c
622    /// grid_view = gtk_grid_view_new (create_model (),
623    ///   gtk_builder_list_item_factory_new_from_resource ("/resource.ui"));
624    /// ```
625    /// ## `model`
626    /// the model to use
627    /// ## `factory`
628    /// The factory to populate items with
629    ///
630    /// # Returns
631    ///
632    /// a new [`GridView`][crate::GridView] using the given @model and @factory
633    #[doc(alias = "gtk_grid_view_new")]
634    pub fn new(
635        model: Option<impl IsA<SelectionModel>>,
636        factory: Option<impl IsA<ListItemFactory>>,
637    ) -> GridView {
638        assert_initialized_main_thread!();
639        unsafe {
640            Widget::from_glib_none(ffi::gtk_grid_view_new(
641                model.map(|p| p.upcast()).into_glib_ptr(),
642                factory.map(|p| p.upcast()).into_glib_ptr(),
643            ))
644            .unsafe_cast()
645        }
646    }
647
648    // rustdoc-stripper-ignore-next
649    /// Creates a new builder-pattern struct instance to construct [`GridView`] objects.
650    ///
651    /// This method returns an instance of [`GridViewBuilder`](crate::builders::GridViewBuilder) which can be used to create [`GridView`] objects.
652    pub fn builder() -> GridViewBuilder {
653        GridViewBuilder::new()
654    }
655
656    /// Returns whether rows can be selected by dragging with the mouse.
657    ///
658    /// # Returns
659    ///
660    /// [`true`] if rubberband selection is enabled
661    #[doc(alias = "gtk_grid_view_get_enable_rubberband")]
662    #[doc(alias = "get_enable_rubberband")]
663    #[doc(alias = "enable-rubberband")]
664    pub fn enables_rubberband(&self) -> bool {
665        unsafe {
666            from_glib(ffi::gtk_grid_view_get_enable_rubberband(
667                self.to_glib_none().0,
668            ))
669        }
670    }
671
672    /// Gets the factory that's currently used to populate list items.
673    ///
674    /// # Returns
675    ///
676    /// The factory in use
677    #[doc(alias = "gtk_grid_view_get_factory")]
678    #[doc(alias = "get_factory")]
679    pub fn factory(&self) -> Option<ListItemFactory> {
680        unsafe { from_glib_none(ffi::gtk_grid_view_get_factory(self.to_glib_none().0)) }
681    }
682
683    /// Gets the maximum number of columns that the grid will use.
684    ///
685    /// # Returns
686    ///
687    /// The maximum number of columns
688    #[doc(alias = "gtk_grid_view_get_max_columns")]
689    #[doc(alias = "get_max_columns")]
690    #[doc(alias = "max-columns")]
691    pub fn max_columns(&self) -> u32 {
692        unsafe { ffi::gtk_grid_view_get_max_columns(self.to_glib_none().0) }
693    }
694
695    /// Gets the minimum number of columns that the grid will use.
696    ///
697    /// # Returns
698    ///
699    /// The minimum number of columns
700    #[doc(alias = "gtk_grid_view_get_min_columns")]
701    #[doc(alias = "get_min_columns")]
702    #[doc(alias = "min-columns")]
703    pub fn min_columns(&self) -> u32 {
704        unsafe { ffi::gtk_grid_view_get_min_columns(self.to_glib_none().0) }
705    }
706
707    /// Gets the model that's currently used to read the items displayed.
708    ///
709    /// # Returns
710    ///
711    /// The model in use
712    #[doc(alias = "gtk_grid_view_get_model")]
713    #[doc(alias = "get_model")]
714    pub fn model(&self) -> Option<SelectionModel> {
715        unsafe { from_glib_none(ffi::gtk_grid_view_get_model(self.to_glib_none().0)) }
716    }
717
718    /// Returns whether items will be activated on single click and
719    /// selected on hover.
720    ///
721    /// # Returns
722    ///
723    /// [`true`] if items are activated on single click
724    #[doc(alias = "gtk_grid_view_get_single_click_activate")]
725    #[doc(alias = "get_single_click_activate")]
726    #[doc(alias = "single-click-activate")]
727    pub fn is_single_click_activate(&self) -> bool {
728        unsafe {
729            from_glib(ffi::gtk_grid_view_get_single_click_activate(
730                self.to_glib_none().0,
731            ))
732        }
733    }
734
735    /// Gets the behavior set for the <kbd>Tab</kbd> key.
736    ///
737    /// # Returns
738    ///
739    /// The behavior of the <kbd>Tab</kbd> key
740    #[cfg(feature = "v4_12")]
741    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
742    #[doc(alias = "gtk_grid_view_get_tab_behavior")]
743    #[doc(alias = "get_tab_behavior")]
744    #[doc(alias = "tab-behavior")]
745    pub fn tab_behavior(&self) -> ListTabBehavior {
746        unsafe { from_glib(ffi::gtk_grid_view_get_tab_behavior(self.to_glib_none().0)) }
747    }
748
749    /// Scrolls to the item at the given position and performs the actions
750    /// specified in @flags.
751    ///
752    /// This function works no matter if the gridview is shown or focused.
753    /// If it isn't, then the changes will take effect once that happens.
754    /// ## `pos`
755    /// position of the item. Must be less than the number of
756    ///   items in the view.
757    /// ## `flags`
758    /// actions to perform
759    /// ## `scroll`
760    /// details of how to perform
761    ///   the scroll operation or [`None`] to scroll into view
762    #[cfg(feature = "v4_12")]
763    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
764    #[doc(alias = "gtk_grid_view_scroll_to")]
765    pub fn scroll_to(&self, pos: u32, flags: ListScrollFlags, scroll: Option<ScrollInfo>) {
766        unsafe {
767            ffi::gtk_grid_view_scroll_to(
768                self.to_glib_none().0,
769                pos,
770                flags.into_glib(),
771                scroll.into_glib_ptr(),
772            );
773        }
774    }
775
776    /// Sets whether selections can be changed by dragging with the mouse.
777    /// ## `enable_rubberband`
778    /// [`true`] to enable rubberband selection
779    #[doc(alias = "gtk_grid_view_set_enable_rubberband")]
780    #[doc(alias = "enable-rubberband")]
781    pub fn set_enable_rubberband(&self, enable_rubberband: bool) {
782        unsafe {
783            ffi::gtk_grid_view_set_enable_rubberband(
784                self.to_glib_none().0,
785                enable_rubberband.into_glib(),
786            );
787        }
788    }
789
790    /// Sets the [`ListItemFactory`][crate::ListItemFactory] to use for populating list items.
791    /// ## `factory`
792    /// the factory to use
793    #[doc(alias = "gtk_grid_view_set_factory")]
794    #[doc(alias = "factory")]
795    pub fn set_factory(&self, factory: Option<&impl IsA<ListItemFactory>>) {
796        unsafe {
797            ffi::gtk_grid_view_set_factory(
798                self.to_glib_none().0,
799                factory.map(|p| p.as_ref()).to_glib_none().0,
800            );
801        }
802    }
803
804    /// Sets the maximum number of columns to use.
805    ///
806    /// This number must be at least 1.
807    ///
808    /// If @max_columns is smaller than the minimum set via
809    /// [`set_min_columns()`][Self::set_min_columns()], that value is used instead.
810    /// ## `max_columns`
811    /// The maximum number of columns
812    #[doc(alias = "gtk_grid_view_set_max_columns")]
813    #[doc(alias = "max-columns")]
814    pub fn set_max_columns(&self, max_columns: u32) {
815        unsafe {
816            ffi::gtk_grid_view_set_max_columns(self.to_glib_none().0, max_columns);
817        }
818    }
819
820    /// Sets the minimum number of columns to use.
821    ///
822    /// This number must be at least 1.
823    ///
824    /// If @min_columns is smaller than the minimum set via
825    /// [`set_max_columns()`][Self::set_max_columns()], that value is ignored.
826    /// ## `min_columns`
827    /// The minimum number of columns
828    #[doc(alias = "gtk_grid_view_set_min_columns")]
829    #[doc(alias = "min-columns")]
830    pub fn set_min_columns(&self, min_columns: u32) {
831        unsafe {
832            ffi::gtk_grid_view_set_min_columns(self.to_glib_none().0, min_columns);
833        }
834    }
835
836    /// Sets the model to use.
837    ///
838    /// This must be a [`SelectionModel`][crate::SelectionModel].
839    /// ## `model`
840    /// the model to use
841    #[doc(alias = "gtk_grid_view_set_model")]
842    #[doc(alias = "model")]
843    pub fn set_model(&self, model: Option<&impl IsA<SelectionModel>>) {
844        unsafe {
845            ffi::gtk_grid_view_set_model(
846                self.to_glib_none().0,
847                model.map(|p| p.as_ref()).to_glib_none().0,
848            );
849        }
850    }
851
852    /// Sets whether items should be activated on single click and
853    /// selected on hover.
854    /// ## `single_click_activate`
855    /// [`true`] to activate items on single click
856    #[doc(alias = "gtk_grid_view_set_single_click_activate")]
857    #[doc(alias = "single-click-activate")]
858    pub fn set_single_click_activate(&self, single_click_activate: bool) {
859        unsafe {
860            ffi::gtk_grid_view_set_single_click_activate(
861                self.to_glib_none().0,
862                single_click_activate.into_glib(),
863            );
864        }
865    }
866
867    /// Sets the behavior of the <kbd>Tab</kbd> and <kbd>Shift</kbd>+<kbd>Tab</kbd> keys.
868    /// ## `tab_behavior`
869    /// The desired tab behavior
870    #[cfg(feature = "v4_12")]
871    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
872    #[doc(alias = "gtk_grid_view_set_tab_behavior")]
873    #[doc(alias = "tab-behavior")]
874    pub fn set_tab_behavior(&self, tab_behavior: ListTabBehavior) {
875        unsafe {
876            ffi::gtk_grid_view_set_tab_behavior(self.to_glib_none().0, tab_behavior.into_glib());
877        }
878    }
879
880    /// Emitted when a cell has been activated by the user,
881    /// usually via activating the GtkGridView|list.activate-item action.
882    ///
883    /// This allows for a convenient way to handle activation in a gridview.
884    /// See [`activatable`][struct@crate::ListItem#activatable] for details on how to use
885    /// this signal.
886    /// ## `position`
887    /// position of item to activate
888    #[doc(alias = "activate")]
889    pub fn connect_activate<F: Fn(&Self, u32) + 'static>(&self, f: F) -> SignalHandlerId {
890        unsafe extern "C" fn activate_trampoline<F: Fn(&GridView, u32) + 'static>(
891            this: *mut ffi::GtkGridView,
892            position: std::ffi::c_uint,
893            f: glib::ffi::gpointer,
894        ) {
895            unsafe {
896                let f: &F = &*(f as *const F);
897                f(&from_glib_borrow(this), position)
898            }
899        }
900        unsafe {
901            let f: Box_<F> = Box_::new(f);
902            connect_raw(
903                self.as_ptr() as *mut _,
904                c"activate".as_ptr() as *const _,
905                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
906                    activate_trampoline::<F> as *const (),
907                )),
908                Box_::into_raw(f),
909            )
910        }
911    }
912
913    #[doc(alias = "enable-rubberband")]
914    pub fn connect_enable_rubberband_notify<F: Fn(&Self) + 'static>(
915        &self,
916        f: F,
917    ) -> SignalHandlerId {
918        unsafe extern "C" fn notify_enable_rubberband_trampoline<F: Fn(&GridView) + 'static>(
919            this: *mut ffi::GtkGridView,
920            _param_spec: glib::ffi::gpointer,
921            f: glib::ffi::gpointer,
922        ) {
923            unsafe {
924                let f: &F = &*(f as *const F);
925                f(&from_glib_borrow(this))
926            }
927        }
928        unsafe {
929            let f: Box_<F> = Box_::new(f);
930            connect_raw(
931                self.as_ptr() as *mut _,
932                c"notify::enable-rubberband".as_ptr() as *const _,
933                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
934                    notify_enable_rubberband_trampoline::<F> as *const (),
935                )),
936                Box_::into_raw(f),
937            )
938        }
939    }
940
941    #[doc(alias = "factory")]
942    pub fn connect_factory_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
943        unsafe extern "C" fn notify_factory_trampoline<F: Fn(&GridView) + 'static>(
944            this: *mut ffi::GtkGridView,
945            _param_spec: glib::ffi::gpointer,
946            f: glib::ffi::gpointer,
947        ) {
948            unsafe {
949                let f: &F = &*(f as *const F);
950                f(&from_glib_borrow(this))
951            }
952        }
953        unsafe {
954            let f: Box_<F> = Box_::new(f);
955            connect_raw(
956                self.as_ptr() as *mut _,
957                c"notify::factory".as_ptr() as *const _,
958                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
959                    notify_factory_trampoline::<F> as *const (),
960                )),
961                Box_::into_raw(f),
962            )
963        }
964    }
965
966    #[doc(alias = "max-columns")]
967    pub fn connect_max_columns_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
968        unsafe extern "C" fn notify_max_columns_trampoline<F: Fn(&GridView) + 'static>(
969            this: *mut ffi::GtkGridView,
970            _param_spec: glib::ffi::gpointer,
971            f: glib::ffi::gpointer,
972        ) {
973            unsafe {
974                let f: &F = &*(f as *const F);
975                f(&from_glib_borrow(this))
976            }
977        }
978        unsafe {
979            let f: Box_<F> = Box_::new(f);
980            connect_raw(
981                self.as_ptr() as *mut _,
982                c"notify::max-columns".as_ptr() as *const _,
983                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
984                    notify_max_columns_trampoline::<F> as *const (),
985                )),
986                Box_::into_raw(f),
987            )
988        }
989    }
990
991    #[doc(alias = "min-columns")]
992    pub fn connect_min_columns_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
993        unsafe extern "C" fn notify_min_columns_trampoline<F: Fn(&GridView) + 'static>(
994            this: *mut ffi::GtkGridView,
995            _param_spec: glib::ffi::gpointer,
996            f: glib::ffi::gpointer,
997        ) {
998            unsafe {
999                let f: &F = &*(f as *const F);
1000                f(&from_glib_borrow(this))
1001            }
1002        }
1003        unsafe {
1004            let f: Box_<F> = Box_::new(f);
1005            connect_raw(
1006                self.as_ptr() as *mut _,
1007                c"notify::min-columns".as_ptr() as *const _,
1008                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1009                    notify_min_columns_trampoline::<F> as *const (),
1010                )),
1011                Box_::into_raw(f),
1012            )
1013        }
1014    }
1015
1016    #[doc(alias = "model")]
1017    pub fn connect_model_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1018        unsafe extern "C" fn notify_model_trampoline<F: Fn(&GridView) + 'static>(
1019            this: *mut ffi::GtkGridView,
1020            _param_spec: glib::ffi::gpointer,
1021            f: glib::ffi::gpointer,
1022        ) {
1023            unsafe {
1024                let f: &F = &*(f as *const F);
1025                f(&from_glib_borrow(this))
1026            }
1027        }
1028        unsafe {
1029            let f: Box_<F> = Box_::new(f);
1030            connect_raw(
1031                self.as_ptr() as *mut _,
1032                c"notify::model".as_ptr() as *const _,
1033                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1034                    notify_model_trampoline::<F> as *const (),
1035                )),
1036                Box_::into_raw(f),
1037            )
1038        }
1039    }
1040
1041    #[doc(alias = "single-click-activate")]
1042    pub fn connect_single_click_activate_notify<F: Fn(&Self) + 'static>(
1043        &self,
1044        f: F,
1045    ) -> SignalHandlerId {
1046        unsafe extern "C" fn notify_single_click_activate_trampoline<F: Fn(&GridView) + 'static>(
1047            this: *mut ffi::GtkGridView,
1048            _param_spec: glib::ffi::gpointer,
1049            f: glib::ffi::gpointer,
1050        ) {
1051            unsafe {
1052                let f: &F = &*(f as *const F);
1053                f(&from_glib_borrow(this))
1054            }
1055        }
1056        unsafe {
1057            let f: Box_<F> = Box_::new(f);
1058            connect_raw(
1059                self.as_ptr() as *mut _,
1060                c"notify::single-click-activate".as_ptr() as *const _,
1061                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1062                    notify_single_click_activate_trampoline::<F> as *const (),
1063                )),
1064                Box_::into_raw(f),
1065            )
1066        }
1067    }
1068
1069    #[cfg(feature = "v4_12")]
1070    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
1071    #[doc(alias = "tab-behavior")]
1072    pub fn connect_tab_behavior_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1073        unsafe extern "C" fn notify_tab_behavior_trampoline<F: Fn(&GridView) + 'static>(
1074            this: *mut ffi::GtkGridView,
1075            _param_spec: glib::ffi::gpointer,
1076            f: glib::ffi::gpointer,
1077        ) {
1078            unsafe {
1079                let f: &F = &*(f as *const F);
1080                f(&from_glib_borrow(this))
1081            }
1082        }
1083        unsafe {
1084            let f: Box_<F> = Box_::new(f);
1085            connect_raw(
1086                self.as_ptr() as *mut _,
1087                c"notify::tab-behavior".as_ptr() as *const _,
1088                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1089                    notify_tab_behavior_trampoline::<F> as *const (),
1090                )),
1091                Box_::into_raw(f),
1092            )
1093        }
1094    }
1095}
1096
1097impl Default for GridView {
1098    fn default() -> Self {
1099        glib::object::Object::new::<Self>()
1100    }
1101}
1102
1103// rustdoc-stripper-ignore-next
1104/// A [builder-pattern] type to construct [`GridView`] objects.
1105///
1106/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1107#[must_use = "The builder must be built to be used"]
1108pub struct GridViewBuilder {
1109    builder: glib::object::ObjectBuilder<'static, GridView>,
1110}
1111
1112impl GridViewBuilder {
1113    fn new() -> Self {
1114        Self {
1115            builder: glib::object::Object::builder(),
1116        }
1117    }
1118
1119    /// Allow rubberband selection.
1120    pub fn enable_rubberband(self, enable_rubberband: bool) -> Self {
1121        Self {
1122            builder: self
1123                .builder
1124                .property("enable-rubberband", enable_rubberband),
1125        }
1126    }
1127
1128    /// Factory for populating list items.
1129    ///
1130    /// The factory must be for configuring [`ListItem`][crate::ListItem] objects.
1131    pub fn factory(self, factory: &impl IsA<ListItemFactory>) -> Self {
1132        Self {
1133            builder: self.builder.property("factory", factory.clone().upcast()),
1134        }
1135    }
1136
1137    /// Maximum number of columns per row.
1138    ///
1139    /// If this number is smaller than [`min-columns`][struct@crate::GridView#min-columns],
1140    /// that value is used instead.
1141    pub fn max_columns(self, max_columns: u32) -> Self {
1142        Self {
1143            builder: self.builder.property("max-columns", max_columns),
1144        }
1145    }
1146
1147    /// Minimum number of columns per row.
1148    pub fn min_columns(self, min_columns: u32) -> Self {
1149        Self {
1150            builder: self.builder.property("min-columns", min_columns),
1151        }
1152    }
1153
1154    /// Model for the items displayed.
1155    pub fn model(self, model: &impl IsA<SelectionModel>) -> Self {
1156        Self {
1157            builder: self.builder.property("model", model.clone().upcast()),
1158        }
1159    }
1160
1161    /// Activate rows on single click and select them on hover.
1162    pub fn single_click_activate(self, single_click_activate: bool) -> Self {
1163        Self {
1164            builder: self
1165                .builder
1166                .property("single-click-activate", single_click_activate),
1167        }
1168    }
1169
1170    /// Behavior of the <kbd>Tab</kbd> key
1171    #[cfg(feature = "v4_12")]
1172    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
1173    pub fn tab_behavior(self, tab_behavior: ListTabBehavior) -> Self {
1174        Self {
1175            builder: self.builder.property("tab-behavior", tab_behavior),
1176        }
1177    }
1178
1179    /// The orientation of the list. See GtkOrientable:orientation
1180    /// for details.
1181    pub fn orientation(self, orientation: Orientation) -> Self {
1182        Self {
1183            builder: self.builder.property("orientation", orientation),
1184        }
1185    }
1186
1187    /// Whether the widget or any of its descendents can accept
1188    /// the input focus.
1189    ///
1190    /// This property is meant to be set by widget implementations,
1191    /// typically in their instance init function.
1192    pub fn can_focus(self, can_focus: bool) -> Self {
1193        Self {
1194            builder: self.builder.property("can-focus", can_focus),
1195        }
1196    }
1197
1198    /// Whether the widget can receive pointer events.
1199    pub fn can_target(self, can_target: bool) -> Self {
1200        Self {
1201            builder: self.builder.property("can-target", can_target),
1202        }
1203    }
1204
1205    /// A list of css classes applied to this widget.
1206    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1207        Self {
1208            builder: self.builder.property("css-classes", css_classes.into()),
1209        }
1210    }
1211
1212    /// The name of this widget in the CSS tree.
1213    ///
1214    /// This property is meant to be set by widget implementations,
1215    /// typically in their instance init function.
1216    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1217        Self {
1218            builder: self.builder.property("css-name", css_name.into()),
1219        }
1220    }
1221
1222    /// The cursor used by @widget.
1223    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1224        Self {
1225            builder: self.builder.property("cursor", cursor.clone()),
1226        }
1227    }
1228
1229    /// Whether the widget should grab focus when it is clicked with the mouse.
1230    ///
1231    /// This property is only relevant for widgets that can take focus.
1232    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1233        Self {
1234            builder: self.builder.property("focus-on-click", focus_on_click),
1235        }
1236    }
1237
1238    /// Whether this widget itself will accept the input focus.
1239    pub fn focusable(self, focusable: bool) -> Self {
1240        Self {
1241            builder: self.builder.property("focusable", focusable),
1242        }
1243    }
1244
1245    /// How to distribute horizontal space if widget gets extra space.
1246    pub fn halign(self, halign: Align) -> Self {
1247        Self {
1248            builder: self.builder.property("halign", halign),
1249        }
1250    }
1251
1252    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1253    /// signal on @widget.
1254    ///
1255    /// A true value indicates that @widget can have a tooltip, in this case
1256    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1257    /// determine whether it will provide a tooltip or not.
1258    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1259        Self {
1260            builder: self.builder.property("has-tooltip", has_tooltip),
1261        }
1262    }
1263
1264    /// Overrides for height request of the widget.
1265    ///
1266    /// If this is -1, the natural request will be used.
1267    pub fn height_request(self, height_request: i32) -> Self {
1268        Self {
1269            builder: self.builder.property("height-request", height_request),
1270        }
1271    }
1272
1273    /// Whether to expand horizontally.
1274    pub fn hexpand(self, hexpand: bool) -> Self {
1275        Self {
1276            builder: self.builder.property("hexpand", hexpand),
1277        }
1278    }
1279
1280    /// Whether to use the `hexpand` property.
1281    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1282        Self {
1283            builder: self.builder.property("hexpand-set", hexpand_set),
1284        }
1285    }
1286
1287    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1288    /// the preferred size of the widget, and allocate its children.
1289    ///
1290    /// This property is meant to be set by widget implementations,
1291    /// typically in their instance init function.
1292    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1293        Self {
1294            builder: self
1295                .builder
1296                .property("layout-manager", layout_manager.clone().upcast()),
1297        }
1298    }
1299
1300    /// Makes this widget act like a modal dialog, with respect to
1301    /// event delivery.
1302    ///
1303    /// Global event controllers will not handle events with targets
1304    /// inside the widget, unless they are set up to ignore propagation
1305    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1306    #[cfg(feature = "v4_18")]
1307    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1308    pub fn limit_events(self, limit_events: bool) -> Self {
1309        Self {
1310            builder: self.builder.property("limit-events", limit_events),
1311        }
1312    }
1313
1314    /// Margin on bottom side of widget.
1315    ///
1316    /// This property adds margin outside of the widget's normal size
1317    /// request, the margin will be added in addition to the size from
1318    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1319    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1320        Self {
1321            builder: self.builder.property("margin-bottom", margin_bottom),
1322        }
1323    }
1324
1325    /// Margin on end of widget, horizontally.
1326    ///
1327    /// This property supports left-to-right and right-to-left text
1328    /// directions.
1329    ///
1330    /// This property adds margin outside of the widget's normal size
1331    /// request, the margin will be added in addition to the size from
1332    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1333    pub fn margin_end(self, margin_end: i32) -> Self {
1334        Self {
1335            builder: self.builder.property("margin-end", margin_end),
1336        }
1337    }
1338
1339    /// Margin on start of widget, horizontally.
1340    ///
1341    /// This property supports left-to-right and right-to-left text
1342    /// directions.
1343    ///
1344    /// This property adds margin outside of the widget's normal size
1345    /// request, the margin will be added in addition to the size from
1346    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1347    pub fn margin_start(self, margin_start: i32) -> Self {
1348        Self {
1349            builder: self.builder.property("margin-start", margin_start),
1350        }
1351    }
1352
1353    /// Margin on top side of widget.
1354    ///
1355    /// This property adds margin outside of the widget's normal size
1356    /// request, the margin will be added in addition to the size from
1357    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1358    pub fn margin_top(self, margin_top: i32) -> Self {
1359        Self {
1360            builder: self.builder.property("margin-top", margin_top),
1361        }
1362    }
1363
1364    /// The name of the widget.
1365    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1366        Self {
1367            builder: self.builder.property("name", name.into()),
1368        }
1369    }
1370
1371    /// The requested opacity of the widget.
1372    pub fn opacity(self, opacity: f64) -> Self {
1373        Self {
1374            builder: self.builder.property("opacity", opacity),
1375        }
1376    }
1377
1378    /// How content outside the widget's content area is treated.
1379    ///
1380    /// This property is meant to be set by widget implementations,
1381    /// typically in their instance init function.
1382    pub fn overflow(self, overflow: Overflow) -> Self {
1383        Self {
1384            builder: self.builder.property("overflow", overflow),
1385        }
1386    }
1387
1388    /// Whether the widget will receive the default action when it is focused.
1389    pub fn receives_default(self, receives_default: bool) -> Self {
1390        Self {
1391            builder: self.builder.property("receives-default", receives_default),
1392        }
1393    }
1394
1395    /// Whether the widget responds to input.
1396    pub fn sensitive(self, sensitive: bool) -> Self {
1397        Self {
1398            builder: self.builder.property("sensitive", sensitive),
1399        }
1400    }
1401
1402    /// Sets the text of tooltip to be the given string, which is marked up
1403    /// with Pango markup.
1404    ///
1405    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1406    ///
1407    /// This is a convenience property which will take care of getting the
1408    /// tooltip shown if the given string is not `NULL`:
1409    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1410    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1411    /// the default signal handler.
1412    ///
1413    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1414    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1415    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1416        Self {
1417            builder: self
1418                .builder
1419                .property("tooltip-markup", tooltip_markup.into()),
1420        }
1421    }
1422
1423    /// Sets the text of tooltip to be the given string.
1424    ///
1425    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1426    ///
1427    /// This is a convenience property which will take care of getting the
1428    /// tooltip shown if the given string is not `NULL`:
1429    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1430    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1431    /// the default signal handler.
1432    ///
1433    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1434    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1435    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1436        Self {
1437            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1438        }
1439    }
1440
1441    /// How to distribute vertical space if widget gets extra space.
1442    pub fn valign(self, valign: Align) -> Self {
1443        Self {
1444            builder: self.builder.property("valign", valign),
1445        }
1446    }
1447
1448    /// Whether to expand vertically.
1449    pub fn vexpand(self, vexpand: bool) -> Self {
1450        Self {
1451            builder: self.builder.property("vexpand", vexpand),
1452        }
1453    }
1454
1455    /// Whether to use the `vexpand` property.
1456    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1457        Self {
1458            builder: self.builder.property("vexpand-set", vexpand_set),
1459        }
1460    }
1461
1462    /// Whether the widget is visible.
1463    pub fn visible(self, visible: bool) -> Self {
1464        Self {
1465            builder: self.builder.property("visible", visible),
1466        }
1467    }
1468
1469    /// Overrides for width request of the widget.
1470    ///
1471    /// If this is -1, the natural request will be used.
1472    pub fn width_request(self, width_request: i32) -> Self {
1473        Self {
1474            builder: self.builder.property("width-request", width_request),
1475        }
1476    }
1477
1478    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1479    ///
1480    /// The accessible role cannot be changed once set.
1481    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1482        Self {
1483            builder: self.builder.property("accessible-role", accessible_role),
1484        }
1485    }
1486
1487    /// Horizontal [`Adjustment`][crate::Adjustment] of the scrollable widget.
1488    ///
1489    /// This adjustment is shared between the scrollable widget and its parent.
1490    pub fn hadjustment(self, hadjustment: &impl IsA<Adjustment>) -> Self {
1491        Self {
1492            builder: self
1493                .builder
1494                .property("hadjustment", hadjustment.clone().upcast()),
1495        }
1496    }
1497
1498    /// Determines when horizontal scrolling should start.
1499    pub fn hscroll_policy(self, hscroll_policy: ScrollablePolicy) -> Self {
1500        Self {
1501            builder: self.builder.property("hscroll-policy", hscroll_policy),
1502        }
1503    }
1504
1505    /// Vertical [`Adjustment`][crate::Adjustment] of the scrollable widget.
1506    ///
1507    /// This adjustment is shared between the scrollable widget and its parent.
1508    pub fn vadjustment(self, vadjustment: &impl IsA<Adjustment>) -> Self {
1509        Self {
1510            builder: self
1511                .builder
1512                .property("vadjustment", vadjustment.clone().upcast()),
1513        }
1514    }
1515
1516    /// Determines when vertical scrolling should start.
1517    pub fn vscroll_policy(self, vscroll_policy: ScrollablePolicy) -> Self {
1518        Self {
1519            builder: self.builder.property("vscroll-policy", vscroll_policy),
1520        }
1521    }
1522
1523    // rustdoc-stripper-ignore-next
1524    /// Build the [`GridView`].
1525    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1526    pub fn build(self) -> GridView {
1527        assert_initialized_main_thread!();
1528        self.builder.build()
1529    }
1530}