gtk4/auto/
list_box.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_18")]
6#[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
7use crate::ListTabBehavior;
8use crate::{
9    ffi, Accessible, AccessibleRole, Adjustment, Align, Buildable, ConstraintTarget, LayoutManager,
10    ListBoxRow, MovementStep, Overflow, SelectionMode, Widget,
11};
12use glib::{
13    object::ObjectType as _,
14    prelude::*,
15    signal::{connect_raw, SignalHandlerId},
16    translate::*,
17};
18use std::boxed::Box as Box_;
19
20glib::wrapper! {
21    /// [`ListBox`][crate::ListBox] is a vertical list.
22    ///
23    /// A [`ListBox`][crate::ListBox] only contains [`ListBoxRow`][crate::ListBoxRow] children. These rows can
24    /// by dynamically sorted and filtered, and headers can be added dynamically
25    /// depending on the row content. It also allows keyboard and mouse navigation
26    /// and selection like a typical list.
27    ///
28    /// Using [`ListBox`][crate::ListBox] is often an alternative to [`TreeView`][crate::TreeView], especially
29    /// when the list contents has a more complicated layout than what is allowed
30    /// by a [`CellRenderer`][crate::CellRenderer], or when the contents is interactive (i.e. has a
31    /// button in it).
32    ///
33    /// Although a [`ListBox`][crate::ListBox] must have only [`ListBoxRow`][crate::ListBoxRow] children, you can
34    /// add any kind of widget to it via [`prepend()`][Self::prepend()],
35    /// [`append()`][Self::append()] and [`insert()`][Self::insert()] and a
36    /// [`ListBoxRow`][crate::ListBoxRow] widget will automatically be inserted between the list
37    /// and the widget.
38    ///
39    /// `GtkListBoxRows` can be marked as activatable or selectable. If a row is
40    /// activatable, [`row-activated`][struct@crate::ListBox#row-activated] will be emitted for it when
41    /// the user tries to activate it. If it is selectable, the row will be marked
42    /// as selected when the user tries to select it.
43    ///
44    /// # GtkListBox as GtkBuildable
45    ///
46    /// The [`ListBox`][crate::ListBox] implementation of the [`Buildable`][crate::Buildable] interface supports
47    /// setting a child as the placeholder by specifying “placeholder” as the “type”
48    /// attribute of a `<child>` element. See [`set_placeholder()`][Self::set_placeholder()]
49    /// for info.
50    ///
51    /// # Shortcuts and Gestures
52    ///
53    /// The following signals have default keybindings:
54    ///
55    /// - [`move-cursor`][struct@crate::ListBox#move-cursor]
56    /// - [`select-all`][struct@crate::ListBox#select-all]
57    /// - [`toggle-cursor-row`][struct@crate::ListBox#toggle-cursor-row]
58    /// - [`unselect-all`][struct@crate::ListBox#unselect-all]
59    ///
60    /// # CSS nodes
61    ///
62    ///
63    ///
64    /// **⚠️ The following code is in plain ⚠️**
65    ///
66    /// ```plain
67    /// list[.separators][.rich-list][.navigation-sidebar][.boxed-list]
68    /// ╰── row[.activatable]
69    /// ```
70    ///
71    /// [`ListBox`][crate::ListBox] uses a single CSS node named list. It may carry the .separators
72    /// style class, when the [`show-separators`][struct@crate::ListBox#show-separators] property is set.
73    /// Each [`ListBoxRow`][crate::ListBoxRow] uses a single CSS node named row. The row nodes get the
74    /// .activatable style class added when appropriate.
75    ///
76    /// It may also carry the .boxed-list style class. In this case, the list will be
77    /// automatically surrounded by a frame and have separators.
78    ///
79    /// The main list node may also carry style classes to select
80    /// the style of [list presentation](section-list-widget.html#list-styles):
81    /// .rich-list, .navigation-sidebar or .data-table.
82    ///
83    /// # Accessibility
84    ///
85    /// [`ListBox`][crate::ListBox] uses the [`AccessibleRole::List`][crate::AccessibleRole::List] role and [`ListBoxRow`][crate::ListBoxRow] uses
86    /// the [`AccessibleRole::ListItem`][crate::AccessibleRole::ListItem] role.
87    ///
88    /// ## Properties
89    ///
90    ///
91    /// #### `accept-unpaired-release`
92    ///  Whether to accept unpaired release events.
93    ///
94    /// Readable | Writeable
95    ///
96    ///
97    /// #### `activate-on-single-click`
98    ///  Determines whether children can be activated with a single
99    /// click, or require a double-click.
100    ///
101    /// Readable | Writeable
102    ///
103    ///
104    /// #### `selection-mode`
105    ///  The selection mode used by the list box.
106    ///
107    /// Readable | Writeable
108    ///
109    ///
110    /// #### `show-separators`
111    ///  Whether to show separators between rows.
112    ///
113    /// Readable | Writeable
114    ///
115    ///
116    /// #### `tab-behavior`
117    ///  Behavior of the <kbd>Tab</kbd> key
118    ///
119    /// Readable | Writeable
120    /// <details><summary><h4>Widget</h4></summary>
121    ///
122    ///
123    /// #### `can-focus`
124    ///  Whether the widget or any of its descendents can accept
125    /// the input focus.
126    ///
127    /// This property is meant to be set by widget implementations,
128    /// typically in their instance init function.
129    ///
130    /// Readable | Writeable
131    ///
132    ///
133    /// #### `can-target`
134    ///  Whether the widget can receive pointer events.
135    ///
136    /// Readable | Writeable
137    ///
138    ///
139    /// #### `css-classes`
140    ///  A list of css classes applied to this widget.
141    ///
142    /// Readable | Writeable
143    ///
144    ///
145    /// #### `css-name`
146    ///  The name of this widget in the CSS tree.
147    ///
148    /// This property is meant to be set by widget implementations,
149    /// typically in their instance init function.
150    ///
151    /// Readable | Writeable | Construct Only
152    ///
153    ///
154    /// #### `cursor`
155    ///  The cursor used by @widget.
156    ///
157    /// Readable | Writeable
158    ///
159    ///
160    /// #### `focus-on-click`
161    ///  Whether the widget should grab focus when it is clicked with the mouse.
162    ///
163    /// This property is only relevant for widgets that can take focus.
164    ///
165    /// Readable | Writeable
166    ///
167    ///
168    /// #### `focusable`
169    ///  Whether this widget itself will accept the input focus.
170    ///
171    /// Readable | Writeable
172    ///
173    ///
174    /// #### `halign`
175    ///  How to distribute horizontal space if widget gets extra space.
176    ///
177    /// Readable | Writeable
178    ///
179    ///
180    /// #### `has-default`
181    ///  Whether the widget is the default widget.
182    ///
183    /// Readable
184    ///
185    ///
186    /// #### `has-focus`
187    ///  Whether the widget has the input focus.
188    ///
189    /// Readable
190    ///
191    ///
192    /// #### `has-tooltip`
193    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
194    /// signal on @widget.
195    ///
196    /// A true value indicates that @widget can have a tooltip, in this case
197    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
198    /// determine whether it will provide a tooltip or not.
199    ///
200    /// Readable | Writeable
201    ///
202    ///
203    /// #### `height-request`
204    ///  Overrides for height request of the widget.
205    ///
206    /// If this is -1, the natural request will be used.
207    ///
208    /// Readable | Writeable
209    ///
210    ///
211    /// #### `hexpand`
212    ///  Whether to expand horizontally.
213    ///
214    /// Readable | Writeable
215    ///
216    ///
217    /// #### `hexpand-set`
218    ///  Whether to use the `hexpand` property.
219    ///
220    /// Readable | Writeable
221    ///
222    ///
223    /// #### `layout-manager`
224    ///  The [`LayoutManager`][crate::LayoutManager] instance to use to compute
225    /// the preferred size of the widget, and allocate its children.
226    ///
227    /// This property is meant to be set by widget implementations,
228    /// typically in their instance init function.
229    ///
230    /// Readable | Writeable
231    ///
232    ///
233    /// #### `limit-events`
234    ///  Makes this widget act like a modal dialog, with respect to
235    /// event delivery.
236    ///
237    /// Global event controllers will not handle events with targets
238    /// inside the widget, unless they are set up to ignore propagation
239    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
240    ///
241    /// Readable | Writeable
242    ///
243    ///
244    /// #### `margin-bottom`
245    ///  Margin on bottom side of widget.
246    ///
247    /// This property adds margin outside of the widget's normal size
248    /// request, the margin will be added in addition to the size from
249    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
250    ///
251    /// Readable | Writeable
252    ///
253    ///
254    /// #### `margin-end`
255    ///  Margin on end of widget, horizontally.
256    ///
257    /// This property supports left-to-right and right-to-left text
258    /// directions.
259    ///
260    /// This property adds margin outside of the widget's normal size
261    /// request, the margin will be added in addition to the size from
262    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
263    ///
264    /// Readable | Writeable
265    ///
266    ///
267    /// #### `margin-start`
268    ///  Margin on start of widget, horizontally.
269    ///
270    /// This property supports left-to-right and right-to-left text
271    /// directions.
272    ///
273    /// This property adds margin outside of the widget's normal size
274    /// request, the margin will be added in addition to the size from
275    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
276    ///
277    /// Readable | Writeable
278    ///
279    ///
280    /// #### `margin-top`
281    ///  Margin on top side of widget.
282    ///
283    /// This property adds margin outside of the widget's normal size
284    /// request, the margin will be added in addition to the size from
285    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
286    ///
287    /// Readable | Writeable
288    ///
289    ///
290    /// #### `name`
291    ///  The name of the widget.
292    ///
293    /// Readable | Writeable
294    ///
295    ///
296    /// #### `opacity`
297    ///  The requested opacity of the widget.
298    ///
299    /// Readable | Writeable
300    ///
301    ///
302    /// #### `overflow`
303    ///  How content outside the widget's content area is treated.
304    ///
305    /// This property is meant to be set by widget implementations,
306    /// typically in their instance init function.
307    ///
308    /// Readable | Writeable
309    ///
310    ///
311    /// #### `parent`
312    ///  The parent widget of this widget.
313    ///
314    /// Readable
315    ///
316    ///
317    /// #### `receives-default`
318    ///  Whether the widget will receive the default action when it is focused.
319    ///
320    /// Readable | Writeable
321    ///
322    ///
323    /// #### `root`
324    ///  The [`Root`][crate::Root] widget of the widget tree containing this widget.
325    ///
326    /// This will be `NULL` if the widget is not contained in a root widget.
327    ///
328    /// Readable
329    ///
330    ///
331    /// #### `scale-factor`
332    ///  The scale factor of the widget.
333    ///
334    /// Readable
335    ///
336    ///
337    /// #### `sensitive`
338    ///  Whether the widget responds to input.
339    ///
340    /// Readable | Writeable
341    ///
342    ///
343    /// #### `tooltip-markup`
344    ///  Sets the text of tooltip to be the given string, which is marked up
345    /// with Pango markup.
346    ///
347    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
348    ///
349    /// This is a convenience property which will take care of getting the
350    /// tooltip shown if the given string is not `NULL`:
351    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
352    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
353    /// the default signal handler.
354    ///
355    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
356    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
357    ///
358    /// Readable | Writeable
359    ///
360    ///
361    /// #### `tooltip-text`
362    ///  Sets the text of tooltip to be the given string.
363    ///
364    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
365    ///
366    /// This is a convenience property which will take care of getting the
367    /// tooltip shown if the given string is not `NULL`:
368    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
369    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
370    /// the default signal handler.
371    ///
372    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
373    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
374    ///
375    /// Readable | Writeable
376    ///
377    ///
378    /// #### `valign`
379    ///  How to distribute vertical space if widget gets extra space.
380    ///
381    /// Readable | Writeable
382    ///
383    ///
384    /// #### `vexpand`
385    ///  Whether to expand vertically.
386    ///
387    /// Readable | Writeable
388    ///
389    ///
390    /// #### `vexpand-set`
391    ///  Whether to use the `vexpand` property.
392    ///
393    /// Readable | Writeable
394    ///
395    ///
396    /// #### `visible`
397    ///  Whether the widget is visible.
398    ///
399    /// Readable | Writeable
400    ///
401    ///
402    /// #### `width-request`
403    ///  Overrides for width request of the widget.
404    ///
405    /// If this is -1, the natural request will be used.
406    ///
407    /// Readable | Writeable
408    /// </details>
409    /// <details><summary><h4>Accessible</h4></summary>
410    ///
411    ///
412    /// #### `accessible-role`
413    ///  The accessible role of the given [`Accessible`][crate::Accessible] implementation.
414    ///
415    /// The accessible role cannot be changed once set.
416    ///
417    /// Readable | Writeable
418    /// </details>
419    ///
420    /// ## Signals
421    ///
422    ///
423    /// #### `activate-cursor-row`
424    ///  Emitted when the cursor row is activated.
425    ///
426    /// Action
427    ///
428    ///
429    /// #### `move-cursor`
430    ///  Emitted when the user initiates a cursor movement.
431    ///
432    /// The default bindings for this signal come in two variants, the variant with
433    /// the Shift modifier extends the selection, the variant without the Shift
434    /// modifier does not. There are too many key combinations to list them all
435    /// here.
436    ///
437    /// - <kbd>←</kbd>, <kbd>→</kbd>, <kbd>↑</kbd>, <kbd>↓</kbd>
438    ///   move by individual children
439    /// - <kbd>Home</kbd>, <kbd>End</kbd> move to the ends of the box
440    /// - <kbd>PgUp</kbd>, <kbd>PgDn</kbd> move vertically by pages
441    ///
442    /// Action
443    ///
444    ///
445    /// #### `row-activated`
446    ///  Emitted when a row has been activated by the user.
447    ///
448    ///
449    ///
450    ///
451    /// #### `row-selected`
452    ///  Emitted when a new row is selected, or (with a [`None`] @row)
453    /// when the selection is cleared.
454    ///
455    /// When the @box_ is using [`SelectionMode::Multiple`][crate::SelectionMode::Multiple], this signal will not
456    /// give you the full picture of selection changes, and you should use
457    /// the [`selected-rows-changed`][struct@crate::ListBox#selected-rows-changed] signal instead.
458    ///
459    ///
460    ///
461    ///
462    /// #### `select-all`
463    ///  Emitted to select all children of the box, if the selection
464    /// mode permits it.
465    ///
466    /// This is a [keybinding signal](class.SignalAction.html).
467    ///
468    /// The default binding for this signal is <kbd>Ctrl</kbd>-<kbd>a</kbd>.
469    ///
470    /// Action
471    ///
472    ///
473    /// #### `selected-rows-changed`
474    ///  Emitted when the set of selected rows changes.
475    ///
476    ///
477    ///
478    ///
479    /// #### `toggle-cursor-row`
480    ///  Emitted when the cursor row is toggled.
481    ///
482    /// The default bindings for this signal is <kbd>Ctrl</kbd>+<kbd>␣</kbd>.
483    ///
484    /// Action
485    ///
486    ///
487    /// #### `unselect-all`
488    ///  Emitted to unselect all children of the box, if the selection
489    /// mode permits it.
490    ///
491    /// This is a [keybinding signal](class.SignalAction.html).
492    ///
493    /// The default binding for this signal is
494    /// <kbd>Ctrl</kbd>-<kbd>Shift</kbd>-<kbd>a</kbd>.
495    ///
496    /// Action
497    /// <details><summary><h4>Widget</h4></summary>
498    ///
499    ///
500    /// #### `destroy`
501    ///  Signals that all holders of a reference to the widget should release
502    /// the reference that they hold.
503    ///
504    /// May result in finalization of the widget if all references are released.
505    ///
506    /// This signal is not suitable for saving widget state.
507    ///
508    ///
509    ///
510    ///
511    /// #### `direction-changed`
512    ///  Emitted when the text direction of a widget changes.
513    ///
514    ///
515    ///
516    ///
517    /// #### `hide`
518    ///  Emitted when @widget is hidden.
519    ///
520    ///
521    ///
522    ///
523    /// #### `keynav-failed`
524    ///  Emitted if keyboard navigation fails.
525    ///
526    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
527    ///
528    ///
529    ///
530    ///
531    /// #### `map`
532    ///  Emitted when @widget is going to be mapped.
533    ///
534    /// A widget is mapped when the widget is visible (which is controlled with
535    /// [`visible`][struct@crate::Widget#visible]) and all its parents up to the toplevel widget
536    /// are also visible.
537    ///
538    /// The `::map` signal can be used to determine whether a widget will be drawn,
539    /// for instance it can resume an animation that was stopped during the
540    /// emission of [`unmap`][struct@crate::Widget#unmap].
541    ///
542    ///
543    ///
544    ///
545    /// #### `mnemonic-activate`
546    ///  Emitted when a widget is activated via a mnemonic.
547    ///
548    /// The default handler for this signal activates @widget if @group_cycling
549    /// is false, or just makes @widget grab focus if @group_cycling is true.
550    ///
551    ///
552    ///
553    ///
554    /// #### `move-focus`
555    ///  Emitted when the focus is moved.
556    ///
557    /// The `::move-focus` signal is a [keybinding signal](class.SignalAction.html).
558    ///
559    /// The default bindings for this signal are <kbd>Tab</kbd> to move forward,
560    /// and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move backward.
561    ///
562    /// Action
563    ///
564    ///
565    /// #### `query-tooltip`
566    ///  Emitted when the widget’s tooltip is about to be shown.
567    ///
568    /// This happens when the [`has-tooltip`][struct@crate::Widget#has-tooltip] property
569    /// is true and the hover timeout has expired with the cursor hovering
570    /// above @widget; or emitted when @widget got focus in keyboard mode.
571    ///
572    /// Using the given coordinates, the signal handler should determine
573    /// whether a tooltip should be shown for @widget. If this is the case
574    /// true should be returned, false otherwise. Note that if @keyboard_mode
575    /// is true, the values of @x and @y are undefined and should not be used.
576    ///
577    /// The signal handler is free to manipulate @tooltip with the therefore
578    /// destined function calls.
579    ///
580    ///
581    ///
582    ///
583    /// #### `realize`
584    ///  Emitted when @widget is associated with a [`gdk::Surface`][crate::gdk::Surface].
585    ///
586    /// This means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called
587    /// or the widget has been mapped (that is, it is going to be drawn).
588    ///
589    ///
590    ///
591    ///
592    /// #### `show`
593    ///  Emitted when @widget is shown.
594    ///
595    ///
596    ///
597    ///
598    /// #### `state-flags-changed`
599    ///  Emitted when the widget state changes.
600    ///
601    /// See [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
602    ///
603    ///
604    ///
605    ///
606    /// #### `unmap`
607    ///  Emitted when @widget is going to be unmapped.
608    ///
609    /// A widget is unmapped when either it or any of its parents up to the
610    /// toplevel widget have been set as hidden.
611    ///
612    /// As `::unmap` indicates that a widget will not be shown any longer,
613    /// it can be used to, for example, stop an animation on the widget.
614    ///
615    ///
616    ///
617    ///
618    /// #### `unrealize`
619    ///  Emitted when the [`gdk::Surface`][crate::gdk::Surface] associated with @widget is destroyed.
620    ///
621    /// This means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been called
622    /// or the widget has been unmapped (that is, it is going to be hidden).
623    ///
624    ///
625    /// </details>
626    ///
627    /// # Implements
628    ///
629    /// [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual]
630    #[doc(alias = "GtkListBox")]
631    pub struct ListBox(Object<ffi::GtkListBox>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget;
632
633    match fn {
634        type_ => || ffi::gtk_list_box_get_type(),
635    }
636}
637
638impl ListBox {
639    /// Creates a new [`ListBox`][crate::ListBox] container.
640    ///
641    /// # Returns
642    ///
643    /// a new [`ListBox`][crate::ListBox]
644    #[doc(alias = "gtk_list_box_new")]
645    pub fn new() -> ListBox {
646        assert_initialized_main_thread!();
647        unsafe { Widget::from_glib_none(ffi::gtk_list_box_new()).unsafe_cast() }
648    }
649
650    // rustdoc-stripper-ignore-next
651    /// Creates a new builder-pattern struct instance to construct [`ListBox`] objects.
652    ///
653    /// This method returns an instance of [`ListBoxBuilder`](crate::builders::ListBoxBuilder) which can be used to create [`ListBox`] objects.
654    pub fn builder() -> ListBoxBuilder {
655        ListBoxBuilder::new()
656    }
657
658    /// Append a widget to the list.
659    ///
660    /// If a sort function is set, the widget will
661    /// actually be inserted at the calculated position.
662    /// ## `child`
663    /// the [`Widget`][crate::Widget] to add
664    #[doc(alias = "gtk_list_box_append")]
665    pub fn append(&self, child: &impl IsA<Widget>) {
666        unsafe {
667            ffi::gtk_list_box_append(self.to_glib_none().0, child.as_ref().to_glib_none().0);
668        }
669    }
670
671    /// Binds @model to @self.
672    ///
673    /// If @self was already bound to a model, that previous binding is
674    /// destroyed.
675    ///
676    /// The contents of @self are cleared and then filled with widgets that
677    /// represent items from @model. @self is updated whenever @model changes.
678    /// If @model is [`None`], @self is left empty.
679    ///
680    /// It is undefined to add or remove widgets directly (for example, with
681    /// [`insert()`][Self::insert()]) while @self is bound to a model.
682    ///
683    /// Note that using a model is incompatible with the filtering and sorting
684    /// functionality in [`ListBox`][crate::ListBox]. When using a model, filtering and sorting
685    /// should be implemented by the model.
686    /// ## `model`
687    /// the `GListModel` to be bound to @self
688    /// ## `create_widget_func`
689    /// a function
690    ///   that creates widgets for items or [`None`] in case you also passed [`None`] as @model
691    #[doc(alias = "gtk_list_box_bind_model")]
692    pub fn bind_model<P: Fn(&glib::Object) -> Widget + 'static>(
693        &self,
694        model: Option<&impl IsA<gio::ListModel>>,
695        create_widget_func: P,
696    ) {
697        let create_widget_func_data: Box_<P> = Box_::new(create_widget_func);
698        unsafe extern "C" fn create_widget_func_func<P: Fn(&glib::Object) -> Widget + 'static>(
699            item: *mut glib::gobject_ffi::GObject,
700            user_data: glib::ffi::gpointer,
701        ) -> *mut ffi::GtkWidget {
702            let item = from_glib_borrow(item);
703            let callback = &*(user_data as *mut P);
704            (*callback)(&item).to_glib_full()
705        }
706        let create_widget_func = Some(create_widget_func_func::<P> as _);
707        unsafe extern "C" fn user_data_free_func_func<P: Fn(&glib::Object) -> Widget + 'static>(
708            data: glib::ffi::gpointer,
709        ) {
710            let _callback = Box_::from_raw(data as *mut P);
711        }
712        let destroy_call4 = Some(user_data_free_func_func::<P> as _);
713        let super_callback0: Box_<P> = create_widget_func_data;
714        unsafe {
715            ffi::gtk_list_box_bind_model(
716                self.to_glib_none().0,
717                model.map(|p| p.as_ref()).to_glib_none().0,
718                create_widget_func,
719                Box_::into_raw(super_callback0) as *mut _,
720                destroy_call4,
721            );
722        }
723    }
724
725    /// Add a drag highlight to a row.
726    ///
727    /// This is a helper function for implementing DnD onto a [`ListBox`][crate::ListBox].
728    /// The passed in @row will be highlighted by setting the
729    /// [`StateFlags::DROP_ACTIVE`][crate::StateFlags::DROP_ACTIVE] state and any previously highlighted
730    /// row will be unhighlighted.
731    ///
732    /// The row will also be unhighlighted when the widget gets
733    /// a drag leave event.
734    /// ## `row`
735    /// a [`ListBoxRow`][crate::ListBoxRow]
736    #[doc(alias = "gtk_list_box_drag_highlight_row")]
737    pub fn drag_highlight_row(&self, row: &impl IsA<ListBoxRow>) {
738        unsafe {
739            ffi::gtk_list_box_drag_highlight_row(
740                self.to_glib_none().0,
741                row.as_ref().to_glib_none().0,
742            );
743        }
744    }
745
746    /// If a row has previously been highlighted via gtk_list_box_drag_highlight_row(),
747    /// it will have the highlight removed.
748    #[doc(alias = "gtk_list_box_drag_unhighlight_row")]
749    pub fn drag_unhighlight_row(&self) {
750        unsafe {
751            ffi::gtk_list_box_drag_unhighlight_row(self.to_glib_none().0);
752        }
753    }
754
755    /// Returns whether rows activate on single clicks.
756    ///
757    /// # Returns
758    ///
759    /// [`true`] if rows are activated on single click, [`false`] otherwise
760    #[doc(alias = "gtk_list_box_get_activate_on_single_click")]
761    #[doc(alias = "get_activate_on_single_click")]
762    #[doc(alias = "activate-on-single-click")]
763    pub fn activates_on_single_click(&self) -> bool {
764        unsafe {
765            from_glib(ffi::gtk_list_box_get_activate_on_single_click(
766                self.to_glib_none().0,
767            ))
768        }
769    }
770
771    /// Gets the adjustment (if any) that the widget uses to
772    /// for vertical scrolling.
773    ///
774    /// # Returns
775    ///
776    /// the adjustment
777    #[doc(alias = "gtk_list_box_get_adjustment")]
778    #[doc(alias = "get_adjustment")]
779    pub fn adjustment(&self) -> Option<Adjustment> {
780        unsafe { from_glib_none(ffi::gtk_list_box_get_adjustment(self.to_glib_none().0)) }
781    }
782
783    /// Gets the n-th child in the list (not counting headers).
784    ///
785    /// If @index_ is negative or larger than the number of items in the
786    /// list, [`None`] is returned.
787    /// ## `index_`
788    /// the index of the row
789    ///
790    /// # Returns
791    ///
792    /// the child [`Widget`][crate::Widget]
793    #[doc(alias = "gtk_list_box_get_row_at_index")]
794    #[doc(alias = "get_row_at_index")]
795    pub fn row_at_index(&self, index_: i32) -> Option<ListBoxRow> {
796        unsafe {
797            from_glib_none(ffi::gtk_list_box_get_row_at_index(
798                self.to_glib_none().0,
799                index_,
800            ))
801        }
802    }
803
804    /// Gets the row at the @y position.
805    /// ## `y`
806    /// position
807    ///
808    /// # Returns
809    ///
810    /// the row
811    #[doc(alias = "gtk_list_box_get_row_at_y")]
812    #[doc(alias = "get_row_at_y")]
813    pub fn row_at_y(&self, y: i32) -> Option<ListBoxRow> {
814        unsafe { from_glib_none(ffi::gtk_list_box_get_row_at_y(self.to_glib_none().0, y)) }
815    }
816
817    /// Gets the selected row, or [`None`] if no rows are selected.
818    ///
819    /// Note that the box may allow multiple selection, in which
820    /// case you should use [`selected_foreach()`][Self::selected_foreach()] to
821    /// find all selected rows.
822    ///
823    /// # Returns
824    ///
825    /// the selected row
826    #[doc(alias = "gtk_list_box_get_selected_row")]
827    #[doc(alias = "get_selected_row")]
828    pub fn selected_row(&self) -> Option<ListBoxRow> {
829        unsafe { from_glib_none(ffi::gtk_list_box_get_selected_row(self.to_glib_none().0)) }
830    }
831
832    /// Creates a list of all selected children.
833    ///
834    /// # Returns
835    ///
836    ///
837    ///   A `GList` containing the [`Widget`][crate::Widget] for each selected child.
838    ///   Free with g_list_free() when done.
839    #[doc(alias = "gtk_list_box_get_selected_rows")]
840    #[doc(alias = "get_selected_rows")]
841    pub fn selected_rows(&self) -> Vec<ListBoxRow> {
842        unsafe {
843            FromGlibPtrContainer::from_glib_container(ffi::gtk_list_box_get_selected_rows(
844                self.to_glib_none().0,
845            ))
846        }
847    }
848
849    /// Gets the selection mode of the listbox.
850    ///
851    /// # Returns
852    ///
853    /// a [`SelectionMode`][crate::SelectionMode]
854    #[doc(alias = "gtk_list_box_get_selection_mode")]
855    #[doc(alias = "get_selection_mode")]
856    #[doc(alias = "selection-mode")]
857    pub fn selection_mode(&self) -> SelectionMode {
858        unsafe { from_glib(ffi::gtk_list_box_get_selection_mode(self.to_glib_none().0)) }
859    }
860
861    /// Returns whether the list box should show separators
862    /// between rows.
863    ///
864    /// # Returns
865    ///
866    /// [`true`] if the list box shows separators
867    #[doc(alias = "gtk_list_box_get_show_separators")]
868    #[doc(alias = "get_show_separators")]
869    #[doc(alias = "show-separators")]
870    pub fn shows_separators(&self) -> bool {
871        unsafe { from_glib(ffi::gtk_list_box_get_show_separators(self.to_glib_none().0)) }
872    }
873
874    /// Returns the behavior of the <kbd>Tab</kbd> and <kbd>Shift</kbd>+<kbd>Tab</kbd> keys.
875    ///
876    /// # Returns
877    ///
878    /// the tab behavior
879    #[cfg(feature = "v4_18")]
880    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
881    #[doc(alias = "gtk_list_box_get_tab_behavior")]
882    #[doc(alias = "get_tab_behavior")]
883    #[doc(alias = "tab-behavior")]
884    pub fn tab_behavior(&self) -> ListTabBehavior {
885        unsafe { from_glib(ffi::gtk_list_box_get_tab_behavior(self.to_glib_none().0)) }
886    }
887
888    /// Insert the @child into the @self at @position.
889    ///
890    /// If a sort function is
891    /// set, the widget will actually be inserted at the calculated position.
892    ///
893    /// If @position is -1, or larger than the total number of items in the
894    /// @self, then the @child will be appended to the end.
895    /// ## `child`
896    /// the [`Widget`][crate::Widget] to add
897    /// ## `position`
898    /// the position to insert @child in
899    #[doc(alias = "gtk_list_box_insert")]
900    pub fn insert(&self, child: &impl IsA<Widget>, position: i32) {
901        unsafe {
902            ffi::gtk_list_box_insert(
903                self.to_glib_none().0,
904                child.as_ref().to_glib_none().0,
905                position,
906            );
907        }
908    }
909
910    /// Update the filtering for all rows.
911    ///
912    /// Call this when result
913    /// of the filter function on the @self is changed due
914    /// to an external factor. For instance, this would be used
915    /// if the filter function just looked for a specific search
916    /// string and the entry with the search string has changed.
917    #[doc(alias = "gtk_list_box_invalidate_filter")]
918    pub fn invalidate_filter(&self) {
919        unsafe {
920            ffi::gtk_list_box_invalidate_filter(self.to_glib_none().0);
921        }
922    }
923
924    /// Update the separators for all rows.
925    ///
926    /// Call this when result
927    /// of the header function on the @self is changed due
928    /// to an external factor.
929    #[doc(alias = "gtk_list_box_invalidate_headers")]
930    pub fn invalidate_headers(&self) {
931        unsafe {
932            ffi::gtk_list_box_invalidate_headers(self.to_glib_none().0);
933        }
934    }
935
936    /// Update the sorting for all rows.
937    ///
938    /// Call this when result
939    /// of the sort function on the @self is changed due
940    /// to an external factor.
941    #[doc(alias = "gtk_list_box_invalidate_sort")]
942    pub fn invalidate_sort(&self) {
943        unsafe {
944            ffi::gtk_list_box_invalidate_sort(self.to_glib_none().0);
945        }
946    }
947
948    /// Prepend a widget to the list.
949    ///
950    /// If a sort function is set, the widget will
951    /// actually be inserted at the calculated position.
952    /// ## `child`
953    /// the [`Widget`][crate::Widget] to add
954    #[doc(alias = "gtk_list_box_prepend")]
955    pub fn prepend(&self, child: &impl IsA<Widget>) {
956        unsafe {
957            ffi::gtk_list_box_prepend(self.to_glib_none().0, child.as_ref().to_glib_none().0);
958        }
959    }
960
961    /// Removes a child from @self.
962    /// ## `child`
963    /// the child to remove
964    #[doc(alias = "gtk_list_box_remove")]
965    pub fn remove(&self, child: &impl IsA<Widget>) {
966        unsafe {
967            ffi::gtk_list_box_remove(self.to_glib_none().0, child.as_ref().to_glib_none().0);
968        }
969    }
970
971    /// Removes all rows from @self.
972    ///
973    /// This function does nothing if @self is backed by a model.
974    #[cfg(feature = "v4_12")]
975    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
976    #[doc(alias = "gtk_list_box_remove_all")]
977    pub fn remove_all(&self) {
978        unsafe {
979            ffi::gtk_list_box_remove_all(self.to_glib_none().0);
980        }
981    }
982
983    /// Select all children of @self, if the selection mode allows it.
984    #[doc(alias = "gtk_list_box_select_all")]
985    pub fn select_all(&self) {
986        unsafe {
987            ffi::gtk_list_box_select_all(self.to_glib_none().0);
988        }
989    }
990
991    /// Make @row the currently selected row.
992    /// ## `row`
993    /// The row to select
994    #[doc(alias = "gtk_list_box_select_row")]
995    pub fn select_row(&self, row: Option<&impl IsA<ListBoxRow>>) {
996        unsafe {
997            ffi::gtk_list_box_select_row(
998                self.to_glib_none().0,
999                row.map(|p| p.as_ref()).to_glib_none().0,
1000            );
1001        }
1002    }
1003
1004    /// Calls a function for each selected child.
1005    ///
1006    /// Note that the selection cannot be modified from within this function.
1007    /// ## `func`
1008    /// the function to call for each selected child
1009    #[doc(alias = "gtk_list_box_selected_foreach")]
1010    pub fn selected_foreach<P: FnMut(&ListBox, &ListBoxRow)>(&self, func: P) {
1011        let mut func_data: P = func;
1012        unsafe extern "C" fn func_func<P: FnMut(&ListBox, &ListBoxRow)>(
1013            box_: *mut ffi::GtkListBox,
1014            row: *mut ffi::GtkListBoxRow,
1015            user_data: glib::ffi::gpointer,
1016        ) {
1017            let box_ = from_glib_borrow(box_);
1018            let row = from_glib_borrow(row);
1019            let callback = user_data as *mut P;
1020            (*callback)(&box_, &row)
1021        }
1022        let func = Some(func_func::<P> as _);
1023        let super_callback0: &mut P = &mut func_data;
1024        unsafe {
1025            ffi::gtk_list_box_selected_foreach(
1026                self.to_glib_none().0,
1027                func,
1028                super_callback0 as *mut _ as *mut _,
1029            );
1030        }
1031    }
1032
1033    /// If @single is [`true`], rows will be activated when you click on them,
1034    /// otherwise you need to double-click.
1035    /// ## `single`
1036    /// a boolean
1037    #[doc(alias = "gtk_list_box_set_activate_on_single_click")]
1038    #[doc(alias = "activate-on-single-click")]
1039    pub fn set_activate_on_single_click(&self, single: bool) {
1040        unsafe {
1041            ffi::gtk_list_box_set_activate_on_single_click(
1042                self.to_glib_none().0,
1043                single.into_glib(),
1044            );
1045        }
1046    }
1047
1048    /// Sets the adjustment (if any) that the widget uses to
1049    /// for vertical scrolling.
1050    ///
1051    /// For instance, this is used to get the page size for
1052    /// PageUp/Down key handling.
1053    ///
1054    /// In the normal case when the @self is packed inside
1055    /// a [`ScrolledWindow`][crate::ScrolledWindow] the adjustment from that will
1056    /// be picked up automatically, so there is no need
1057    /// to manually do that.
1058    /// ## `adjustment`
1059    /// the adjustment
1060    #[doc(alias = "gtk_list_box_set_adjustment")]
1061    pub fn set_adjustment(&self, adjustment: Option<&impl IsA<Adjustment>>) {
1062        unsafe {
1063            ffi::gtk_list_box_set_adjustment(
1064                self.to_glib_none().0,
1065                adjustment.map(|p| p.as_ref()).to_glib_none().0,
1066            );
1067        }
1068    }
1069
1070    /// By setting a filter function on the @self one can decide dynamically which
1071    /// of the rows to show.
1072    ///
1073    /// For instance, to implement a search function on a list that
1074    /// filters the original list to only show the matching rows.
1075    ///
1076    /// The @filter_func will be called for each row after the call, and
1077    /// it will continue to be called each time a row changes (via
1078    /// [`ListBoxRowExt::changed()`][crate::prelude::ListBoxRowExt::changed()]) or when [`invalidate_filter()`][Self::invalidate_filter()]
1079    /// is called.
1080    ///
1081    /// Note that using a filter function is incompatible with using a model
1082    /// (see [`bind_model()`][Self::bind_model()]).
1083    /// ## `filter_func`
1084    /// callback
1085    ///   that lets you filter which rows to show
1086    #[doc(alias = "gtk_list_box_set_filter_func")]
1087    pub fn set_filter_func<P: Fn(&ListBoxRow) -> bool + 'static>(&self, filter_func: P) {
1088        let filter_func_data: Box_<P> = Box_::new(filter_func);
1089        unsafe extern "C" fn filter_func_func<P: Fn(&ListBoxRow) -> bool + 'static>(
1090            row: *mut ffi::GtkListBoxRow,
1091            user_data: glib::ffi::gpointer,
1092        ) -> glib::ffi::gboolean {
1093            let row = from_glib_borrow(row);
1094            let callback = &*(user_data as *mut P);
1095            (*callback)(&row).into_glib()
1096        }
1097        let filter_func = Some(filter_func_func::<P> as _);
1098        unsafe extern "C" fn destroy_func<P: Fn(&ListBoxRow) -> bool + 'static>(
1099            data: glib::ffi::gpointer,
1100        ) {
1101            let _callback = Box_::from_raw(data as *mut P);
1102        }
1103        let destroy_call3 = Some(destroy_func::<P> as _);
1104        let super_callback0: Box_<P> = filter_func_data;
1105        unsafe {
1106            ffi::gtk_list_box_set_filter_func(
1107                self.to_glib_none().0,
1108                filter_func,
1109                Box_::into_raw(super_callback0) as *mut _,
1110                destroy_call3,
1111            );
1112        }
1113    }
1114
1115    /// Sets a header function.
1116    ///
1117    /// By setting a header function on the @self one can dynamically add headers
1118    /// in front of rows, depending on the contents of the row and its position
1119    /// in the list.
1120    ///
1121    /// For instance, one could use it to add headers in front of the first item
1122    /// of a new kind, in a list sorted by the kind.
1123    ///
1124    /// The @update_header can look at the current header widget using
1125    /// [`ListBoxRowExt::header()`][crate::prelude::ListBoxRowExt::header()] and either update the state of the widget
1126    /// as needed, or set a new one using [`ListBoxRowExt::set_header()`][crate::prelude::ListBoxRowExt::set_header()]. If no
1127    /// header is needed, set the header to [`None`].
1128    ///
1129    /// Note that you may get many calls @update_header to this for a particular
1130    /// row when e.g. changing things that don’t affect the header. In this case
1131    /// it is important for performance to not blindly replace an existing header
1132    /// with an identical one.
1133    ///
1134    /// The @update_header function will be called for each row after the call,
1135    /// and it will continue to be called each time a row changes (via
1136    /// [`ListBoxRowExt::changed()`][crate::prelude::ListBoxRowExt::changed()]) and when the row before changes (either
1137    /// by [`ListBoxRowExt::changed()`][crate::prelude::ListBoxRowExt::changed()] on the previous row, or when the previous
1138    /// row becomes a different row). It is also called for all rows when
1139    /// [`invalidate_headers()`][Self::invalidate_headers()] is called.
1140    /// ## `update_header`
1141    /// callback
1142    ///   that lets you add row headers
1143    #[doc(alias = "gtk_list_box_set_header_func")]
1144    pub fn set_header_func<P: Fn(&ListBoxRow, Option<&ListBoxRow>) + 'static>(
1145        &self,
1146        update_header: P,
1147    ) {
1148        let update_header_data: Box_<P> = Box_::new(update_header);
1149        unsafe extern "C" fn update_header_func<
1150            P: Fn(&ListBoxRow, Option<&ListBoxRow>) + 'static,
1151        >(
1152            row: *mut ffi::GtkListBoxRow,
1153            before: *mut ffi::GtkListBoxRow,
1154            user_data: glib::ffi::gpointer,
1155        ) {
1156            let row = from_glib_borrow(row);
1157            let before: Borrowed<Option<ListBoxRow>> = from_glib_borrow(before);
1158            let callback = &*(user_data as *mut P);
1159            (*callback)(&row, before.as_ref().as_ref())
1160        }
1161        let update_header = Some(update_header_func::<P> as _);
1162        unsafe extern "C" fn destroy_func<P: Fn(&ListBoxRow, Option<&ListBoxRow>) + 'static>(
1163            data: glib::ffi::gpointer,
1164        ) {
1165            let _callback = Box_::from_raw(data as *mut P);
1166        }
1167        let destroy_call3 = Some(destroy_func::<P> as _);
1168        let super_callback0: Box_<P> = update_header_data;
1169        unsafe {
1170            ffi::gtk_list_box_set_header_func(
1171                self.to_glib_none().0,
1172                update_header,
1173                Box_::into_raw(super_callback0) as *mut _,
1174                destroy_call3,
1175            );
1176        }
1177    }
1178
1179    /// Sets the placeholder widget that is shown in the list when
1180    /// it doesn't display any visible children.
1181    /// ## `placeholder`
1182    /// a [`Widget`][crate::Widget]
1183    #[doc(alias = "gtk_list_box_set_placeholder")]
1184    pub fn set_placeholder(&self, placeholder: Option<&impl IsA<Widget>>) {
1185        unsafe {
1186            ffi::gtk_list_box_set_placeholder(
1187                self.to_glib_none().0,
1188                placeholder.map(|p| p.as_ref()).to_glib_none().0,
1189            );
1190        }
1191    }
1192
1193    /// Sets how selection works in the listbox.
1194    /// ## `mode`
1195    /// The [`SelectionMode`][crate::SelectionMode]
1196    #[doc(alias = "gtk_list_box_set_selection_mode")]
1197    #[doc(alias = "selection-mode")]
1198    pub fn set_selection_mode(&self, mode: SelectionMode) {
1199        unsafe {
1200            ffi::gtk_list_box_set_selection_mode(self.to_glib_none().0, mode.into_glib());
1201        }
1202    }
1203
1204    /// Sets whether the list box should show separators
1205    /// between rows.
1206    /// ## `show_separators`
1207    /// [`true`] to show separators
1208    #[doc(alias = "gtk_list_box_set_show_separators")]
1209    #[doc(alias = "show-separators")]
1210    pub fn set_show_separators(&self, show_separators: bool) {
1211        unsafe {
1212            ffi::gtk_list_box_set_show_separators(
1213                self.to_glib_none().0,
1214                show_separators.into_glib(),
1215            );
1216        }
1217    }
1218
1219    /// Sets the behavior of the <kbd>Tab</kbd> and <kbd>Shift</kbd>+<kbd>Tab</kbd> keys.
1220    /// ## `behavior`
1221    /// the tab behavior
1222    #[cfg(feature = "v4_18")]
1223    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1224    #[doc(alias = "gtk_list_box_set_tab_behavior")]
1225    #[doc(alias = "tab-behavior")]
1226    pub fn set_tab_behavior(&self, behavior: ListTabBehavior) {
1227        unsafe {
1228            ffi::gtk_list_box_set_tab_behavior(self.to_glib_none().0, behavior.into_glib());
1229        }
1230    }
1231
1232    /// Unselect all children of @self, if the selection mode allows it.
1233    #[doc(alias = "gtk_list_box_unselect_all")]
1234    pub fn unselect_all(&self) {
1235        unsafe {
1236            ffi::gtk_list_box_unselect_all(self.to_glib_none().0);
1237        }
1238    }
1239
1240    /// Unselects a single row of @self, if the selection mode allows it.
1241    /// ## `row`
1242    /// the row to unselect
1243    #[doc(alias = "gtk_list_box_unselect_row")]
1244    pub fn unselect_row(&self, row: &impl IsA<ListBoxRow>) {
1245        unsafe {
1246            ffi::gtk_list_box_unselect_row(self.to_glib_none().0, row.as_ref().to_glib_none().0);
1247        }
1248    }
1249
1250    /// Whether to accept unpaired release events.
1251    #[doc(alias = "accept-unpaired-release")]
1252    pub fn accepts_unpaired_release(&self) -> bool {
1253        ObjectExt::property(self, "accept-unpaired-release")
1254    }
1255
1256    /// Whether to accept unpaired release events.
1257    #[doc(alias = "accept-unpaired-release")]
1258    pub fn set_accept_unpaired_release(&self, accept_unpaired_release: bool) {
1259        ObjectExt::set_property(self, "accept-unpaired-release", accept_unpaired_release)
1260    }
1261
1262    /// Emitted when the cursor row is activated.
1263    #[doc(alias = "activate-cursor-row")]
1264    pub fn connect_activate_cursor_row<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1265        unsafe extern "C" fn activate_cursor_row_trampoline<F: Fn(&ListBox) + 'static>(
1266            this: *mut ffi::GtkListBox,
1267            f: glib::ffi::gpointer,
1268        ) {
1269            let f: &F = &*(f as *const F);
1270            f(&from_glib_borrow(this))
1271        }
1272        unsafe {
1273            let f: Box_<F> = Box_::new(f);
1274            connect_raw(
1275                self.as_ptr() as *mut _,
1276                b"activate-cursor-row\0".as_ptr() as *const _,
1277                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1278                    activate_cursor_row_trampoline::<F> as *const (),
1279                )),
1280                Box_::into_raw(f),
1281            )
1282        }
1283    }
1284
1285    pub fn emit_activate_cursor_row(&self) {
1286        self.emit_by_name::<()>("activate-cursor-row", &[]);
1287    }
1288
1289    /// Emitted when the user initiates a cursor movement.
1290    ///
1291    /// The default bindings for this signal come in two variants, the variant with
1292    /// the Shift modifier extends the selection, the variant without the Shift
1293    /// modifier does not. There are too many key combinations to list them all
1294    /// here.
1295    ///
1296    /// - <kbd>←</kbd>, <kbd>→</kbd>, <kbd>↑</kbd>, <kbd>↓</kbd>
1297    ///   move by individual children
1298    /// - <kbd>Home</kbd>, <kbd>End</kbd> move to the ends of the box
1299    /// - <kbd>PgUp</kbd>, <kbd>PgDn</kbd> move vertically by pages
1300    /// ## `step`
1301    /// the granularity of the move, as a [`MovementStep`][crate::MovementStep]
1302    /// ## `count`
1303    /// the number of @step units to move
1304    /// ## `extend`
1305    /// whether to extend the selection
1306    /// ## `modify`
1307    /// whether to modify the selection
1308    #[doc(alias = "move-cursor")]
1309    pub fn connect_move_cursor<F: Fn(&Self, MovementStep, i32, bool, bool) + 'static>(
1310        &self,
1311        f: F,
1312    ) -> SignalHandlerId {
1313        unsafe extern "C" fn move_cursor_trampoline<
1314            F: Fn(&ListBox, MovementStep, i32, bool, bool) + 'static,
1315        >(
1316            this: *mut ffi::GtkListBox,
1317            step: ffi::GtkMovementStep,
1318            count: std::ffi::c_int,
1319            extend: glib::ffi::gboolean,
1320            modify: glib::ffi::gboolean,
1321            f: glib::ffi::gpointer,
1322        ) {
1323            let f: &F = &*(f as *const F);
1324            f(
1325                &from_glib_borrow(this),
1326                from_glib(step),
1327                count,
1328                from_glib(extend),
1329                from_glib(modify),
1330            )
1331        }
1332        unsafe {
1333            let f: Box_<F> = Box_::new(f);
1334            connect_raw(
1335                self.as_ptr() as *mut _,
1336                b"move-cursor\0".as_ptr() as *const _,
1337                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1338                    move_cursor_trampoline::<F> as *const (),
1339                )),
1340                Box_::into_raw(f),
1341            )
1342        }
1343    }
1344
1345    pub fn emit_move_cursor(&self, step: MovementStep, count: i32, extend: bool, modify: bool) {
1346        self.emit_by_name::<()>("move-cursor", &[&step, &count, &extend, &modify]);
1347    }
1348
1349    /// Emitted when a row has been activated by the user.
1350    /// ## `row`
1351    /// the activated row
1352    #[doc(alias = "row-activated")]
1353    pub fn connect_row_activated<F: Fn(&Self, &ListBoxRow) + 'static>(
1354        &self,
1355        f: F,
1356    ) -> SignalHandlerId {
1357        unsafe extern "C" fn row_activated_trampoline<F: Fn(&ListBox, &ListBoxRow) + 'static>(
1358            this: *mut ffi::GtkListBox,
1359            row: *mut ffi::GtkListBoxRow,
1360            f: glib::ffi::gpointer,
1361        ) {
1362            let f: &F = &*(f as *const F);
1363            f(&from_glib_borrow(this), &from_glib_borrow(row))
1364        }
1365        unsafe {
1366            let f: Box_<F> = Box_::new(f);
1367            connect_raw(
1368                self.as_ptr() as *mut _,
1369                b"row-activated\0".as_ptr() as *const _,
1370                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1371                    row_activated_trampoline::<F> as *const (),
1372                )),
1373                Box_::into_raw(f),
1374            )
1375        }
1376    }
1377
1378    /// Emitted when a new row is selected, or (with a [`None`] @row)
1379    /// when the selection is cleared.
1380    ///
1381    /// When the @box_ is using [`SelectionMode::Multiple`][crate::SelectionMode::Multiple], this signal will not
1382    /// give you the full picture of selection changes, and you should use
1383    /// the [`selected-rows-changed`][struct@crate::ListBox#selected-rows-changed] signal instead.
1384    /// ## `row`
1385    /// the selected row
1386    #[doc(alias = "row-selected")]
1387    pub fn connect_row_selected<F: Fn(&Self, Option<&ListBoxRow>) + 'static>(
1388        &self,
1389        f: F,
1390    ) -> SignalHandlerId {
1391        unsafe extern "C" fn row_selected_trampoline<
1392            F: Fn(&ListBox, Option<&ListBoxRow>) + 'static,
1393        >(
1394            this: *mut ffi::GtkListBox,
1395            row: *mut ffi::GtkListBoxRow,
1396            f: glib::ffi::gpointer,
1397        ) {
1398            let f: &F = &*(f as *const F);
1399            f(
1400                &from_glib_borrow(this),
1401                Option::<ListBoxRow>::from_glib_borrow(row)
1402                    .as_ref()
1403                    .as_ref(),
1404            )
1405        }
1406        unsafe {
1407            let f: Box_<F> = Box_::new(f);
1408            connect_raw(
1409                self.as_ptr() as *mut _,
1410                b"row-selected\0".as_ptr() as *const _,
1411                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1412                    row_selected_trampoline::<F> as *const (),
1413                )),
1414                Box_::into_raw(f),
1415            )
1416        }
1417    }
1418
1419    /// Emitted to select all children of the box, if the selection
1420    /// mode permits it.
1421    ///
1422    /// This is a [keybinding signal](class.SignalAction.html).
1423    ///
1424    /// The default binding for this signal is <kbd>Ctrl</kbd>-<kbd>a</kbd>.
1425    #[doc(alias = "select-all")]
1426    pub fn connect_select_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1427        unsafe extern "C" fn select_all_trampoline<F: Fn(&ListBox) + 'static>(
1428            this: *mut ffi::GtkListBox,
1429            f: glib::ffi::gpointer,
1430        ) {
1431            let f: &F = &*(f as *const F);
1432            f(&from_glib_borrow(this))
1433        }
1434        unsafe {
1435            let f: Box_<F> = Box_::new(f);
1436            connect_raw(
1437                self.as_ptr() as *mut _,
1438                b"select-all\0".as_ptr() as *const _,
1439                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1440                    select_all_trampoline::<F> as *const (),
1441                )),
1442                Box_::into_raw(f),
1443            )
1444        }
1445    }
1446
1447    pub fn emit_select_all(&self) {
1448        self.emit_by_name::<()>("select-all", &[]);
1449    }
1450
1451    /// Emitted when the set of selected rows changes.
1452    #[doc(alias = "selected-rows-changed")]
1453    pub fn connect_selected_rows_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1454        unsafe extern "C" fn selected_rows_changed_trampoline<F: Fn(&ListBox) + 'static>(
1455            this: *mut ffi::GtkListBox,
1456            f: glib::ffi::gpointer,
1457        ) {
1458            let f: &F = &*(f as *const F);
1459            f(&from_glib_borrow(this))
1460        }
1461        unsafe {
1462            let f: Box_<F> = Box_::new(f);
1463            connect_raw(
1464                self.as_ptr() as *mut _,
1465                b"selected-rows-changed\0".as_ptr() as *const _,
1466                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1467                    selected_rows_changed_trampoline::<F> as *const (),
1468                )),
1469                Box_::into_raw(f),
1470            )
1471        }
1472    }
1473
1474    /// Emitted when the cursor row is toggled.
1475    ///
1476    /// The default bindings for this signal is <kbd>Ctrl</kbd>+<kbd>␣</kbd>.
1477    #[doc(alias = "toggle-cursor-row")]
1478    pub fn connect_toggle_cursor_row<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1479        unsafe extern "C" fn toggle_cursor_row_trampoline<F: Fn(&ListBox) + 'static>(
1480            this: *mut ffi::GtkListBox,
1481            f: glib::ffi::gpointer,
1482        ) {
1483            let f: &F = &*(f as *const F);
1484            f(&from_glib_borrow(this))
1485        }
1486        unsafe {
1487            let f: Box_<F> = Box_::new(f);
1488            connect_raw(
1489                self.as_ptr() as *mut _,
1490                b"toggle-cursor-row\0".as_ptr() as *const _,
1491                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1492                    toggle_cursor_row_trampoline::<F> as *const (),
1493                )),
1494                Box_::into_raw(f),
1495            )
1496        }
1497    }
1498
1499    pub fn emit_toggle_cursor_row(&self) {
1500        self.emit_by_name::<()>("toggle-cursor-row", &[]);
1501    }
1502
1503    /// Emitted to unselect all children of the box, if the selection
1504    /// mode permits it.
1505    ///
1506    /// This is a [keybinding signal](class.SignalAction.html).
1507    ///
1508    /// The default binding for this signal is
1509    /// <kbd>Ctrl</kbd>-<kbd>Shift</kbd>-<kbd>a</kbd>.
1510    #[doc(alias = "unselect-all")]
1511    pub fn connect_unselect_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1512        unsafe extern "C" fn unselect_all_trampoline<F: Fn(&ListBox) + 'static>(
1513            this: *mut ffi::GtkListBox,
1514            f: glib::ffi::gpointer,
1515        ) {
1516            let f: &F = &*(f as *const F);
1517            f(&from_glib_borrow(this))
1518        }
1519        unsafe {
1520            let f: Box_<F> = Box_::new(f);
1521            connect_raw(
1522                self.as_ptr() as *mut _,
1523                b"unselect-all\0".as_ptr() as *const _,
1524                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1525                    unselect_all_trampoline::<F> as *const (),
1526                )),
1527                Box_::into_raw(f),
1528            )
1529        }
1530    }
1531
1532    pub fn emit_unselect_all(&self) {
1533        self.emit_by_name::<()>("unselect-all", &[]);
1534    }
1535
1536    #[doc(alias = "accept-unpaired-release")]
1537    pub fn connect_accept_unpaired_release_notify<F: Fn(&Self) + 'static>(
1538        &self,
1539        f: F,
1540    ) -> SignalHandlerId {
1541        unsafe extern "C" fn notify_accept_unpaired_release_trampoline<
1542            F: Fn(&ListBox) + 'static,
1543        >(
1544            this: *mut ffi::GtkListBox,
1545            _param_spec: glib::ffi::gpointer,
1546            f: glib::ffi::gpointer,
1547        ) {
1548            let f: &F = &*(f as *const F);
1549            f(&from_glib_borrow(this))
1550        }
1551        unsafe {
1552            let f: Box_<F> = Box_::new(f);
1553            connect_raw(
1554                self.as_ptr() as *mut _,
1555                b"notify::accept-unpaired-release\0".as_ptr() as *const _,
1556                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1557                    notify_accept_unpaired_release_trampoline::<F> as *const (),
1558                )),
1559                Box_::into_raw(f),
1560            )
1561        }
1562    }
1563
1564    #[doc(alias = "activate-on-single-click")]
1565    pub fn connect_activate_on_single_click_notify<F: Fn(&Self) + 'static>(
1566        &self,
1567        f: F,
1568    ) -> SignalHandlerId {
1569        unsafe extern "C" fn notify_activate_on_single_click_trampoline<
1570            F: Fn(&ListBox) + 'static,
1571        >(
1572            this: *mut ffi::GtkListBox,
1573            _param_spec: glib::ffi::gpointer,
1574            f: glib::ffi::gpointer,
1575        ) {
1576            let f: &F = &*(f as *const F);
1577            f(&from_glib_borrow(this))
1578        }
1579        unsafe {
1580            let f: Box_<F> = Box_::new(f);
1581            connect_raw(
1582                self.as_ptr() as *mut _,
1583                b"notify::activate-on-single-click\0".as_ptr() as *const _,
1584                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1585                    notify_activate_on_single_click_trampoline::<F> as *const (),
1586                )),
1587                Box_::into_raw(f),
1588            )
1589        }
1590    }
1591
1592    #[doc(alias = "selection-mode")]
1593    pub fn connect_selection_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1594        unsafe extern "C" fn notify_selection_mode_trampoline<F: Fn(&ListBox) + 'static>(
1595            this: *mut ffi::GtkListBox,
1596            _param_spec: glib::ffi::gpointer,
1597            f: glib::ffi::gpointer,
1598        ) {
1599            let f: &F = &*(f as *const F);
1600            f(&from_glib_borrow(this))
1601        }
1602        unsafe {
1603            let f: Box_<F> = Box_::new(f);
1604            connect_raw(
1605                self.as_ptr() as *mut _,
1606                b"notify::selection-mode\0".as_ptr() as *const _,
1607                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1608                    notify_selection_mode_trampoline::<F> as *const (),
1609                )),
1610                Box_::into_raw(f),
1611            )
1612        }
1613    }
1614
1615    #[doc(alias = "show-separators")]
1616    pub fn connect_show_separators_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1617        unsafe extern "C" fn notify_show_separators_trampoline<F: Fn(&ListBox) + 'static>(
1618            this: *mut ffi::GtkListBox,
1619            _param_spec: glib::ffi::gpointer,
1620            f: glib::ffi::gpointer,
1621        ) {
1622            let f: &F = &*(f as *const F);
1623            f(&from_glib_borrow(this))
1624        }
1625        unsafe {
1626            let f: Box_<F> = Box_::new(f);
1627            connect_raw(
1628                self.as_ptr() as *mut _,
1629                b"notify::show-separators\0".as_ptr() as *const _,
1630                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1631                    notify_show_separators_trampoline::<F> as *const (),
1632                )),
1633                Box_::into_raw(f),
1634            )
1635        }
1636    }
1637
1638    #[cfg(feature = "v4_18")]
1639    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1640    #[doc(alias = "tab-behavior")]
1641    pub fn connect_tab_behavior_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1642        unsafe extern "C" fn notify_tab_behavior_trampoline<F: Fn(&ListBox) + 'static>(
1643            this: *mut ffi::GtkListBox,
1644            _param_spec: glib::ffi::gpointer,
1645            f: glib::ffi::gpointer,
1646        ) {
1647            let f: &F = &*(f as *const F);
1648            f(&from_glib_borrow(this))
1649        }
1650        unsafe {
1651            let f: Box_<F> = Box_::new(f);
1652            connect_raw(
1653                self.as_ptr() as *mut _,
1654                b"notify::tab-behavior\0".as_ptr() as *const _,
1655                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1656                    notify_tab_behavior_trampoline::<F> as *const (),
1657                )),
1658                Box_::into_raw(f),
1659            )
1660        }
1661    }
1662}
1663
1664impl Default for ListBox {
1665    fn default() -> Self {
1666        Self::new()
1667    }
1668}
1669
1670// rustdoc-stripper-ignore-next
1671/// A [builder-pattern] type to construct [`ListBox`] objects.
1672///
1673/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1674#[must_use = "The builder must be built to be used"]
1675pub struct ListBoxBuilder {
1676    builder: glib::object::ObjectBuilder<'static, ListBox>,
1677}
1678
1679impl ListBoxBuilder {
1680    fn new() -> Self {
1681        Self {
1682            builder: glib::object::Object::builder(),
1683        }
1684    }
1685
1686    /// Whether to accept unpaired release events.
1687    pub fn accept_unpaired_release(self, accept_unpaired_release: bool) -> Self {
1688        Self {
1689            builder: self
1690                .builder
1691                .property("accept-unpaired-release", accept_unpaired_release),
1692        }
1693    }
1694
1695    /// Determines whether children can be activated with a single
1696    /// click, or require a double-click.
1697    pub fn activate_on_single_click(self, activate_on_single_click: bool) -> Self {
1698        Self {
1699            builder: self
1700                .builder
1701                .property("activate-on-single-click", activate_on_single_click),
1702        }
1703    }
1704
1705    /// The selection mode used by the list box.
1706    pub fn selection_mode(self, selection_mode: SelectionMode) -> Self {
1707        Self {
1708            builder: self.builder.property("selection-mode", selection_mode),
1709        }
1710    }
1711
1712    /// Whether to show separators between rows.
1713    pub fn show_separators(self, show_separators: bool) -> Self {
1714        Self {
1715            builder: self.builder.property("show-separators", show_separators),
1716        }
1717    }
1718
1719    /// Behavior of the <kbd>Tab</kbd> key
1720    #[cfg(feature = "v4_18")]
1721    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1722    pub fn tab_behavior(self, tab_behavior: ListTabBehavior) -> Self {
1723        Self {
1724            builder: self.builder.property("tab-behavior", tab_behavior),
1725        }
1726    }
1727
1728    /// Whether the widget or any of its descendents can accept
1729    /// the input focus.
1730    ///
1731    /// This property is meant to be set by widget implementations,
1732    /// typically in their instance init function.
1733    pub fn can_focus(self, can_focus: bool) -> Self {
1734        Self {
1735            builder: self.builder.property("can-focus", can_focus),
1736        }
1737    }
1738
1739    /// Whether the widget can receive pointer events.
1740    pub fn can_target(self, can_target: bool) -> Self {
1741        Self {
1742            builder: self.builder.property("can-target", can_target),
1743        }
1744    }
1745
1746    /// A list of css classes applied to this widget.
1747    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1748        Self {
1749            builder: self.builder.property("css-classes", css_classes.into()),
1750        }
1751    }
1752
1753    /// The name of this widget in the CSS tree.
1754    ///
1755    /// This property is meant to be set by widget implementations,
1756    /// typically in their instance init function.
1757    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1758        Self {
1759            builder: self.builder.property("css-name", css_name.into()),
1760        }
1761    }
1762
1763    /// The cursor used by @widget.
1764    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1765        Self {
1766            builder: self.builder.property("cursor", cursor.clone()),
1767        }
1768    }
1769
1770    /// Whether the widget should grab focus when it is clicked with the mouse.
1771    ///
1772    /// This property is only relevant for widgets that can take focus.
1773    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1774        Self {
1775            builder: self.builder.property("focus-on-click", focus_on_click),
1776        }
1777    }
1778
1779    /// Whether this widget itself will accept the input focus.
1780    pub fn focusable(self, focusable: bool) -> Self {
1781        Self {
1782            builder: self.builder.property("focusable", focusable),
1783        }
1784    }
1785
1786    /// How to distribute horizontal space if widget gets extra space.
1787    pub fn halign(self, halign: Align) -> Self {
1788        Self {
1789            builder: self.builder.property("halign", halign),
1790        }
1791    }
1792
1793    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1794    /// signal on @widget.
1795    ///
1796    /// A true value indicates that @widget can have a tooltip, in this case
1797    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1798    /// determine whether it will provide a tooltip or not.
1799    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1800        Self {
1801            builder: self.builder.property("has-tooltip", has_tooltip),
1802        }
1803    }
1804
1805    /// Overrides for height request of the widget.
1806    ///
1807    /// If this is -1, the natural request will be used.
1808    pub fn height_request(self, height_request: i32) -> Self {
1809        Self {
1810            builder: self.builder.property("height-request", height_request),
1811        }
1812    }
1813
1814    /// Whether to expand horizontally.
1815    pub fn hexpand(self, hexpand: bool) -> Self {
1816        Self {
1817            builder: self.builder.property("hexpand", hexpand),
1818        }
1819    }
1820
1821    /// Whether to use the `hexpand` property.
1822    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1823        Self {
1824            builder: self.builder.property("hexpand-set", hexpand_set),
1825        }
1826    }
1827
1828    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1829    /// the preferred size of the widget, and allocate its children.
1830    ///
1831    /// This property is meant to be set by widget implementations,
1832    /// typically in their instance init function.
1833    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1834        Self {
1835            builder: self
1836                .builder
1837                .property("layout-manager", layout_manager.clone().upcast()),
1838        }
1839    }
1840
1841    /// Makes this widget act like a modal dialog, with respect to
1842    /// event delivery.
1843    ///
1844    /// Global event controllers will not handle events with targets
1845    /// inside the widget, unless they are set up to ignore propagation
1846    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1847    #[cfg(feature = "v4_18")]
1848    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1849    pub fn limit_events(self, limit_events: bool) -> Self {
1850        Self {
1851            builder: self.builder.property("limit-events", limit_events),
1852        }
1853    }
1854
1855    /// Margin on bottom side of widget.
1856    ///
1857    /// This property adds margin outside of the widget's normal size
1858    /// request, the margin will be added in addition to the size from
1859    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1860    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1861        Self {
1862            builder: self.builder.property("margin-bottom", margin_bottom),
1863        }
1864    }
1865
1866    /// Margin on end of widget, horizontally.
1867    ///
1868    /// This property supports left-to-right and right-to-left text
1869    /// directions.
1870    ///
1871    /// This property adds margin outside of the widget's normal size
1872    /// request, the margin will be added in addition to the size from
1873    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1874    pub fn margin_end(self, margin_end: i32) -> Self {
1875        Self {
1876            builder: self.builder.property("margin-end", margin_end),
1877        }
1878    }
1879
1880    /// Margin on start of widget, horizontally.
1881    ///
1882    /// This property supports left-to-right and right-to-left text
1883    /// directions.
1884    ///
1885    /// This property adds margin outside of the widget's normal size
1886    /// request, the margin will be added in addition to the size from
1887    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1888    pub fn margin_start(self, margin_start: i32) -> Self {
1889        Self {
1890            builder: self.builder.property("margin-start", margin_start),
1891        }
1892    }
1893
1894    /// Margin on top side of widget.
1895    ///
1896    /// This property adds margin outside of the widget's normal size
1897    /// request, the margin will be added in addition to the size from
1898    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1899    pub fn margin_top(self, margin_top: i32) -> Self {
1900        Self {
1901            builder: self.builder.property("margin-top", margin_top),
1902        }
1903    }
1904
1905    /// The name of the widget.
1906    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1907        Self {
1908            builder: self.builder.property("name", name.into()),
1909        }
1910    }
1911
1912    /// The requested opacity of the widget.
1913    pub fn opacity(self, opacity: f64) -> Self {
1914        Self {
1915            builder: self.builder.property("opacity", opacity),
1916        }
1917    }
1918
1919    /// How content outside the widget's content area is treated.
1920    ///
1921    /// This property is meant to be set by widget implementations,
1922    /// typically in their instance init function.
1923    pub fn overflow(self, overflow: Overflow) -> Self {
1924        Self {
1925            builder: self.builder.property("overflow", overflow),
1926        }
1927    }
1928
1929    /// Whether the widget will receive the default action when it is focused.
1930    pub fn receives_default(self, receives_default: bool) -> Self {
1931        Self {
1932            builder: self.builder.property("receives-default", receives_default),
1933        }
1934    }
1935
1936    /// Whether the widget responds to input.
1937    pub fn sensitive(self, sensitive: bool) -> Self {
1938        Self {
1939            builder: self.builder.property("sensitive", sensitive),
1940        }
1941    }
1942
1943    /// Sets the text of tooltip to be the given string, which is marked up
1944    /// with Pango markup.
1945    ///
1946    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1947    ///
1948    /// This is a convenience property which will take care of getting the
1949    /// tooltip shown if the given string is not `NULL`:
1950    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1951    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1952    /// the default signal handler.
1953    ///
1954    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1955    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1956    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1957        Self {
1958            builder: self
1959                .builder
1960                .property("tooltip-markup", tooltip_markup.into()),
1961        }
1962    }
1963
1964    /// Sets the text of tooltip to be the given string.
1965    ///
1966    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1967    ///
1968    /// This is a convenience property which will take care of getting the
1969    /// tooltip shown if the given string is not `NULL`:
1970    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1971    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1972    /// the default signal handler.
1973    ///
1974    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1975    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1976    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1977        Self {
1978            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1979        }
1980    }
1981
1982    /// How to distribute vertical space if widget gets extra space.
1983    pub fn valign(self, valign: Align) -> Self {
1984        Self {
1985            builder: self.builder.property("valign", valign),
1986        }
1987    }
1988
1989    /// Whether to expand vertically.
1990    pub fn vexpand(self, vexpand: bool) -> Self {
1991        Self {
1992            builder: self.builder.property("vexpand", vexpand),
1993        }
1994    }
1995
1996    /// Whether to use the `vexpand` property.
1997    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1998        Self {
1999            builder: self.builder.property("vexpand-set", vexpand_set),
2000        }
2001    }
2002
2003    /// Whether the widget is visible.
2004    pub fn visible(self, visible: bool) -> Self {
2005        Self {
2006            builder: self.builder.property("visible", visible),
2007        }
2008    }
2009
2010    /// Overrides for width request of the widget.
2011    ///
2012    /// If this is -1, the natural request will be used.
2013    pub fn width_request(self, width_request: i32) -> Self {
2014        Self {
2015            builder: self.builder.property("width-request", width_request),
2016        }
2017    }
2018
2019    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
2020    ///
2021    /// The accessible role cannot be changed once set.
2022    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
2023        Self {
2024            builder: self.builder.property("accessible-role", accessible_role),
2025        }
2026    }
2027
2028    // rustdoc-stripper-ignore-next
2029    /// Build the [`ListBox`].
2030    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
2031    pub fn build(self) -> ListBox {
2032        assert_initialized_main_thread!();
2033        self.builder.build()
2034    }
2035}