Skip to main content

gtk/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
5use crate::{
6    Adjustment, Align, Buildable, Container, ListBoxRow, MovementStep, ResizeMode, SelectionMode,
7    Widget, ffi,
8};
9use glib::{
10    object::ObjectType as _,
11    prelude::*,
12    signal::{SignalHandlerId, connect_raw},
13    translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18    /// A GtkListBox is a vertical container that contains GtkListBoxRow
19    /// children. These rows can be dynamically sorted and filtered, and
20    /// headers can be added dynamically depending on the row content.
21    /// It also allows keyboard and mouse navigation and selection like
22    /// a typical list.
23    ///
24    /// Using GtkListBox is often an alternative to [`TreeView`][crate::TreeView], especially
25    /// when the list contents has a more complicated layout than what is allowed
26    /// by a [`CellRenderer`][crate::CellRenderer], or when the contents is interactive (i.e. has a
27    /// button in it).
28    ///
29    /// Although a [`ListBox`][crate::ListBox] must have only [`ListBoxRow`][crate::ListBoxRow] children you can
30    /// add any kind of widget to it via [`ContainerExt::add()`][crate::prelude::ContainerExt::add()], and a [`ListBoxRow`][crate::ListBoxRow]
31    /// widget will automatically be inserted between the list and the widget.
32    ///
33    /// `GtkListBoxRows` can be marked as activatable or selectable. If a row
34    /// is activatable, [`row-activated`][struct@crate::ListBox#row-activated] will be emitted for it when
35    /// the user tries to activate it. If it is selectable, the row will be marked
36    /// as selected when the user tries to select it.
37    ///
38    /// The GtkListBox widget was added in GTK+ 3.10.
39    ///
40    /// # GtkListBox as GtkBuildable
41    ///
42    /// The GtkListBox implementation of the [`Buildable`][crate::Buildable] interface supports
43    /// setting a child as the placeholder by specifying “placeholder” as the “type”
44    /// attribute of a ``<child>`` element. See [`ListBoxExt::set_placeholder()`][crate::prelude::ListBoxExt::set_placeholder()] for info.
45    ///
46    /// # CSS nodes
47    ///
48    ///
49    ///
50    /// **⚠️ The following code is in plain ⚠️**
51    ///
52    /// ```plain
53    /// list
54    /// ╰── row[.activatable]
55    /// ```
56    ///
57    /// GtkListBox uses a single CSS node named list. Each GtkListBoxRow uses
58    /// a single CSS node named row. The row nodes get the .activatable
59    /// style class added when appropriate.
60    ///
61    /// ## Properties
62    ///
63    ///
64    /// #### `activate-on-single-click`
65    ///  Readable | Writable
66    ///
67    ///
68    /// #### `selection-mode`
69    ///  Readable | Writable
70    /// <details><summary><h4>Container</h4></summary>
71    ///
72    ///
73    /// #### `border-width`
74    ///  Readable | Writable
75    ///
76    ///
77    /// #### `child`
78    ///  Writable
79    ///
80    ///
81    /// #### `resize-mode`
82    ///  Readable | Writable
83    /// </details>
84    /// <details><summary><h4>Widget</h4></summary>
85    ///
86    ///
87    /// #### `app-paintable`
88    ///  Readable | Writable
89    ///
90    ///
91    /// #### `can-default`
92    ///  Readable | Writable
93    ///
94    ///
95    /// #### `can-focus`
96    ///  Readable | Writable
97    ///
98    ///
99    /// #### `composite-child`
100    ///  Readable
101    ///
102    ///
103    /// #### `double-buffered`
104    ///  Whether the widget is double buffered.
105    ///
106    /// Readable | Writable
107    ///
108    ///
109    /// #### `events`
110    ///  Readable | Writable
111    ///
112    ///
113    /// #### `expand`
114    ///  Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
115    ///
116    /// Readable | Writable
117    ///
118    ///
119    /// #### `focus-on-click`
120    ///  Whether the widget should grab focus when it is clicked with the mouse.
121    ///
122    /// This property is only relevant for widgets that can take focus.
123    ///
124    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
125    /// GtkComboBox) implemented this property individually.
126    ///
127    /// Readable | Writable
128    ///
129    ///
130    /// #### `halign`
131    ///  How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
132    ///
133    /// Readable | Writable
134    ///
135    ///
136    /// #### `has-default`
137    ///  Readable | Writable
138    ///
139    ///
140    /// #### `has-focus`
141    ///  Readable | Writable
142    ///
143    ///
144    /// #### `has-tooltip`
145    ///  Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
146    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
147    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
148    /// whether it will provide a tooltip or not.
149    ///
150    /// Note that setting this property to [`true`] for the first time will change
151    /// the event masks of the GdkWindows of this widget to include leave-notify
152    /// and motion-notify events. This cannot and will not be undone when the
153    /// property is set to [`false`] again.
154    ///
155    /// Readable | Writable
156    ///
157    ///
158    /// #### `height-request`
159    ///  Readable | Writable
160    ///
161    ///
162    /// #### `hexpand`
163    ///  Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
164    ///
165    /// Readable | Writable
166    ///
167    ///
168    /// #### `hexpand-set`
169    ///  Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
170    ///
171    /// Readable | Writable
172    ///
173    ///
174    /// #### `is-focus`
175    ///  Readable | Writable
176    ///
177    ///
178    /// #### `margin`
179    ///  Sets all four sides' margin at once. If read, returns max
180    /// margin on any side.
181    ///
182    /// Readable | Writable
183    ///
184    ///
185    /// #### `margin-bottom`
186    ///  Margin on bottom side of widget.
187    ///
188    /// This property adds margin outside of the widget's normal size
189    /// request, the margin will be added in addition to the size from
190    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
191    ///
192    /// Readable | Writable
193    ///
194    ///
195    /// #### `margin-end`
196    ///  Margin on end of widget, horizontally. This property supports
197    /// left-to-right and right-to-left text directions.
198    ///
199    /// This property adds margin outside of the widget's normal size
200    /// request, the margin will be added in addition to the size from
201    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
202    ///
203    /// Readable | Writable
204    ///
205    ///
206    /// #### `margin-left`
207    ///  Margin on left side of widget.
208    ///
209    /// This property adds margin outside of the widget's normal size
210    /// request, the margin will be added in addition to the size from
211    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
212    ///
213    /// Readable | Writable
214    ///
215    ///
216    /// #### `margin-right`
217    ///  Margin on right side of widget.
218    ///
219    /// This property adds margin outside of the widget's normal size
220    /// request, the margin will be added in addition to the size from
221    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
222    ///
223    /// Readable | Writable
224    ///
225    ///
226    /// #### `margin-start`
227    ///  Margin on start of widget, horizontally. This property supports
228    /// left-to-right and right-to-left text directions.
229    ///
230    /// This property adds margin outside of the widget's normal size
231    /// request, the margin will be added in addition to the size from
232    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
233    ///
234    /// Readable | Writable
235    ///
236    ///
237    /// #### `margin-top`
238    ///  Margin on top side of widget.
239    ///
240    /// This property adds margin outside of the widget's normal size
241    /// request, the margin will be added in addition to the size from
242    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
243    ///
244    /// Readable | Writable
245    ///
246    ///
247    /// #### `name`
248    ///  Readable | Writable
249    ///
250    ///
251    /// #### `no-show-all`
252    ///  Readable | Writable
253    ///
254    ///
255    /// #### `opacity`
256    ///  The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
257    /// more details about window opacity.
258    ///
259    /// Before 3.8 this was only available in GtkWindow
260    ///
261    /// Readable | Writable
262    ///
263    ///
264    /// #### `parent`
265    ///  Readable | Writable
266    ///
267    ///
268    /// #### `receives-default`
269    ///  Readable | Writable
270    ///
271    ///
272    /// #### `scale-factor`
273    ///  The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
274    /// more details about widget scaling.
275    ///
276    /// Readable
277    ///
278    ///
279    /// #### `sensitive`
280    ///  Readable | Writable
281    ///
282    ///
283    /// #### `style`
284    ///  The style of the widget, which contains information about how it will look (colors, etc).
285    ///
286    /// Readable | Writable
287    ///
288    ///
289    /// #### `tooltip-markup`
290    ///  Sets the text of tooltip to be the given string, which is marked up
291    /// with the [Pango text markup language][PangoMarkupFormat].
292    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
293    ///
294    /// This is a convenience property which will take care of getting the
295    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
296    /// will automatically be set to [`true`] and there will be taken care of
297    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
298    ///
299    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
300    /// are set, the last one wins.
301    ///
302    /// Readable | Writable
303    ///
304    ///
305    /// #### `tooltip-text`
306    ///  Sets the text of tooltip to be the given string.
307    ///
308    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
309    ///
310    /// This is a convenience property which will take care of getting the
311    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
312    /// will automatically be set to [`true`] and there will be taken care of
313    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
314    ///
315    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
316    /// are set, the last one wins.
317    ///
318    /// Readable | Writable
319    ///
320    ///
321    /// #### `valign`
322    ///  How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
323    ///
324    /// Readable | Writable
325    ///
326    ///
327    /// #### `vexpand`
328    ///  Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
329    ///
330    /// Readable | Writable
331    ///
332    ///
333    /// #### `vexpand-set`
334    ///  Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
335    ///
336    /// Readable | Writable
337    ///
338    ///
339    /// #### `visible`
340    ///  Readable | Writable
341    ///
342    ///
343    /// #### `width-request`
344    ///  Readable | Writable
345    ///
346    ///
347    /// #### `window`
348    ///  The widget's window if it is realized, [`None`] otherwise.
349    ///
350    /// Readable
351    /// </details>
352    ///
353    /// ## Signals
354    ///
355    ///
356    /// #### `activate-cursor-row`
357    ///  Action
358    ///
359    ///
360    /// #### `move-cursor`
361    ///  Action
362    ///
363    ///
364    /// #### `row-activated`
365    ///  The ::row-activated signal is emitted when a row has been activated by the user.
366    ///
367    ///
368    ///
369    ///
370    /// #### `row-selected`
371    ///  The ::row-selected signal is emitted when a new row is selected, or
372    /// (with a [`None`] `row`) when the selection is cleared.
373    ///
374    /// When the `box_` is using [`SelectionMode::Multiple`][crate::SelectionMode::Multiple], this signal will not
375    /// give you the full picture of selection changes, and you should use
376    /// the [`selected-rows-changed`][struct@crate::ListBox#selected-rows-changed] signal instead.
377    ///
378    ///
379    ///
380    ///
381    /// #### `select-all`
382    ///  The ::select-all signal is a [keybinding signal][GtkBindingSignal]
383    /// which gets emitted to select all children of the box, if the selection
384    /// mode permits it.
385    ///
386    /// The default bindings for this signal is Ctrl-a.
387    ///
388    /// Action
389    ///
390    ///
391    /// #### `selected-rows-changed`
392    ///  The ::selected-rows-changed signal is emitted when the
393    /// set of selected rows changes.
394    ///
395    ///
396    ///
397    ///
398    /// #### `toggle-cursor-row`
399    ///  Action
400    ///
401    ///
402    /// #### `unselect-all`
403    ///  The ::unselect-all signal is a [keybinding signal][GtkBindingSignal]
404    /// which gets emitted to unselect all children of the box, if the selection
405    /// mode permits it.
406    ///
407    /// The default bindings for this signal is Ctrl-Shift-a.
408    ///
409    /// Action
410    /// <details><summary><h4>Container</h4></summary>
411    ///
412    ///
413    /// #### `add`
414    ///
415    ///
416    ///
417    /// #### `check-resize`
418    ///
419    ///
420    ///
421    /// #### `remove`
422    ///
423    ///
424    ///
425    /// #### `set-focus-child`
426    ///
427    /// </details>
428    /// <details><summary><h4>Widget</h4></summary>
429    ///
430    ///
431    /// #### `accel-closures-changed`
432    ///
433    ///
434    ///
435    /// #### `button-press-event`
436    ///  The ::button-press-event signal will be emitted when a button
437    /// (typically from a mouse) is pressed.
438    ///
439    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
440    /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
441    ///
442    /// This signal will be sent to the grab widget if there is one.
443    ///
444    ///
445    ///
446    ///
447    /// #### `button-release-event`
448    ///  The ::button-release-event signal will be emitted when a button
449    /// (typically from a mouse) is released.
450    ///
451    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
452    /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
453    ///
454    /// This signal will be sent to the grab widget if there is one.
455    ///
456    ///
457    ///
458    ///
459    /// #### `can-activate-accel`
460    ///  Determines whether an accelerator that activates the signal
461    /// identified by `signal_id` can currently be activated.
462    /// This signal is present to allow applications and derived
463    /// widgets to override the default [`Widget`][crate::Widget] handling
464    /// for determining whether an accelerator can be activated.
465    ///
466    ///
467    ///
468    ///
469    /// #### `child-notify`
470    ///  The ::child-notify signal is emitted for each
471    /// [child property][child-properties] that has
472    /// changed on an object. The signal's detail holds the property name.
473    ///
474    /// Detailed
475    ///
476    ///
477    /// #### `composited-changed`
478    ///  The ::composited-changed signal is emitted when the composited
479    /// status of `widgets` screen changes.
480    /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
481    ///
482    /// Action
483    ///
484    ///
485    /// #### `configure-event`
486    ///  The ::configure-event signal will be emitted when the size, position or
487    /// stacking of the `widget`'s window has changed.
488    ///
489    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
490    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
491    /// automatically for all new windows.
492    ///
493    ///
494    ///
495    ///
496    /// #### `damage-event`
497    ///  Emitted when a redirected window belonging to `widget` gets drawn into.
498    /// The region/area members of the event shows what area of the redirected
499    /// drawable was drawn into.
500    ///
501    ///
502    ///
503    ///
504    /// #### `delete-event`
505    ///  The ::delete-event signal is emitted if a user requests that
506    /// a toplevel window is closed. The default handler for this signal
507    /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
508    /// this signal will cause the window to be hidden instead, so that
509    /// it can later be shown again without reconstructing it.
510    ///
511    ///
512    ///
513    ///
514    /// #### `destroy`
515    ///  Signals that all holders of a reference to the widget should release
516    /// the reference that they hold. May result in finalization of the widget
517    /// if all references are released.
518    ///
519    /// This signal is not suitable for saving widget state.
520    ///
521    ///
522    ///
523    ///
524    /// #### `destroy-event`
525    ///  The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
526    /// You rarely get this signal, because most widgets disconnect themselves
527    /// from their window before they destroy it, so no widget owns the
528    /// window at destroy time.
529    ///
530    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
531    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
532    /// automatically for all new windows.
533    ///
534    ///
535    ///
536    ///
537    /// #### `direction-changed`
538    ///  The ::direction-changed signal is emitted when the text direction
539    /// of a widget changes.
540    ///
541    ///
542    ///
543    ///
544    /// #### `drag-begin`
545    ///  The ::drag-begin signal is emitted on the drag source when a drag is
546    /// started. A typical reason to connect to this signal is to set up a
547    /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
548    ///
549    /// Note that some widgets set up a drag icon in the default handler of
550    /// this signal, so you may have to use `g_signal_connect_after()` to
551    /// override what the default handler did.
552    ///
553    ///
554    ///
555    ///
556    /// #### `drag-data-delete`
557    ///  The ::drag-data-delete signal is emitted on the drag source when a drag
558    /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
559    /// handler is responsible for deleting the data that has been dropped. What
560    /// "delete" means depends on the context of the drag operation.
561    ///
562    ///
563    ///
564    ///
565    /// #### `drag-data-get`
566    ///  The ::drag-data-get signal is emitted on the drag source when the drop
567    /// site requests the data which is dragged. It is the responsibility of
568    /// the signal handler to fill `data` with the data in the format which
569    /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
570    /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
571    ///
572    ///
573    ///
574    ///
575    /// #### `drag-data-received`
576    ///  The ::drag-data-received signal is emitted on the drop site when the
577    /// dragged data has been received. If the data was received in order to
578    /// determine whether the drop will be accepted, the handler is expected
579    /// to call `gdk_drag_status()` and not finish the drag.
580    /// If the data was received in response to a [`drag-drop`][struct@crate::Widget#drag-drop] signal
581    /// (and this is the last target to be received), the handler for this
582    /// signal is expected to process the received data and then call
583    /// `gtk_drag_finish()`, setting the `success` parameter depending on
584    /// whether the data was processed successfully.
585    ///
586    /// Applications must create some means to determine why the signal was emitted
587    /// and therefore whether to call `gdk_drag_status()` or `gtk_drag_finish()`.
588    ///
589    /// The handler may inspect the selected action with
590    /// [`DragContext::selected_action()`][crate::gdk::DragContext::selected_action()] before calling
591    /// `gtk_drag_finish()`, e.g. to implement [`gdk::DragAction::ASK`][crate::gdk::DragAction::ASK] as
592    /// shown in the following example:
593    ///
594    ///
595    /// **⚠️ The following code is in C ⚠️**
596    ///
597    /// ```C
598    /// void
599    /// drag_data_received (GtkWidget          *widget,
600    ///                     GdkDragContext     *context,
601    ///                     gint                x,
602    ///                     gint                y,
603    ///                     GtkSelectionData   *data,
604    ///                     guint               info,
605    ///                     guint               time)
606    /// {
607    ///   if ((data->length >= 0) && (data->format == 8))
608    ///     {
609    ///       GdkDragAction action;
610    ///
611    ///       // handle data here
612    ///
613    ///       action = gdk_drag_context_get_selected_action (context);
614    ///       if (action == GDK_ACTION_ASK)
615    ///         {
616    ///           GtkWidget *dialog;
617    ///           gint response;
618    ///
619    ///           dialog = gtk_message_dialog_new (NULL,
620    ///                                            GTK_DIALOG_MODAL |
621    ///                                            GTK_DIALOG_DESTROY_WITH_PARENT,
622    ///                                            GTK_MESSAGE_INFO,
623    ///                                            GTK_BUTTONS_YES_NO,
624    ///                                            "Move the data ?\n");
625    ///           response = gtk_dialog_run (GTK_DIALOG (dialog));
626    ///           gtk_widget_destroy (dialog);
627    ///
628    ///           if (response == GTK_RESPONSE_YES)
629    ///             action = GDK_ACTION_MOVE;
630    ///           else
631    ///             action = GDK_ACTION_COPY;
632    ///          }
633    ///
634    ///       gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
635    ///     }
636    ///   else
637    ///     gtk_drag_finish (context, FALSE, FALSE, time);
638    ///  }
639    /// ```
640    ///
641    ///
642    ///
643    ///
644    /// #### `drag-drop`
645    ///  The ::drag-drop signal is emitted on the drop site when the user drops
646    /// the data onto the widget. The signal handler must determine whether
647    /// the cursor position is in a drop zone or not. If it is not in a drop
648    /// zone, it returns [`false`] and no further processing is necessary.
649    /// Otherwise, the handler returns [`true`]. In this case, the handler must
650    /// ensure that `gtk_drag_finish()` is called to let the source know that
651    /// the drop is done. The call to `gtk_drag_finish()` can be done either
652    /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
653    /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
654    /// or more of the supported targets.
655    ///
656    ///
657    ///
658    ///
659    /// #### `drag-end`
660    ///  The ::drag-end signal is emitted on the drag source when a drag is
661    /// finished. A typical reason to connect to this signal is to undo
662    /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
663    ///
664    ///
665    ///
666    ///
667    /// #### `drag-failed`
668    ///  The ::drag-failed signal is emitted on the drag source when a drag has
669    /// failed. The signal handler may hook custom code to handle a failed DnD
670    /// operation based on the type of error, it returns [`true`] is the failure has
671    /// been already handled (not showing the default "drag operation failed"
672    /// animation), otherwise it returns [`false`].
673    ///
674    ///
675    ///
676    ///
677    /// #### `drag-leave`
678    ///  The ::drag-leave signal is emitted on the drop site when the cursor
679    /// leaves the widget. A typical reason to connect to this signal is to
680    /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
681    /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
682    ///
683    ///
684    /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
685    /// ::drag-drop signal, for instance to allow cleaning up of a preview item
686    /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
687    ///
688    ///
689    ///
690    ///
691    /// #### `drag-motion`
692    ///  The ::drag-motion signal is emitted on the drop site when the user
693    /// moves the cursor over the widget during a drag. The signal handler
694    /// must determine whether the cursor position is in a drop zone or not.
695    /// If it is not in a drop zone, it returns [`false`] and no further processing
696    /// is necessary. Otherwise, the handler returns [`true`]. In this case, the
697    /// handler is responsible for providing the necessary information for
698    /// displaying feedback to the user, by calling `gdk_drag_status()`.
699    ///
700    /// If the decision whether the drop will be accepted or rejected can't be
701    /// made based solely on the cursor position and the type of the data, the
702    /// handler may inspect the dragged data by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] and
703    /// defer the `gdk_drag_status()` call to the [`drag-data-received`][struct@crate::Widget#drag-data-received]
704    /// handler. Note that you must pass [`DestDefaults::DROP`][crate::DestDefaults::DROP],
705    /// [`DestDefaults::MOTION`][crate::DestDefaults::MOTION] or [`DestDefaults::ALL`][crate::DestDefaults::ALL] to [`WidgetExtManual::drag_dest_set()`][crate::prelude::WidgetExtManual::drag_dest_set()]
706    /// when using the drag-motion signal that way.
707    ///
708    /// Also note that there is no drag-enter signal. The drag receiver has to
709    /// keep track of whether he has received any drag-motion signals since the
710    /// last [`drag-leave`][struct@crate::Widget#drag-leave] and if not, treat the drag-motion signal as
711    /// an "enter" signal. Upon an "enter", the handler will typically highlight
712    /// the drop site with [`WidgetExt::drag_highlight()`][crate::prelude::WidgetExt::drag_highlight()].
713    ///
714    ///
715    /// **⚠️ The following code is in C ⚠️**
716    ///
717    /// ```C
718    /// static void
719    /// drag_motion (GtkWidget      *widget,
720    ///              GdkDragContext *context,
721    ///              gint            x,
722    ///              gint            y,
723    ///              guint           time)
724    /// {
725    ///   GdkAtom target;
726    ///
727    ///   PrivateData *private_data = GET_PRIVATE_DATA (widget);
728    ///
729    ///   if (!private_data->drag_highlight)
730    ///    {
731    ///      private_data->drag_highlight = 1;
732    ///      gtk_drag_highlight (widget);
733    ///    }
734    ///
735    ///   target = gtk_drag_dest_find_target (widget, context, NULL);
736    ///   if (target == GDK_NONE)
737    ///     gdk_drag_status (context, 0, time);
738    ///   else
739    ///    {
740    ///      private_data->pending_status
741    ///         = gdk_drag_context_get_suggested_action (context);
742    ///      gtk_drag_get_data (widget, context, target, time);
743    ///    }
744    ///
745    ///   return TRUE;
746    /// }
747    ///
748    /// static void
749    /// drag_data_received (GtkWidget        *widget,
750    ///                     GdkDragContext   *context,
751    ///                     gint              x,
752    ///                     gint              y,
753    ///                     GtkSelectionData *selection_data,
754    ///                     guint             info,
755    ///                     guint             time)
756    /// {
757    ///   PrivateData *private_data = GET_PRIVATE_DATA (widget);
758    ///
759    ///   if (private_data->suggested_action)
760    ///    {
761    ///      private_data->suggested_action = 0;
762    ///
763    ///      // We are getting this data due to a request in drag_motion,
764    ///      // rather than due to a request in drag_drop, so we are just
765    ///      // supposed to call gdk_drag_status(), not actually paste in
766    ///      // the data.
767    ///
768    ///      str = gtk_selection_data_get_text (selection_data);
769    ///      if (!data_is_acceptable (str))
770    ///        gdk_drag_status (context, 0, time);
771    ///      else
772    ///        gdk_drag_status (context,
773    ///                         private_data->suggested_action,
774    ///                         time);
775    ///    }
776    ///   else
777    ///    {
778    ///      // accept the drop
779    ///    }
780    /// }
781    /// ```
782    ///
783    ///
784    ///
785    ///
786    /// #### `draw`
787    ///  This signal is emitted when a widget is supposed to render itself.
788    /// The `widget`'s top left corner must be painted at the origin of
789    /// the passed in context and be sized to the values returned by
790    /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
791    /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
792    ///
793    /// Signal handlers connected to this signal can modify the cairo
794    /// context passed as `cr` in any way they like and don't need to
795    /// restore it. The signal emission takes care of calling `cairo_save()`
796    /// before and `cairo_restore()` after invoking the handler.
797    ///
798    /// The signal handler will get a `cr` with a clip region already set to the
799    /// widget's dirty region, i.e. to the area that needs repainting. Complicated
800    /// widgets that want to avoid redrawing themselves completely can get the full
801    /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
802    /// get a finer-grained representation of the dirty region with
803    /// `cairo_copy_clip_rectangle_list()`.
804    ///
805    ///
806    ///
807    ///
808    /// #### `enter-notify-event`
809    ///  The ::enter-notify-event will be emitted when the pointer enters
810    /// the `widget`'s window.
811    ///
812    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
813    /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
814    ///
815    /// This signal will be sent to the grab widget if there is one.
816    ///
817    ///
818    ///
819    ///
820    /// #### `event`
821    ///  The GTK+ main loop will emit three signals for each GDK event delivered
822    /// to a widget: one generic ::event signal, another, more specific,
823    /// signal that matches the type of event delivered (e.g.
824    /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
825    /// [`event-after`][struct@crate::Widget#event-after] signal.
826    ///
827    ///
828    ///
829    ///
830    /// #### `event-after`
831    ///  After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
832    /// the second more specific signal, ::event-after will be emitted
833    /// regardless of the previous two signals handlers return values.
834    ///
835    ///
836    ///
837    ///
838    /// #### `focus`
839    ///
840    ///
841    ///
842    /// #### `focus-in-event`
843    ///  The ::focus-in-event signal will be emitted when the keyboard focus
844    /// enters the `widget`'s window.
845    ///
846    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
847    /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
848    ///
849    ///
850    ///
851    ///
852    /// #### `focus-out-event`
853    ///  The ::focus-out-event signal will be emitted when the keyboard focus
854    /// leaves the `widget`'s window.
855    ///
856    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
857    /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
858    ///
859    ///
860    ///
861    ///
862    /// #### `grab-broken-event`
863    ///  Emitted when a pointer or keyboard grab on a window belonging
864    /// to `widget` gets broken.
865    ///
866    /// On X11, this happens when the grab window becomes unviewable
867    /// (i.e. it or one of its ancestors is unmapped), or if the same
868    /// application grabs the pointer or keyboard again.
869    ///
870    ///
871    ///
872    ///
873    /// #### `grab-focus`
874    ///  Action
875    ///
876    ///
877    /// #### `grab-notify`
878    ///  The ::grab-notify signal is emitted when a widget becomes
879    /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
880    /// another widget, or when it becomes unshadowed due to a grab
881    /// being removed.
882    ///
883    /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
884    /// grab widget in the grab stack of its window group is not
885    /// its ancestor.
886    ///
887    ///
888    ///
889    ///
890    /// #### `hide`
891    ///  The ::hide signal is emitted when `widget` is hidden, for example with
892    /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
893    ///
894    ///
895    ///
896    ///
897    /// #### `hierarchy-changed`
898    ///  The ::hierarchy-changed signal is emitted when the
899    /// anchored state of a widget changes. A widget is
900    /// “anchored” when its toplevel
901    /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
902    /// a widget changes from un-anchored to anchored or vice-versa.
903    ///
904    ///
905    ///
906    ///
907    /// #### `key-press-event`
908    ///  The ::key-press-event signal is emitted when a key is pressed. The signal
909    /// emission will reoccur at the key-repeat rate when the key is kept pressed.
910    ///
911    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
912    /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
913    ///
914    /// This signal will be sent to the grab widget if there is one.
915    ///
916    ///
917    ///
918    ///
919    /// #### `key-release-event`
920    ///  The ::key-release-event signal is emitted when a key is released.
921    ///
922    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
923    /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
924    ///
925    /// This signal will be sent to the grab widget if there is one.
926    ///
927    ///
928    ///
929    ///
930    /// #### `keynav-failed`
931    ///  Gets emitted if keyboard navigation fails.
932    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
933    ///
934    ///
935    ///
936    ///
937    /// #### `leave-notify-event`
938    ///  The ::leave-notify-event will be emitted when the pointer leaves
939    /// the `widget`'s window.
940    ///
941    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
942    /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
943    ///
944    /// This signal will be sent to the grab widget if there is one.
945    ///
946    ///
947    ///
948    ///
949    /// #### `map`
950    ///  The ::map signal is emitted when `widget` is going to be mapped, that is
951    /// when the widget is visible (which is controlled with
952    /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
953    /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
954    /// be emitted.
955    ///
956    /// The ::map signal can be used to determine whether a widget will be drawn,
957    /// for instance it can resume an animation that was stopped during the
958    /// emission of [`unmap`][struct@crate::Widget#unmap].
959    ///
960    ///
961    ///
962    ///
963    /// #### `map-event`
964    ///  The ::map-event signal will be emitted when the `widget`'s window is
965    /// mapped. A window is mapped when it becomes visible on the screen.
966    ///
967    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
968    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
969    /// automatically for all new windows.
970    ///
971    ///
972    ///
973    ///
974    /// #### `mnemonic-activate`
975    ///  The default handler for this signal activates `widget` if `group_cycling`
976    /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
977    ///
978    ///
979    ///
980    ///
981    /// #### `motion-notify-event`
982    ///  The ::motion-notify-event signal is emitted when the pointer moves
983    /// over the widget's [`gdk::Window`][crate::gdk::Window].
984    ///
985    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
986    /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
987    ///
988    /// This signal will be sent to the grab widget if there is one.
989    ///
990    ///
991    ///
992    ///
993    /// #### `move-focus`
994    ///  Action
995    ///
996    ///
997    /// #### `parent-set`
998    ///  The ::parent-set signal is emitted when a new parent
999    /// has been set on a widget.
1000    ///
1001    ///
1002    ///
1003    ///
1004    /// #### `popup-menu`
1005    ///  This signal gets emitted whenever a widget should pop up a context
1006    /// menu. This usually happens through the standard key binding mechanism;
1007    /// by pressing a certain key while a widget is focused, the user can cause
1008    /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
1009    /// a menu with clipboard commands. See the
1010    /// [Popup Menu Migration Checklist][checklist-popup-menu]
1011    /// for an example of how to use this signal.
1012    ///
1013    /// Action
1014    ///
1015    ///
1016    /// #### `property-notify-event`
1017    ///  The ::property-notify-event signal will be emitted when a property on
1018    /// the `widget`'s window has been changed or deleted.
1019    ///
1020    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1021    /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
1022    ///
1023    ///
1024    ///
1025    ///
1026    /// #### `proximity-in-event`
1027    ///  To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1028    /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
1029    ///
1030    /// This signal will be sent to the grab widget if there is one.
1031    ///
1032    ///
1033    ///
1034    ///
1035    /// #### `proximity-out-event`
1036    ///  To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1037    /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
1038    ///
1039    /// This signal will be sent to the grab widget if there is one.
1040    ///
1041    ///
1042    ///
1043    ///
1044    /// #### `query-tooltip`
1045    ///  Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
1046    /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
1047    /// focus in keyboard mode.
1048    ///
1049    /// Using the given coordinates, the signal handler should determine
1050    /// whether a tooltip should be shown for `widget`. If this is the case
1051    /// [`true`] should be returned, [`false`] otherwise. Note that if
1052    /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
1053    /// should not be used.
1054    ///
1055    /// The signal handler is free to manipulate `tooltip` with the therefore
1056    /// destined function calls.
1057    ///
1058    ///
1059    ///
1060    ///
1061    /// #### `realize`
1062    ///  The ::realize signal is emitted when `widget` is associated with a
1063    /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
1064    /// widget has been mapped (that is, it is going to be drawn).
1065    ///
1066    ///
1067    ///
1068    ///
1069    /// #### `screen-changed`
1070    ///  The ::screen-changed signal gets emitted when the
1071    /// screen of a widget has changed.
1072    ///
1073    ///
1074    ///
1075    ///
1076    /// #### `scroll-event`
1077    ///  The ::scroll-event signal is emitted when a button in the 4 to 7
1078    /// range is pressed. Wheel mice are usually configured to generate
1079    /// button press events for buttons 4 and 5 when the wheel is turned.
1080    ///
1081    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1082    /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
1083    ///
1084    /// This signal will be sent to the grab widget if there is one.
1085    ///
1086    ///
1087    ///
1088    ///
1089    /// #### `selection-clear-event`
1090    ///  The ::selection-clear-event signal will be emitted when the
1091    /// the `widget`'s window has lost ownership of a selection.
1092    ///
1093    ///
1094    ///
1095    ///
1096    /// #### `selection-get`
1097    ///
1098    ///
1099    ///
1100    /// #### `selection-notify-event`
1101    ///
1102    ///
1103    ///
1104    /// #### `selection-received`
1105    ///
1106    ///
1107    ///
1108    /// #### `selection-request-event`
1109    ///  The ::selection-request-event signal will be emitted when
1110    /// another client requests ownership of the selection owned by
1111    /// the `widget`'s window.
1112    ///
1113    ///
1114    ///
1115    ///
1116    /// #### `show`
1117    ///  The ::show signal is emitted when `widget` is shown, for example with
1118    /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
1119    ///
1120    ///
1121    ///
1122    ///
1123    /// #### `show-help`
1124    ///  Action
1125    ///
1126    ///
1127    /// #### `size-allocate`
1128    ///
1129    ///
1130    ///
1131    /// #### `state-changed`
1132    ///  The ::state-changed signal is emitted when the widget state changes.
1133    /// See `gtk_widget_get_state()`.
1134    ///
1135    ///
1136    ///
1137    ///
1138    /// #### `state-flags-changed`
1139    ///  The ::state-flags-changed signal is emitted when the widget state
1140    /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
1141    ///
1142    ///
1143    ///
1144    ///
1145    /// #### `style-set`
1146    ///  The ::style-set signal is emitted when a new style has been set
1147    /// on a widget. Note that style-modifying functions like
1148    /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1149    ///
1150    /// Note that this signal is emitted for changes to the deprecated
1151    /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1152    /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1153    ///
1154    ///
1155    ///
1156    ///
1157    /// #### `style-updated`
1158    ///  The ::style-updated signal is a convenience signal that is emitted when the
1159    /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1160    /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1161    ///
1162    /// Note that style-modifying functions like `gtk_widget_override_color()` also
1163    /// cause this signal to be emitted.
1164    ///
1165    ///
1166    ///
1167    ///
1168    /// #### `touch-event`
1169    ///
1170    ///
1171    ///
1172    /// #### `unmap`
1173    ///  The ::unmap signal is emitted when `widget` is going to be unmapped, which
1174    /// means that either it or any of its parents up to the toplevel widget have
1175    /// been set as hidden.
1176    ///
1177    /// As ::unmap indicates that a widget will not be shown any longer, it can be
1178    /// used to, for example, stop an animation on the widget.
1179    ///
1180    ///
1181    ///
1182    ///
1183    /// #### `unmap-event`
1184    ///  The ::unmap-event signal will be emitted when the `widget`'s window is
1185    /// unmapped. A window is unmapped when it becomes invisible on the screen.
1186    ///
1187    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1188    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1189    /// automatically for all new windows.
1190    ///
1191    ///
1192    ///
1193    ///
1194    /// #### `unrealize`
1195    ///  The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1196    /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1197    /// called or the widget has been unmapped (that is, it is going to be
1198    /// hidden).
1199    ///
1200    ///
1201    ///
1202    ///
1203    /// #### `visibility-notify-event`
1204    ///  The ::visibility-notify-event will be emitted when the `widget`'s
1205    /// window is obscured or unobscured.
1206    ///
1207    /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1208    /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1209    ///
1210    ///
1211    ///
1212    ///
1213    /// #### `window-state-event`
1214    ///  The ::window-state-event will be emitted when the state of the
1215    /// toplevel window associated to the `widget` changes.
1216    ///
1217    /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1218    /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1219    /// this mask automatically for all new windows.
1220    ///
1221    ///
1222    /// </details>
1223    ///
1224    /// # Implements
1225    ///
1226    /// [`ListBoxExt`][trait@crate::prelude::ListBoxExt], [`ContainerExt`][trait@crate::prelude::ContainerExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ListBoxExtManual`][trait@crate::prelude::ListBoxExtManual], [`ContainerExtManual`][trait@crate::prelude::ContainerExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
1227    #[doc(alias = "GtkListBox")]
1228    pub struct ListBox(Object<ffi::GtkListBox, ffi::GtkListBoxClass>) @extends Container, Widget, @implements Buildable;
1229
1230    match fn {
1231        type_ => || ffi::gtk_list_box_get_type(),
1232    }
1233}
1234
1235impl ListBox {
1236    pub const NONE: Option<&'static ListBox> = None;
1237
1238    /// Creates a new [`ListBox`][crate::ListBox] container.
1239    ///
1240    /// # Returns
1241    ///
1242    /// a new [`ListBox`][crate::ListBox]
1243    #[doc(alias = "gtk_list_box_new")]
1244    pub fn new() -> ListBox {
1245        assert_initialized_main_thread!();
1246        unsafe { Widget::from_glib_none(ffi::gtk_list_box_new()).unsafe_cast() }
1247    }
1248
1249    // rustdoc-stripper-ignore-next
1250    /// Creates a new builder-pattern struct instance to construct [`ListBox`] objects.
1251    ///
1252    /// This method returns an instance of [`ListBoxBuilder`](crate::builders::ListBoxBuilder) which can be used to create [`ListBox`] objects.
1253    pub fn builder() -> ListBoxBuilder {
1254        ListBoxBuilder::new()
1255    }
1256}
1257
1258impl Default for ListBox {
1259    fn default() -> Self {
1260        Self::new()
1261    }
1262}
1263
1264// rustdoc-stripper-ignore-next
1265/// A [builder-pattern] type to construct [`ListBox`] objects.
1266///
1267/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1268#[must_use = "The builder must be built to be used"]
1269pub struct ListBoxBuilder {
1270    builder: glib::object::ObjectBuilder<'static, ListBox>,
1271}
1272
1273impl ListBoxBuilder {
1274    fn new() -> Self {
1275        Self {
1276            builder: glib::object::Object::builder(),
1277        }
1278    }
1279
1280    pub fn activate_on_single_click(self, activate_on_single_click: bool) -> Self {
1281        Self {
1282            builder: self
1283                .builder
1284                .property("activate-on-single-click", activate_on_single_click),
1285        }
1286    }
1287
1288    pub fn selection_mode(self, selection_mode: SelectionMode) -> Self {
1289        Self {
1290            builder: self.builder.property("selection-mode", selection_mode),
1291        }
1292    }
1293
1294    pub fn border_width(self, border_width: u32) -> Self {
1295        Self {
1296            builder: self.builder.property("border-width", border_width),
1297        }
1298    }
1299
1300    pub fn child(self, child: &impl IsA<Widget>) -> Self {
1301        Self {
1302            builder: self.builder.property("child", child.clone().upcast()),
1303        }
1304    }
1305
1306    pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
1307        Self {
1308            builder: self.builder.property("resize-mode", resize_mode),
1309        }
1310    }
1311
1312    pub fn app_paintable(self, app_paintable: bool) -> Self {
1313        Self {
1314            builder: self.builder.property("app-paintable", app_paintable),
1315        }
1316    }
1317
1318    pub fn can_default(self, can_default: bool) -> Self {
1319        Self {
1320            builder: self.builder.property("can-default", can_default),
1321        }
1322    }
1323
1324    pub fn can_focus(self, can_focus: bool) -> Self {
1325        Self {
1326            builder: self.builder.property("can-focus", can_focus),
1327        }
1328    }
1329
1330    pub fn events(self, events: gdk::EventMask) -> Self {
1331        Self {
1332            builder: self.builder.property("events", events),
1333        }
1334    }
1335
1336    /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1337    pub fn expand(self, expand: bool) -> Self {
1338        Self {
1339            builder: self.builder.property("expand", expand),
1340        }
1341    }
1342
1343    /// Whether the widget should grab focus when it is clicked with the mouse.
1344    ///
1345    /// This property is only relevant for widgets that can take focus.
1346    ///
1347    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1348    /// GtkComboBox) implemented this property individually.
1349    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1350        Self {
1351            builder: self.builder.property("focus-on-click", focus_on_click),
1352        }
1353    }
1354
1355    /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1356    pub fn halign(self, halign: Align) -> Self {
1357        Self {
1358            builder: self.builder.property("halign", halign),
1359        }
1360    }
1361
1362    pub fn has_default(self, has_default: bool) -> Self {
1363        Self {
1364            builder: self.builder.property("has-default", has_default),
1365        }
1366    }
1367
1368    pub fn has_focus(self, has_focus: bool) -> Self {
1369        Self {
1370            builder: self.builder.property("has-focus", has_focus),
1371        }
1372    }
1373
1374    /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1375    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1376    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1377    /// whether it will provide a tooltip or not.
1378    ///
1379    /// Note that setting this property to [`true`] for the first time will change
1380    /// the event masks of the GdkWindows of this widget to include leave-notify
1381    /// and motion-notify events. This cannot and will not be undone when the
1382    /// property is set to [`false`] again.
1383    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1384        Self {
1385            builder: self.builder.property("has-tooltip", has_tooltip),
1386        }
1387    }
1388
1389    pub fn height_request(self, height_request: i32) -> Self {
1390        Self {
1391            builder: self.builder.property("height-request", height_request),
1392        }
1393    }
1394
1395    /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1396    pub fn hexpand(self, hexpand: bool) -> Self {
1397        Self {
1398            builder: self.builder.property("hexpand", hexpand),
1399        }
1400    }
1401
1402    /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1403    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1404        Self {
1405            builder: self.builder.property("hexpand-set", hexpand_set),
1406        }
1407    }
1408
1409    pub fn is_focus(self, is_focus: bool) -> Self {
1410        Self {
1411            builder: self.builder.property("is-focus", is_focus),
1412        }
1413    }
1414
1415    /// Sets all four sides' margin at once. If read, returns max
1416    /// margin on any side.
1417    pub fn margin(self, margin: i32) -> Self {
1418        Self {
1419            builder: self.builder.property("margin", margin),
1420        }
1421    }
1422
1423    /// Margin on bottom side of widget.
1424    ///
1425    /// This property adds margin outside of the widget's normal size
1426    /// request, the margin will be added in addition to the size from
1427    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1428    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1429        Self {
1430            builder: self.builder.property("margin-bottom", margin_bottom),
1431        }
1432    }
1433
1434    /// Margin on end of widget, horizontally. This property supports
1435    /// left-to-right and right-to-left text directions.
1436    ///
1437    /// This property adds margin outside of the widget's normal size
1438    /// request, the margin will be added in addition to the size from
1439    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1440    pub fn margin_end(self, margin_end: i32) -> Self {
1441        Self {
1442            builder: self.builder.property("margin-end", margin_end),
1443        }
1444    }
1445
1446    /// Margin on start of widget, horizontally. This property supports
1447    /// left-to-right and right-to-left text directions.
1448    ///
1449    /// This property adds margin outside of the widget's normal size
1450    /// request, the margin will be added in addition to the size from
1451    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1452    pub fn margin_start(self, margin_start: i32) -> Self {
1453        Self {
1454            builder: self.builder.property("margin-start", margin_start),
1455        }
1456    }
1457
1458    /// Margin on top side of widget.
1459    ///
1460    /// This property adds margin outside of the widget's normal size
1461    /// request, the margin will be added in addition to the size from
1462    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1463    pub fn margin_top(self, margin_top: i32) -> Self {
1464        Self {
1465            builder: self.builder.property("margin-top", margin_top),
1466        }
1467    }
1468
1469    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1470        Self {
1471            builder: self.builder.property("name", name.into()),
1472        }
1473    }
1474
1475    pub fn no_show_all(self, no_show_all: bool) -> Self {
1476        Self {
1477            builder: self.builder.property("no-show-all", no_show_all),
1478        }
1479    }
1480
1481    /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1482    /// more details about window opacity.
1483    ///
1484    /// Before 3.8 this was only available in GtkWindow
1485    pub fn opacity(self, opacity: f64) -> Self {
1486        Self {
1487            builder: self.builder.property("opacity", opacity),
1488        }
1489    }
1490
1491    pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1492        Self {
1493            builder: self.builder.property("parent", parent.clone().upcast()),
1494        }
1495    }
1496
1497    pub fn receives_default(self, receives_default: bool) -> Self {
1498        Self {
1499            builder: self.builder.property("receives-default", receives_default),
1500        }
1501    }
1502
1503    pub fn sensitive(self, sensitive: bool) -> Self {
1504        Self {
1505            builder: self.builder.property("sensitive", sensitive),
1506        }
1507    }
1508
1509    /// Sets the text of tooltip to be the given string, which is marked up
1510    /// with the [Pango text markup language][PangoMarkupFormat].
1511    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1512    ///
1513    /// This is a convenience property which will take care of getting the
1514    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1515    /// will automatically be set to [`true`] and there will be taken care of
1516    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1517    ///
1518    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1519    /// are set, the last one wins.
1520    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1521        Self {
1522            builder: self
1523                .builder
1524                .property("tooltip-markup", tooltip_markup.into()),
1525        }
1526    }
1527
1528    /// Sets the text of tooltip to be the given string.
1529    ///
1530    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1531    ///
1532    /// This is a convenience property which will take care of getting the
1533    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1534    /// will automatically be set to [`true`] and there will be taken care of
1535    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1536    ///
1537    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1538    /// are set, the last one wins.
1539    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1540        Self {
1541            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1542        }
1543    }
1544
1545    /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1546    pub fn valign(self, valign: Align) -> Self {
1547        Self {
1548            builder: self.builder.property("valign", valign),
1549        }
1550    }
1551
1552    /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1553    pub fn vexpand(self, vexpand: bool) -> Self {
1554        Self {
1555            builder: self.builder.property("vexpand", vexpand),
1556        }
1557    }
1558
1559    /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1560    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1561        Self {
1562            builder: self.builder.property("vexpand-set", vexpand_set),
1563        }
1564    }
1565
1566    pub fn visible(self, visible: bool) -> Self {
1567        Self {
1568            builder: self.builder.property("visible", visible),
1569        }
1570    }
1571
1572    pub fn width_request(self, width_request: i32) -> Self {
1573        Self {
1574            builder: self.builder.property("width-request", width_request),
1575        }
1576    }
1577
1578    // rustdoc-stripper-ignore-next
1579    /// Build the [`ListBox`].
1580    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1581    pub fn build(self) -> ListBox {
1582        assert_initialized_main_thread!();
1583        self.builder.build()
1584    }
1585}
1586
1587/// Trait containing all [`struct@ListBox`] methods.
1588///
1589/// # Implementors
1590///
1591/// [`ListBox`][struct@crate::ListBox]
1592pub trait ListBoxExt: IsA<ListBox> + 'static {
1593    /// Binds `model` to `self`.
1594    ///
1595    /// If `self` was already bound to a model, that previous binding is
1596    /// destroyed.
1597    ///
1598    /// The contents of `self` are cleared and then filled with widgets that
1599    /// represent items from `model`. `self` is updated whenever `model` changes.
1600    /// If `model` is [`None`], `self` is left empty.
1601    ///
1602    /// It is undefined to add or remove widgets directly (for example, with
1603    /// [`insert()`][Self::insert()] or [`ContainerExt::add()`][crate::prelude::ContainerExt::add()]) while `self` is bound to a
1604    /// model.
1605    ///
1606    /// Note that using a model is incompatible with the filtering and sorting
1607    /// functionality in GtkListBox. When using a model, filtering and sorting
1608    /// should be implemented by the model.
1609    /// ## `model`
1610    /// the [`gio::ListModel`][crate::gio::ListModel] to be bound to `self`
1611    /// ## `create_widget_func`
1612    /// a function that creates widgets for items
1613    ///  or [`None`] in case you also passed [`None`] as `model`
1614    #[doc(alias = "gtk_list_box_bind_model")]
1615    fn bind_model<P: Fn(&glib::Object) -> Widget + 'static>(
1616        &self,
1617        model: Option<&impl IsA<gio::ListModel>>,
1618        create_widget_func: P,
1619    ) {
1620        let create_widget_func_data: Box_<P> = Box_::new(create_widget_func);
1621        unsafe extern "C" fn create_widget_func_func<P: Fn(&glib::Object) -> Widget + 'static>(
1622            item: *mut glib::gobject_ffi::GObject,
1623            user_data: glib::ffi::gpointer,
1624        ) -> *mut ffi::GtkWidget {
1625            unsafe {
1626                let item = from_glib_borrow(item);
1627                let callback = &*(user_data as *mut P);
1628                (*callback)(&item).to_glib_full()
1629            }
1630        }
1631        let create_widget_func = Some(create_widget_func_func::<P> as _);
1632        unsafe extern "C" fn user_data_free_func_func<P: Fn(&glib::Object) -> Widget + 'static>(
1633            data: glib::ffi::gpointer,
1634        ) {
1635            unsafe {
1636                let _callback = Box_::from_raw(data as *mut P);
1637            }
1638        }
1639        let destroy_call4 = Some(user_data_free_func_func::<P> as _);
1640        let super_callback0: Box_<P> = create_widget_func_data;
1641        unsafe {
1642            ffi::gtk_list_box_bind_model(
1643                self.as_ref().to_glib_none().0,
1644                model.map(|p| p.as_ref()).to_glib_none().0,
1645                create_widget_func,
1646                Box_::into_raw(super_callback0) as *mut _,
1647                destroy_call4,
1648            );
1649        }
1650    }
1651
1652    /// This is a helper function for implementing DnD onto a [`ListBox`][crate::ListBox].
1653    /// The passed in `row` will be highlighted via [`WidgetExt::drag_highlight()`][crate::prelude::WidgetExt::drag_highlight()],
1654    /// and any previously highlighted row will be unhighlighted.
1655    ///
1656    /// The row will also be unhighlighted when the widget gets
1657    /// a drag leave event.
1658    /// ## `row`
1659    /// a [`ListBoxRow`][crate::ListBoxRow]
1660    #[doc(alias = "gtk_list_box_drag_highlight_row")]
1661    fn drag_highlight_row(&self, row: &impl IsA<ListBoxRow>) {
1662        unsafe {
1663            ffi::gtk_list_box_drag_highlight_row(
1664                self.as_ref().to_glib_none().0,
1665                row.as_ref().to_glib_none().0,
1666            );
1667        }
1668    }
1669
1670    /// If a row has previously been highlighted via [`drag_highlight_row()`][Self::drag_highlight_row()]
1671    /// it will have the highlight removed.
1672    #[doc(alias = "gtk_list_box_drag_unhighlight_row")]
1673    fn drag_unhighlight_row(&self) {
1674        unsafe {
1675            ffi::gtk_list_box_drag_unhighlight_row(self.as_ref().to_glib_none().0);
1676        }
1677    }
1678
1679    /// Returns whether rows activate on single clicks.
1680    ///
1681    /// # Returns
1682    ///
1683    /// [`true`] if rows are activated on single click, [`false`] otherwise
1684    #[doc(alias = "gtk_list_box_get_activate_on_single_click")]
1685    #[doc(alias = "get_activate_on_single_click")]
1686    #[doc(alias = "activate-on-single-click")]
1687    fn activates_on_single_click(&self) -> bool {
1688        unsafe {
1689            from_glib(ffi::gtk_list_box_get_activate_on_single_click(
1690                self.as_ref().to_glib_none().0,
1691            ))
1692        }
1693    }
1694
1695    /// Gets the adjustment (if any) that the widget uses to
1696    /// for vertical scrolling.
1697    ///
1698    /// # Returns
1699    ///
1700    /// the adjustment
1701    #[doc(alias = "gtk_list_box_get_adjustment")]
1702    #[doc(alias = "get_adjustment")]
1703    fn adjustment(&self) -> Option<Adjustment> {
1704        unsafe {
1705            from_glib_none(ffi::gtk_list_box_get_adjustment(
1706                self.as_ref().to_glib_none().0,
1707            ))
1708        }
1709    }
1710
1711    /// Gets the n-th child in the list (not counting headers).
1712    /// If `_index` is negative or larger than the number of items in the
1713    /// list, [`None`] is returned.
1714    /// ## `index_`
1715    /// the index of the row
1716    ///
1717    /// # Returns
1718    ///
1719    /// the child [`Widget`][crate::Widget] or [`None`]
1720    #[doc(alias = "gtk_list_box_get_row_at_index")]
1721    #[doc(alias = "get_row_at_index")]
1722    fn row_at_index(&self, index_: i32) -> Option<ListBoxRow> {
1723        unsafe {
1724            from_glib_none(ffi::gtk_list_box_get_row_at_index(
1725                self.as_ref().to_glib_none().0,
1726                index_,
1727            ))
1728        }
1729    }
1730
1731    /// Gets the row at the `y` position.
1732    /// ## `y`
1733    /// position
1734    ///
1735    /// # Returns
1736    ///
1737    /// the row or [`None`]
1738    ///  in case no row exists for the given y coordinate.
1739    #[doc(alias = "gtk_list_box_get_row_at_y")]
1740    #[doc(alias = "get_row_at_y")]
1741    fn row_at_y(&self, y: i32) -> Option<ListBoxRow> {
1742        unsafe {
1743            from_glib_none(ffi::gtk_list_box_get_row_at_y(
1744                self.as_ref().to_glib_none().0,
1745                y,
1746            ))
1747        }
1748    }
1749
1750    /// Gets the selected row.
1751    ///
1752    /// Note that the box may allow multiple selection, in which
1753    /// case you should use [`selected_foreach()`][Self::selected_foreach()] to
1754    /// find all selected rows.
1755    ///
1756    /// # Returns
1757    ///
1758    /// the selected row
1759    #[doc(alias = "gtk_list_box_get_selected_row")]
1760    #[doc(alias = "get_selected_row")]
1761    fn selected_row(&self) -> Option<ListBoxRow> {
1762        unsafe {
1763            from_glib_none(ffi::gtk_list_box_get_selected_row(
1764                self.as_ref().to_glib_none().0,
1765            ))
1766        }
1767    }
1768
1769    /// Creates a list of all selected children.
1770    ///
1771    /// # Returns
1772    ///
1773    ///
1774    ///  A `GList` containing the [`Widget`][crate::Widget] for each selected child.
1775    ///  Free with `g_list_free()` when done.
1776    #[doc(alias = "gtk_list_box_get_selected_rows")]
1777    #[doc(alias = "get_selected_rows")]
1778    fn selected_rows(&self) -> Vec<ListBoxRow> {
1779        unsafe {
1780            FromGlibPtrContainer::from_glib_container(ffi::gtk_list_box_get_selected_rows(
1781                self.as_ref().to_glib_none().0,
1782            ))
1783        }
1784    }
1785
1786    /// Gets the selection mode of the listbox.
1787    ///
1788    /// # Returns
1789    ///
1790    /// a [`SelectionMode`][crate::SelectionMode]
1791    #[doc(alias = "gtk_list_box_get_selection_mode")]
1792    #[doc(alias = "get_selection_mode")]
1793    #[doc(alias = "selection-mode")]
1794    fn selection_mode(&self) -> SelectionMode {
1795        unsafe {
1796            from_glib(ffi::gtk_list_box_get_selection_mode(
1797                self.as_ref().to_glib_none().0,
1798            ))
1799        }
1800    }
1801
1802    /// Insert the `child` into the `self` at `position`. If a sort function is
1803    /// set, the widget will actually be inserted at the calculated position and
1804    /// this function has the same effect of [`ContainerExt::add()`][crate::prelude::ContainerExt::add()].
1805    ///
1806    /// If `position` is -1, or larger than the total number of items in the
1807    /// `self`, then the `child` will be appended to the end.
1808    /// ## `child`
1809    /// the [`Widget`][crate::Widget] to add
1810    /// ## `position`
1811    /// the position to insert `child` in
1812    #[doc(alias = "gtk_list_box_insert")]
1813    fn insert(&self, child: &impl IsA<Widget>, position: i32) {
1814        unsafe {
1815            ffi::gtk_list_box_insert(
1816                self.as_ref().to_glib_none().0,
1817                child.as_ref().to_glib_none().0,
1818                position,
1819            );
1820        }
1821    }
1822
1823    /// Update the filtering for all rows. Call this when result
1824    /// of the filter function on the `self` is changed due
1825    /// to an external factor. For instance, this would be used
1826    /// if the filter function just looked for a specific search
1827    /// string and the entry with the search string has changed.
1828    #[doc(alias = "gtk_list_box_invalidate_filter")]
1829    fn invalidate_filter(&self) {
1830        unsafe {
1831            ffi::gtk_list_box_invalidate_filter(self.as_ref().to_glib_none().0);
1832        }
1833    }
1834
1835    /// Update the separators for all rows. Call this when result
1836    /// of the header function on the `self` is changed due
1837    /// to an external factor.
1838    #[doc(alias = "gtk_list_box_invalidate_headers")]
1839    fn invalidate_headers(&self) {
1840        unsafe {
1841            ffi::gtk_list_box_invalidate_headers(self.as_ref().to_glib_none().0);
1842        }
1843    }
1844
1845    /// Update the sorting for all rows. Call this when result
1846    /// of the sort function on the `self` is changed due
1847    /// to an external factor.
1848    #[doc(alias = "gtk_list_box_invalidate_sort")]
1849    fn invalidate_sort(&self) {
1850        unsafe {
1851            ffi::gtk_list_box_invalidate_sort(self.as_ref().to_glib_none().0);
1852        }
1853    }
1854
1855    /// Prepend a widget to the list. If a sort function is set, the widget will
1856    /// actually be inserted at the calculated position and this function has the
1857    /// same effect of [`ContainerExt::add()`][crate::prelude::ContainerExt::add()].
1858    /// ## `child`
1859    /// the [`Widget`][crate::Widget] to add
1860    #[doc(alias = "gtk_list_box_prepend")]
1861    fn prepend(&self, child: &impl IsA<Widget>) {
1862        unsafe {
1863            ffi::gtk_list_box_prepend(
1864                self.as_ref().to_glib_none().0,
1865                child.as_ref().to_glib_none().0,
1866            );
1867        }
1868    }
1869
1870    /// Select all children of `self`, if the selection mode allows it.
1871    #[doc(alias = "gtk_list_box_select_all")]
1872    fn select_all(&self) {
1873        unsafe {
1874            ffi::gtk_list_box_select_all(self.as_ref().to_glib_none().0);
1875        }
1876    }
1877
1878    /// Make `row` the currently selected row.
1879    /// ## `row`
1880    /// The row to select or [`None`]
1881    #[doc(alias = "gtk_list_box_select_row")]
1882    fn select_row(&self, row: Option<&impl IsA<ListBoxRow>>) {
1883        unsafe {
1884            ffi::gtk_list_box_select_row(
1885                self.as_ref().to_glib_none().0,
1886                row.map(|p| p.as_ref()).to_glib_none().0,
1887            );
1888        }
1889    }
1890
1891    /// Calls a function for each selected child.
1892    ///
1893    /// Note that the selection cannot be modified from within this function.
1894    /// ## `func`
1895    /// the function to call for each selected child
1896    #[doc(alias = "gtk_list_box_selected_foreach")]
1897    fn selected_foreach<P: FnMut(&ListBox, &ListBoxRow)>(&self, func: P) {
1898        let mut func_data: P = func;
1899        unsafe extern "C" fn func_func<P: FnMut(&ListBox, &ListBoxRow)>(
1900            box_: *mut ffi::GtkListBox,
1901            row: *mut ffi::GtkListBoxRow,
1902            user_data: glib::ffi::gpointer,
1903        ) {
1904            unsafe {
1905                let box_ = from_glib_borrow(box_);
1906                let row = from_glib_borrow(row);
1907                let callback = user_data as *mut P;
1908                (*callback)(&box_, &row)
1909            }
1910        }
1911        let func = Some(func_func::<P> as _);
1912        let super_callback0: &mut P = &mut func_data;
1913        unsafe {
1914            ffi::gtk_list_box_selected_foreach(
1915                self.as_ref().to_glib_none().0,
1916                func,
1917                super_callback0 as *mut _ as *mut _,
1918            );
1919        }
1920    }
1921
1922    /// If `single` is [`true`], rows will be activated when you click on them,
1923    /// otherwise you need to double-click.
1924    /// ## `single`
1925    /// a boolean
1926    #[doc(alias = "gtk_list_box_set_activate_on_single_click")]
1927    #[doc(alias = "activate-on-single-click")]
1928    fn set_activate_on_single_click(&self, single: bool) {
1929        unsafe {
1930            ffi::gtk_list_box_set_activate_on_single_click(
1931                self.as_ref().to_glib_none().0,
1932                single.into_glib(),
1933            );
1934        }
1935    }
1936
1937    /// Sets the adjustment (if any) that the widget uses to
1938    /// for vertical scrolling. For instance, this is used
1939    /// to get the page size for PageUp/Down key handling.
1940    ///
1941    /// In the normal case when the `self` is packed inside
1942    /// a [`ScrolledWindow`][crate::ScrolledWindow] the adjustment from that will
1943    /// be picked up automatically, so there is no need
1944    /// to manually do that.
1945    /// ## `adjustment`
1946    /// the adjustment, or [`None`]
1947    #[doc(alias = "gtk_list_box_set_adjustment")]
1948    fn set_adjustment(&self, adjustment: Option<&impl IsA<Adjustment>>) {
1949        unsafe {
1950            ffi::gtk_list_box_set_adjustment(
1951                self.as_ref().to_glib_none().0,
1952                adjustment.map(|p| p.as_ref()).to_glib_none().0,
1953            );
1954        }
1955    }
1956
1957    /// By setting a filter function on the `self` one can decide dynamically which
1958    /// of the rows to show. For instance, to implement a search function on a list that
1959    /// filters the original list to only show the matching rows.
1960    ///
1961    /// The `filter_func` will be called for each row after the call, and it will
1962    /// continue to be called each time a row changes (via [`ListBoxRowExt::changed()`][crate::prelude::ListBoxRowExt::changed()]) or
1963    /// when [`invalidate_filter()`][Self::invalidate_filter()] is called.
1964    ///
1965    /// Note that using a filter function is incompatible with using a model
1966    /// (see [`bind_model()`][Self::bind_model()]).
1967    /// ## `filter_func`
1968    /// callback that lets you filter which rows to show
1969    #[doc(alias = "gtk_list_box_set_filter_func")]
1970    fn set_filter_func(&self, filter_func: Option<Box_<dyn Fn(&ListBoxRow) -> bool + 'static>>) {
1971        let filter_func_data: Box_<Option<Box_<dyn Fn(&ListBoxRow) -> bool + 'static>>> =
1972            Box_::new(filter_func);
1973        unsafe extern "C" fn filter_func_func(
1974            row: *mut ffi::GtkListBoxRow,
1975            user_data: glib::ffi::gpointer,
1976        ) -> glib::ffi::gboolean {
1977            unsafe {
1978                let row = from_glib_borrow(row);
1979                let callback =
1980                    &*(user_data as *mut Option<Box_<dyn Fn(&ListBoxRow) -> bool + 'static>>);
1981                if let Some(ref callback) = *callback {
1982                    callback(&row)
1983                } else {
1984                    panic!("cannot get closure...")
1985                }
1986                .into_glib()
1987            }
1988        }
1989        let filter_func = if filter_func_data.is_some() {
1990            Some(filter_func_func as _)
1991        } else {
1992            None
1993        };
1994        unsafe extern "C" fn destroy_func(data: glib::ffi::gpointer) {
1995            unsafe {
1996                let _callback = Box_::from_raw(
1997                    data as *mut Option<Box_<dyn Fn(&ListBoxRow) -> bool + 'static>>,
1998                );
1999            }
2000        }
2001        let destroy_call3 = Some(destroy_func as _);
2002        let super_callback0: Box_<Option<Box_<dyn Fn(&ListBoxRow) -> bool + 'static>>> =
2003            filter_func_data;
2004        unsafe {
2005            ffi::gtk_list_box_set_filter_func(
2006                self.as_ref().to_glib_none().0,
2007                filter_func,
2008                Box_::into_raw(super_callback0) as *mut _,
2009                destroy_call3,
2010            );
2011        }
2012    }
2013
2014    /// By setting a header function on the `self` one can dynamically add headers
2015    /// in front of rows, depending on the contents of the row and its position in the list.
2016    /// For instance, one could use it to add headers in front of the first item of a
2017    /// new kind, in a list sorted by the kind.
2018    ///
2019    /// The `update_header` can look at the current header widget using [`ListBoxRowExt::header()`][crate::prelude::ListBoxRowExt::header()]
2020    /// and either update the state of the widget as needed, or set a new one using
2021    /// [`ListBoxRowExt::set_header()`][crate::prelude::ListBoxRowExt::set_header()]. If no header is needed, set the header to [`None`].
2022    ///
2023    /// Note that you may get many calls `update_header` to this for a particular row when e.g.
2024    /// changing things that don’t affect the header. In this case it is important for performance
2025    /// to not blindly replace an existing header with an identical one.
2026    ///
2027    /// The `update_header` function will be called for each row after the call, and it will
2028    /// continue to be called each time a row changes (via [`ListBoxRowExt::changed()`][crate::prelude::ListBoxRowExt::changed()]) and when
2029    /// the row before changes (either by [`ListBoxRowExt::changed()`][crate::prelude::ListBoxRowExt::changed()] on the previous row, or when
2030    /// the previous row becomes a different row). It is also called for all rows when
2031    /// [`invalidate_headers()`][Self::invalidate_headers()] is called.
2032    /// ## `update_header`
2033    /// callback that lets you add row headers
2034    #[doc(alias = "gtk_list_box_set_header_func")]
2035    fn set_header_func(
2036        &self,
2037        update_header: Option<Box_<dyn Fn(&ListBoxRow, Option<&ListBoxRow>) + 'static>>,
2038    ) {
2039        let update_header_data: Box_<
2040            Option<Box_<dyn Fn(&ListBoxRow, Option<&ListBoxRow>) + 'static>>,
2041        > = Box_::new(update_header);
2042        unsafe extern "C" fn update_header_func(
2043            row: *mut ffi::GtkListBoxRow,
2044            before: *mut ffi::GtkListBoxRow,
2045            user_data: glib::ffi::gpointer,
2046        ) {
2047            unsafe {
2048                let row = from_glib_borrow(row);
2049                let before: Borrowed<Option<ListBoxRow>> = from_glib_borrow(before);
2050                let callback = &*(user_data
2051                    as *mut Option<Box_<dyn Fn(&ListBoxRow, Option<&ListBoxRow>) + 'static>>);
2052                if let Some(ref callback) = *callback {
2053                    callback(&row, before.as_ref().as_ref())
2054                } else {
2055                    panic!("cannot get closure...")
2056                }
2057            }
2058        }
2059        let update_header = if update_header_data.is_some() {
2060            Some(update_header_func as _)
2061        } else {
2062            None
2063        };
2064        unsafe extern "C" fn destroy_func(data: glib::ffi::gpointer) {
2065            unsafe {
2066                let _callback = Box_::from_raw(
2067                    data as *mut Option<Box_<dyn Fn(&ListBoxRow, Option<&ListBoxRow>) + 'static>>,
2068                );
2069            }
2070        }
2071        let destroy_call3 = Some(destroy_func as _);
2072        let super_callback0: Box_<
2073            Option<Box_<dyn Fn(&ListBoxRow, Option<&ListBoxRow>) + 'static>>,
2074        > = update_header_data;
2075        unsafe {
2076            ffi::gtk_list_box_set_header_func(
2077                self.as_ref().to_glib_none().0,
2078                update_header,
2079                Box_::into_raw(super_callback0) as *mut _,
2080                destroy_call3,
2081            );
2082        }
2083    }
2084
2085    /// Sets the placeholder widget that is shown in the list when
2086    /// it doesn't display any visible children.
2087    /// ## `placeholder`
2088    /// a [`Widget`][crate::Widget] or [`None`]
2089    #[doc(alias = "gtk_list_box_set_placeholder")]
2090    fn set_placeholder(&self, placeholder: Option<&impl IsA<Widget>>) {
2091        unsafe {
2092            ffi::gtk_list_box_set_placeholder(
2093                self.as_ref().to_glib_none().0,
2094                placeholder.map(|p| p.as_ref()).to_glib_none().0,
2095            );
2096        }
2097    }
2098
2099    /// Sets how selection works in the listbox.
2100    /// See [`SelectionMode`][crate::SelectionMode] for details.
2101    /// ## `mode`
2102    /// The [`SelectionMode`][crate::SelectionMode]
2103    #[doc(alias = "gtk_list_box_set_selection_mode")]
2104    #[doc(alias = "selection-mode")]
2105    fn set_selection_mode(&self, mode: SelectionMode) {
2106        unsafe {
2107            ffi::gtk_list_box_set_selection_mode(self.as_ref().to_glib_none().0, mode.into_glib());
2108        }
2109    }
2110
2111    /// By setting a sort function on the `self` one can dynamically reorder the rows
2112    /// of the list, based on the contents of the rows.
2113    ///
2114    /// The `sort_func` will be called for each row after the call, and will continue to
2115    /// be called each time a row changes (via [`ListBoxRowExt::changed()`][crate::prelude::ListBoxRowExt::changed()]) and when
2116    /// [`invalidate_sort()`][Self::invalidate_sort()] is called.
2117    ///
2118    /// Note that using a sort function is incompatible with using a model
2119    /// (see [`bind_model()`][Self::bind_model()]).
2120    /// ## `sort_func`
2121    /// the sort function
2122    #[doc(alias = "gtk_list_box_set_sort_func")]
2123    fn set_sort_func(
2124        &self,
2125        sort_func: Option<Box_<dyn Fn(&ListBoxRow, &ListBoxRow) -> i32 + 'static>>,
2126    ) {
2127        let sort_func_data: Box_<Option<Box_<dyn Fn(&ListBoxRow, &ListBoxRow) -> i32 + 'static>>> =
2128            Box_::new(sort_func);
2129        unsafe extern "C" fn sort_func_func(
2130            row1: *mut ffi::GtkListBoxRow,
2131            row2: *mut ffi::GtkListBoxRow,
2132            user_data: glib::ffi::gpointer,
2133        ) -> std::ffi::c_int {
2134            unsafe {
2135                let row1 = from_glib_borrow(row1);
2136                let row2 = from_glib_borrow(row2);
2137                let callback = &*(user_data
2138                    as *mut Option<Box_<dyn Fn(&ListBoxRow, &ListBoxRow) -> i32 + 'static>>);
2139                if let Some(ref callback) = *callback {
2140                    callback(&row1, &row2)
2141                } else {
2142                    panic!("cannot get closure...")
2143                }
2144            }
2145        }
2146        let sort_func = if sort_func_data.is_some() {
2147            Some(sort_func_func as _)
2148        } else {
2149            None
2150        };
2151        unsafe extern "C" fn destroy_func(data: glib::ffi::gpointer) {
2152            unsafe {
2153                let _callback = Box_::from_raw(
2154                    data as *mut Option<Box_<dyn Fn(&ListBoxRow, &ListBoxRow) -> i32 + 'static>>,
2155                );
2156            }
2157        }
2158        let destroy_call3 = Some(destroy_func as _);
2159        let super_callback0: Box_<Option<Box_<dyn Fn(&ListBoxRow, &ListBoxRow) -> i32 + 'static>>> =
2160            sort_func_data;
2161        unsafe {
2162            ffi::gtk_list_box_set_sort_func(
2163                self.as_ref().to_glib_none().0,
2164                sort_func,
2165                Box_::into_raw(super_callback0) as *mut _,
2166                destroy_call3,
2167            );
2168        }
2169    }
2170
2171    /// Unselect all children of `self`, if the selection mode allows it.
2172    #[doc(alias = "gtk_list_box_unselect_all")]
2173    fn unselect_all(&self) {
2174        unsafe {
2175            ffi::gtk_list_box_unselect_all(self.as_ref().to_glib_none().0);
2176        }
2177    }
2178
2179    /// Unselects a single row of `self`, if the selection mode allows it.
2180    /// ## `row`
2181    /// the row to unselected
2182    #[doc(alias = "gtk_list_box_unselect_row")]
2183    fn unselect_row(&self, row: &impl IsA<ListBoxRow>) {
2184        unsafe {
2185            ffi::gtk_list_box_unselect_row(
2186                self.as_ref().to_glib_none().0,
2187                row.as_ref().to_glib_none().0,
2188            );
2189        }
2190    }
2191
2192    #[doc(alias = "activate-cursor-row")]
2193    fn connect_activate_cursor_row<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2194        unsafe extern "C" fn activate_cursor_row_trampoline<
2195            P: IsA<ListBox>,
2196            F: Fn(&P) + 'static,
2197        >(
2198            this: *mut ffi::GtkListBox,
2199            f: glib::ffi::gpointer,
2200        ) {
2201            unsafe {
2202                let f: &F = &*(f as *const F);
2203                f(ListBox::from_glib_borrow(this).unsafe_cast_ref())
2204            }
2205        }
2206        unsafe {
2207            let f: Box_<F> = Box_::new(f);
2208            connect_raw(
2209                self.as_ptr() as *mut _,
2210                c"activate-cursor-row".as_ptr(),
2211                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2212                    activate_cursor_row_trampoline::<Self, F> as *const (),
2213                )),
2214                Box_::into_raw(f),
2215            )
2216        }
2217    }
2218
2219    fn emit_activate_cursor_row(&self) {
2220        self.emit_by_name::<()>("activate-cursor-row", &[]);
2221    }
2222
2223    #[doc(alias = "move-cursor")]
2224    fn connect_move_cursor<F: Fn(&Self, MovementStep, i32) + 'static>(
2225        &self,
2226        f: F,
2227    ) -> SignalHandlerId {
2228        unsafe extern "C" fn move_cursor_trampoline<
2229            P: IsA<ListBox>,
2230            F: Fn(&P, MovementStep, i32) + 'static,
2231        >(
2232            this: *mut ffi::GtkListBox,
2233            object: ffi::GtkMovementStep,
2234            p0: std::ffi::c_int,
2235            f: glib::ffi::gpointer,
2236        ) {
2237            unsafe {
2238                let f: &F = &*(f as *const F);
2239                f(
2240                    ListBox::from_glib_borrow(this).unsafe_cast_ref(),
2241                    from_glib(object),
2242                    p0,
2243                )
2244            }
2245        }
2246        unsafe {
2247            let f: Box_<F> = Box_::new(f);
2248            connect_raw(
2249                self.as_ptr() as *mut _,
2250                c"move-cursor".as_ptr(),
2251                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2252                    move_cursor_trampoline::<Self, F> as *const (),
2253                )),
2254                Box_::into_raw(f),
2255            )
2256        }
2257    }
2258
2259    fn emit_move_cursor(&self, object: MovementStep, p0: i32) {
2260        self.emit_by_name::<()>("move-cursor", &[&object, &p0]);
2261    }
2262
2263    /// The ::row-activated signal is emitted when a row has been activated by the user.
2264    /// ## `row`
2265    /// the activated row
2266    #[doc(alias = "row-activated")]
2267    fn connect_row_activated<F: Fn(&Self, &ListBoxRow) + 'static>(&self, f: F) -> SignalHandlerId {
2268        unsafe extern "C" fn row_activated_trampoline<
2269            P: IsA<ListBox>,
2270            F: Fn(&P, &ListBoxRow) + 'static,
2271        >(
2272            this: *mut ffi::GtkListBox,
2273            row: *mut ffi::GtkListBoxRow,
2274            f: glib::ffi::gpointer,
2275        ) {
2276            unsafe {
2277                let f: &F = &*(f as *const F);
2278                f(
2279                    ListBox::from_glib_borrow(this).unsafe_cast_ref(),
2280                    &from_glib_borrow(row),
2281                )
2282            }
2283        }
2284        unsafe {
2285            let f: Box_<F> = Box_::new(f);
2286            connect_raw(
2287                self.as_ptr() as *mut _,
2288                c"row-activated".as_ptr(),
2289                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2290                    row_activated_trampoline::<Self, F> as *const (),
2291                )),
2292                Box_::into_raw(f),
2293            )
2294        }
2295    }
2296
2297    /// The ::row-selected signal is emitted when a new row is selected, or
2298    /// (with a [`None`] `row`) when the selection is cleared.
2299    ///
2300    /// When the `box_` is using [`SelectionMode::Multiple`][crate::SelectionMode::Multiple], this signal will not
2301    /// give you the full picture of selection changes, and you should use
2302    /// the [`selected-rows-changed`][struct@crate::ListBox#selected-rows-changed] signal instead.
2303    /// ## `row`
2304    /// the selected row
2305    #[doc(alias = "row-selected")]
2306    fn connect_row_selected<F: Fn(&Self, Option<&ListBoxRow>) + 'static>(
2307        &self,
2308        f: F,
2309    ) -> SignalHandlerId {
2310        unsafe extern "C" fn row_selected_trampoline<
2311            P: IsA<ListBox>,
2312            F: Fn(&P, Option<&ListBoxRow>) + 'static,
2313        >(
2314            this: *mut ffi::GtkListBox,
2315            row: *mut ffi::GtkListBoxRow,
2316            f: glib::ffi::gpointer,
2317        ) {
2318            unsafe {
2319                let f: &F = &*(f as *const F);
2320                f(
2321                    ListBox::from_glib_borrow(this).unsafe_cast_ref(),
2322                    Option::<ListBoxRow>::from_glib_borrow(row)
2323                        .as_ref()
2324                        .as_ref(),
2325                )
2326            }
2327        }
2328        unsafe {
2329            let f: Box_<F> = Box_::new(f);
2330            connect_raw(
2331                self.as_ptr() as *mut _,
2332                c"row-selected".as_ptr(),
2333                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2334                    row_selected_trampoline::<Self, F> as *const (),
2335                )),
2336                Box_::into_raw(f),
2337            )
2338        }
2339    }
2340
2341    /// The ::select-all signal is a [keybinding signal][GtkBindingSignal]
2342    /// which gets emitted to select all children of the box, if the selection
2343    /// mode permits it.
2344    ///
2345    /// The default bindings for this signal is Ctrl-a.
2346    #[doc(alias = "select-all")]
2347    fn connect_select_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2348        unsafe extern "C" fn select_all_trampoline<P: IsA<ListBox>, F: Fn(&P) + 'static>(
2349            this: *mut ffi::GtkListBox,
2350            f: glib::ffi::gpointer,
2351        ) {
2352            unsafe {
2353                let f: &F = &*(f as *const F);
2354                f(ListBox::from_glib_borrow(this).unsafe_cast_ref())
2355            }
2356        }
2357        unsafe {
2358            let f: Box_<F> = Box_::new(f);
2359            connect_raw(
2360                self.as_ptr() as *mut _,
2361                c"select-all".as_ptr(),
2362                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2363                    select_all_trampoline::<Self, F> as *const (),
2364                )),
2365                Box_::into_raw(f),
2366            )
2367        }
2368    }
2369
2370    fn emit_select_all(&self) {
2371        self.emit_by_name::<()>("select-all", &[]);
2372    }
2373
2374    /// The ::selected-rows-changed signal is emitted when the
2375    /// set of selected rows changes.
2376    #[doc(alias = "selected-rows-changed")]
2377    fn connect_selected_rows_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2378        unsafe extern "C" fn selected_rows_changed_trampoline<
2379            P: IsA<ListBox>,
2380            F: Fn(&P) + 'static,
2381        >(
2382            this: *mut ffi::GtkListBox,
2383            f: glib::ffi::gpointer,
2384        ) {
2385            unsafe {
2386                let f: &F = &*(f as *const F);
2387                f(ListBox::from_glib_borrow(this).unsafe_cast_ref())
2388            }
2389        }
2390        unsafe {
2391            let f: Box_<F> = Box_::new(f);
2392            connect_raw(
2393                self.as_ptr() as *mut _,
2394                c"selected-rows-changed".as_ptr(),
2395                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2396                    selected_rows_changed_trampoline::<Self, F> as *const (),
2397                )),
2398                Box_::into_raw(f),
2399            )
2400        }
2401    }
2402
2403    #[doc(alias = "toggle-cursor-row")]
2404    fn connect_toggle_cursor_row<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2405        unsafe extern "C" fn toggle_cursor_row_trampoline<P: IsA<ListBox>, F: Fn(&P) + 'static>(
2406            this: *mut ffi::GtkListBox,
2407            f: glib::ffi::gpointer,
2408        ) {
2409            unsafe {
2410                let f: &F = &*(f as *const F);
2411                f(ListBox::from_glib_borrow(this).unsafe_cast_ref())
2412            }
2413        }
2414        unsafe {
2415            let f: Box_<F> = Box_::new(f);
2416            connect_raw(
2417                self.as_ptr() as *mut _,
2418                c"toggle-cursor-row".as_ptr(),
2419                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2420                    toggle_cursor_row_trampoline::<Self, F> as *const (),
2421                )),
2422                Box_::into_raw(f),
2423            )
2424        }
2425    }
2426
2427    fn emit_toggle_cursor_row(&self) {
2428        self.emit_by_name::<()>("toggle-cursor-row", &[]);
2429    }
2430
2431    /// The ::unselect-all signal is a [keybinding signal][GtkBindingSignal]
2432    /// which gets emitted to unselect all children of the box, if the selection
2433    /// mode permits it.
2434    ///
2435    /// The default bindings for this signal is Ctrl-Shift-a.
2436    #[doc(alias = "unselect-all")]
2437    fn connect_unselect_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2438        unsafe extern "C" fn unselect_all_trampoline<P: IsA<ListBox>, F: Fn(&P) + 'static>(
2439            this: *mut ffi::GtkListBox,
2440            f: glib::ffi::gpointer,
2441        ) {
2442            unsafe {
2443                let f: &F = &*(f as *const F);
2444                f(ListBox::from_glib_borrow(this).unsafe_cast_ref())
2445            }
2446        }
2447        unsafe {
2448            let f: Box_<F> = Box_::new(f);
2449            connect_raw(
2450                self.as_ptr() as *mut _,
2451                c"unselect-all".as_ptr(),
2452                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2453                    unselect_all_trampoline::<Self, F> as *const (),
2454                )),
2455                Box_::into_raw(f),
2456            )
2457        }
2458    }
2459
2460    fn emit_unselect_all(&self) {
2461        self.emit_by_name::<()>("unselect-all", &[]);
2462    }
2463
2464    #[doc(alias = "activate-on-single-click")]
2465    fn connect_activate_on_single_click_notify<F: Fn(&Self) + 'static>(
2466        &self,
2467        f: F,
2468    ) -> SignalHandlerId {
2469        unsafe extern "C" fn notify_activate_on_single_click_trampoline<
2470            P: IsA<ListBox>,
2471            F: Fn(&P) + 'static,
2472        >(
2473            this: *mut ffi::GtkListBox,
2474            _param_spec: glib::ffi::gpointer,
2475            f: glib::ffi::gpointer,
2476        ) {
2477            unsafe {
2478                let f: &F = &*(f as *const F);
2479                f(ListBox::from_glib_borrow(this).unsafe_cast_ref())
2480            }
2481        }
2482        unsafe {
2483            let f: Box_<F> = Box_::new(f);
2484            connect_raw(
2485                self.as_ptr() as *mut _,
2486                c"notify::activate-on-single-click".as_ptr(),
2487                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2488                    notify_activate_on_single_click_trampoline::<Self, F> as *const (),
2489                )),
2490                Box_::into_raw(f),
2491            )
2492        }
2493    }
2494
2495    #[doc(alias = "selection-mode")]
2496    fn connect_selection_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2497        unsafe extern "C" fn notify_selection_mode_trampoline<
2498            P: IsA<ListBox>,
2499            F: Fn(&P) + 'static,
2500        >(
2501            this: *mut ffi::GtkListBox,
2502            _param_spec: glib::ffi::gpointer,
2503            f: glib::ffi::gpointer,
2504        ) {
2505            unsafe {
2506                let f: &F = &*(f as *const F);
2507                f(ListBox::from_glib_borrow(this).unsafe_cast_ref())
2508            }
2509        }
2510        unsafe {
2511            let f: Box_<F> = Box_::new(f);
2512            connect_raw(
2513                self.as_ptr() as *mut _,
2514                c"notify::selection-mode".as_ptr(),
2515                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2516                    notify_selection_mode_trampoline::<Self, F> as *const (),
2517                )),
2518                Box_::into_raw(f),
2519            )
2520        }
2521    }
2522}
2523
2524impl<O: IsA<ListBox>> ListBoxExt for O {}