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