Skip to main content

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