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