Skip to main content

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