Skip to main content

gtk/auto/
container.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#![allow(deprecated)]
5
6use crate::{Adjustment, Buildable, ResizeMode, Widget, WidgetPath, ffi};
7use glib::{
8    object::ObjectType as _,
9    prelude::*,
10    signal::{SignalHandlerId, connect_raw},
11    translate::*,
12};
13use std::boxed::Box as Box_;
14
15glib::wrapper! {
16    /// A GTK+ user interface is constructed by nesting widgets inside widgets.
17    /// Container widgets are the inner nodes in the resulting tree of widgets:
18    /// they contain other widgets. So, for example, you might have a [`Window`][crate::Window]
19    /// containing a [`Frame`][crate::Frame] containing a [`Label`][crate::Label]. If you wanted an image instead
20    /// of a textual label inside the frame, you might replace the [`Label`][crate::Label] widget
21    /// with a [`Image`][crate::Image] widget.
22    ///
23    /// There are two major kinds of container widgets in GTK+. Both are subclasses
24    /// of the abstract GtkContainer base class.
25    ///
26    /// The first type of container widget has a single child widget and derives
27    /// from [`Bin`][crate::Bin]. These containers are decorators, which
28    /// add some kind of functionality to the child. For example, a [`Button`][crate::Button] makes
29    /// its child into a clickable button; a [`Frame`][crate::Frame] draws a frame around its child
30    /// and a [`Window`][crate::Window] places its child widget inside a top-level window.
31    ///
32    /// The second type of container can have more than one child; its purpose is to
33    /// manage layout. This means that these containers assign
34    /// sizes and positions to their children. For example, a `GtkHBox` arranges its
35    /// children in a horizontal row, and a [`Grid`][crate::Grid] arranges the widgets it contains
36    /// in a two-dimensional grid.
37    ///
38    /// For implementations of [`Container`][crate::Container] the virtual method `GtkContainerClass.forall()`
39    /// is always required, since it's used for drawing and other internal operations
40    /// on the children.
41    /// If the [`Container`][crate::Container] implementation expect to have non internal children
42    /// it's needed to implement both `GtkContainerClass.add()` and `GtkContainerClass.remove()`.
43    /// If the GtkContainer implementation has internal children, they should be added
44    /// with [`WidgetExt::set_parent()`][crate::prelude::WidgetExt::set_parent()] on `init()` and removed with [`WidgetExt::unparent()`][crate::prelude::WidgetExt::unparent()]
45    /// in the `GtkWidgetClass.destroy()` implementation.
46    /// See more about implementing custom widgets at https://wiki.gnome.org/HowDoI/CustomWidgets
47    ///
48    /// # Height for width geometry management
49    ///
50    /// GTK+ uses a height-for-width (and width-for-height) geometry management system.
51    /// Height-for-width means that a widget can change how much vertical space it needs,
52    /// depending on the amount of horizontal space that it is given (and similar for
53    /// width-for-height).
54    ///
55    /// There are some things to keep in mind when implementing container widgets
56    /// that make use of GTK+’s height for width geometry management system. First,
57    /// it’s important to note that a container must prioritize one of its
58    /// dimensions, that is to say that a widget or container can only have a
59    /// [`SizeRequestMode`][crate::SizeRequestMode] that is [`SizeRequestMode::HeightForWidth`][crate::SizeRequestMode::HeightForWidth] or
60    /// [`SizeRequestMode::WidthForHeight`][crate::SizeRequestMode::WidthForHeight]. However, every widget and container
61    /// must be able to respond to the APIs for both dimensions, i.e. even if a
62    /// widget has a request mode that is height-for-width, it is possible that
63    /// its parent will request its sizes using the width-for-height APIs.
64    ///
65    /// To ensure that everything works properly, here are some guidelines to follow
66    /// when implementing height-for-width (or width-for-height) containers.
67    ///
68    /// Each request mode involves 2 virtual methods. Height-for-width apis run
69    /// through [`WidgetExt::preferred_width()`][crate::prelude::WidgetExt::preferred_width()] and then through [`WidgetExt::preferred_height_for_width()`][crate::prelude::WidgetExt::preferred_height_for_width()].
70    /// When handling requests in the opposite [`SizeRequestMode`][crate::SizeRequestMode] it is important that
71    /// every widget request at least enough space to display all of its content at all times.
72    ///
73    /// When [`WidgetExt::preferred_height()`][crate::prelude::WidgetExt::preferred_height()] is called on a container that is height-for-width,
74    /// the container must return the height for its minimum width. This is easily achieved by
75    /// simply calling the reverse apis implemented for itself as follows:
76    ///
77    ///
78    ///
79    /// **⚠️ The following code is in C ⚠️**
80    ///
81    /// ```C
82    /// static void
83    /// foo_container_get_preferred_height (GtkWidget *widget,
84    ///                                     gint *min_height,
85    ///                                     gint *nat_height)
86    /// {
87    ///    if (i_am_in_height_for_width_mode)
88    ///      {
89    ///        gint min_width;
90    ///
91    ///        GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget,
92    ///                                                            &min_width,
93    ///                                                            NULL);
94    ///        GTK_WIDGET_GET_CLASS (widget)->get_preferred_height_for_width
95    ///                                                           (widget,
96    ///                                                            min_width,
97    ///                                                            min_height,
98    ///                                                            nat_height);
99    ///      }
100    ///    else
101    ///      {
102    ///        ... many containers support both request modes, execute the
103    ///        real width-for-height request here by returning the
104    ///        collective heights of all widgets that are stacked
105    ///        vertically (or whatever is appropriate for this container)
106    ///        ...
107    ///      }
108    /// }
109    /// ```
110    ///
111    /// Similarly, when [`WidgetExt::preferred_width_for_height()`][crate::prelude::WidgetExt::preferred_width_for_height()] is called for a container or widget
112    /// that is height-for-width, it then only needs to return the base minimum width like so:
113    ///
114    ///
115    ///
116    /// **⚠️ The following code is in C ⚠️**
117    ///
118    /// ```C
119    /// static void
120    /// foo_container_get_preferred_width_for_height (GtkWidget *widget,
121    ///                                               gint for_height,
122    ///                                               gint *min_width,
123    ///                                               gint *nat_width)
124    /// {
125    ///    if (i_am_in_height_for_width_mode)
126    ///      {
127    ///        GTK_WIDGET_GET_CLASS (widget)->get_preferred_width (widget,
128    ///                                                            min_width,
129    ///                                                            nat_width);
130    ///      }
131    ///    else
132    ///      {
133    ///        ... execute the real width-for-height request here based on
134    ///        the required width of the children collectively if the
135    ///        container were to be allocated the said height ...
136    ///      }
137    /// }
138    /// ```
139    ///
140    /// Height for width requests are generally implemented in terms of a virtual allocation
141    /// of widgets in the input orientation. Assuming an height-for-width request mode, a container
142    /// would implement the `get_preferred_height_for_width()` virtual function by first calling
143    /// [`WidgetExt::preferred_width()`][crate::prelude::WidgetExt::preferred_width()] for each of its children.
144    ///
145    /// For each potential group of children that are lined up horizontally, the values returned by
146    /// [`WidgetExt::preferred_width()`][crate::prelude::WidgetExt::preferred_width()] should be collected in an array of `GtkRequestedSize` structures.
147    /// Any child spacing should be removed from the input `for_width` and then the collective size should be
148    /// allocated using the `gtk_distribute_natural_allocation()` convenience function.
149    ///
150    /// The container will then move on to request the preferred height for each child by using
151    /// [`WidgetExt::preferred_height_for_width()`][crate::prelude::WidgetExt::preferred_height_for_width()] and using the sizes stored in the `GtkRequestedSize` array.
152    ///
153    /// To allocate a height-for-width container, it’s again important
154    /// to consider that a container must prioritize one dimension over the other. So if
155    /// a container is a height-for-width container it must first allocate all widgets horizontally
156    /// using a `GtkRequestedSize` array and `gtk_distribute_natural_allocation()` and then add any
157    /// extra space (if and where appropriate) for the widget to expand.
158    ///
159    /// After adding all the expand space, the container assumes it was allocated sufficient
160    /// height to fit all of its content. At this time, the container must use the total horizontal sizes
161    /// of each widget to request the height-for-width of each of its children and store the requests in a
162    /// `GtkRequestedSize` array for any widgets that stack vertically (for tabular containers this can
163    /// be generalized into the heights and widths of rows and columns).
164    /// The vertical space must then again be distributed using `gtk_distribute_natural_allocation()`
165    /// while this time considering the allocated height of the widget minus any vertical spacing
166    /// that the container adds. Then vertical expand space should be added where appropriate and available
167    /// and the container should go on to actually allocating the child widgets.
168    ///
169    /// See [GtkWidget’s geometry management section][geometry-management]
170    /// to learn more about implementing height-for-width geometry management for widgets.
171    ///
172    /// # Child properties
173    ///
174    /// GtkContainer introduces child properties.
175    /// These are object properties that are not specific
176    /// to either the container or the contained widget, but rather to their relation.
177    /// Typical examples of child properties are the position or pack-type of a widget
178    /// which is contained in a [`Box`][crate::Box].
179    ///
180    /// Use `gtk_container_class_install_child_property()` to install child properties
181    /// for a container class and `gtk_container_class_find_child_property()` or
182    /// `gtk_container_class_list_child_properties()` to get information about existing
183    /// child properties.
184    ///
185    /// To set the value of a child property, use [`ContainerExtManual::child_set_property()`][crate::prelude::ContainerExtManual::child_set_property()],
186    /// `gtk_container_child_set()` or `gtk_container_child_set_valist()`.
187    /// To obtain the value of a child property, use
188    /// [`ContainerExtManual::child_get_property()`][crate::prelude::ContainerExtManual::child_get_property()], `gtk_container_child_get()` or
189    /// `gtk_container_child_get_valist()`. To emit notification about child property
190    /// changes, use [`WidgetExt::child_notify()`][crate::prelude::WidgetExt::child_notify()].
191    ///
192    /// # GtkContainer as GtkBuildable
193    ///
194    /// The GtkContainer implementation of the GtkBuildable interface supports
195    /// a ``<packing>`` element for children, which can contain multiple ``<property>``
196    /// elements that specify child properties for the child.
197    ///
198    /// Since 2.16, child properties can also be marked as translatable using
199    /// the same “translatable”, “comments” and “context” attributes that are used
200    /// for regular properties.
201    ///
202    /// Since 3.16, containers can have a ``<focus-chain>`` element containing multiple
203    /// ``<widget>`` elements, one for each child that should be added to the focus
204    /// chain. The ”name” attribute gives the id of the widget.
205    ///
206    /// An example of these properties in UI definitions:
207    ///
208    ///
209    ///
210    /// **⚠️ The following code is in xml ⚠️**
211    ///
212    /// ```xml
213    /// <object class="GtkBox">
214    ///   <child>
215    ///     <object class="GtkEntry" id="entry1"/>
216    ///     <packing>
217    ///       <property name="pack-type">start</property>
218    ///     </packing>
219    ///   </child>
220    ///   <child>
221    ///     <object class="GtkEntry" id="entry2"/>
222    ///   </child>
223    ///   <focus-chain>
224    ///     <widget name="entry1"/>
225    ///     <widget name="entry2"/>
226    ///   </focus-chain>
227    /// </object>
228    /// ```
229    ///
230    /// This is an Abstract Base Class, you cannot instantiate it.
231    ///
232    /// ## Properties
233    ///
234    ///
235    /// #### `border-width`
236    ///  Readable | Writable
237    ///
238    ///
239    /// #### `child`
240    ///  Writable
241    ///
242    ///
243    /// #### `resize-mode`
244    ///  Readable | Writable
245    /// <details><summary><h4>Widget</h4></summary>
246    ///
247    ///
248    /// #### `app-paintable`
249    ///  Readable | Writable
250    ///
251    ///
252    /// #### `can-default`
253    ///  Readable | Writable
254    ///
255    ///
256    /// #### `can-focus`
257    ///  Readable | Writable
258    ///
259    ///
260    /// #### `composite-child`
261    ///  Readable
262    ///
263    ///
264    /// #### `double-buffered`
265    ///  Whether the widget is double buffered.
266    ///
267    /// Readable | Writable
268    ///
269    ///
270    /// #### `events`
271    ///  Readable | Writable
272    ///
273    ///
274    /// #### `expand`
275    ///  Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
276    ///
277    /// Readable | Writable
278    ///
279    ///
280    /// #### `focus-on-click`
281    ///  Whether the widget should grab focus when it is clicked with the mouse.
282    ///
283    /// This property is only relevant for widgets that can take focus.
284    ///
285    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
286    /// GtkComboBox) implemented this property individually.
287    ///
288    /// Readable | Writable
289    ///
290    ///
291    /// #### `halign`
292    ///  How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
293    ///
294    /// Readable | Writable
295    ///
296    ///
297    /// #### `has-default`
298    ///  Readable | Writable
299    ///
300    ///
301    /// #### `has-focus`
302    ///  Readable | Writable
303    ///
304    ///
305    /// #### `has-tooltip`
306    ///  Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
307    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
308    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
309    /// whether it will provide a tooltip or not.
310    ///
311    /// Note that setting this property to [`true`] for the first time will change
312    /// the event masks of the GdkWindows of this widget to include leave-notify
313    /// and motion-notify events. This cannot and will not be undone when the
314    /// property is set to [`false`] again.
315    ///
316    /// Readable | Writable
317    ///
318    ///
319    /// #### `height-request`
320    ///  Readable | Writable
321    ///
322    ///
323    /// #### `hexpand`
324    ///  Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
325    ///
326    /// Readable | Writable
327    ///
328    ///
329    /// #### `hexpand-set`
330    ///  Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
331    ///
332    /// Readable | Writable
333    ///
334    ///
335    /// #### `is-focus`
336    ///  Readable | Writable
337    ///
338    ///
339    /// #### `margin`
340    ///  Sets all four sides' margin at once. If read, returns max
341    /// margin on any side.
342    ///
343    /// Readable | Writable
344    ///
345    ///
346    /// #### `margin-bottom`
347    ///  Margin on bottom side of widget.
348    ///
349    /// This property adds margin outside of the widget's normal size
350    /// request, the margin will be added in addition to the size from
351    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
352    ///
353    /// Readable | Writable
354    ///
355    ///
356    /// #### `margin-end`
357    ///  Margin on end of widget, horizontally. This property supports
358    /// left-to-right and right-to-left text directions.
359    ///
360    /// This property adds margin outside of the widget's normal size
361    /// request, the margin will be added in addition to the size from
362    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
363    ///
364    /// Readable | Writable
365    ///
366    ///
367    /// #### `margin-left`
368    ///  Margin on left side of widget.
369    ///
370    /// This property adds margin outside of the widget's normal size
371    /// request, the margin will be added in addition to the size from
372    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
373    ///
374    /// Readable | Writable
375    ///
376    ///
377    /// #### `margin-right`
378    ///  Margin on right side of widget.
379    ///
380    /// This property adds margin outside of the widget's normal size
381    /// request, the margin will be added in addition to the size from
382    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
383    ///
384    /// Readable | Writable
385    ///
386    ///
387    /// #### `margin-start`
388    ///  Margin on start of widget, horizontally. This property supports
389    /// left-to-right and right-to-left text directions.
390    ///
391    /// This property adds margin outside of the widget's normal size
392    /// request, the margin will be added in addition to the size from
393    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
394    ///
395    /// Readable | Writable
396    ///
397    ///
398    /// #### `margin-top`
399    ///  Margin on top side of widget.
400    ///
401    /// This property adds margin outside of the widget's normal size
402    /// request, the margin will be added in addition to the size from
403    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
404    ///
405    /// Readable | Writable
406    ///
407    ///
408    /// #### `name`
409    ///  Readable | Writable
410    ///
411    ///
412    /// #### `no-show-all`
413    ///  Readable | Writable
414    ///
415    ///
416    /// #### `opacity`
417    ///  The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
418    /// more details about window opacity.
419    ///
420    /// Before 3.8 this was only available in GtkWindow
421    ///
422    /// Readable | Writable
423    ///
424    ///
425    /// #### `parent`
426    ///  Readable | Writable
427    ///
428    ///
429    /// #### `receives-default`
430    ///  Readable | Writable
431    ///
432    ///
433    /// #### `scale-factor`
434    ///  The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
435    /// more details about widget scaling.
436    ///
437    /// Readable
438    ///
439    ///
440    /// #### `sensitive`
441    ///  Readable | Writable
442    ///
443    ///
444    /// #### `style`
445    ///  The style of the widget, which contains information about how it will look (colors, etc).
446    ///
447    /// Readable | Writable
448    ///
449    ///
450    /// #### `tooltip-markup`
451    ///  Sets the text of tooltip to be the given string, which is marked up
452    /// with the [Pango text markup language][PangoMarkupFormat].
453    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
454    ///
455    /// This is a convenience property which will take care of getting the
456    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
457    /// will automatically be set to [`true`] and there will be taken care of
458    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
459    ///
460    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
461    /// are set, the last one wins.
462    ///
463    /// Readable | Writable
464    ///
465    ///
466    /// #### `tooltip-text`
467    ///  Sets the text of tooltip to be the given string.
468    ///
469    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
470    ///
471    /// This is a convenience property which will take care of getting the
472    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
473    /// will automatically be set to [`true`] and there will be taken care of
474    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
475    ///
476    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
477    /// are set, the last one wins.
478    ///
479    /// Readable | Writable
480    ///
481    ///
482    /// #### `valign`
483    ///  How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
484    ///
485    /// Readable | Writable
486    ///
487    ///
488    /// #### `vexpand`
489    ///  Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
490    ///
491    /// Readable | Writable
492    ///
493    ///
494    /// #### `vexpand-set`
495    ///  Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
496    ///
497    /// Readable | Writable
498    ///
499    ///
500    /// #### `visible`
501    ///  Readable | Writable
502    ///
503    ///
504    /// #### `width-request`
505    ///  Readable | Writable
506    ///
507    ///
508    /// #### `window`
509    ///  The widget's window if it is realized, [`None`] otherwise.
510    ///
511    /// Readable
512    /// </details>
513    ///
514    /// ## Signals
515    ///
516    ///
517    /// #### `add`
518    ///
519    ///
520    ///
521    /// #### `check-resize`
522    ///
523    ///
524    ///
525    /// #### `remove`
526    ///
527    ///
528    ///
529    /// #### `set-focus-child`
530    ///
531    /// <details><summary><h4>Widget</h4></summary>
532    ///
533    ///
534    /// #### `accel-closures-changed`
535    ///
536    ///
537    ///
538    /// #### `button-press-event`
539    ///  The ::button-press-event signal will be emitted when a button
540    /// (typically from a mouse) is pressed.
541    ///
542    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
543    /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
544    ///
545    /// This signal will be sent to the grab widget if there is one.
546    ///
547    ///
548    ///
549    ///
550    /// #### `button-release-event`
551    ///  The ::button-release-event signal will be emitted when a button
552    /// (typically from a mouse) is released.
553    ///
554    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
555    /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
556    ///
557    /// This signal will be sent to the grab widget if there is one.
558    ///
559    ///
560    ///
561    ///
562    /// #### `can-activate-accel`
563    ///  Determines whether an accelerator that activates the signal
564    /// identified by `signal_id` can currently be activated.
565    /// This signal is present to allow applications and derived
566    /// widgets to override the default [`Widget`][crate::Widget] handling
567    /// for determining whether an accelerator can be activated.
568    ///
569    ///
570    ///
571    ///
572    /// #### `child-notify`
573    ///  The ::child-notify signal is emitted for each
574    /// [child property][child-properties] that has
575    /// changed on an object. The signal's detail holds the property name.
576    ///
577    /// Detailed
578    ///
579    ///
580    /// #### `composited-changed`
581    ///  The ::composited-changed signal is emitted when the composited
582    /// status of `widgets` screen changes.
583    /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
584    ///
585    /// Action
586    ///
587    ///
588    /// #### `configure-event`
589    ///  The ::configure-event signal will be emitted when the size, position or
590    /// stacking of the `widget`'s window has changed.
591    ///
592    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
593    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
594    /// automatically for all new windows.
595    ///
596    ///
597    ///
598    ///
599    /// #### `damage-event`
600    ///  Emitted when a redirected window belonging to `widget` gets drawn into.
601    /// The region/area members of the event shows what area of the redirected
602    /// drawable was drawn into.
603    ///
604    ///
605    ///
606    ///
607    /// #### `delete-event`
608    ///  The ::delete-event signal is emitted if a user requests that
609    /// a toplevel window is closed. The default handler for this signal
610    /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
611    /// this signal will cause the window to be hidden instead, so that
612    /// it can later be shown again without reconstructing it.
613    ///
614    ///
615    ///
616    ///
617    /// #### `destroy`
618    ///  Signals that all holders of a reference to the widget should release
619    /// the reference that they hold. May result in finalization of the widget
620    /// if all references are released.
621    ///
622    /// This signal is not suitable for saving widget state.
623    ///
624    ///
625    ///
626    ///
627    /// #### `destroy-event`
628    ///  The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
629    /// You rarely get this signal, because most widgets disconnect themselves
630    /// from their window before they destroy it, so no widget owns the
631    /// window at destroy time.
632    ///
633    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
634    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
635    /// automatically for all new windows.
636    ///
637    ///
638    ///
639    ///
640    /// #### `direction-changed`
641    ///  The ::direction-changed signal is emitted when the text direction
642    /// of a widget changes.
643    ///
644    ///
645    ///
646    ///
647    /// #### `drag-begin`
648    ///  The ::drag-begin signal is emitted on the drag source when a drag is
649    /// started. A typical reason to connect to this signal is to set up a
650    /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
651    ///
652    /// Note that some widgets set up a drag icon in the default handler of
653    /// this signal, so you may have to use `g_signal_connect_after()` to
654    /// override what the default handler did.
655    ///
656    ///
657    ///
658    ///
659    /// #### `drag-data-delete`
660    ///  The ::drag-data-delete signal is emitted on the drag source when a drag
661    /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
662    /// handler is responsible for deleting the data that has been dropped. What
663    /// "delete" means depends on the context of the drag operation.
664    ///
665    ///
666    ///
667    ///
668    /// #### `drag-data-get`
669    ///  The ::drag-data-get signal is emitted on the drag source when the drop
670    /// site requests the data which is dragged. It is the responsibility of
671    /// the signal handler to fill `data` with the data in the format which
672    /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
673    /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
674    ///
675    ///
676    ///
677    ///
678    /// #### `drag-data-received`
679    ///  The ::drag-data-received signal is emitted on the drop site when the
680    /// dragged data has been received. If the data was received in order to
681    /// determine whether the drop will be accepted, the handler is expected
682    /// to call `gdk_drag_status()` and not finish the drag.
683    /// If the data was received in response to a [`drag-drop`][struct@crate::Widget#drag-drop] signal
684    /// (and this is the last target to be received), the handler for this
685    /// signal is expected to process the received data and then call
686    /// `gtk_drag_finish()`, setting the `success` parameter depending on
687    /// whether the data was processed successfully.
688    ///
689    /// Applications must create some means to determine why the signal was emitted
690    /// and therefore whether to call `gdk_drag_status()` or `gtk_drag_finish()`.
691    ///
692    /// The handler may inspect the selected action with
693    /// [`DragContext::selected_action()`][crate::gdk::DragContext::selected_action()] before calling
694    /// `gtk_drag_finish()`, e.g. to implement [`gdk::DragAction::ASK`][crate::gdk::DragAction::ASK] as
695    /// shown in the following example:
696    ///
697    ///
698    /// **⚠️ The following code is in C ⚠️**
699    ///
700    /// ```C
701    /// void
702    /// drag_data_received (GtkWidget          *widget,
703    ///                     GdkDragContext     *context,
704    ///                     gint                x,
705    ///                     gint                y,
706    ///                     GtkSelectionData   *data,
707    ///                     guint               info,
708    ///                     guint               time)
709    /// {
710    ///   if ((data->length >= 0) && (data->format == 8))
711    ///     {
712    ///       GdkDragAction action;
713    ///
714    ///       // handle data here
715    ///
716    ///       action = gdk_drag_context_get_selected_action (context);
717    ///       if (action == GDK_ACTION_ASK)
718    ///         {
719    ///           GtkWidget *dialog;
720    ///           gint response;
721    ///
722    ///           dialog = gtk_message_dialog_new (NULL,
723    ///                                            GTK_DIALOG_MODAL |
724    ///                                            GTK_DIALOG_DESTROY_WITH_PARENT,
725    ///                                            GTK_MESSAGE_INFO,
726    ///                                            GTK_BUTTONS_YES_NO,
727    ///                                            "Move the data ?\n");
728    ///           response = gtk_dialog_run (GTK_DIALOG (dialog));
729    ///           gtk_widget_destroy (dialog);
730    ///
731    ///           if (response == GTK_RESPONSE_YES)
732    ///             action = GDK_ACTION_MOVE;
733    ///           else
734    ///             action = GDK_ACTION_COPY;
735    ///          }
736    ///
737    ///       gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
738    ///     }
739    ///   else
740    ///     gtk_drag_finish (context, FALSE, FALSE, time);
741    ///  }
742    /// ```
743    ///
744    ///
745    ///
746    ///
747    /// #### `drag-drop`
748    ///  The ::drag-drop signal is emitted on the drop site when the user drops
749    /// the data onto the widget. The signal handler must determine whether
750    /// the cursor position is in a drop zone or not. If it is not in a drop
751    /// zone, it returns [`false`] and no further processing is necessary.
752    /// Otherwise, the handler returns [`true`]. In this case, the handler must
753    /// ensure that `gtk_drag_finish()` is called to let the source know that
754    /// the drop is done. The call to `gtk_drag_finish()` can be done either
755    /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
756    /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
757    /// or more of the supported targets.
758    ///
759    ///
760    ///
761    ///
762    /// #### `drag-end`
763    ///  The ::drag-end signal is emitted on the drag source when a drag is
764    /// finished. A typical reason to connect to this signal is to undo
765    /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
766    ///
767    ///
768    ///
769    ///
770    /// #### `drag-failed`
771    ///  The ::drag-failed signal is emitted on the drag source when a drag has
772    /// failed. The signal handler may hook custom code to handle a failed DnD
773    /// operation based on the type of error, it returns [`true`] is the failure has
774    /// been already handled (not showing the default "drag operation failed"
775    /// animation), otherwise it returns [`false`].
776    ///
777    ///
778    ///
779    ///
780    /// #### `drag-leave`
781    ///  The ::drag-leave signal is emitted on the drop site when the cursor
782    /// leaves the widget. A typical reason to connect to this signal is to
783    /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
784    /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
785    ///
786    ///
787    /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
788    /// ::drag-drop signal, for instance to allow cleaning up of a preview item
789    /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
790    ///
791    ///
792    ///
793    ///
794    /// #### `drag-motion`
795    ///  The ::drag-motion signal is emitted on the drop site when the user
796    /// moves the cursor over the widget during a drag. The signal handler
797    /// must determine whether the cursor position is in a drop zone or not.
798    /// If it is not in a drop zone, it returns [`false`] and no further processing
799    /// is necessary. Otherwise, the handler returns [`true`]. In this case, the
800    /// handler is responsible for providing the necessary information for
801    /// displaying feedback to the user, by calling `gdk_drag_status()`.
802    ///
803    /// If the decision whether the drop will be accepted or rejected can't be
804    /// made based solely on the cursor position and the type of the data, the
805    /// handler may inspect the dragged data by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] and
806    /// defer the `gdk_drag_status()` call to the [`drag-data-received`][struct@crate::Widget#drag-data-received]
807    /// handler. Note that you must pass [`DestDefaults::DROP`][crate::DestDefaults::DROP],
808    /// [`DestDefaults::MOTION`][crate::DestDefaults::MOTION] or [`DestDefaults::ALL`][crate::DestDefaults::ALL] to [`WidgetExtManual::drag_dest_set()`][crate::prelude::WidgetExtManual::drag_dest_set()]
809    /// when using the drag-motion signal that way.
810    ///
811    /// Also note that there is no drag-enter signal. The drag receiver has to
812    /// keep track of whether he has received any drag-motion signals since the
813    /// last [`drag-leave`][struct@crate::Widget#drag-leave] and if not, treat the drag-motion signal as
814    /// an "enter" signal. Upon an "enter", the handler will typically highlight
815    /// the drop site with [`WidgetExt::drag_highlight()`][crate::prelude::WidgetExt::drag_highlight()].
816    ///
817    ///
818    /// **⚠️ The following code is in C ⚠️**
819    ///
820    /// ```C
821    /// static void
822    /// drag_motion (GtkWidget      *widget,
823    ///              GdkDragContext *context,
824    ///              gint            x,
825    ///              gint            y,
826    ///              guint           time)
827    /// {
828    ///   GdkAtom target;
829    ///
830    ///   PrivateData *private_data = GET_PRIVATE_DATA (widget);
831    ///
832    ///   if (!private_data->drag_highlight)
833    ///    {
834    ///      private_data->drag_highlight = 1;
835    ///      gtk_drag_highlight (widget);
836    ///    }
837    ///
838    ///   target = gtk_drag_dest_find_target (widget, context, NULL);
839    ///   if (target == GDK_NONE)
840    ///     gdk_drag_status (context, 0, time);
841    ///   else
842    ///    {
843    ///      private_data->pending_status
844    ///         = gdk_drag_context_get_suggested_action (context);
845    ///      gtk_drag_get_data (widget, context, target, time);
846    ///    }
847    ///
848    ///   return TRUE;
849    /// }
850    ///
851    /// static void
852    /// drag_data_received (GtkWidget        *widget,
853    ///                     GdkDragContext   *context,
854    ///                     gint              x,
855    ///                     gint              y,
856    ///                     GtkSelectionData *selection_data,
857    ///                     guint             info,
858    ///                     guint             time)
859    /// {
860    ///   PrivateData *private_data = GET_PRIVATE_DATA (widget);
861    ///
862    ///   if (private_data->suggested_action)
863    ///    {
864    ///      private_data->suggested_action = 0;
865    ///
866    ///      // We are getting this data due to a request in drag_motion,
867    ///      // rather than due to a request in drag_drop, so we are just
868    ///      // supposed to call gdk_drag_status(), not actually paste in
869    ///      // the data.
870    ///
871    ///      str = gtk_selection_data_get_text (selection_data);
872    ///      if (!data_is_acceptable (str))
873    ///        gdk_drag_status (context, 0, time);
874    ///      else
875    ///        gdk_drag_status (context,
876    ///                         private_data->suggested_action,
877    ///                         time);
878    ///    }
879    ///   else
880    ///    {
881    ///      // accept the drop
882    ///    }
883    /// }
884    /// ```
885    ///
886    ///
887    ///
888    ///
889    /// #### `draw`
890    ///  This signal is emitted when a widget is supposed to render itself.
891    /// The `widget`'s top left corner must be painted at the origin of
892    /// the passed in context and be sized to the values returned by
893    /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
894    /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
895    ///
896    /// Signal handlers connected to this signal can modify the cairo
897    /// context passed as `cr` in any way they like and don't need to
898    /// restore it. The signal emission takes care of calling `cairo_save()`
899    /// before and `cairo_restore()` after invoking the handler.
900    ///
901    /// The signal handler will get a `cr` with a clip region already set to the
902    /// widget's dirty region, i.e. to the area that needs repainting. Complicated
903    /// widgets that want to avoid redrawing themselves completely can get the full
904    /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
905    /// get a finer-grained representation of the dirty region with
906    /// `cairo_copy_clip_rectangle_list()`.
907    ///
908    ///
909    ///
910    ///
911    /// #### `enter-notify-event`
912    ///  The ::enter-notify-event will be emitted when the pointer enters
913    /// the `widget`'s window.
914    ///
915    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
916    /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
917    ///
918    /// This signal will be sent to the grab widget if there is one.
919    ///
920    ///
921    ///
922    ///
923    /// #### `event`
924    ///  The GTK+ main loop will emit three signals for each GDK event delivered
925    /// to a widget: one generic ::event signal, another, more specific,
926    /// signal that matches the type of event delivered (e.g.
927    /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
928    /// [`event-after`][struct@crate::Widget#event-after] signal.
929    ///
930    ///
931    ///
932    ///
933    /// #### `event-after`
934    ///  After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
935    /// the second more specific signal, ::event-after will be emitted
936    /// regardless of the previous two signals handlers return values.
937    ///
938    ///
939    ///
940    ///
941    /// #### `focus`
942    ///
943    ///
944    ///
945    /// #### `focus-in-event`
946    ///  The ::focus-in-event signal will be emitted when the keyboard focus
947    /// enters the `widget`'s window.
948    ///
949    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
950    /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
951    ///
952    ///
953    ///
954    ///
955    /// #### `focus-out-event`
956    ///  The ::focus-out-event signal will be emitted when the keyboard focus
957    /// leaves the `widget`'s window.
958    ///
959    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
960    /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
961    ///
962    ///
963    ///
964    ///
965    /// #### `grab-broken-event`
966    ///  Emitted when a pointer or keyboard grab on a window belonging
967    /// to `widget` gets broken.
968    ///
969    /// On X11, this happens when the grab window becomes unviewable
970    /// (i.e. it or one of its ancestors is unmapped), or if the same
971    /// application grabs the pointer or keyboard again.
972    ///
973    ///
974    ///
975    ///
976    /// #### `grab-focus`
977    ///  Action
978    ///
979    ///
980    /// #### `grab-notify`
981    ///  The ::grab-notify signal is emitted when a widget becomes
982    /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
983    /// another widget, or when it becomes unshadowed due to a grab
984    /// being removed.
985    ///
986    /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
987    /// grab widget in the grab stack of its window group is not
988    /// its ancestor.
989    ///
990    ///
991    ///
992    ///
993    /// #### `hide`
994    ///  The ::hide signal is emitted when `widget` is hidden, for example with
995    /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
996    ///
997    ///
998    ///
999    ///
1000    /// #### `hierarchy-changed`
1001    ///  The ::hierarchy-changed signal is emitted when the
1002    /// anchored state of a widget changes. A widget is
1003    /// “anchored” when its toplevel
1004    /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
1005    /// a widget changes from un-anchored to anchored or vice-versa.
1006    ///
1007    ///
1008    ///
1009    ///
1010    /// #### `key-press-event`
1011    ///  The ::key-press-event signal is emitted when a key is pressed. The signal
1012    /// emission will reoccur at the key-repeat rate when the key is kept pressed.
1013    ///
1014    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1015    /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
1016    ///
1017    /// This signal will be sent to the grab widget if there is one.
1018    ///
1019    ///
1020    ///
1021    ///
1022    /// #### `key-release-event`
1023    ///  The ::key-release-event signal is emitted when a key is released.
1024    ///
1025    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1026    /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
1027    ///
1028    /// This signal will be sent to the grab widget if there is one.
1029    ///
1030    ///
1031    ///
1032    ///
1033    /// #### `keynav-failed`
1034    ///  Gets emitted if keyboard navigation fails.
1035    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
1036    ///
1037    ///
1038    ///
1039    ///
1040    /// #### `leave-notify-event`
1041    ///  The ::leave-notify-event will be emitted when the pointer leaves
1042    /// the `widget`'s window.
1043    ///
1044    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1045    /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
1046    ///
1047    /// This signal will be sent to the grab widget if there is one.
1048    ///
1049    ///
1050    ///
1051    ///
1052    /// #### `map`
1053    ///  The ::map signal is emitted when `widget` is going to be mapped, that is
1054    /// when the widget is visible (which is controlled with
1055    /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
1056    /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
1057    /// be emitted.
1058    ///
1059    /// The ::map signal can be used to determine whether a widget will be drawn,
1060    /// for instance it can resume an animation that was stopped during the
1061    /// emission of [`unmap`][struct@crate::Widget#unmap].
1062    ///
1063    ///
1064    ///
1065    ///
1066    /// #### `map-event`
1067    ///  The ::map-event signal will be emitted when the `widget`'s window is
1068    /// mapped. A window is mapped when it becomes visible on the screen.
1069    ///
1070    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1071    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1072    /// automatically for all new windows.
1073    ///
1074    ///
1075    ///
1076    ///
1077    /// #### `mnemonic-activate`
1078    ///  The default handler for this signal activates `widget` if `group_cycling`
1079    /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
1080    ///
1081    ///
1082    ///
1083    ///
1084    /// #### `motion-notify-event`
1085    ///  The ::motion-notify-event signal is emitted when the pointer moves
1086    /// over the widget's [`gdk::Window`][crate::gdk::Window].
1087    ///
1088    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
1089    /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
1090    ///
1091    /// This signal will be sent to the grab widget if there is one.
1092    ///
1093    ///
1094    ///
1095    ///
1096    /// #### `move-focus`
1097    ///  Action
1098    ///
1099    ///
1100    /// #### `parent-set`
1101    ///  The ::parent-set signal is emitted when a new parent
1102    /// has been set on a widget.
1103    ///
1104    ///
1105    ///
1106    ///
1107    /// #### `popup-menu`
1108    ///  This signal gets emitted whenever a widget should pop up a context
1109    /// menu. This usually happens through the standard key binding mechanism;
1110    /// by pressing a certain key while a widget is focused, the user can cause
1111    /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
1112    /// a menu with clipboard commands. See the
1113    /// [Popup Menu Migration Checklist][checklist-popup-menu]
1114    /// for an example of how to use this signal.
1115    ///
1116    /// Action
1117    ///
1118    ///
1119    /// #### `property-notify-event`
1120    ///  The ::property-notify-event signal will be emitted when a property on
1121    /// the `widget`'s window has been changed or deleted.
1122    ///
1123    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1124    /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
1125    ///
1126    ///
1127    ///
1128    ///
1129    /// #### `proximity-in-event`
1130    ///  To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1131    /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
1132    ///
1133    /// This signal will be sent to the grab widget if there is one.
1134    ///
1135    ///
1136    ///
1137    ///
1138    /// #### `proximity-out-event`
1139    ///  To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1140    /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
1141    ///
1142    /// This signal will be sent to the grab widget if there is one.
1143    ///
1144    ///
1145    ///
1146    ///
1147    /// #### `query-tooltip`
1148    ///  Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
1149    /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
1150    /// focus in keyboard mode.
1151    ///
1152    /// Using the given coordinates, the signal handler should determine
1153    /// whether a tooltip should be shown for `widget`. If this is the case
1154    /// [`true`] should be returned, [`false`] otherwise. Note that if
1155    /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
1156    /// should not be used.
1157    ///
1158    /// The signal handler is free to manipulate `tooltip` with the therefore
1159    /// destined function calls.
1160    ///
1161    ///
1162    ///
1163    ///
1164    /// #### `realize`
1165    ///  The ::realize signal is emitted when `widget` is associated with a
1166    /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
1167    /// widget has been mapped (that is, it is going to be drawn).
1168    ///
1169    ///
1170    ///
1171    ///
1172    /// #### `screen-changed`
1173    ///  The ::screen-changed signal gets emitted when the
1174    /// screen of a widget has changed.
1175    ///
1176    ///
1177    ///
1178    ///
1179    /// #### `scroll-event`
1180    ///  The ::scroll-event signal is emitted when a button in the 4 to 7
1181    /// range is pressed. Wheel mice are usually configured to generate
1182    /// button press events for buttons 4 and 5 when the wheel is turned.
1183    ///
1184    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1185    /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
1186    ///
1187    /// This signal will be sent to the grab widget if there is one.
1188    ///
1189    ///
1190    ///
1191    ///
1192    /// #### `selection-clear-event`
1193    ///  The ::selection-clear-event signal will be emitted when the
1194    /// the `widget`'s window has lost ownership of a selection.
1195    ///
1196    ///
1197    ///
1198    ///
1199    /// #### `selection-get`
1200    ///
1201    ///
1202    ///
1203    /// #### `selection-notify-event`
1204    ///
1205    ///
1206    ///
1207    /// #### `selection-received`
1208    ///
1209    ///
1210    ///
1211    /// #### `selection-request-event`
1212    ///  The ::selection-request-event signal will be emitted when
1213    /// another client requests ownership of the selection owned by
1214    /// the `widget`'s window.
1215    ///
1216    ///
1217    ///
1218    ///
1219    /// #### `show`
1220    ///  The ::show signal is emitted when `widget` is shown, for example with
1221    /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
1222    ///
1223    ///
1224    ///
1225    ///
1226    /// #### `show-help`
1227    ///  Action
1228    ///
1229    ///
1230    /// #### `size-allocate`
1231    ///
1232    ///
1233    ///
1234    /// #### `state-changed`
1235    ///  The ::state-changed signal is emitted when the widget state changes.
1236    /// See `gtk_widget_get_state()`.
1237    ///
1238    ///
1239    ///
1240    ///
1241    /// #### `state-flags-changed`
1242    ///  The ::state-flags-changed signal is emitted when the widget state
1243    /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
1244    ///
1245    ///
1246    ///
1247    ///
1248    /// #### `style-set`
1249    ///  The ::style-set signal is emitted when a new style has been set
1250    /// on a widget. Note that style-modifying functions like
1251    /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1252    ///
1253    /// Note that this signal is emitted for changes to the deprecated
1254    /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1255    /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1256    ///
1257    ///
1258    ///
1259    ///
1260    /// #### `style-updated`
1261    ///  The ::style-updated signal is a convenience signal that is emitted when the
1262    /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1263    /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1264    ///
1265    /// Note that style-modifying functions like `gtk_widget_override_color()` also
1266    /// cause this signal to be emitted.
1267    ///
1268    ///
1269    ///
1270    ///
1271    /// #### `touch-event`
1272    ///
1273    ///
1274    ///
1275    /// #### `unmap`
1276    ///  The ::unmap signal is emitted when `widget` is going to be unmapped, which
1277    /// means that either it or any of its parents up to the toplevel widget have
1278    /// been set as hidden.
1279    ///
1280    /// As ::unmap indicates that a widget will not be shown any longer, it can be
1281    /// used to, for example, stop an animation on the widget.
1282    ///
1283    ///
1284    ///
1285    ///
1286    /// #### `unmap-event`
1287    ///  The ::unmap-event signal will be emitted when the `widget`'s window is
1288    /// unmapped. A window is unmapped when it becomes invisible on the screen.
1289    ///
1290    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1291    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1292    /// automatically for all new windows.
1293    ///
1294    ///
1295    ///
1296    ///
1297    /// #### `unrealize`
1298    ///  The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1299    /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1300    /// called or the widget has been unmapped (that is, it is going to be
1301    /// hidden).
1302    ///
1303    ///
1304    ///
1305    ///
1306    /// #### `visibility-notify-event`
1307    ///  The ::visibility-notify-event will be emitted when the `widget`'s
1308    /// window is obscured or unobscured.
1309    ///
1310    /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1311    /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1312    ///
1313    ///
1314    ///
1315    ///
1316    /// #### `window-state-event`
1317    ///  The ::window-state-event will be emitted when the state of the
1318    /// toplevel window associated to the `widget` changes.
1319    ///
1320    /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1321    /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1322    /// this mask automatically for all new windows.
1323    ///
1324    ///
1325    /// </details>
1326    ///
1327    /// # Implements
1328    ///
1329    /// [`ContainerExt`][trait@crate::prelude::ContainerExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ContainerExtManual`][trait@crate::prelude::ContainerExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
1330    #[doc(alias = "GtkContainer")]
1331    pub struct Container(Object<ffi::GtkContainer, ffi::GtkContainerClass>) @extends Widget, @implements Buildable;
1332
1333    match fn {
1334        type_ => || ffi::gtk_container_get_type(),
1335    }
1336}
1337
1338impl Container {
1339    pub const NONE: Option<&'static Container> = None;
1340}
1341
1342/// Trait containing all [`struct@Container`] methods.
1343///
1344/// # Implementors
1345///
1346/// [`Bin`][struct@crate::Bin], [`Box`][struct@crate::Box], [`Container`][struct@crate::Container], [`Fixed`][struct@crate::Fixed], [`FlowBox`][struct@crate::FlowBox], [`Grid`][struct@crate::Grid], [`HeaderBar`][struct@crate::HeaderBar], [`IconView`][struct@crate::IconView], [`Layout`][struct@crate::Layout], [`ListBox`][struct@crate::ListBox], [`MenuShell`][struct@crate::MenuShell], [`Notebook`][struct@crate::Notebook], [`Paned`][struct@crate::Paned], [`Socket`][struct@crate::Socket], [`Stack`][struct@crate::Stack], [`TextView`][struct@crate::TextView], [`ToolItemGroup`][struct@crate::ToolItemGroup], [`ToolPalette`][struct@crate::ToolPalette], [`Toolbar`][struct@crate::Toolbar], [`TreeView`][struct@crate::TreeView]
1347pub trait ContainerExt: IsA<Container> + 'static {
1348    /// Adds `widget` to `self`. Typically used for simple containers
1349    /// such as [`Window`][crate::Window], [`Frame`][crate::Frame], or [`Button`][crate::Button]; for more complicated
1350    /// layout containers such as [`Box`][crate::Box] or [`Grid`][crate::Grid], this function will
1351    /// pick default packing parameters that may not be correct. So
1352    /// consider functions such as [`BoxExt::pack_start()`][crate::prelude::BoxExt::pack_start()] and
1353    /// [`GridExt::attach()`][crate::prelude::GridExt::attach()] as an alternative to [`add()`][Self::add()] in
1354    /// those cases. A widget may be added to only one container at a time;
1355    /// you can’t place the same widget inside two different containers.
1356    ///
1357    /// Note that some containers, such as [`ScrolledWindow`][crate::ScrolledWindow] or [`ListBox`][crate::ListBox],
1358    /// may add intermediate children between the added widget and the
1359    /// container.
1360    /// ## `widget`
1361    /// a widget to be placed inside `self`
1362    #[doc(alias = "gtk_container_add")]
1363    fn add(&self, widget: &impl IsA<Widget>) {
1364        unsafe {
1365            ffi::gtk_container_add(
1366                self.as_ref().to_glib_none().0,
1367                widget.as_ref().to_glib_none().0,
1368            );
1369        }
1370    }
1371
1372    //#[doc(alias = "gtk_container_add_with_properties")]
1373    //fn add_with_properties(&self, widget: &impl IsA<Widget>, first_prop_name: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) {
1374    //    unsafe { TODO: call ffi:gtk_container_add_with_properties() }
1375    //}
1376
1377    #[doc(alias = "gtk_container_check_resize")]
1378    fn check_resize(&self) {
1379        unsafe {
1380            ffi::gtk_container_check_resize(self.as_ref().to_glib_none().0);
1381        }
1382    }
1383
1384    //#[doc(alias = "gtk_container_child_get")]
1385    //fn child_get(&self, child: &impl IsA<Widget>, first_prop_name: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) {
1386    //    unsafe { TODO: call ffi:gtk_container_child_get() }
1387    //}
1388
1389    //#[doc(alias = "gtk_container_child_get_valist")]
1390    //fn child_get_valist(&self, child: &impl IsA<Widget>, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) {
1391    //    unsafe { TODO: call ffi:gtk_container_child_get_valist() }
1392    //}
1393
1394    /// Emits a [`child-notify`][struct@crate::Widget#child-notify] signal for the
1395    /// [child property][child-properties]
1396    /// `child_property` on the child.
1397    ///
1398    /// This is an analogue of [`ObjectExt::notify()`][crate::glib::prelude::ObjectExt::notify()] for child properties.
1399    ///
1400    /// Also see [`WidgetExt::child_notify()`][crate::prelude::WidgetExt::child_notify()].
1401    /// ## `child`
1402    /// the child widget
1403    /// ## `child_property`
1404    /// the name of a child property installed on
1405    ///  the class of `self`
1406    #[doc(alias = "gtk_container_child_notify")]
1407    fn child_notify(&self, child: &impl IsA<Widget>, child_property: &str) {
1408        unsafe {
1409            ffi::gtk_container_child_notify(
1410                self.as_ref().to_glib_none().0,
1411                child.as_ref().to_glib_none().0,
1412                child_property.to_glib_none().0,
1413            );
1414        }
1415    }
1416
1417    /// Emits a [`child-notify`][struct@crate::Widget#child-notify] signal for the
1418    /// [child property][child-properties] specified by
1419    /// `pspec` on the child.
1420    ///
1421    /// This is an analogue of [`ObjectExt::notify_by_pspec()`][crate::glib::prelude::ObjectExt::notify_by_pspec()] for child properties.
1422    /// ## `child`
1423    /// the child widget
1424    /// ## `pspec`
1425    /// the [`glib::ParamSpec`][crate::glib::ParamSpec] of a child property instealled on
1426    ///  the class of `self`
1427    #[doc(alias = "gtk_container_child_notify_by_pspec")]
1428    fn child_notify_by_pspec(&self, child: &impl IsA<Widget>, pspec: impl AsRef<glib::ParamSpec>) {
1429        unsafe {
1430            ffi::gtk_container_child_notify_by_pspec(
1431                self.as_ref().to_glib_none().0,
1432                child.as_ref().to_glib_none().0,
1433                pspec.as_ref().to_glib_none().0,
1434            );
1435        }
1436    }
1437
1438    //#[doc(alias = "gtk_container_child_set")]
1439    //fn child_set(&self, child: &impl IsA<Widget>, first_prop_name: &str, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) {
1440    //    unsafe { TODO: call ffi:gtk_container_child_set() }
1441    //}
1442
1443    //#[doc(alias = "gtk_container_child_set_valist")]
1444    //fn child_set_valist(&self, child: &impl IsA<Widget>, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) {
1445    //    unsafe { TODO: call ffi:gtk_container_child_set_valist() }
1446    //}
1447
1448    /// Returns the type of the children supported by the container.
1449    ///
1450    /// Note that this may return `G_TYPE_NONE` to indicate that no more
1451    /// children can be added, e.g. for a [`Paned`][crate::Paned] which already has two
1452    /// children.
1453    ///
1454    /// # Returns
1455    ///
1456    /// a `GType`.
1457    #[doc(alias = "gtk_container_child_type")]
1458    fn child_type(&self) -> glib::types::Type {
1459        unsafe {
1460            from_glib(ffi::gtk_container_child_type(
1461                self.as_ref().to_glib_none().0,
1462            ))
1463        }
1464    }
1465
1466    /// Invokes `callback` on each direct child of `self`, including
1467    /// children that are considered “internal” (implementation details
1468    /// of the container). “Internal” children generally weren’t added
1469    /// by the user of the container, but were added by the container
1470    /// implementation itself.
1471    ///
1472    /// Most applications should use [`foreach()`][Self::foreach()], rather
1473    /// than [`forall()`][Self::forall()].
1474    /// ## `callback`
1475    /// a callback
1476    /// ## `callback_data`
1477    /// callback user data
1478    #[doc(alias = "gtk_container_forall")]
1479    fn forall<P: FnMut(&Widget)>(&self, callback: P) {
1480        let mut callback_data: P = callback;
1481        unsafe extern "C" fn callback_func<P: FnMut(&Widget)>(
1482            widget: *mut ffi::GtkWidget,
1483            data: glib::ffi::gpointer,
1484        ) {
1485            unsafe {
1486                let widget = from_glib_borrow(widget);
1487                let callback = data as *mut P;
1488                (*callback)(&widget)
1489            }
1490        }
1491        let callback = Some(callback_func::<P> as _);
1492        let super_callback0: &mut P = &mut callback_data;
1493        unsafe {
1494            ffi::gtk_container_forall(
1495                self.as_ref().to_glib_none().0,
1496                callback,
1497                super_callback0 as *mut _ as *mut _,
1498            );
1499        }
1500    }
1501
1502    /// Invokes `callback` on each non-internal child of `self`.
1503    /// See [`forall()`][Self::forall()] for details on what constitutes
1504    /// an “internal” child. For all practical purposes, this function
1505    /// should iterate over precisely those child widgets that were
1506    /// added to the container by the application with explicit `add()`
1507    /// calls.
1508    ///
1509    /// It is permissible to remove the child from the `callback` handler.
1510    ///
1511    /// Most applications should use [`foreach()`][Self::foreach()],
1512    /// rather than [`forall()`][Self::forall()].
1513    /// ## `callback`
1514    /// a callback
1515    /// ## `callback_data`
1516    /// callback user data
1517    #[doc(alias = "gtk_container_foreach")]
1518    fn foreach<P: FnMut(&Widget)>(&self, callback: P) {
1519        let mut callback_data: P = callback;
1520        unsafe extern "C" fn callback_func<P: FnMut(&Widget)>(
1521            widget: *mut ffi::GtkWidget,
1522            data: glib::ffi::gpointer,
1523        ) {
1524            unsafe {
1525                let widget = from_glib_borrow(widget);
1526                let callback = data as *mut P;
1527                (*callback)(&widget)
1528            }
1529        }
1530        let callback = Some(callback_func::<P> as _);
1531        let super_callback0: &mut P = &mut callback_data;
1532        unsafe {
1533            ffi::gtk_container_foreach(
1534                self.as_ref().to_glib_none().0,
1535                callback,
1536                super_callback0 as *mut _ as *mut _,
1537            );
1538        }
1539    }
1540
1541    /// Retrieves the border width of the container. See
1542    /// [`set_border_width()`][Self::set_border_width()].
1543    ///
1544    /// # Returns
1545    ///
1546    /// the current border width
1547    #[doc(alias = "gtk_container_get_border_width")]
1548    #[doc(alias = "get_border_width")]
1549    #[doc(alias = "border-width")]
1550    fn border_width(&self) -> u32 {
1551        unsafe { ffi::gtk_container_get_border_width(self.as_ref().to_glib_none().0) }
1552    }
1553
1554    /// Returns the container’s non-internal children. See
1555    /// [`forall()`][Self::forall()] for details on what constitutes an "internal" child.
1556    ///
1557    /// # Returns
1558    ///
1559    /// a newly-allocated list of the container’s non-internal children.
1560    #[doc(alias = "gtk_container_get_children")]
1561    #[doc(alias = "get_children")]
1562    fn children(&self) -> Vec<Widget> {
1563        unsafe {
1564            FromGlibPtrContainer::from_glib_container(ffi::gtk_container_get_children(
1565                self.as_ref().to_glib_none().0,
1566            ))
1567        }
1568    }
1569
1570    //#[cfg_attr(feature = "v3_24", deprecated = "Since 3.24")]
1571    //#[allow(deprecated)]
1572    //#[doc(alias = "gtk_container_get_focus_chain")]
1573    //#[doc(alias = "get_focus_chain")]
1574    //fn focus_chain(&self, focusable_widgets: /*Unimplemented*/Vec<Widget>) -> bool {
1575    //    unsafe { TODO: call ffi:gtk_container_get_focus_chain() }
1576    //}
1577
1578    /// Returns the current focus child widget inside `self`. This is not the
1579    /// currently focused widget. That can be obtained by calling
1580    /// [`GtkWindowExt::focused_widget()`][crate::prelude::GtkWindowExt::focused_widget()].
1581    ///
1582    /// # Returns
1583    ///
1584    /// The child widget which will receive the
1585    ///  focus inside `self` when the `self` is focused,
1586    ///  or [`None`] if none is set.
1587    #[doc(alias = "gtk_container_get_focus_child")]
1588    #[doc(alias = "get_focus_child")]
1589    fn focus_child(&self) -> Option<Widget> {
1590        unsafe {
1591            from_glib_none(ffi::gtk_container_get_focus_child(
1592                self.as_ref().to_glib_none().0,
1593            ))
1594        }
1595    }
1596
1597    /// Retrieves the horizontal focus adjustment for the container. See
1598    /// gtk_container_set_focus_hadjustment ().
1599    ///
1600    /// # Returns
1601    ///
1602    /// the horizontal focus adjustment, or [`None`] if
1603    ///  none has been set.
1604    #[doc(alias = "gtk_container_get_focus_hadjustment")]
1605    #[doc(alias = "get_focus_hadjustment")]
1606    fn focus_hadjustment(&self) -> Option<Adjustment> {
1607        unsafe {
1608            from_glib_none(ffi::gtk_container_get_focus_hadjustment(
1609                self.as_ref().to_glib_none().0,
1610            ))
1611        }
1612    }
1613
1614    /// Retrieves the vertical focus adjustment for the container. See
1615    /// [`set_focus_vadjustment()`][Self::set_focus_vadjustment()].
1616    ///
1617    /// # Returns
1618    ///
1619    /// the vertical focus adjustment, or
1620    ///  [`None`] if none has been set.
1621    #[doc(alias = "gtk_container_get_focus_vadjustment")]
1622    #[doc(alias = "get_focus_vadjustment")]
1623    fn focus_vadjustment(&self) -> Option<Adjustment> {
1624        unsafe {
1625            from_glib_none(ffi::gtk_container_get_focus_vadjustment(
1626                self.as_ref().to_glib_none().0,
1627            ))
1628        }
1629    }
1630
1631    /// Returns a newly created widget path representing all the widget hierarchy
1632    /// from the toplevel down to and including `child`.
1633    /// ## `child`
1634    /// a child of `self`
1635    ///
1636    /// # Returns
1637    ///
1638    /// A newly created [`WidgetPath`][crate::WidgetPath]
1639    #[doc(alias = "gtk_container_get_path_for_child")]
1640    #[doc(alias = "get_path_for_child")]
1641    fn path_for_child(&self, child: &impl IsA<Widget>) -> Option<WidgetPath> {
1642        unsafe {
1643            from_glib_full(ffi::gtk_container_get_path_for_child(
1644                self.as_ref().to_glib_none().0,
1645                child.as_ref().to_glib_none().0,
1646            ))
1647        }
1648    }
1649
1650    /// When a container receives a call to the draw function, it must send
1651    /// synthetic [`draw`][struct@crate::Widget#draw] calls to all children that don’t have their
1652    /// own `GdkWindows`. This function provides a convenient way of doing this.
1653    /// A container, when it receives a call to its [`draw`][struct@crate::Widget#draw] function,
1654    /// calls [`propagate_draw()`][Self::propagate_draw()] once for each child, passing in
1655    /// the `cr` the container received.
1656    ///
1657    /// [`propagate_draw()`][Self::propagate_draw()] takes care of translating the origin of `cr`,
1658    /// and deciding whether the draw needs to be sent to the child. It is a
1659    /// convenient and optimized way of getting the same effect as calling
1660    /// [`WidgetExt::draw()`][crate::prelude::WidgetExt::draw()] on the child directly.
1661    ///
1662    /// In most cases, a container can simply either inherit the
1663    /// [`draw`][struct@crate::Widget#draw] implementation from [`Container`][crate::Container], or do some drawing
1664    /// and then chain to the ::draw implementation from [`Container`][crate::Container].
1665    /// ## `child`
1666    /// a child of `self`
1667    /// ## `cr`
1668    /// Cairo context as passed to the container. If you want to use `cr`
1669    ///  in container’s draw function, consider using `cairo_save()` and
1670    ///  `cairo_restore()` before calling this function.
1671    #[doc(alias = "gtk_container_propagate_draw")]
1672    fn propagate_draw(&self, child: &impl IsA<Widget>, cr: &cairo::Context) {
1673        unsafe {
1674            ffi::gtk_container_propagate_draw(
1675                self.as_ref().to_glib_none().0,
1676                child.as_ref().to_glib_none().0,
1677                mut_override(cr.to_glib_none().0),
1678            );
1679        }
1680    }
1681
1682    /// Removes `widget` from `self`. `widget` must be inside `self`.
1683    /// Note that `self` will own a reference to `widget`, and that this
1684    /// may be the last reference held; so removing a widget from its
1685    /// container can destroy that widget. If you want to use `widget`
1686    /// again, you need to add a reference to it before removing it from
1687    /// a container, using `g_object_ref()`. If you don’t want to use `widget`
1688    /// again it’s usually more efficient to simply destroy it directly
1689    /// using `gtk_widget_destroy()` since this will remove it from the
1690    /// container and help break any circular reference count cycles.
1691    /// ## `widget`
1692    /// a current child of `self`
1693    #[doc(alias = "gtk_container_remove")]
1694    fn remove(&self, widget: &impl IsA<Widget>) {
1695        unsafe {
1696            ffi::gtk_container_remove(
1697                self.as_ref().to_glib_none().0,
1698                widget.as_ref().to_glib_none().0,
1699            );
1700        }
1701    }
1702
1703    /// Sets the border width of the container.
1704    ///
1705    /// The border width of a container is the amount of space to leave
1706    /// around the outside of the container. The only exception to this is
1707    /// [`Window`][crate::Window]; because toplevel windows can’t leave space outside,
1708    /// they leave the space inside. The border is added on all sides of
1709    /// the container. To add space to only one side, use a specific
1710    /// [`margin`][struct@crate::Widget#margin] property on the child widget, for example
1711    /// [`margin-top`][struct@crate::Widget#margin-top].
1712    /// ## `border_width`
1713    /// amount of blank space to leave outside
1714    ///  the container. Valid values are in the range 0-65535 pixels.
1715    #[doc(alias = "gtk_container_set_border_width")]
1716    #[doc(alias = "border-width")]
1717    fn set_border_width(&self, border_width: u32) {
1718        unsafe {
1719            ffi::gtk_container_set_border_width(self.as_ref().to_glib_none().0, border_width);
1720        }
1721    }
1722
1723    /// Sets a focus chain, overriding the one computed automatically by GTK+.
1724    ///
1725    /// In principle each widget in the chain should be a descendant of the
1726    /// container, but this is not enforced by this method, since it’s allowed
1727    /// to set the focus chain before you pack the widgets, or have a widget
1728    /// in the chain that isn’t always packed. The necessary checks are done
1729    /// when the focus chain is actually traversed.
1730    ///
1731    /// # Deprecated since 3.24
1732    ///
1733    /// For overriding focus behavior, use the
1734    ///  GtkWidgetClass::focus signal.
1735    /// ## `focusable_widgets`
1736    ///
1737    ///  the new focus chain
1738    #[cfg_attr(feature = "v3_24", deprecated = "Since 3.24")]
1739    #[allow(deprecated)]
1740    #[doc(alias = "gtk_container_set_focus_chain")]
1741    fn set_focus_chain(&self, focusable_widgets: &[Widget]) {
1742        unsafe {
1743            ffi::gtk_container_set_focus_chain(
1744                self.as_ref().to_glib_none().0,
1745                focusable_widgets.to_glib_none().0,
1746            );
1747        }
1748    }
1749
1750    /// Sets, or unsets if `child` is [`None`], the focused child of `self`.
1751    ///
1752    /// This function emits the GtkContainer::set_focus_child signal of
1753    /// `self`. Implementations of [`Container`][crate::Container] can override the
1754    /// default behaviour by overriding the class closure of this signal.
1755    ///
1756    /// This is function is mostly meant to be used by widgets. Applications can use
1757    /// [`WidgetExt::grab_focus()`][crate::prelude::WidgetExt::grab_focus()] to manually set the focus to a specific widget.
1758    /// ## `child`
1759    /// a [`Widget`][crate::Widget], or [`None`]
1760    #[doc(alias = "gtk_container_set_focus_child")]
1761    fn set_focus_child(&self, child: Option<&impl IsA<Widget>>) {
1762        unsafe {
1763            ffi::gtk_container_set_focus_child(
1764                self.as_ref().to_glib_none().0,
1765                child.map(|p| p.as_ref()).to_glib_none().0,
1766            );
1767        }
1768    }
1769
1770    /// Hooks up an adjustment to focus handling in a container, so when a child
1771    /// of the container is focused, the adjustment is scrolled to show that
1772    /// widget. This function sets the horizontal alignment.
1773    /// See [`ScrolledWindowExt::hadjustment()`][crate::prelude::ScrolledWindowExt::hadjustment()] for a typical way of obtaining
1774    /// the adjustment and [`set_focus_vadjustment()`][Self::set_focus_vadjustment()] for setting
1775    /// the vertical adjustment.
1776    ///
1777    /// The adjustments have to be in pixel units and in the same coordinate
1778    /// system as the allocation for immediate children of the container.
1779    /// ## `adjustment`
1780    /// an adjustment which should be adjusted when the focus is
1781    ///  moved among the descendents of `self`
1782    #[doc(alias = "gtk_container_set_focus_hadjustment")]
1783    fn set_focus_hadjustment(&self, adjustment: &impl IsA<Adjustment>) {
1784        unsafe {
1785            ffi::gtk_container_set_focus_hadjustment(
1786                self.as_ref().to_glib_none().0,
1787                adjustment.as_ref().to_glib_none().0,
1788            );
1789        }
1790    }
1791
1792    /// Hooks up an adjustment to focus handling in a container, so when a
1793    /// child of the container is focused, the adjustment is scrolled to
1794    /// show that widget. This function sets the vertical alignment. See
1795    /// [`ScrolledWindowExt::vadjustment()`][crate::prelude::ScrolledWindowExt::vadjustment()] for a typical way of obtaining
1796    /// the adjustment and [`set_focus_hadjustment()`][Self::set_focus_hadjustment()] for setting
1797    /// the horizontal adjustment.
1798    ///
1799    /// The adjustments have to be in pixel units and in the same coordinate
1800    /// system as the allocation for immediate children of the container.
1801    /// ## `adjustment`
1802    /// an adjustment which should be adjusted when the focus
1803    ///  is moved among the descendents of `self`
1804    #[doc(alias = "gtk_container_set_focus_vadjustment")]
1805    fn set_focus_vadjustment(&self, adjustment: &impl IsA<Adjustment>) {
1806        unsafe {
1807            ffi::gtk_container_set_focus_vadjustment(
1808                self.as_ref().to_glib_none().0,
1809                adjustment.as_ref().to_glib_none().0,
1810            );
1811        }
1812    }
1813
1814    /// Removes a focus chain explicitly set with [`set_focus_chain()`][Self::set_focus_chain()].
1815    ///
1816    /// # Deprecated since 3.24
1817    ///
1818    /// For overriding focus behavior, use the
1819    ///  GtkWidgetClass::focus signal.
1820    #[cfg_attr(feature = "v3_24", deprecated = "Since 3.24")]
1821    #[allow(deprecated)]
1822    #[doc(alias = "gtk_container_unset_focus_chain")]
1823    fn unset_focus_chain(&self) {
1824        unsafe {
1825            ffi::gtk_container_unset_focus_chain(self.as_ref().to_glib_none().0);
1826        }
1827    }
1828
1829    fn set_child<P: IsA<Widget>>(&self, child: Option<&P>) {
1830        ObjectExt::set_property(self.as_ref(), "child", child)
1831    }
1832
1833    #[doc(alias = "resize-mode")]
1834    fn resize_mode(&self) -> ResizeMode {
1835        ObjectExt::property(self.as_ref(), "resize-mode")
1836    }
1837
1838    #[doc(alias = "resize-mode")]
1839    fn set_resize_mode(&self, resize_mode: ResizeMode) {
1840        ObjectExt::set_property(self.as_ref(), "resize-mode", resize_mode)
1841    }
1842
1843    #[doc(alias = "add")]
1844    fn connect_add<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId {
1845        unsafe extern "C" fn add_trampoline<P: IsA<Container>, F: Fn(&P, &Widget) + 'static>(
1846            this: *mut ffi::GtkContainer,
1847            object: *mut ffi::GtkWidget,
1848            f: glib::ffi::gpointer,
1849        ) {
1850            unsafe {
1851                let f: &F = &*(f as *const F);
1852                f(
1853                    Container::from_glib_borrow(this).unsafe_cast_ref(),
1854                    &from_glib_borrow(object),
1855                )
1856            }
1857        }
1858        unsafe {
1859            let f: Box_<F> = Box_::new(f);
1860            connect_raw(
1861                self.as_ptr() as *mut _,
1862                c"add".as_ptr(),
1863                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1864                    add_trampoline::<Self, F> as *const (),
1865                )),
1866                Box_::into_raw(f),
1867            )
1868        }
1869    }
1870
1871    #[doc(alias = "check-resize")]
1872    fn connect_check_resize<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1873        unsafe extern "C" fn check_resize_trampoline<P: IsA<Container>, F: Fn(&P) + 'static>(
1874            this: *mut ffi::GtkContainer,
1875            f: glib::ffi::gpointer,
1876        ) {
1877            unsafe {
1878                let f: &F = &*(f as *const F);
1879                f(Container::from_glib_borrow(this).unsafe_cast_ref())
1880            }
1881        }
1882        unsafe {
1883            let f: Box_<F> = Box_::new(f);
1884            connect_raw(
1885                self.as_ptr() as *mut _,
1886                c"check-resize".as_ptr(),
1887                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1888                    check_resize_trampoline::<Self, F> as *const (),
1889                )),
1890                Box_::into_raw(f),
1891            )
1892        }
1893    }
1894
1895    #[doc(alias = "remove")]
1896    fn connect_remove<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId {
1897        unsafe extern "C" fn remove_trampoline<P: IsA<Container>, F: Fn(&P, &Widget) + 'static>(
1898            this: *mut ffi::GtkContainer,
1899            object: *mut ffi::GtkWidget,
1900            f: glib::ffi::gpointer,
1901        ) {
1902            unsafe {
1903                let f: &F = &*(f as *const F);
1904                f(
1905                    Container::from_glib_borrow(this).unsafe_cast_ref(),
1906                    &from_glib_borrow(object),
1907                )
1908            }
1909        }
1910        unsafe {
1911            let f: Box_<F> = Box_::new(f);
1912            connect_raw(
1913                self.as_ptr() as *mut _,
1914                c"remove".as_ptr(),
1915                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1916                    remove_trampoline::<Self, F> as *const (),
1917                )),
1918                Box_::into_raw(f),
1919            )
1920        }
1921    }
1922
1923    #[doc(alias = "set-focus-child")]
1924    fn connect_set_focus_child<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId {
1925        unsafe extern "C" fn set_focus_child_trampoline<
1926            P: IsA<Container>,
1927            F: Fn(&P, &Widget) + 'static,
1928        >(
1929            this: *mut ffi::GtkContainer,
1930            object: *mut ffi::GtkWidget,
1931            f: glib::ffi::gpointer,
1932        ) {
1933            unsafe {
1934                let f: &F = &*(f as *const F);
1935                f(
1936                    Container::from_glib_borrow(this).unsafe_cast_ref(),
1937                    &from_glib_borrow(object),
1938                )
1939            }
1940        }
1941        unsafe {
1942            let f: Box_<F> = Box_::new(f);
1943            connect_raw(
1944                self.as_ptr() as *mut _,
1945                c"set-focus-child".as_ptr(),
1946                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1947                    set_focus_child_trampoline::<Self, F> as *const (),
1948                )),
1949                Box_::into_raw(f),
1950            )
1951        }
1952    }
1953
1954    #[doc(alias = "border-width")]
1955    fn connect_border_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1956        unsafe extern "C" fn notify_border_width_trampoline<
1957            P: IsA<Container>,
1958            F: Fn(&P) + 'static,
1959        >(
1960            this: *mut ffi::GtkContainer,
1961            _param_spec: glib::ffi::gpointer,
1962            f: glib::ffi::gpointer,
1963        ) {
1964            unsafe {
1965                let f: &F = &*(f as *const F);
1966                f(Container::from_glib_borrow(this).unsafe_cast_ref())
1967            }
1968        }
1969        unsafe {
1970            let f: Box_<F> = Box_::new(f);
1971            connect_raw(
1972                self.as_ptr() as *mut _,
1973                c"notify::border-width".as_ptr(),
1974                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1975                    notify_border_width_trampoline::<Self, F> as *const (),
1976                )),
1977                Box_::into_raw(f),
1978            )
1979        }
1980    }
1981
1982    #[doc(alias = "child")]
1983    fn connect_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1984        unsafe extern "C" fn notify_child_trampoline<P: IsA<Container>, F: Fn(&P) + 'static>(
1985            this: *mut ffi::GtkContainer,
1986            _param_spec: glib::ffi::gpointer,
1987            f: glib::ffi::gpointer,
1988        ) {
1989            unsafe {
1990                let f: &F = &*(f as *const F);
1991                f(Container::from_glib_borrow(this).unsafe_cast_ref())
1992            }
1993        }
1994        unsafe {
1995            let f: Box_<F> = Box_::new(f);
1996            connect_raw(
1997                self.as_ptr() as *mut _,
1998                c"notify::child".as_ptr(),
1999                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2000                    notify_child_trampoline::<Self, F> as *const (),
2001                )),
2002                Box_::into_raw(f),
2003            )
2004        }
2005    }
2006
2007    #[doc(alias = "resize-mode")]
2008    fn connect_resize_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2009        unsafe extern "C" fn notify_resize_mode_trampoline<
2010            P: IsA<Container>,
2011            F: Fn(&P) + 'static,
2012        >(
2013            this: *mut ffi::GtkContainer,
2014            _param_spec: glib::ffi::gpointer,
2015            f: glib::ffi::gpointer,
2016        ) {
2017            unsafe {
2018                let f: &F = &*(f as *const F);
2019                f(Container::from_glib_borrow(this).unsafe_cast_ref())
2020            }
2021        }
2022        unsafe {
2023            let f: Box_<F> = Box_::new(f);
2024            connect_raw(
2025                self.as_ptr() as *mut _,
2026                c"notify::resize-mode".as_ptr(),
2027                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2028                    notify_resize_mode_trampoline::<Self, F> as *const (),
2029                )),
2030                Box_::into_raw(f),
2031            )
2032        }
2033    }
2034}
2035
2036impl<O: IsA<Container>> ContainerExt for O {}