Skip to main content

gtk/auto/
scrolled_window.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{
6    Adjustment, Align, Bin, Buildable, Container, CornerType, DirectionType, PolicyType,
7    PositionType, ResizeMode, ScrollType, ShadowType, Widget,
8};
9use glib::{
10    prelude::*,
11    signal::{connect_raw, SignalHandlerId},
12    translate::*,
13};
14use std::{boxed::Box as Box_, fmt, mem, mem::transmute};
15
16glib::wrapper! {
17    /// GtkScrolledWindow is a container that accepts a single child widget and makes
18    /// that child scrollable using either internally added scrollbars or externally
19    /// associated adjustments.
20    ///
21    /// Widgets with native scrolling support, i.e. those whose classes implement the
22    /// [`Scrollable`][crate::Scrollable] interface, are added directly. For other types of widget, the
23    /// class [`Viewport`][crate::Viewport] acts as an adaptor, giving scrollability to other widgets.
24    /// GtkScrolledWindow’s implementation of [`ContainerExt::add()`][crate::prelude::ContainerExt::add()] intelligently
25    /// accounts for whether or not the added child is a [`Scrollable`][crate::Scrollable]. If it isn’t,
26    /// [`ScrolledWindow`][crate::ScrolledWindow] wraps the child in a [`Viewport`][crate::Viewport] and adds that for you.
27    /// Therefore, you can just add any child widget and not worry about the details.
28    ///
29    /// If [`ContainerExt::add()`][crate::prelude::ContainerExt::add()] has added a [`Viewport`][crate::Viewport] for you, you can remove
30    /// both your added child widget from the [`Viewport`][crate::Viewport], and the [`Viewport`][crate::Viewport]
31    /// from the GtkScrolledWindow, like this:
32    ///
33    ///
34    ///
35    /// **⚠️ The following code is in C ⚠️**
36    ///
37    /// ```C
38    /// GtkWidget *scrolled_window = gtk_scrolled_window_new (NULL, NULL);
39    /// GtkWidget *child_widget = gtk_button_new ();
40    ///
41    /// // GtkButton is not a GtkScrollable, so GtkScrolledWindow will automatically
42    /// // add a GtkViewport.
43    /// gtk_container_add (GTK_CONTAINER (scrolled_window),
44    ///                    child_widget);
45    ///
46    /// // Either of these will result in child_widget being unparented:
47    /// gtk_container_remove (GTK_CONTAINER (scrolled_window),
48    ///                       child_widget);
49    /// // or
50    /// gtk_container_remove (GTK_CONTAINER (scrolled_window),
51    ///                       gtk_bin_get_child (GTK_BIN (scrolled_window)));
52    /// ```
53    ///
54    /// Unless [`policy`][struct@crate::ScrolledWindow#policy] is GTK_POLICY_NEVER or GTK_POLICY_EXTERNAL,
55    /// GtkScrolledWindow adds internal [`Scrollbar`][crate::Scrollbar] widgets around its child. The
56    /// scroll position of the child, and if applicable the scrollbars, is controlled
57    /// by the [`hadjustment`][struct@crate::ScrolledWindow#hadjustment] and [`vadjustment`][struct@crate::ScrolledWindow#vadjustment]
58    /// that are associated with the GtkScrolledWindow. See the docs on [`Scrollbar`][crate::Scrollbar]
59    /// for the details, but note that the “step_increment” and “page_increment”
60    /// fields are only effective if the policy causes scrollbars to be present.
61    ///
62    /// If a GtkScrolledWindow doesn’t behave quite as you would like, or
63    /// doesn’t have exactly the right layout, it’s very possible to set up
64    /// your own scrolling with [`Scrollbar`][crate::Scrollbar] and for example a [`Grid`][crate::Grid].
65    ///
66    /// # Touch support
67    ///
68    /// GtkScrolledWindow has built-in support for touch devices. When a
69    /// touchscreen is used, swiping will move the scrolled window, and will
70    /// expose 'kinetic' behavior. This can be turned off with the
71    /// [`kinetic-scrolling`][struct@crate::ScrolledWindow#kinetic-scrolling] property if it is undesired.
72    ///
73    /// GtkScrolledWindow also displays visual 'overshoot' indication when
74    /// the content is pulled beyond the end, and this situation can be
75    /// captured with the [`edge-overshot`][struct@crate::ScrolledWindow#edge-overshot] signal.
76    ///
77    /// If no mouse device is present, the scrollbars will overlayed as
78    /// narrow, auto-hiding indicators over the content. If traditional
79    /// scrollbars are desired although no mouse is present, this behaviour
80    /// can be turned off with the [`overlay-scrolling`][struct@crate::ScrolledWindow#overlay-scrolling]
81    /// property.
82    ///
83    /// # CSS nodes
84    ///
85    /// GtkScrolledWindow has a main CSS node with name scrolledwindow.
86    ///
87    /// It uses subnodes with names overshoot and undershoot to
88    /// draw the overflow and underflow indications. These nodes get
89    /// the .left, .right, .top or .bottom style class added depending
90    /// on where the indication is drawn.
91    ///
92    /// GtkScrolledWindow also sets the positional style classes (.left,
93    /// .right, .top, .bottom) and style classes related to overlay
94    /// scrolling (.overlay-indicator, .dragging, .hovering) on its scrollbars.
95    ///
96    /// If both scrollbars are visible, the area where they meet is drawn
97    /// with a subnode named junction.
98    ///
99    /// ## Properties
100    ///
101    ///
102    /// #### `hadjustment`
103    ///  Readable | Writeable | Construct
104    ///
105    ///
106    /// #### `hscrollbar-policy`
107    ///  Readable | Writeable
108    ///
109    ///
110    /// #### `kinetic-scrolling`
111    ///  Whether kinetic scrolling is enabled or not. Kinetic scrolling
112    /// only applies to devices with source `GDK_SOURCE_TOUCHSCREEN`.
113    ///
114    /// Readable | Writeable
115    ///
116    ///
117    /// #### `max-content-height`
118    ///  The maximum content height of `scrolled_window`, or -1 if not set.
119    ///
120    /// Readable | Writeable
121    ///
122    ///
123    /// #### `max-content-width`
124    ///  The maximum content width of `scrolled_window`, or -1 if not set.
125    ///
126    /// Readable | Writeable
127    ///
128    ///
129    /// #### `min-content-height`
130    ///  The minimum content height of `scrolled_window`, or -1 if not set.
131    ///
132    /// Readable | Writeable
133    ///
134    ///
135    /// #### `min-content-width`
136    ///  The minimum content width of `scrolled_window`, or -1 if not set.
137    ///
138    /// Readable | Writeable
139    ///
140    ///
141    /// #### `overlay-scrolling`
142    ///  Whether overlay scrolling is enabled or not. If it is, the
143    /// scrollbars are only added as traditional widgets when a mouse
144    /// is present. Otherwise, they are overlayed on top of the content,
145    /// as narrow indicators.
146    ///
147    /// Note that overlay scrolling can also be globally disabled, with
148    /// the [`gtk-overlay-scrolling`][struct@crate::Settings#gtk-overlay-scrolling] setting.
149    ///
150    /// Readable | Writeable
151    ///
152    ///
153    /// #### `propagate-natural-height`
154    ///  Whether the natural height of the child should be calculated and propagated
155    /// through the scrolled window’s requested natural height.
156    ///
157    /// This is useful in cases where an attempt should be made to allocate exactly
158    /// enough space for the natural size of the child.
159    ///
160    /// Readable | Writeable
161    ///
162    ///
163    /// #### `propagate-natural-width`
164    ///  Whether the natural width of the child should be calculated and propagated
165    /// through the scrolled window’s requested natural width.
166    ///
167    /// This is useful in cases where an attempt should be made to allocate exactly
168    /// enough space for the natural size of the child.
169    ///
170    /// Readable | Writeable
171    ///
172    ///
173    /// #### `shadow-type`
174    ///  Readable | Writeable
175    ///
176    ///
177    /// #### `vadjustment`
178    ///  Readable | Writeable | Construct
179    ///
180    ///
181    /// #### `vscrollbar-policy`
182    ///  Readable | Writeable
183    ///
184    ///
185    /// #### `window-placement`
186    ///  Readable | Writeable
187    ///
188    ///
189    /// #### `window-placement-set`
190    ///  Whether "window-placement" should be used to determine the location
191    /// of the contents with respect to the scrollbars.
192    ///
193    /// Readable | Writeable
194    /// <details><summary><h4>Container</h4></summary>
195    ///
196    ///
197    /// #### `border-width`
198    ///  Readable | Writeable
199    ///
200    ///
201    /// #### `child`
202    ///  Writeable
203    ///
204    ///
205    /// #### `resize-mode`
206    ///  Readable | Writeable
207    /// </details>
208    /// <details><summary><h4>Widget</h4></summary>
209    ///
210    ///
211    /// #### `app-paintable`
212    ///  Readable | Writeable
213    ///
214    ///
215    /// #### `can-default`
216    ///  Readable | Writeable
217    ///
218    ///
219    /// #### `can-focus`
220    ///  Readable | Writeable
221    ///
222    ///
223    /// #### `composite-child`
224    ///  Readable
225    ///
226    ///
227    /// #### `double-buffered`
228    ///  Whether the widget is double buffered.
229    ///
230    /// Readable | Writeable
231    ///
232    ///
233    /// #### `events`
234    ///  Readable | Writeable
235    ///
236    ///
237    /// #### `expand`
238    ///  Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
239    ///
240    /// Readable | Writeable
241    ///
242    ///
243    /// #### `focus-on-click`
244    ///  Whether the widget should grab focus when it is clicked with the mouse.
245    ///
246    /// This property is only relevant for widgets that can take focus.
247    ///
248    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
249    /// GtkComboBox) implemented this property individually.
250    ///
251    /// Readable | Writeable
252    ///
253    ///
254    /// #### `halign`
255    ///  How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
256    ///
257    /// Readable | Writeable
258    ///
259    ///
260    /// #### `has-default`
261    ///  Readable | Writeable
262    ///
263    ///
264    /// #### `has-focus`
265    ///  Readable | Writeable
266    ///
267    ///
268    /// #### `has-tooltip`
269    ///  Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
270    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
271    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
272    /// whether it will provide a tooltip or not.
273    ///
274    /// Note that setting this property to [`true`] for the first time will change
275    /// the event masks of the GdkWindows of this widget to include leave-notify
276    /// and motion-notify events. This cannot and will not be undone when the
277    /// property is set to [`false`] again.
278    ///
279    /// Readable | Writeable
280    ///
281    ///
282    /// #### `height-request`
283    ///  Readable | Writeable
284    ///
285    ///
286    /// #### `hexpand`
287    ///  Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
288    ///
289    /// Readable | Writeable
290    ///
291    ///
292    /// #### `hexpand-set`
293    ///  Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
294    ///
295    /// Readable | Writeable
296    ///
297    ///
298    /// #### `is-focus`
299    ///  Readable | Writeable
300    ///
301    ///
302    /// #### `margin`
303    ///  Sets all four sides' margin at once. If read, returns max
304    /// margin on any side.
305    ///
306    /// Readable | Writeable
307    ///
308    ///
309    /// #### `margin-bottom`
310    ///  Margin on bottom side of widget.
311    ///
312    /// This property adds margin outside of the widget's normal size
313    /// request, the margin will be added in addition to the size from
314    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
315    ///
316    /// Readable | Writeable
317    ///
318    ///
319    /// #### `margin-end`
320    ///  Margin on end of widget, horizontally. This property supports
321    /// left-to-right and right-to-left text directions.
322    ///
323    /// This property adds margin outside of the widget's normal size
324    /// request, the margin will be added in addition to the size from
325    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
326    ///
327    /// Readable | Writeable
328    ///
329    ///
330    /// #### `margin-left`
331    ///  Margin on left side of widget.
332    ///
333    /// This property adds margin outside of the widget's normal size
334    /// request, the margin will be added in addition to the size from
335    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
336    ///
337    /// Readable | Writeable
338    ///
339    ///
340    /// #### `margin-right`
341    ///  Margin on right side of widget.
342    ///
343    /// This property adds margin outside of the widget's normal size
344    /// request, the margin will be added in addition to the size from
345    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
346    ///
347    /// Readable | Writeable
348    ///
349    ///
350    /// #### `margin-start`
351    ///  Margin on start of widget, horizontally. This property supports
352    /// left-to-right and right-to-left text directions.
353    ///
354    /// This property adds margin outside of the widget's normal size
355    /// request, the margin will be added in addition to the size from
356    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
357    ///
358    /// Readable | Writeable
359    ///
360    ///
361    /// #### `margin-top`
362    ///  Margin on top side of widget.
363    ///
364    /// This property adds margin outside of the widget's normal size
365    /// request, the margin will be added in addition to the size from
366    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
367    ///
368    /// Readable | Writeable
369    ///
370    ///
371    /// #### `name`
372    ///  Readable | Writeable
373    ///
374    ///
375    /// #### `no-show-all`
376    ///  Readable | Writeable
377    ///
378    ///
379    /// #### `opacity`
380    ///  The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
381    /// more details about window opacity.
382    ///
383    /// Before 3.8 this was only available in GtkWindow
384    ///
385    /// Readable | Writeable
386    ///
387    ///
388    /// #### `parent`
389    ///  Readable | Writeable
390    ///
391    ///
392    /// #### `receives-default`
393    ///  Readable | Writeable
394    ///
395    ///
396    /// #### `scale-factor`
397    ///  The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
398    /// more details about widget scaling.
399    ///
400    /// Readable
401    ///
402    ///
403    /// #### `sensitive`
404    ///  Readable | Writeable
405    ///
406    ///
407    /// #### `style`
408    ///  The style of the widget, which contains information about how it will look (colors, etc).
409    ///
410    /// Readable | Writeable
411    ///
412    ///
413    /// #### `tooltip-markup`
414    ///  Sets the text of tooltip to be the given string, which is marked up
415    /// with the [Pango text markup language][PangoMarkupFormat].
416    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
417    ///
418    /// This is a convenience property which will take care of getting the
419    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
420    /// will automatically be set to [`true`] and there will be taken care of
421    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
422    ///
423    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
424    /// are set, the last one wins.
425    ///
426    /// Readable | Writeable
427    ///
428    ///
429    /// #### `tooltip-text`
430    ///  Sets the text of tooltip to be the given string.
431    ///
432    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
433    ///
434    /// This is a convenience property which will take care of getting the
435    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
436    /// will automatically be set to [`true`] and there will be taken care of
437    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
438    ///
439    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
440    /// are set, the last one wins.
441    ///
442    /// Readable | Writeable
443    ///
444    ///
445    /// #### `valign`
446    ///  How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
447    ///
448    /// Readable | Writeable
449    ///
450    ///
451    /// #### `vexpand`
452    ///  Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
453    ///
454    /// Readable | Writeable
455    ///
456    ///
457    /// #### `vexpand-set`
458    ///  Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
459    ///
460    /// Readable | Writeable
461    ///
462    ///
463    /// #### `visible`
464    ///  Readable | Writeable
465    ///
466    ///
467    /// #### `width-request`
468    ///  Readable | Writeable
469    ///
470    ///
471    /// #### `window`
472    ///  The widget's window if it is realized, [`None`] otherwise.
473    ///
474    /// Readable
475    /// </details>
476    ///
477    /// ## Signals
478    ///
479    ///
480    /// #### `edge-overshot`
481    ///  The ::edge-overshot signal is emitted whenever user initiated scrolling
482    /// makes the scrolled window firmly surpass (i.e. with some edge resistance)
483    /// the lower or upper limits defined by the adjustment in that orientation.
484    ///
485    /// A similar behavior without edge resistance is provided by the
486    /// [`edge-reached`][struct@crate::ScrolledWindow#edge-reached] signal.
487    ///
488    /// Note: The `pos` argument is LTR/RTL aware, so callers should be aware too
489    /// if intending to provide behavior on horizontal edges.
490    ///
491    ///
492    ///
493    ///
494    /// #### `edge-reached`
495    ///  The ::edge-reached signal is emitted whenever user-initiated scrolling
496    /// makes the scrolled window exactly reach the lower or upper limits
497    /// defined by the adjustment in that orientation.
498    ///
499    /// A similar behavior with edge resistance is provided by the
500    /// [`edge-overshot`][struct@crate::ScrolledWindow#edge-overshot] signal.
501    ///
502    /// Note: The `pos` argument is LTR/RTL aware, so callers should be aware too
503    /// if intending to provide behavior on horizontal edges.
504    ///
505    ///
506    ///
507    ///
508    /// #### `move-focus-out`
509    ///  The ::move-focus-out signal is a
510    /// [keybinding signal][GtkBindingSignal] which gets
511    /// emitted when focus is moved away from the scrolled window by a
512    /// keybinding. The [`move-focus`][struct@crate::Widget#move-focus] signal is emitted with
513    /// `direction_type` on this scrolled window’s toplevel parent in the
514    /// container hierarchy. The default bindings for this signal are
515    /// `Ctrl + Tab` to move forward and `Ctrl + Shift + Tab` to move backward.
516    ///
517    /// Action
518    ///
519    ///
520    /// #### `scroll-child`
521    ///  The ::scroll-child signal is a
522    /// [keybinding signal][GtkBindingSignal]
523    /// which gets emitted when a keybinding that scrolls is pressed.
524    /// The horizontal or vertical adjustment is updated which triggers a
525    /// signal that the scrolled window’s child may listen to and scroll itself.
526    ///
527    /// Action
528    /// <details><summary><h4>Container</h4></summary>
529    ///
530    ///
531    /// #### `add`
532    ///
533    ///
534    ///
535    /// #### `check-resize`
536    ///
537    ///
538    ///
539    /// #### `remove`
540    ///
541    ///
542    ///
543    /// #### `set-focus-child`
544    ///
545    /// </details>
546    /// <details><summary><h4>Widget</h4></summary>
547    ///
548    ///
549    /// #### `accel-closures-changed`
550    ///
551    ///
552    ///
553    /// #### `button-press-event`
554    ///  The ::button-press-event signal will be emitted when a button
555    /// (typically from a mouse) is pressed.
556    ///
557    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
558    /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
559    ///
560    /// This signal will be sent to the grab widget if there is one.
561    ///
562    ///
563    ///
564    ///
565    /// #### `button-release-event`
566    ///  The ::button-release-event signal will be emitted when a button
567    /// (typically from a mouse) is released.
568    ///
569    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
570    /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
571    ///
572    /// This signal will be sent to the grab widget if there is one.
573    ///
574    ///
575    ///
576    ///
577    /// #### `can-activate-accel`
578    ///  Determines whether an accelerator that activates the signal
579    /// identified by `signal_id` can currently be activated.
580    /// This signal is present to allow applications and derived
581    /// widgets to override the default [`Widget`][crate::Widget] handling
582    /// for determining whether an accelerator can be activated.
583    ///
584    ///
585    ///
586    ///
587    /// #### `child-notify`
588    ///  The ::child-notify signal is emitted for each
589    /// [child property][child-properties] that has
590    /// changed on an object. The signal's detail holds the property name.
591    ///
592    /// Detailed
593    ///
594    ///
595    /// #### `composited-changed`
596    ///  The ::composited-changed signal is emitted when the composited
597    /// status of `widgets` screen changes.
598    /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
599    ///
600    /// Action
601    ///
602    ///
603    /// #### `configure-event`
604    ///  The ::configure-event signal will be emitted when the size, position or
605    /// stacking of the `widget`'s window has changed.
606    ///
607    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
608    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
609    /// automatically for all new windows.
610    ///
611    ///
612    ///
613    ///
614    /// #### `damage-event`
615    ///  Emitted when a redirected window belonging to `widget` gets drawn into.
616    /// The region/area members of the event shows what area of the redirected
617    /// drawable was drawn into.
618    ///
619    ///
620    ///
621    ///
622    /// #### `delete-event`
623    ///  The ::delete-event signal is emitted if a user requests that
624    /// a toplevel window is closed. The default handler for this signal
625    /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
626    /// this signal will cause the window to be hidden instead, so that
627    /// it can later be shown again without reconstructing it.
628    ///
629    ///
630    ///
631    ///
632    /// #### `destroy`
633    ///  Signals that all holders of a reference to the widget should release
634    /// the reference that they hold. May result in finalization of the widget
635    /// if all references are released.
636    ///
637    /// This signal is not suitable for saving widget state.
638    ///
639    ///
640    ///
641    ///
642    /// #### `destroy-event`
643    ///  The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
644    /// You rarely get this signal, because most widgets disconnect themselves
645    /// from their window before they destroy it, so no widget owns the
646    /// window at destroy time.
647    ///
648    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
649    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
650    /// automatically for all new windows.
651    ///
652    ///
653    ///
654    ///
655    /// #### `direction-changed`
656    ///  The ::direction-changed signal is emitted when the text direction
657    /// of a widget changes.
658    ///
659    ///
660    ///
661    ///
662    /// #### `drag-begin`
663    ///  The ::drag-begin signal is emitted on the drag source when a drag is
664    /// started. A typical reason to connect to this signal is to set up a
665    /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
666    ///
667    /// Note that some widgets set up a drag icon in the default handler of
668    /// this signal, so you may have to use `g_signal_connect_after()` to
669    /// override what the default handler did.
670    ///
671    ///
672    ///
673    ///
674    /// #### `drag-data-delete`
675    ///  The ::drag-data-delete signal is emitted on the drag source when a drag
676    /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
677    /// handler is responsible for deleting the data that has been dropped. What
678    /// "delete" means depends on the context of the drag operation.
679    ///
680    ///
681    ///
682    ///
683    /// #### `drag-data-get`
684    ///  The ::drag-data-get signal is emitted on the drag source when the drop
685    /// site requests the data which is dragged. It is the responsibility of
686    /// the signal handler to fill `data` with the data in the format which
687    /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
688    /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
689    ///
690    ///
691    ///
692    ///
693    /// #### `drag-data-received`
694    ///  The ::drag-data-received signal is emitted on the drop site when the
695    /// dragged data has been received. If the data was received in order to
696    /// determine whether the drop will be accepted, the handler is expected
697    /// to call `gdk_drag_status()` and not finish the drag.
698    /// If the data was received in response to a [`drag-drop`][struct@crate::Widget#drag-drop] signal
699    /// (and this is the last target to be received), the handler for this
700    /// signal is expected to process the received data and then call
701    /// `gtk_drag_finish()`, setting the `success` parameter depending on
702    /// whether the data was processed successfully.
703    ///
704    /// Applications must create some means to determine why the signal was emitted
705    /// and therefore whether to call `gdk_drag_status()` or `gtk_drag_finish()`.
706    ///
707    /// The handler may inspect the selected action with
708    /// [`DragContext::selected_action()`][crate::gdk::DragContext::selected_action()] before calling
709    /// `gtk_drag_finish()`, e.g. to implement [`gdk::DragAction::ASK`][crate::gdk::DragAction::ASK] as
710    /// shown in the following example:
711    ///
712    ///
713    /// **⚠️ The following code is in C ⚠️**
714    ///
715    /// ```C
716    /// void
717    /// drag_data_received (GtkWidget          *widget,
718    ///                     GdkDragContext     *context,
719    ///                     gint                x,
720    ///                     gint                y,
721    ///                     GtkSelectionData   *data,
722    ///                     guint               info,
723    ///                     guint               time)
724    /// {
725    ///   if ((data->length >= 0) && (data->format == 8))
726    ///     {
727    ///       GdkDragAction action;
728    ///
729    ///       // handle data here
730    ///
731    ///       action = gdk_drag_context_get_selected_action (context);
732    ///       if (action == GDK_ACTION_ASK)
733    ///         {
734    ///           GtkWidget *dialog;
735    ///           gint response;
736    ///
737    ///           dialog = gtk_message_dialog_new (NULL,
738    ///                                            GTK_DIALOG_MODAL |
739    ///                                            GTK_DIALOG_DESTROY_WITH_PARENT,
740    ///                                            GTK_MESSAGE_INFO,
741    ///                                            GTK_BUTTONS_YES_NO,
742    ///                                            "Move the data ?\n");
743    ///           response = gtk_dialog_run (GTK_DIALOG (dialog));
744    ///           gtk_widget_destroy (dialog);
745    ///
746    ///           if (response == GTK_RESPONSE_YES)
747    ///             action = GDK_ACTION_MOVE;
748    ///           else
749    ///             action = GDK_ACTION_COPY;
750    ///          }
751    ///
752    ///       gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
753    ///     }
754    ///   else
755    ///     gtk_drag_finish (context, FALSE, FALSE, time);
756    ///  }
757    /// ```
758    ///
759    ///
760    ///
761    ///
762    /// #### `drag-drop`
763    ///  The ::drag-drop signal is emitted on the drop site when the user drops
764    /// the data onto the widget. The signal handler must determine whether
765    /// the cursor position is in a drop zone or not. If it is not in a drop
766    /// zone, it returns [`false`] and no further processing is necessary.
767    /// Otherwise, the handler returns [`true`]. In this case, the handler must
768    /// ensure that `gtk_drag_finish()` is called to let the source know that
769    /// the drop is done. The call to `gtk_drag_finish()` can be done either
770    /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
771    /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
772    /// or more of the supported targets.
773    ///
774    ///
775    ///
776    ///
777    /// #### `drag-end`
778    ///  The ::drag-end signal is emitted on the drag source when a drag is
779    /// finished. A typical reason to connect to this signal is to undo
780    /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
781    ///
782    ///
783    ///
784    ///
785    /// #### `drag-failed`
786    ///  The ::drag-failed signal is emitted on the drag source when a drag has
787    /// failed. The signal handler may hook custom code to handle a failed DnD
788    /// operation based on the type of error, it returns [`true`] is the failure has
789    /// been already handled (not showing the default "drag operation failed"
790    /// animation), otherwise it returns [`false`].
791    ///
792    ///
793    ///
794    ///
795    /// #### `drag-leave`
796    ///  The ::drag-leave signal is emitted on the drop site when the cursor
797    /// leaves the widget. A typical reason to connect to this signal is to
798    /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
799    /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
800    ///
801    ///
802    /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
803    /// ::drag-drop signal, for instance to allow cleaning up of a preview item
804    /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
805    ///
806    ///
807    ///
808    ///
809    /// #### `drag-motion`
810    ///  The ::drag-motion signal is emitted on the drop site when the user
811    /// moves the cursor over the widget during a drag. The signal handler
812    /// must determine whether the cursor position is in a drop zone or not.
813    /// If it is not in a drop zone, it returns [`false`] and no further processing
814    /// is necessary. Otherwise, the handler returns [`true`]. In this case, the
815    /// handler is responsible for providing the necessary information for
816    /// displaying feedback to the user, by calling `gdk_drag_status()`.
817    ///
818    /// If the decision whether the drop will be accepted or rejected can't be
819    /// made based solely on the cursor position and the type of the data, the
820    /// handler may inspect the dragged data by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] and
821    /// defer the `gdk_drag_status()` call to the [`drag-data-received`][struct@crate::Widget#drag-data-received]
822    /// handler. Note that you must pass [`DestDefaults::DROP`][crate::DestDefaults::DROP],
823    /// [`DestDefaults::MOTION`][crate::DestDefaults::MOTION] or [`DestDefaults::ALL`][crate::DestDefaults::ALL] to [`WidgetExtManual::drag_dest_set()`][crate::prelude::WidgetExtManual::drag_dest_set()]
824    /// when using the drag-motion signal that way.
825    ///
826    /// Also note that there is no drag-enter signal. The drag receiver has to
827    /// keep track of whether he has received any drag-motion signals since the
828    /// last [`drag-leave`][struct@crate::Widget#drag-leave] and if not, treat the drag-motion signal as
829    /// an "enter" signal. Upon an "enter", the handler will typically highlight
830    /// the drop site with [`WidgetExt::drag_highlight()`][crate::prelude::WidgetExt::drag_highlight()].
831    ///
832    ///
833    /// **⚠️ The following code is in C ⚠️**
834    ///
835    /// ```C
836    /// static void
837    /// drag_motion (GtkWidget      *widget,
838    ///              GdkDragContext *context,
839    ///              gint            x,
840    ///              gint            y,
841    ///              guint           time)
842    /// {
843    ///   GdkAtom target;
844    ///
845    ///   PrivateData *private_data = GET_PRIVATE_DATA (widget);
846    ///
847    ///   if (!private_data->drag_highlight)
848    ///    {
849    ///      private_data->drag_highlight = 1;
850    ///      gtk_drag_highlight (widget);
851    ///    }
852    ///
853    ///   target = gtk_drag_dest_find_target (widget, context, NULL);
854    ///   if (target == GDK_NONE)
855    ///     gdk_drag_status (context, 0, time);
856    ///   else
857    ///    {
858    ///      private_data->pending_status
859    ///         = gdk_drag_context_get_suggested_action (context);
860    ///      gtk_drag_get_data (widget, context, target, time);
861    ///    }
862    ///
863    ///   return TRUE;
864    /// }
865    ///
866    /// static void
867    /// drag_data_received (GtkWidget        *widget,
868    ///                     GdkDragContext   *context,
869    ///                     gint              x,
870    ///                     gint              y,
871    ///                     GtkSelectionData *selection_data,
872    ///                     guint             info,
873    ///                     guint             time)
874    /// {
875    ///   PrivateData *private_data = GET_PRIVATE_DATA (widget);
876    ///
877    ///   if (private_data->suggested_action)
878    ///    {
879    ///      private_data->suggested_action = 0;
880    ///
881    ///      // We are getting this data due to a request in drag_motion,
882    ///      // rather than due to a request in drag_drop, so we are just
883    ///      // supposed to call gdk_drag_status(), not actually paste in
884    ///      // the data.
885    ///
886    ///      str = gtk_selection_data_get_text (selection_data);
887    ///      if (!data_is_acceptable (str))
888    ///        gdk_drag_status (context, 0, time);
889    ///      else
890    ///        gdk_drag_status (context,
891    ///                         private_data->suggested_action,
892    ///                         time);
893    ///    }
894    ///   else
895    ///    {
896    ///      // accept the drop
897    ///    }
898    /// }
899    /// ```
900    ///
901    ///
902    ///
903    ///
904    /// #### `draw`
905    ///  This signal is emitted when a widget is supposed to render itself.
906    /// The `widget`'s top left corner must be painted at the origin of
907    /// the passed in context and be sized to the values returned by
908    /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
909    /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
910    ///
911    /// Signal handlers connected to this signal can modify the cairo
912    /// context passed as `cr` in any way they like and don't need to
913    /// restore it. The signal emission takes care of calling `cairo_save()`
914    /// before and `cairo_restore()` after invoking the handler.
915    ///
916    /// The signal handler will get a `cr` with a clip region already set to the
917    /// widget's dirty region, i.e. to the area that needs repainting. Complicated
918    /// widgets that want to avoid redrawing themselves completely can get the full
919    /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
920    /// get a finer-grained representation of the dirty region with
921    /// `cairo_copy_clip_rectangle_list()`.
922    ///
923    ///
924    ///
925    ///
926    /// #### `enter-notify-event`
927    ///  The ::enter-notify-event will be emitted when the pointer enters
928    /// the `widget`'s window.
929    ///
930    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
931    /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
932    ///
933    /// This signal will be sent to the grab widget if there is one.
934    ///
935    ///
936    ///
937    ///
938    /// #### `event`
939    ///  The GTK+ main loop will emit three signals for each GDK event delivered
940    /// to a widget: one generic ::event signal, another, more specific,
941    /// signal that matches the type of event delivered (e.g.
942    /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
943    /// [`event-after`][struct@crate::Widget#event-after] signal.
944    ///
945    ///
946    ///
947    ///
948    /// #### `event-after`
949    ///  After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
950    /// the second more specific signal, ::event-after will be emitted
951    /// regardless of the previous two signals handlers return values.
952    ///
953    ///
954    ///
955    ///
956    /// #### `focus`
957    ///
958    ///
959    ///
960    /// #### `focus-in-event`
961    ///  The ::focus-in-event signal will be emitted when the keyboard focus
962    /// enters the `widget`'s window.
963    ///
964    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
965    /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
966    ///
967    ///
968    ///
969    ///
970    /// #### `focus-out-event`
971    ///  The ::focus-out-event signal will be emitted when the keyboard focus
972    /// leaves the `widget`'s window.
973    ///
974    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
975    /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
976    ///
977    ///
978    ///
979    ///
980    /// #### `grab-broken-event`
981    ///  Emitted when a pointer or keyboard grab on a window belonging
982    /// to `widget` gets broken.
983    ///
984    /// On X11, this happens when the grab window becomes unviewable
985    /// (i.e. it or one of its ancestors is unmapped), or if the same
986    /// application grabs the pointer or keyboard again.
987    ///
988    ///
989    ///
990    ///
991    /// #### `grab-focus`
992    ///  Action
993    ///
994    ///
995    /// #### `grab-notify`
996    ///  The ::grab-notify signal is emitted when a widget becomes
997    /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
998    /// another widget, or when it becomes unshadowed due to a grab
999    /// being removed.
1000    ///
1001    /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
1002    /// grab widget in the grab stack of its window group is not
1003    /// its ancestor.
1004    ///
1005    ///
1006    ///
1007    ///
1008    /// #### `hide`
1009    ///  The ::hide signal is emitted when `widget` is hidden, for example with
1010    /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
1011    ///
1012    ///
1013    ///
1014    ///
1015    /// #### `hierarchy-changed`
1016    ///  The ::hierarchy-changed signal is emitted when the
1017    /// anchored state of a widget changes. A widget is
1018    /// “anchored” when its toplevel
1019    /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
1020    /// a widget changes from un-anchored to anchored or vice-versa.
1021    ///
1022    ///
1023    ///
1024    ///
1025    /// #### `key-press-event`
1026    ///  The ::key-press-event signal is emitted when a key is pressed. The signal
1027    /// emission will reoccur at the key-repeat rate when the key is kept pressed.
1028    ///
1029    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1030    /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
1031    ///
1032    /// This signal will be sent to the grab widget if there is one.
1033    ///
1034    ///
1035    ///
1036    ///
1037    /// #### `key-release-event`
1038    ///  The ::key-release-event signal is emitted when a key is released.
1039    ///
1040    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1041    /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
1042    ///
1043    /// This signal will be sent to the grab widget if there is one.
1044    ///
1045    ///
1046    ///
1047    ///
1048    /// #### `keynav-failed`
1049    ///  Gets emitted if keyboard navigation fails.
1050    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
1051    ///
1052    ///
1053    ///
1054    ///
1055    /// #### `leave-notify-event`
1056    ///  The ::leave-notify-event will be emitted when the pointer leaves
1057    /// the `widget`'s window.
1058    ///
1059    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1060    /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
1061    ///
1062    /// This signal will be sent to the grab widget if there is one.
1063    ///
1064    ///
1065    ///
1066    ///
1067    /// #### `map`
1068    ///  The ::map signal is emitted when `widget` is going to be mapped, that is
1069    /// when the widget is visible (which is controlled with
1070    /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
1071    /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
1072    /// be emitted.
1073    ///
1074    /// The ::map signal can be used to determine whether a widget will be drawn,
1075    /// for instance it can resume an animation that was stopped during the
1076    /// emission of [`unmap`][struct@crate::Widget#unmap].
1077    ///
1078    ///
1079    ///
1080    ///
1081    /// #### `map-event`
1082    ///  The ::map-event signal will be emitted when the `widget`'s window is
1083    /// mapped. A window is mapped when it becomes visible on the screen.
1084    ///
1085    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1086    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1087    /// automatically for all new windows.
1088    ///
1089    ///
1090    ///
1091    ///
1092    /// #### `mnemonic-activate`
1093    ///  The default handler for this signal activates `widget` if `group_cycling`
1094    /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
1095    ///
1096    ///
1097    ///
1098    ///
1099    /// #### `motion-notify-event`
1100    ///  The ::motion-notify-event signal is emitted when the pointer moves
1101    /// over the widget's [`gdk::Window`][crate::gdk::Window].
1102    ///
1103    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
1104    /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
1105    ///
1106    /// This signal will be sent to the grab widget if there is one.
1107    ///
1108    ///
1109    ///
1110    ///
1111    /// #### `move-focus`
1112    ///  Action
1113    ///
1114    ///
1115    /// #### `parent-set`
1116    ///  The ::parent-set signal is emitted when a new parent
1117    /// has been set on a widget.
1118    ///
1119    ///
1120    ///
1121    ///
1122    /// #### `popup-menu`
1123    ///  This signal gets emitted whenever a widget should pop up a context
1124    /// menu. This usually happens through the standard key binding mechanism;
1125    /// by pressing a certain key while a widget is focused, the user can cause
1126    /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
1127    /// a menu with clipboard commands. See the
1128    /// [Popup Menu Migration Checklist][checklist-popup-menu]
1129    /// for an example of how to use this signal.
1130    ///
1131    /// Action
1132    ///
1133    ///
1134    /// #### `property-notify-event`
1135    ///  The ::property-notify-event signal will be emitted when a property on
1136    /// the `widget`'s window has been changed or deleted.
1137    ///
1138    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1139    /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
1140    ///
1141    ///
1142    ///
1143    ///
1144    /// #### `proximity-in-event`
1145    ///  To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1146    /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
1147    ///
1148    /// This signal will be sent to the grab widget if there is one.
1149    ///
1150    ///
1151    ///
1152    ///
1153    /// #### `proximity-out-event`
1154    ///  To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1155    /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
1156    ///
1157    /// This signal will be sent to the grab widget if there is one.
1158    ///
1159    ///
1160    ///
1161    ///
1162    /// #### `query-tooltip`
1163    ///  Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
1164    /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
1165    /// focus in keyboard mode.
1166    ///
1167    /// Using the given coordinates, the signal handler should determine
1168    /// whether a tooltip should be shown for `widget`. If this is the case
1169    /// [`true`] should be returned, [`false`] otherwise. Note that if
1170    /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
1171    /// should not be used.
1172    ///
1173    /// The signal handler is free to manipulate `tooltip` with the therefore
1174    /// destined function calls.
1175    ///
1176    ///
1177    ///
1178    ///
1179    /// #### `realize`
1180    ///  The ::realize signal is emitted when `widget` is associated with a
1181    /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
1182    /// widget has been mapped (that is, it is going to be drawn).
1183    ///
1184    ///
1185    ///
1186    ///
1187    /// #### `screen-changed`
1188    ///  The ::screen-changed signal gets emitted when the
1189    /// screen of a widget has changed.
1190    ///
1191    ///
1192    ///
1193    ///
1194    /// #### `scroll-event`
1195    ///  The ::scroll-event signal is emitted when a button in the 4 to 7
1196    /// range is pressed. Wheel mice are usually configured to generate
1197    /// button press events for buttons 4 and 5 when the wheel is turned.
1198    ///
1199    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1200    /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
1201    ///
1202    /// This signal will be sent to the grab widget if there is one.
1203    ///
1204    ///
1205    ///
1206    ///
1207    /// #### `selection-clear-event`
1208    ///  The ::selection-clear-event signal will be emitted when the
1209    /// the `widget`'s window has lost ownership of a selection.
1210    ///
1211    ///
1212    ///
1213    ///
1214    /// #### `selection-get`
1215    ///
1216    ///
1217    ///
1218    /// #### `selection-notify-event`
1219    ///
1220    ///
1221    ///
1222    /// #### `selection-received`
1223    ///
1224    ///
1225    ///
1226    /// #### `selection-request-event`
1227    ///  The ::selection-request-event signal will be emitted when
1228    /// another client requests ownership of the selection owned by
1229    /// the `widget`'s window.
1230    ///
1231    ///
1232    ///
1233    ///
1234    /// #### `show`
1235    ///  The ::show signal is emitted when `widget` is shown, for example with
1236    /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
1237    ///
1238    ///
1239    ///
1240    ///
1241    /// #### `show-help`
1242    ///  Action
1243    ///
1244    ///
1245    /// #### `size-allocate`
1246    ///
1247    ///
1248    ///
1249    /// #### `state-changed`
1250    ///  The ::state-changed signal is emitted when the widget state changes.
1251    /// See `gtk_widget_get_state()`.
1252    ///
1253    ///
1254    ///
1255    ///
1256    /// #### `state-flags-changed`
1257    ///  The ::state-flags-changed signal is emitted when the widget state
1258    /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
1259    ///
1260    ///
1261    ///
1262    ///
1263    /// #### `style-set`
1264    ///  The ::style-set signal is emitted when a new style has been set
1265    /// on a widget. Note that style-modifying functions like
1266    /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1267    ///
1268    /// Note that this signal is emitted for changes to the deprecated
1269    /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1270    /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1271    ///
1272    ///
1273    ///
1274    ///
1275    /// #### `style-updated`
1276    ///  The ::style-updated signal is a convenience signal that is emitted when the
1277    /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1278    /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1279    ///
1280    /// Note that style-modifying functions like `gtk_widget_override_color()` also
1281    /// cause this signal to be emitted.
1282    ///
1283    ///
1284    ///
1285    ///
1286    /// #### `touch-event`
1287    ///
1288    ///
1289    ///
1290    /// #### `unmap`
1291    ///  The ::unmap signal is emitted when `widget` is going to be unmapped, which
1292    /// means that either it or any of its parents up to the toplevel widget have
1293    /// been set as hidden.
1294    ///
1295    /// As ::unmap indicates that a widget will not be shown any longer, it can be
1296    /// used to, for example, stop an animation on the widget.
1297    ///
1298    ///
1299    ///
1300    ///
1301    /// #### `unmap-event`
1302    ///  The ::unmap-event signal will be emitted when the `widget`'s window is
1303    /// unmapped. A window is unmapped when it becomes invisible on the screen.
1304    ///
1305    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1306    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1307    /// automatically for all new windows.
1308    ///
1309    ///
1310    ///
1311    ///
1312    /// #### `unrealize`
1313    ///  The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1314    /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1315    /// called or the widget has been unmapped (that is, it is going to be
1316    /// hidden).
1317    ///
1318    ///
1319    ///
1320    ///
1321    /// #### `visibility-notify-event`
1322    ///  The ::visibility-notify-event will be emitted when the `widget`'s
1323    /// window is obscured or unobscured.
1324    ///
1325    /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1326    /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1327    ///
1328    ///
1329    ///
1330    ///
1331    /// #### `window-state-event`
1332    ///  The ::window-state-event will be emitted when the state of the
1333    /// toplevel window associated to the `widget` changes.
1334    ///
1335    /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1336    /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1337    /// this mask automatically for all new windows.
1338    ///
1339    ///
1340    /// </details>
1341    ///
1342    /// # Implements
1343    ///
1344    /// [`ScrolledWindowExt`][trait@crate::prelude::ScrolledWindowExt], [`BinExt`][trait@crate::prelude::BinExt], [`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]
1345    #[doc(alias = "GtkScrolledWindow")]
1346    pub struct ScrolledWindow(Object<ffi::GtkScrolledWindow, ffi::GtkScrolledWindowClass>) @extends Bin, Container, Widget, @implements Buildable;
1347
1348    match fn {
1349        type_ => || ffi::gtk_scrolled_window_get_type(),
1350    }
1351}
1352
1353impl ScrolledWindow {
1354    pub const NONE: Option<&'static ScrolledWindow> = None;
1355
1356    /// Creates a new scrolled window.
1357    ///
1358    /// The two arguments are the scrolled window’s adjustments; these will be
1359    /// shared with the scrollbars and the child widget to keep the bars in sync
1360    /// with the child. Usually you want to pass [`None`] for the adjustments, which
1361    /// will cause the scrolled window to create them for you.
1362    /// ## `hadjustment`
1363    /// horizontal adjustment
1364    /// ## `vadjustment`
1365    /// vertical adjustment
1366    ///
1367    /// # Returns
1368    ///
1369    /// a new scrolled window
1370    #[doc(alias = "gtk_scrolled_window_new")]
1371    pub fn new(
1372        hadjustment: Option<&impl IsA<Adjustment>>,
1373        vadjustment: Option<&impl IsA<Adjustment>>,
1374    ) -> ScrolledWindow {
1375        assert_initialized_main_thread!();
1376        unsafe {
1377            Widget::from_glib_none(ffi::gtk_scrolled_window_new(
1378                hadjustment.map(|p| p.as_ref()).to_glib_none().0,
1379                vadjustment.map(|p| p.as_ref()).to_glib_none().0,
1380            ))
1381            .unsafe_cast()
1382        }
1383    }
1384
1385    // rustdoc-stripper-ignore-next
1386    /// Creates a new builder-pattern struct instance to construct [`ScrolledWindow`] objects.
1387    ///
1388    /// This method returns an instance of [`ScrolledWindowBuilder`](crate::builders::ScrolledWindowBuilder) which can be used to create [`ScrolledWindow`] objects.
1389    pub fn builder() -> ScrolledWindowBuilder {
1390        ScrolledWindowBuilder::new()
1391    }
1392}
1393
1394impl Default for ScrolledWindow {
1395    fn default() -> Self {
1396        glib::object::Object::new::<Self>()
1397    }
1398}
1399
1400// rustdoc-stripper-ignore-next
1401/// A [builder-pattern] type to construct [`ScrolledWindow`] objects.
1402///
1403/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1404#[must_use = "The builder must be built to be used"]
1405pub struct ScrolledWindowBuilder {
1406    builder: glib::object::ObjectBuilder<'static, ScrolledWindow>,
1407}
1408
1409impl ScrolledWindowBuilder {
1410    fn new() -> Self {
1411        Self {
1412            builder: glib::object::Object::builder(),
1413        }
1414    }
1415
1416    pub fn hadjustment(self, hadjustment: &impl IsA<Adjustment>) -> Self {
1417        Self {
1418            builder: self
1419                .builder
1420                .property("hadjustment", hadjustment.clone().upcast()),
1421        }
1422    }
1423
1424    pub fn hscrollbar_policy(self, hscrollbar_policy: PolicyType) -> Self {
1425        Self {
1426            builder: self
1427                .builder
1428                .property("hscrollbar-policy", hscrollbar_policy),
1429        }
1430    }
1431
1432    /// Whether kinetic scrolling is enabled or not. Kinetic scrolling
1433    /// only applies to devices with source `GDK_SOURCE_TOUCHSCREEN`.
1434    pub fn kinetic_scrolling(self, kinetic_scrolling: bool) -> Self {
1435        Self {
1436            builder: self
1437                .builder
1438                .property("kinetic-scrolling", kinetic_scrolling),
1439        }
1440    }
1441
1442    /// The maximum content height of `scrolled_window`, or -1 if not set.
1443    pub fn max_content_height(self, max_content_height: i32) -> Self {
1444        Self {
1445            builder: self
1446                .builder
1447                .property("max-content-height", max_content_height),
1448        }
1449    }
1450
1451    /// The maximum content width of `scrolled_window`, or -1 if not set.
1452    pub fn max_content_width(self, max_content_width: i32) -> Self {
1453        Self {
1454            builder: self
1455                .builder
1456                .property("max-content-width", max_content_width),
1457        }
1458    }
1459
1460    /// The minimum content height of `scrolled_window`, or -1 if not set.
1461    pub fn min_content_height(self, min_content_height: i32) -> Self {
1462        Self {
1463            builder: self
1464                .builder
1465                .property("min-content-height", min_content_height),
1466        }
1467    }
1468
1469    /// The minimum content width of `scrolled_window`, or -1 if not set.
1470    pub fn min_content_width(self, min_content_width: i32) -> Self {
1471        Self {
1472            builder: self
1473                .builder
1474                .property("min-content-width", min_content_width),
1475        }
1476    }
1477
1478    /// Whether overlay scrolling is enabled or not. If it is, the
1479    /// scrollbars are only added as traditional widgets when a mouse
1480    /// is present. Otherwise, they are overlayed on top of the content,
1481    /// as narrow indicators.
1482    ///
1483    /// Note that overlay scrolling can also be globally disabled, with
1484    /// the [`gtk-overlay-scrolling`][struct@crate::Settings#gtk-overlay-scrolling] setting.
1485    pub fn overlay_scrolling(self, overlay_scrolling: bool) -> Self {
1486        Self {
1487            builder: self
1488                .builder
1489                .property("overlay-scrolling", overlay_scrolling),
1490        }
1491    }
1492
1493    /// Whether the natural height of the child should be calculated and propagated
1494    /// through the scrolled window’s requested natural height.
1495    ///
1496    /// This is useful in cases where an attempt should be made to allocate exactly
1497    /// enough space for the natural size of the child.
1498    pub fn propagate_natural_height(self, propagate_natural_height: bool) -> Self {
1499        Self {
1500            builder: self
1501                .builder
1502                .property("propagate-natural-height", propagate_natural_height),
1503        }
1504    }
1505
1506    /// Whether the natural width of the child should be calculated and propagated
1507    /// through the scrolled window’s requested natural width.
1508    ///
1509    /// This is useful in cases where an attempt should be made to allocate exactly
1510    /// enough space for the natural size of the child.
1511    pub fn propagate_natural_width(self, propagate_natural_width: bool) -> Self {
1512        Self {
1513            builder: self
1514                .builder
1515                .property("propagate-natural-width", propagate_natural_width),
1516        }
1517    }
1518
1519    pub fn shadow_type(self, shadow_type: ShadowType) -> Self {
1520        Self {
1521            builder: self.builder.property("shadow-type", shadow_type),
1522        }
1523    }
1524
1525    pub fn vadjustment(self, vadjustment: &impl IsA<Adjustment>) -> Self {
1526        Self {
1527            builder: self
1528                .builder
1529                .property("vadjustment", vadjustment.clone().upcast()),
1530        }
1531    }
1532
1533    pub fn vscrollbar_policy(self, vscrollbar_policy: PolicyType) -> Self {
1534        Self {
1535            builder: self
1536                .builder
1537                .property("vscrollbar-policy", vscrollbar_policy),
1538        }
1539    }
1540
1541    pub fn window_placement(self, window_placement: CornerType) -> Self {
1542        Self {
1543            builder: self.builder.property("window-placement", window_placement),
1544        }
1545    }
1546
1547    pub fn border_width(self, border_width: u32) -> Self {
1548        Self {
1549            builder: self.builder.property("border-width", border_width),
1550        }
1551    }
1552
1553    pub fn child(self, child: &impl IsA<Widget>) -> Self {
1554        Self {
1555            builder: self.builder.property("child", child.clone().upcast()),
1556        }
1557    }
1558
1559    pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
1560        Self {
1561            builder: self.builder.property("resize-mode", resize_mode),
1562        }
1563    }
1564
1565    pub fn app_paintable(self, app_paintable: bool) -> Self {
1566        Self {
1567            builder: self.builder.property("app-paintable", app_paintable),
1568        }
1569    }
1570
1571    pub fn can_default(self, can_default: bool) -> Self {
1572        Self {
1573            builder: self.builder.property("can-default", can_default),
1574        }
1575    }
1576
1577    pub fn can_focus(self, can_focus: bool) -> Self {
1578        Self {
1579            builder: self.builder.property("can-focus", can_focus),
1580        }
1581    }
1582
1583    pub fn events(self, events: gdk::EventMask) -> Self {
1584        Self {
1585            builder: self.builder.property("events", events),
1586        }
1587    }
1588
1589    /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1590    pub fn expand(self, expand: bool) -> Self {
1591        Self {
1592            builder: self.builder.property("expand", expand),
1593        }
1594    }
1595
1596    /// Whether the widget should grab focus when it is clicked with the mouse.
1597    ///
1598    /// This property is only relevant for widgets that can take focus.
1599    ///
1600    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1601    /// GtkComboBox) implemented this property individually.
1602    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1603        Self {
1604            builder: self.builder.property("focus-on-click", focus_on_click),
1605        }
1606    }
1607
1608    /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1609    pub fn halign(self, halign: Align) -> Self {
1610        Self {
1611            builder: self.builder.property("halign", halign),
1612        }
1613    }
1614
1615    pub fn has_default(self, has_default: bool) -> Self {
1616        Self {
1617            builder: self.builder.property("has-default", has_default),
1618        }
1619    }
1620
1621    pub fn has_focus(self, has_focus: bool) -> Self {
1622        Self {
1623            builder: self.builder.property("has-focus", has_focus),
1624        }
1625    }
1626
1627    /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1628    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1629    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1630    /// whether it will provide a tooltip or not.
1631    ///
1632    /// Note that setting this property to [`true`] for the first time will change
1633    /// the event masks of the GdkWindows of this widget to include leave-notify
1634    /// and motion-notify events. This cannot and will not be undone when the
1635    /// property is set to [`false`] again.
1636    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1637        Self {
1638            builder: self.builder.property("has-tooltip", has_tooltip),
1639        }
1640    }
1641
1642    pub fn height_request(self, height_request: i32) -> Self {
1643        Self {
1644            builder: self.builder.property("height-request", height_request),
1645        }
1646    }
1647
1648    /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1649    pub fn hexpand(self, hexpand: bool) -> Self {
1650        Self {
1651            builder: self.builder.property("hexpand", hexpand),
1652        }
1653    }
1654
1655    /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1656    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1657        Self {
1658            builder: self.builder.property("hexpand-set", hexpand_set),
1659        }
1660    }
1661
1662    pub fn is_focus(self, is_focus: bool) -> Self {
1663        Self {
1664            builder: self.builder.property("is-focus", is_focus),
1665        }
1666    }
1667
1668    /// Sets all four sides' margin at once. If read, returns max
1669    /// margin on any side.
1670    pub fn margin(self, margin: i32) -> Self {
1671        Self {
1672            builder: self.builder.property("margin", margin),
1673        }
1674    }
1675
1676    /// Margin on bottom side of widget.
1677    ///
1678    /// This property adds margin outside of the widget's normal size
1679    /// request, the margin will be added in addition to the size from
1680    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1681    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1682        Self {
1683            builder: self.builder.property("margin-bottom", margin_bottom),
1684        }
1685    }
1686
1687    /// Margin on end of widget, horizontally. This property supports
1688    /// left-to-right and right-to-left text directions.
1689    ///
1690    /// This property adds margin outside of the widget's normal size
1691    /// request, the margin will be added in addition to the size from
1692    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1693    pub fn margin_end(self, margin_end: i32) -> Self {
1694        Self {
1695            builder: self.builder.property("margin-end", margin_end),
1696        }
1697    }
1698
1699    /// Margin on start of widget, horizontally. This property supports
1700    /// left-to-right and right-to-left text directions.
1701    ///
1702    /// This property adds margin outside of the widget's normal size
1703    /// request, the margin will be added in addition to the size from
1704    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1705    pub fn margin_start(self, margin_start: i32) -> Self {
1706        Self {
1707            builder: self.builder.property("margin-start", margin_start),
1708        }
1709    }
1710
1711    /// Margin on top side of widget.
1712    ///
1713    /// This property adds margin outside of the widget's normal size
1714    /// request, the margin will be added in addition to the size from
1715    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1716    pub fn margin_top(self, margin_top: i32) -> Self {
1717        Self {
1718            builder: self.builder.property("margin-top", margin_top),
1719        }
1720    }
1721
1722    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1723        Self {
1724            builder: self.builder.property("name", name.into()),
1725        }
1726    }
1727
1728    pub fn no_show_all(self, no_show_all: bool) -> Self {
1729        Self {
1730            builder: self.builder.property("no-show-all", no_show_all),
1731        }
1732    }
1733
1734    /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1735    /// more details about window opacity.
1736    ///
1737    /// Before 3.8 this was only available in GtkWindow
1738    pub fn opacity(self, opacity: f64) -> Self {
1739        Self {
1740            builder: self.builder.property("opacity", opacity),
1741        }
1742    }
1743
1744    pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1745        Self {
1746            builder: self.builder.property("parent", parent.clone().upcast()),
1747        }
1748    }
1749
1750    pub fn receives_default(self, receives_default: bool) -> Self {
1751        Self {
1752            builder: self.builder.property("receives-default", receives_default),
1753        }
1754    }
1755
1756    pub fn sensitive(self, sensitive: bool) -> Self {
1757        Self {
1758            builder: self.builder.property("sensitive", sensitive),
1759        }
1760    }
1761
1762    /// Sets the text of tooltip to be the given string, which is marked up
1763    /// with the [Pango text markup language][PangoMarkupFormat].
1764    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1765    ///
1766    /// This is a convenience property which will take care of getting the
1767    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1768    /// will automatically be set to [`true`] and there will be taken care of
1769    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1770    ///
1771    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1772    /// are set, the last one wins.
1773    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1774        Self {
1775            builder: self
1776                .builder
1777                .property("tooltip-markup", tooltip_markup.into()),
1778        }
1779    }
1780
1781    /// Sets the text of tooltip to be the given string.
1782    ///
1783    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1784    ///
1785    /// This is a convenience property which will take care of getting the
1786    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1787    /// will automatically be set to [`true`] and there will be taken care of
1788    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1789    ///
1790    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1791    /// are set, the last one wins.
1792    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1793        Self {
1794            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1795        }
1796    }
1797
1798    /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1799    pub fn valign(self, valign: Align) -> Self {
1800        Self {
1801            builder: self.builder.property("valign", valign),
1802        }
1803    }
1804
1805    /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1806    pub fn vexpand(self, vexpand: bool) -> Self {
1807        Self {
1808            builder: self.builder.property("vexpand", vexpand),
1809        }
1810    }
1811
1812    /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1813    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1814        Self {
1815            builder: self.builder.property("vexpand-set", vexpand_set),
1816        }
1817    }
1818
1819    pub fn visible(self, visible: bool) -> Self {
1820        Self {
1821            builder: self.builder.property("visible", visible),
1822        }
1823    }
1824
1825    pub fn width_request(self, width_request: i32) -> Self {
1826        Self {
1827            builder: self.builder.property("width-request", width_request),
1828        }
1829    }
1830
1831    // rustdoc-stripper-ignore-next
1832    /// Build the [`ScrolledWindow`].
1833    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1834    pub fn build(self) -> ScrolledWindow {
1835        self.builder.build()
1836    }
1837}
1838
1839mod sealed {
1840    pub trait Sealed {}
1841    impl<T: super::IsA<super::ScrolledWindow>> Sealed for T {}
1842}
1843
1844/// Trait containing all [`struct@ScrolledWindow`] methods.
1845///
1846/// # Implementors
1847///
1848/// [`PlacesSidebar`][struct@crate::PlacesSidebar], [`ScrolledWindow`][struct@crate::ScrolledWindow]
1849pub trait ScrolledWindowExt: IsA<ScrolledWindow> + sealed::Sealed + 'static {
1850    /// Return whether button presses are captured during kinetic
1851    /// scrolling. See [`set_capture_button_press()`][Self::set_capture_button_press()].
1852    ///
1853    /// # Returns
1854    ///
1855    /// [`true`] if button presses are captured during kinetic scrolling
1856    #[doc(alias = "gtk_scrolled_window_get_capture_button_press")]
1857    #[doc(alias = "get_capture_button_press")]
1858    fn is_capture_button_press(&self) -> bool {
1859        unsafe {
1860            from_glib(ffi::gtk_scrolled_window_get_capture_button_press(
1861                self.as_ref().to_glib_none().0,
1862            ))
1863        }
1864    }
1865
1866    /// Returns the horizontal scrollbar’s adjustment, used to connect the
1867    /// horizontal scrollbar to the child widget’s horizontal scroll
1868    /// functionality.
1869    ///
1870    /// # Returns
1871    ///
1872    /// the horizontal [`Adjustment`][crate::Adjustment]
1873    #[doc(alias = "gtk_scrolled_window_get_hadjustment")]
1874    #[doc(alias = "get_hadjustment")]
1875    fn hadjustment(&self) -> Adjustment {
1876        unsafe {
1877            from_glib_none(ffi::gtk_scrolled_window_get_hadjustment(
1878                self.as_ref().to_glib_none().0,
1879            ))
1880        }
1881    }
1882
1883    /// Returns the horizontal scrollbar of `self`.
1884    ///
1885    /// # Returns
1886    ///
1887    /// the horizontal scrollbar of the scrolled window.
1888    #[doc(alias = "gtk_scrolled_window_get_hscrollbar")]
1889    #[doc(alias = "get_hscrollbar")]
1890    fn hscrollbar(&self) -> Option<Widget> {
1891        unsafe {
1892            from_glib_none(ffi::gtk_scrolled_window_get_hscrollbar(
1893                self.as_ref().to_glib_none().0,
1894            ))
1895        }
1896    }
1897
1898    /// Returns the specified kinetic scrolling behavior.
1899    ///
1900    /// # Returns
1901    ///
1902    /// the scrolling behavior flags.
1903    #[doc(alias = "gtk_scrolled_window_get_kinetic_scrolling")]
1904    #[doc(alias = "get_kinetic_scrolling")]
1905    fn is_kinetic_scrolling(&self) -> bool {
1906        unsafe {
1907            from_glib(ffi::gtk_scrolled_window_get_kinetic_scrolling(
1908                self.as_ref().to_glib_none().0,
1909            ))
1910        }
1911    }
1912
1913    /// Returns the maximum content height set.
1914    ///
1915    /// # Returns
1916    ///
1917    /// the maximum content height, or -1
1918    #[doc(alias = "gtk_scrolled_window_get_max_content_height")]
1919    #[doc(alias = "get_max_content_height")]
1920    fn max_content_height(&self) -> i32 {
1921        unsafe { ffi::gtk_scrolled_window_get_max_content_height(self.as_ref().to_glib_none().0) }
1922    }
1923
1924    /// Returns the maximum content width set.
1925    ///
1926    /// # Returns
1927    ///
1928    /// the maximum content width, or -1
1929    #[doc(alias = "gtk_scrolled_window_get_max_content_width")]
1930    #[doc(alias = "get_max_content_width")]
1931    fn max_content_width(&self) -> i32 {
1932        unsafe { ffi::gtk_scrolled_window_get_max_content_width(self.as_ref().to_glib_none().0) }
1933    }
1934
1935    /// Gets the minimal content height of `self`, or -1 if not set.
1936    ///
1937    /// # Returns
1938    ///
1939    /// the minimal content height
1940    #[doc(alias = "gtk_scrolled_window_get_min_content_height")]
1941    #[doc(alias = "get_min_content_height")]
1942    fn min_content_height(&self) -> i32 {
1943        unsafe { ffi::gtk_scrolled_window_get_min_content_height(self.as_ref().to_glib_none().0) }
1944    }
1945
1946    /// Gets the minimum content width of `self`, or -1 if not set.
1947    ///
1948    /// # Returns
1949    ///
1950    /// the minimum content width
1951    #[doc(alias = "gtk_scrolled_window_get_min_content_width")]
1952    #[doc(alias = "get_min_content_width")]
1953    fn min_content_width(&self) -> i32 {
1954        unsafe { ffi::gtk_scrolled_window_get_min_content_width(self.as_ref().to_glib_none().0) }
1955    }
1956
1957    /// Returns whether overlay scrolling is enabled for this scrolled window.
1958    ///
1959    /// # Returns
1960    ///
1961    /// [`true`] if overlay scrolling is enabled
1962    #[doc(alias = "gtk_scrolled_window_get_overlay_scrolling")]
1963    #[doc(alias = "get_overlay_scrolling")]
1964    fn is_overlay_scrolling(&self) -> bool {
1965        unsafe {
1966            from_glib(ffi::gtk_scrolled_window_get_overlay_scrolling(
1967                self.as_ref().to_glib_none().0,
1968            ))
1969        }
1970    }
1971
1972    /// Gets the placement of the contents with respect to the scrollbars
1973    /// for the scrolled window. See [`set_placement()`][Self::set_placement()].
1974    ///
1975    /// # Returns
1976    ///
1977    /// the current placement value.
1978    ///
1979    /// See also [`set_placement()`][Self::set_placement()] and
1980    /// [`unset_placement()`][Self::unset_placement()].
1981    #[doc(alias = "gtk_scrolled_window_get_placement")]
1982    #[doc(alias = "get_placement")]
1983    fn placement(&self) -> CornerType {
1984        unsafe {
1985            from_glib(ffi::gtk_scrolled_window_get_placement(
1986                self.as_ref().to_glib_none().0,
1987            ))
1988        }
1989    }
1990
1991    /// Retrieves the current policy values for the horizontal and vertical
1992    /// scrollbars. See [`set_policy()`][Self::set_policy()].
1993    ///
1994    /// # Returns
1995    ///
1996    ///
1997    /// ## `hscrollbar_policy`
1998    /// location to store the policy
1999    ///  for the horizontal scrollbar, or [`None`]
2000    ///
2001    /// ## `vscrollbar_policy`
2002    /// location to store the policy
2003    ///  for the vertical scrollbar, or [`None`]
2004    #[doc(alias = "gtk_scrolled_window_get_policy")]
2005    #[doc(alias = "get_policy")]
2006    fn policy(&self) -> (PolicyType, PolicyType) {
2007        unsafe {
2008            let mut hscrollbar_policy = mem::MaybeUninit::uninit();
2009            let mut vscrollbar_policy = mem::MaybeUninit::uninit();
2010            ffi::gtk_scrolled_window_get_policy(
2011                self.as_ref().to_glib_none().0,
2012                hscrollbar_policy.as_mut_ptr(),
2013                vscrollbar_policy.as_mut_ptr(),
2014            );
2015            (
2016                from_glib(hscrollbar_policy.assume_init()),
2017                from_glib(vscrollbar_policy.assume_init()),
2018            )
2019        }
2020    }
2021
2022    /// Reports whether the natural height of the child will be calculated and propagated
2023    /// through the scrolled window’s requested natural height.
2024    ///
2025    /// # Returns
2026    ///
2027    /// whether natural height propagation is enabled.
2028    #[doc(alias = "gtk_scrolled_window_get_propagate_natural_height")]
2029    #[doc(alias = "get_propagate_natural_height")]
2030    fn propagates_natural_height(&self) -> bool {
2031        unsafe {
2032            from_glib(ffi::gtk_scrolled_window_get_propagate_natural_height(
2033                self.as_ref().to_glib_none().0,
2034            ))
2035        }
2036    }
2037
2038    /// Reports whether the natural width of the child will be calculated and propagated
2039    /// through the scrolled window’s requested natural width.
2040    ///
2041    /// # Returns
2042    ///
2043    /// whether natural width propagation is enabled.
2044    #[doc(alias = "gtk_scrolled_window_get_propagate_natural_width")]
2045    #[doc(alias = "get_propagate_natural_width")]
2046    fn propagates_natural_width(&self) -> bool {
2047        unsafe {
2048            from_glib(ffi::gtk_scrolled_window_get_propagate_natural_width(
2049                self.as_ref().to_glib_none().0,
2050            ))
2051        }
2052    }
2053
2054    /// Gets the shadow type of the scrolled window. See
2055    /// [`set_shadow_type()`][Self::set_shadow_type()].
2056    ///
2057    /// # Returns
2058    ///
2059    /// the current shadow type
2060    #[doc(alias = "gtk_scrolled_window_get_shadow_type")]
2061    #[doc(alias = "get_shadow_type")]
2062    fn shadow_type(&self) -> ShadowType {
2063        unsafe {
2064            from_glib(ffi::gtk_scrolled_window_get_shadow_type(
2065                self.as_ref().to_glib_none().0,
2066            ))
2067        }
2068    }
2069
2070    /// Returns the vertical scrollbar’s adjustment, used to connect the
2071    /// vertical scrollbar to the child widget’s vertical scroll functionality.
2072    ///
2073    /// # Returns
2074    ///
2075    /// the vertical [`Adjustment`][crate::Adjustment]
2076    #[doc(alias = "gtk_scrolled_window_get_vadjustment")]
2077    #[doc(alias = "get_vadjustment")]
2078    fn vadjustment(&self) -> Adjustment {
2079        unsafe {
2080            from_glib_none(ffi::gtk_scrolled_window_get_vadjustment(
2081                self.as_ref().to_glib_none().0,
2082            ))
2083        }
2084    }
2085
2086    /// Returns the vertical scrollbar of `self`.
2087    ///
2088    /// # Returns
2089    ///
2090    /// the vertical scrollbar of the scrolled window.
2091    #[doc(alias = "gtk_scrolled_window_get_vscrollbar")]
2092    #[doc(alias = "get_vscrollbar")]
2093    fn vscrollbar(&self) -> Option<Widget> {
2094        unsafe {
2095            from_glib_none(ffi::gtk_scrolled_window_get_vscrollbar(
2096                self.as_ref().to_glib_none().0,
2097            ))
2098        }
2099    }
2100
2101    /// Changes the behaviour of `self` with regard to the initial
2102    /// event that possibly starts kinetic scrolling. When `capture_button_press`
2103    /// is set to [`true`], the event is captured by the scrolled window, and
2104    /// then later replayed if it is meant to go to the child widget.
2105    ///
2106    /// This should be enabled if any child widgets perform non-reversible
2107    /// actions on [`button-press-event`][struct@crate::Widget#button-press-event]. If they don't, and handle
2108    /// additionally handle [`grab-broken-event`][struct@crate::Widget#grab-broken-event], it might be better
2109    /// to set `capture_button_press` to [`false`].
2110    ///
2111    /// This setting only has an effect if kinetic scrolling is enabled.
2112    /// ## `capture_button_press`
2113    /// [`true`] to capture button presses
2114    #[doc(alias = "gtk_scrolled_window_set_capture_button_press")]
2115    fn set_capture_button_press(&self, capture_button_press: bool) {
2116        unsafe {
2117            ffi::gtk_scrolled_window_set_capture_button_press(
2118                self.as_ref().to_glib_none().0,
2119                capture_button_press.into_glib(),
2120            );
2121        }
2122    }
2123
2124    /// Sets the [`Adjustment`][crate::Adjustment] for the horizontal scrollbar.
2125    /// ## `hadjustment`
2126    /// the [`Adjustment`][crate::Adjustment] to use, or [`None`] to create a new one
2127    #[doc(alias = "gtk_scrolled_window_set_hadjustment")]
2128    fn set_hadjustment(&self, hadjustment: Option<&impl IsA<Adjustment>>) {
2129        unsafe {
2130            ffi::gtk_scrolled_window_set_hadjustment(
2131                self.as_ref().to_glib_none().0,
2132                hadjustment.map(|p| p.as_ref()).to_glib_none().0,
2133            );
2134        }
2135    }
2136
2137    /// Turns kinetic scrolling on or off.
2138    /// Kinetic scrolling only applies to devices with source
2139    /// `GDK_SOURCE_TOUCHSCREEN`.
2140    /// ## `kinetic_scrolling`
2141    /// [`true`] to enable kinetic scrolling
2142    #[doc(alias = "gtk_scrolled_window_set_kinetic_scrolling")]
2143    fn set_kinetic_scrolling(&self, kinetic_scrolling: bool) {
2144        unsafe {
2145            ffi::gtk_scrolled_window_set_kinetic_scrolling(
2146                self.as_ref().to_glib_none().0,
2147                kinetic_scrolling.into_glib(),
2148            );
2149        }
2150    }
2151
2152    /// Sets the maximum height that `self` should keep visible. The
2153    /// `self` will grow up to this height before it starts scrolling
2154    /// the content.
2155    ///
2156    /// It is a programming error to set the maximum content height to a value
2157    /// smaller than [`min-content-height`][struct@crate::ScrolledWindow#min-content-height].
2158    /// ## `height`
2159    /// the maximum content height
2160    #[doc(alias = "gtk_scrolled_window_set_max_content_height")]
2161    fn set_max_content_height(&self, height: i32) {
2162        unsafe {
2163            ffi::gtk_scrolled_window_set_max_content_height(self.as_ref().to_glib_none().0, height);
2164        }
2165    }
2166
2167    /// Sets the maximum width that `self` should keep visible. The
2168    /// `self` will grow up to this width before it starts scrolling
2169    /// the content.
2170    ///
2171    /// It is a programming error to set the maximum content width to a value
2172    /// smaller than [`min-content-width`][struct@crate::ScrolledWindow#min-content-width].
2173    /// ## `width`
2174    /// the maximum content width
2175    #[doc(alias = "gtk_scrolled_window_set_max_content_width")]
2176    fn set_max_content_width(&self, width: i32) {
2177        unsafe {
2178            ffi::gtk_scrolled_window_set_max_content_width(self.as_ref().to_glib_none().0, width);
2179        }
2180    }
2181
2182    /// Sets the minimum height that `self` should keep visible.
2183    /// Note that this can and (usually will) be smaller than the minimum
2184    /// size of the content.
2185    ///
2186    /// It is a programming error to set the minimum content height to a
2187    /// value greater than [`max-content-height`][struct@crate::ScrolledWindow#max-content-height].
2188    /// ## `height`
2189    /// the minimal content height
2190    #[doc(alias = "gtk_scrolled_window_set_min_content_height")]
2191    fn set_min_content_height(&self, height: i32) {
2192        unsafe {
2193            ffi::gtk_scrolled_window_set_min_content_height(self.as_ref().to_glib_none().0, height);
2194        }
2195    }
2196
2197    /// Sets the minimum width that `self` should keep visible.
2198    /// Note that this can and (usually will) be smaller than the minimum
2199    /// size of the content.
2200    ///
2201    /// It is a programming error to set the minimum content width to a
2202    /// value greater than [`max-content-width`][struct@crate::ScrolledWindow#max-content-width].
2203    /// ## `width`
2204    /// the minimal content width
2205    #[doc(alias = "gtk_scrolled_window_set_min_content_width")]
2206    fn set_min_content_width(&self, width: i32) {
2207        unsafe {
2208            ffi::gtk_scrolled_window_set_min_content_width(self.as_ref().to_glib_none().0, width);
2209        }
2210    }
2211
2212    /// Enables or disables overlay scrolling for this scrolled window.
2213    /// ## `overlay_scrolling`
2214    /// whether to enable overlay scrolling
2215    #[doc(alias = "gtk_scrolled_window_set_overlay_scrolling")]
2216    fn set_overlay_scrolling(&self, overlay_scrolling: bool) {
2217        unsafe {
2218            ffi::gtk_scrolled_window_set_overlay_scrolling(
2219                self.as_ref().to_glib_none().0,
2220                overlay_scrolling.into_glib(),
2221            );
2222        }
2223    }
2224
2225    /// Sets the placement of the contents with respect to the scrollbars
2226    /// for the scrolled window.
2227    ///
2228    /// The default is [`CornerType::TopLeft`][crate::CornerType::TopLeft], meaning the child is
2229    /// in the top left, with the scrollbars underneath and to the right.
2230    /// Other values in [`CornerType`][crate::CornerType] are [`CornerType::TopRight`][crate::CornerType::TopRight],
2231    /// [`CornerType::BottomLeft`][crate::CornerType::BottomLeft], and [`CornerType::BottomRight`][crate::CornerType::BottomRight].
2232    ///
2233    /// See also [`placement()`][Self::placement()] and
2234    /// [`unset_placement()`][Self::unset_placement()].
2235    /// ## `window_placement`
2236    /// position of the child window
2237    #[doc(alias = "gtk_scrolled_window_set_placement")]
2238    fn set_placement(&self, window_placement: CornerType) {
2239        unsafe {
2240            ffi::gtk_scrolled_window_set_placement(
2241                self.as_ref().to_glib_none().0,
2242                window_placement.into_glib(),
2243            );
2244        }
2245    }
2246
2247    /// Sets the scrollbar policy for the horizontal and vertical scrollbars.
2248    ///
2249    /// The policy determines when the scrollbar should appear; it is a value
2250    /// from the [`PolicyType`][crate::PolicyType] enumeration. If [`PolicyType::Always`][crate::PolicyType::Always], the
2251    /// scrollbar is always present; if [`PolicyType::Never`][crate::PolicyType::Never], the scrollbar is
2252    /// never present; if [`PolicyType::Automatic`][crate::PolicyType::Automatic], the scrollbar is present only
2253    /// if needed (that is, if the slider part of the bar would be smaller
2254    /// than the trough — the display is larger than the page size).
2255    /// ## `hscrollbar_policy`
2256    /// policy for horizontal bar
2257    /// ## `vscrollbar_policy`
2258    /// policy for vertical bar
2259    #[doc(alias = "gtk_scrolled_window_set_policy")]
2260    fn set_policy(&self, hscrollbar_policy: PolicyType, vscrollbar_policy: PolicyType) {
2261        unsafe {
2262            ffi::gtk_scrolled_window_set_policy(
2263                self.as_ref().to_glib_none().0,
2264                hscrollbar_policy.into_glib(),
2265                vscrollbar_policy.into_glib(),
2266            );
2267        }
2268    }
2269
2270    /// Sets whether the natural height of the child should be calculated and propagated
2271    /// through the scrolled window’s requested natural height.
2272    /// ## `propagate`
2273    /// whether to propagate natural height
2274    #[doc(alias = "gtk_scrolled_window_set_propagate_natural_height")]
2275    fn set_propagate_natural_height(&self, propagate: bool) {
2276        unsafe {
2277            ffi::gtk_scrolled_window_set_propagate_natural_height(
2278                self.as_ref().to_glib_none().0,
2279                propagate.into_glib(),
2280            );
2281        }
2282    }
2283
2284    /// Sets whether the natural width of the child should be calculated and propagated
2285    /// through the scrolled window’s requested natural width.
2286    /// ## `propagate`
2287    /// whether to propagate natural width
2288    #[doc(alias = "gtk_scrolled_window_set_propagate_natural_width")]
2289    fn set_propagate_natural_width(&self, propagate: bool) {
2290        unsafe {
2291            ffi::gtk_scrolled_window_set_propagate_natural_width(
2292                self.as_ref().to_glib_none().0,
2293                propagate.into_glib(),
2294            );
2295        }
2296    }
2297
2298    /// Changes the type of shadow drawn around the contents of
2299    /// `self`.
2300    /// ## `type_`
2301    /// kind of shadow to draw around scrolled window contents
2302    #[doc(alias = "gtk_scrolled_window_set_shadow_type")]
2303    fn set_shadow_type(&self, type_: ShadowType) {
2304        unsafe {
2305            ffi::gtk_scrolled_window_set_shadow_type(
2306                self.as_ref().to_glib_none().0,
2307                type_.into_glib(),
2308            );
2309        }
2310    }
2311
2312    /// Sets the [`Adjustment`][crate::Adjustment] for the vertical scrollbar.
2313    /// ## `vadjustment`
2314    /// the [`Adjustment`][crate::Adjustment] to use, or [`None`] to create a new one
2315    #[doc(alias = "gtk_scrolled_window_set_vadjustment")]
2316    fn set_vadjustment(&self, vadjustment: Option<&impl IsA<Adjustment>>) {
2317        unsafe {
2318            ffi::gtk_scrolled_window_set_vadjustment(
2319                self.as_ref().to_glib_none().0,
2320                vadjustment.map(|p| p.as_ref()).to_glib_none().0,
2321            );
2322        }
2323    }
2324
2325    /// Unsets the placement of the contents with respect to the scrollbars
2326    /// for the scrolled window. If no window placement is set for a scrolled
2327    /// window, it defaults to [`CornerType::TopLeft`][crate::CornerType::TopLeft].
2328    ///
2329    /// See also [`set_placement()`][Self::set_placement()] and
2330    /// [`placement()`][Self::placement()].
2331    #[doc(alias = "gtk_scrolled_window_unset_placement")]
2332    fn unset_placement(&self) {
2333        unsafe {
2334            ffi::gtk_scrolled_window_unset_placement(self.as_ref().to_glib_none().0);
2335        }
2336    }
2337
2338    #[doc(alias = "hscrollbar-policy")]
2339    fn hscrollbar_policy(&self) -> PolicyType {
2340        ObjectExt::property(self.as_ref(), "hscrollbar-policy")
2341    }
2342
2343    #[doc(alias = "hscrollbar-policy")]
2344    fn set_hscrollbar_policy(&self, hscrollbar_policy: PolicyType) {
2345        ObjectExt::set_property(self.as_ref(), "hscrollbar-policy", hscrollbar_policy)
2346    }
2347
2348    #[doc(alias = "vscrollbar-policy")]
2349    fn vscrollbar_policy(&self) -> PolicyType {
2350        ObjectExt::property(self.as_ref(), "vscrollbar-policy")
2351    }
2352
2353    #[doc(alias = "vscrollbar-policy")]
2354    fn set_vscrollbar_policy(&self, vscrollbar_policy: PolicyType) {
2355        ObjectExt::set_property(self.as_ref(), "vscrollbar-policy", vscrollbar_policy)
2356    }
2357
2358    #[doc(alias = "window-placement")]
2359    fn window_placement(&self) -> CornerType {
2360        ObjectExt::property(self.as_ref(), "window-placement")
2361    }
2362
2363    #[doc(alias = "window-placement")]
2364    fn set_window_placement(&self, window_placement: CornerType) {
2365        ObjectExt::set_property(self.as_ref(), "window-placement", window_placement)
2366    }
2367
2368    /// The ::edge-overshot signal is emitted whenever user initiated scrolling
2369    /// makes the scrolled window firmly surpass (i.e. with some edge resistance)
2370    /// the lower or upper limits defined by the adjustment in that orientation.
2371    ///
2372    /// A similar behavior without edge resistance is provided by the
2373    /// [`edge-reached`][struct@crate::ScrolledWindow#edge-reached] signal.
2374    ///
2375    /// Note: The `pos` argument is LTR/RTL aware, so callers should be aware too
2376    /// if intending to provide behavior on horizontal edges.
2377    /// ## `pos`
2378    /// edge side that was hit
2379    #[doc(alias = "edge-overshot")]
2380    fn connect_edge_overshot<F: Fn(&Self, PositionType) + 'static>(&self, f: F) -> SignalHandlerId {
2381        unsafe extern "C" fn edge_overshot_trampoline<
2382            P: IsA<ScrolledWindow>,
2383            F: Fn(&P, PositionType) + 'static,
2384        >(
2385            this: *mut ffi::GtkScrolledWindow,
2386            pos: ffi::GtkPositionType,
2387            f: glib::ffi::gpointer,
2388        ) {
2389            let f: &F = &*(f as *const F);
2390            f(
2391                ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref(),
2392                from_glib(pos),
2393            )
2394        }
2395        unsafe {
2396            let f: Box_<F> = Box_::new(f);
2397            connect_raw(
2398                self.as_ptr() as *mut _,
2399                b"edge-overshot\0".as_ptr() as *const _,
2400                Some(transmute::<_, unsafe extern "C" fn()>(
2401                    edge_overshot_trampoline::<Self, F> as *const (),
2402                )),
2403                Box_::into_raw(f),
2404            )
2405        }
2406    }
2407
2408    /// The ::edge-reached signal is emitted whenever user-initiated scrolling
2409    /// makes the scrolled window exactly reach the lower or upper limits
2410    /// defined by the adjustment in that orientation.
2411    ///
2412    /// A similar behavior with edge resistance is provided by the
2413    /// [`edge-overshot`][struct@crate::ScrolledWindow#edge-overshot] signal.
2414    ///
2415    /// Note: The `pos` argument is LTR/RTL aware, so callers should be aware too
2416    /// if intending to provide behavior on horizontal edges.
2417    /// ## `pos`
2418    /// edge side that was reached
2419    #[doc(alias = "edge-reached")]
2420    fn connect_edge_reached<F: Fn(&Self, PositionType) + 'static>(&self, f: F) -> SignalHandlerId {
2421        unsafe extern "C" fn edge_reached_trampoline<
2422            P: IsA<ScrolledWindow>,
2423            F: Fn(&P, PositionType) + 'static,
2424        >(
2425            this: *mut ffi::GtkScrolledWindow,
2426            pos: ffi::GtkPositionType,
2427            f: glib::ffi::gpointer,
2428        ) {
2429            let f: &F = &*(f as *const F);
2430            f(
2431                ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref(),
2432                from_glib(pos),
2433            )
2434        }
2435        unsafe {
2436            let f: Box_<F> = Box_::new(f);
2437            connect_raw(
2438                self.as_ptr() as *mut _,
2439                b"edge-reached\0".as_ptr() as *const _,
2440                Some(transmute::<_, unsafe extern "C" fn()>(
2441                    edge_reached_trampoline::<Self, F> as *const (),
2442                )),
2443                Box_::into_raw(f),
2444            )
2445        }
2446    }
2447
2448    /// The ::move-focus-out signal is a
2449    /// [keybinding signal][GtkBindingSignal] which gets
2450    /// emitted when focus is moved away from the scrolled window by a
2451    /// keybinding. The [`move-focus`][struct@crate::Widget#move-focus] signal is emitted with
2452    /// `direction_type` on this scrolled window’s toplevel parent in the
2453    /// container hierarchy. The default bindings for this signal are
2454    /// `Ctrl + Tab` to move forward and `Ctrl + Shift + Tab` to move backward.
2455    /// ## `direction_type`
2456    /// either [`DirectionType::TabForward`][crate::DirectionType::TabForward] or
2457    ///  [`DirectionType::TabBackward`][crate::DirectionType::TabBackward]
2458    #[doc(alias = "move-focus-out")]
2459    fn connect_move_focus_out<F: Fn(&Self, DirectionType) + 'static>(
2460        &self,
2461        f: F,
2462    ) -> SignalHandlerId {
2463        unsafe extern "C" fn move_focus_out_trampoline<
2464            P: IsA<ScrolledWindow>,
2465            F: Fn(&P, DirectionType) + 'static,
2466        >(
2467            this: *mut ffi::GtkScrolledWindow,
2468            direction_type: ffi::GtkDirectionType,
2469            f: glib::ffi::gpointer,
2470        ) {
2471            let f: &F = &*(f as *const F);
2472            f(
2473                ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref(),
2474                from_glib(direction_type),
2475            )
2476        }
2477        unsafe {
2478            let f: Box_<F> = Box_::new(f);
2479            connect_raw(
2480                self.as_ptr() as *mut _,
2481                b"move-focus-out\0".as_ptr() as *const _,
2482                Some(transmute::<_, unsafe extern "C" fn()>(
2483                    move_focus_out_trampoline::<Self, F> as *const (),
2484                )),
2485                Box_::into_raw(f),
2486            )
2487        }
2488    }
2489
2490    fn emit_move_focus_out(&self, direction_type: DirectionType) {
2491        self.emit_by_name::<()>("move-focus-out", &[&direction_type]);
2492    }
2493
2494    /// The ::scroll-child signal is a
2495    /// [keybinding signal][GtkBindingSignal]
2496    /// which gets emitted when a keybinding that scrolls is pressed.
2497    /// The horizontal or vertical adjustment is updated which triggers a
2498    /// signal that the scrolled window’s child may listen to and scroll itself.
2499    /// ## `scroll`
2500    /// a [`ScrollType`][crate::ScrollType] describing how much to scroll
2501    /// ## `horizontal`
2502    /// whether the keybinding scrolls the child
2503    ///  horizontally or not
2504    #[doc(alias = "scroll-child")]
2505    fn connect_scroll_child<F: Fn(&Self, ScrollType, bool) -> bool + 'static>(
2506        &self,
2507        f: F,
2508    ) -> SignalHandlerId {
2509        unsafe extern "C" fn scroll_child_trampoline<
2510            P: IsA<ScrolledWindow>,
2511            F: Fn(&P, ScrollType, bool) -> bool + 'static,
2512        >(
2513            this: *mut ffi::GtkScrolledWindow,
2514            scroll: ffi::GtkScrollType,
2515            horizontal: glib::ffi::gboolean,
2516            f: glib::ffi::gpointer,
2517        ) -> glib::ffi::gboolean {
2518            let f: &F = &*(f as *const F);
2519            f(
2520                ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref(),
2521                from_glib(scroll),
2522                from_glib(horizontal),
2523            )
2524            .into_glib()
2525        }
2526        unsafe {
2527            let f: Box_<F> = Box_::new(f);
2528            connect_raw(
2529                self.as_ptr() as *mut _,
2530                b"scroll-child\0".as_ptr() as *const _,
2531                Some(transmute::<_, unsafe extern "C" fn()>(
2532                    scroll_child_trampoline::<Self, F> as *const (),
2533                )),
2534                Box_::into_raw(f),
2535            )
2536        }
2537    }
2538
2539    fn emit_scroll_child(&self, scroll: ScrollType, horizontal: bool) -> bool {
2540        self.emit_by_name("scroll-child", &[&scroll, &horizontal])
2541    }
2542
2543    #[doc(alias = "hadjustment")]
2544    fn connect_hadjustment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2545        unsafe extern "C" fn notify_hadjustment_trampoline<
2546            P: IsA<ScrolledWindow>,
2547            F: Fn(&P) + 'static,
2548        >(
2549            this: *mut ffi::GtkScrolledWindow,
2550            _param_spec: glib::ffi::gpointer,
2551            f: glib::ffi::gpointer,
2552        ) {
2553            let f: &F = &*(f as *const F);
2554            f(ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref())
2555        }
2556        unsafe {
2557            let f: Box_<F> = Box_::new(f);
2558            connect_raw(
2559                self.as_ptr() as *mut _,
2560                b"notify::hadjustment\0".as_ptr() as *const _,
2561                Some(transmute::<_, unsafe extern "C" fn()>(
2562                    notify_hadjustment_trampoline::<Self, F> as *const (),
2563                )),
2564                Box_::into_raw(f),
2565            )
2566        }
2567    }
2568
2569    #[doc(alias = "hscrollbar-policy")]
2570    fn connect_hscrollbar_policy_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2571        unsafe extern "C" fn notify_hscrollbar_policy_trampoline<
2572            P: IsA<ScrolledWindow>,
2573            F: Fn(&P) + 'static,
2574        >(
2575            this: *mut ffi::GtkScrolledWindow,
2576            _param_spec: glib::ffi::gpointer,
2577            f: glib::ffi::gpointer,
2578        ) {
2579            let f: &F = &*(f as *const F);
2580            f(ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref())
2581        }
2582        unsafe {
2583            let f: Box_<F> = Box_::new(f);
2584            connect_raw(
2585                self.as_ptr() as *mut _,
2586                b"notify::hscrollbar-policy\0".as_ptr() as *const _,
2587                Some(transmute::<_, unsafe extern "C" fn()>(
2588                    notify_hscrollbar_policy_trampoline::<Self, F> as *const (),
2589                )),
2590                Box_::into_raw(f),
2591            )
2592        }
2593    }
2594
2595    #[doc(alias = "kinetic-scrolling")]
2596    fn connect_kinetic_scrolling_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2597        unsafe extern "C" fn notify_kinetic_scrolling_trampoline<
2598            P: IsA<ScrolledWindow>,
2599            F: Fn(&P) + 'static,
2600        >(
2601            this: *mut ffi::GtkScrolledWindow,
2602            _param_spec: glib::ffi::gpointer,
2603            f: glib::ffi::gpointer,
2604        ) {
2605            let f: &F = &*(f as *const F);
2606            f(ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref())
2607        }
2608        unsafe {
2609            let f: Box_<F> = Box_::new(f);
2610            connect_raw(
2611                self.as_ptr() as *mut _,
2612                b"notify::kinetic-scrolling\0".as_ptr() as *const _,
2613                Some(transmute::<_, unsafe extern "C" fn()>(
2614                    notify_kinetic_scrolling_trampoline::<Self, F> as *const (),
2615                )),
2616                Box_::into_raw(f),
2617            )
2618        }
2619    }
2620
2621    #[doc(alias = "max-content-height")]
2622    fn connect_max_content_height_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2623        unsafe extern "C" fn notify_max_content_height_trampoline<
2624            P: IsA<ScrolledWindow>,
2625            F: Fn(&P) + 'static,
2626        >(
2627            this: *mut ffi::GtkScrolledWindow,
2628            _param_spec: glib::ffi::gpointer,
2629            f: glib::ffi::gpointer,
2630        ) {
2631            let f: &F = &*(f as *const F);
2632            f(ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref())
2633        }
2634        unsafe {
2635            let f: Box_<F> = Box_::new(f);
2636            connect_raw(
2637                self.as_ptr() as *mut _,
2638                b"notify::max-content-height\0".as_ptr() as *const _,
2639                Some(transmute::<_, unsafe extern "C" fn()>(
2640                    notify_max_content_height_trampoline::<Self, F> as *const (),
2641                )),
2642                Box_::into_raw(f),
2643            )
2644        }
2645    }
2646
2647    #[doc(alias = "max-content-width")]
2648    fn connect_max_content_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2649        unsafe extern "C" fn notify_max_content_width_trampoline<
2650            P: IsA<ScrolledWindow>,
2651            F: Fn(&P) + 'static,
2652        >(
2653            this: *mut ffi::GtkScrolledWindow,
2654            _param_spec: glib::ffi::gpointer,
2655            f: glib::ffi::gpointer,
2656        ) {
2657            let f: &F = &*(f as *const F);
2658            f(ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref())
2659        }
2660        unsafe {
2661            let f: Box_<F> = Box_::new(f);
2662            connect_raw(
2663                self.as_ptr() as *mut _,
2664                b"notify::max-content-width\0".as_ptr() as *const _,
2665                Some(transmute::<_, unsafe extern "C" fn()>(
2666                    notify_max_content_width_trampoline::<Self, F> as *const (),
2667                )),
2668                Box_::into_raw(f),
2669            )
2670        }
2671    }
2672
2673    #[doc(alias = "min-content-height")]
2674    fn connect_min_content_height_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2675        unsafe extern "C" fn notify_min_content_height_trampoline<
2676            P: IsA<ScrolledWindow>,
2677            F: Fn(&P) + 'static,
2678        >(
2679            this: *mut ffi::GtkScrolledWindow,
2680            _param_spec: glib::ffi::gpointer,
2681            f: glib::ffi::gpointer,
2682        ) {
2683            let f: &F = &*(f as *const F);
2684            f(ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref())
2685        }
2686        unsafe {
2687            let f: Box_<F> = Box_::new(f);
2688            connect_raw(
2689                self.as_ptr() as *mut _,
2690                b"notify::min-content-height\0".as_ptr() as *const _,
2691                Some(transmute::<_, unsafe extern "C" fn()>(
2692                    notify_min_content_height_trampoline::<Self, F> as *const (),
2693                )),
2694                Box_::into_raw(f),
2695            )
2696        }
2697    }
2698
2699    #[doc(alias = "min-content-width")]
2700    fn connect_min_content_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2701        unsafe extern "C" fn notify_min_content_width_trampoline<
2702            P: IsA<ScrolledWindow>,
2703            F: Fn(&P) + 'static,
2704        >(
2705            this: *mut ffi::GtkScrolledWindow,
2706            _param_spec: glib::ffi::gpointer,
2707            f: glib::ffi::gpointer,
2708        ) {
2709            let f: &F = &*(f as *const F);
2710            f(ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref())
2711        }
2712        unsafe {
2713            let f: Box_<F> = Box_::new(f);
2714            connect_raw(
2715                self.as_ptr() as *mut _,
2716                b"notify::min-content-width\0".as_ptr() as *const _,
2717                Some(transmute::<_, unsafe extern "C" fn()>(
2718                    notify_min_content_width_trampoline::<Self, F> as *const (),
2719                )),
2720                Box_::into_raw(f),
2721            )
2722        }
2723    }
2724
2725    #[doc(alias = "overlay-scrolling")]
2726    fn connect_overlay_scrolling_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2727        unsafe extern "C" fn notify_overlay_scrolling_trampoline<
2728            P: IsA<ScrolledWindow>,
2729            F: Fn(&P) + 'static,
2730        >(
2731            this: *mut ffi::GtkScrolledWindow,
2732            _param_spec: glib::ffi::gpointer,
2733            f: glib::ffi::gpointer,
2734        ) {
2735            let f: &F = &*(f as *const F);
2736            f(ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref())
2737        }
2738        unsafe {
2739            let f: Box_<F> = Box_::new(f);
2740            connect_raw(
2741                self.as_ptr() as *mut _,
2742                b"notify::overlay-scrolling\0".as_ptr() as *const _,
2743                Some(transmute::<_, unsafe extern "C" fn()>(
2744                    notify_overlay_scrolling_trampoline::<Self, F> as *const (),
2745                )),
2746                Box_::into_raw(f),
2747            )
2748        }
2749    }
2750
2751    #[doc(alias = "propagate-natural-height")]
2752    fn connect_propagate_natural_height_notify<F: Fn(&Self) + 'static>(
2753        &self,
2754        f: F,
2755    ) -> SignalHandlerId {
2756        unsafe extern "C" fn notify_propagate_natural_height_trampoline<
2757            P: IsA<ScrolledWindow>,
2758            F: Fn(&P) + 'static,
2759        >(
2760            this: *mut ffi::GtkScrolledWindow,
2761            _param_spec: glib::ffi::gpointer,
2762            f: glib::ffi::gpointer,
2763        ) {
2764            let f: &F = &*(f as *const F);
2765            f(ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref())
2766        }
2767        unsafe {
2768            let f: Box_<F> = Box_::new(f);
2769            connect_raw(
2770                self.as_ptr() as *mut _,
2771                b"notify::propagate-natural-height\0".as_ptr() as *const _,
2772                Some(transmute::<_, unsafe extern "C" fn()>(
2773                    notify_propagate_natural_height_trampoline::<Self, F> as *const (),
2774                )),
2775                Box_::into_raw(f),
2776            )
2777        }
2778    }
2779
2780    #[doc(alias = "propagate-natural-width")]
2781    fn connect_propagate_natural_width_notify<F: Fn(&Self) + 'static>(
2782        &self,
2783        f: F,
2784    ) -> SignalHandlerId {
2785        unsafe extern "C" fn notify_propagate_natural_width_trampoline<
2786            P: IsA<ScrolledWindow>,
2787            F: Fn(&P) + 'static,
2788        >(
2789            this: *mut ffi::GtkScrolledWindow,
2790            _param_spec: glib::ffi::gpointer,
2791            f: glib::ffi::gpointer,
2792        ) {
2793            let f: &F = &*(f as *const F);
2794            f(ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref())
2795        }
2796        unsafe {
2797            let f: Box_<F> = Box_::new(f);
2798            connect_raw(
2799                self.as_ptr() as *mut _,
2800                b"notify::propagate-natural-width\0".as_ptr() as *const _,
2801                Some(transmute::<_, unsafe extern "C" fn()>(
2802                    notify_propagate_natural_width_trampoline::<Self, F> as *const (),
2803                )),
2804                Box_::into_raw(f),
2805            )
2806        }
2807    }
2808
2809    #[doc(alias = "shadow-type")]
2810    fn connect_shadow_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2811        unsafe extern "C" fn notify_shadow_type_trampoline<
2812            P: IsA<ScrolledWindow>,
2813            F: Fn(&P) + 'static,
2814        >(
2815            this: *mut ffi::GtkScrolledWindow,
2816            _param_spec: glib::ffi::gpointer,
2817            f: glib::ffi::gpointer,
2818        ) {
2819            let f: &F = &*(f as *const F);
2820            f(ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref())
2821        }
2822        unsafe {
2823            let f: Box_<F> = Box_::new(f);
2824            connect_raw(
2825                self.as_ptr() as *mut _,
2826                b"notify::shadow-type\0".as_ptr() as *const _,
2827                Some(transmute::<_, unsafe extern "C" fn()>(
2828                    notify_shadow_type_trampoline::<Self, F> as *const (),
2829                )),
2830                Box_::into_raw(f),
2831            )
2832        }
2833    }
2834
2835    #[doc(alias = "vadjustment")]
2836    fn connect_vadjustment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2837        unsafe extern "C" fn notify_vadjustment_trampoline<
2838            P: IsA<ScrolledWindow>,
2839            F: Fn(&P) + 'static,
2840        >(
2841            this: *mut ffi::GtkScrolledWindow,
2842            _param_spec: glib::ffi::gpointer,
2843            f: glib::ffi::gpointer,
2844        ) {
2845            let f: &F = &*(f as *const F);
2846            f(ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref())
2847        }
2848        unsafe {
2849            let f: Box_<F> = Box_::new(f);
2850            connect_raw(
2851                self.as_ptr() as *mut _,
2852                b"notify::vadjustment\0".as_ptr() as *const _,
2853                Some(transmute::<_, unsafe extern "C" fn()>(
2854                    notify_vadjustment_trampoline::<Self, F> as *const (),
2855                )),
2856                Box_::into_raw(f),
2857            )
2858        }
2859    }
2860
2861    #[doc(alias = "vscrollbar-policy")]
2862    fn connect_vscrollbar_policy_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2863        unsafe extern "C" fn notify_vscrollbar_policy_trampoline<
2864            P: IsA<ScrolledWindow>,
2865            F: Fn(&P) + 'static,
2866        >(
2867            this: *mut ffi::GtkScrolledWindow,
2868            _param_spec: glib::ffi::gpointer,
2869            f: glib::ffi::gpointer,
2870        ) {
2871            let f: &F = &*(f as *const F);
2872            f(ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref())
2873        }
2874        unsafe {
2875            let f: Box_<F> = Box_::new(f);
2876            connect_raw(
2877                self.as_ptr() as *mut _,
2878                b"notify::vscrollbar-policy\0".as_ptr() as *const _,
2879                Some(transmute::<_, unsafe extern "C" fn()>(
2880                    notify_vscrollbar_policy_trampoline::<Self, F> as *const (),
2881                )),
2882                Box_::into_raw(f),
2883            )
2884        }
2885    }
2886
2887    #[doc(alias = "window-placement")]
2888    fn connect_window_placement_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2889        unsafe extern "C" fn notify_window_placement_trampoline<
2890            P: IsA<ScrolledWindow>,
2891            F: Fn(&P) + 'static,
2892        >(
2893            this: *mut ffi::GtkScrolledWindow,
2894            _param_spec: glib::ffi::gpointer,
2895            f: glib::ffi::gpointer,
2896        ) {
2897            let f: &F = &*(f as *const F);
2898            f(ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref())
2899        }
2900        unsafe {
2901            let f: Box_<F> = Box_::new(f);
2902            connect_raw(
2903                self.as_ptr() as *mut _,
2904                b"notify::window-placement\0".as_ptr() as *const _,
2905                Some(transmute::<_, unsafe extern "C" fn()>(
2906                    notify_window_placement_trampoline::<Self, F> as *const (),
2907                )),
2908                Box_::into_raw(f),
2909            )
2910        }
2911    }
2912}
2913
2914impl<O: IsA<ScrolledWindow>> ScrolledWindowExt for O {}
2915
2916impl fmt::Display for ScrolledWindow {
2917    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
2918        f.write_str("ScrolledWindow")
2919    }
2920}