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