Skip to main content

gtk4/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
5#[cfg(feature = "v4_10")]
6#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
7use crate::Accessible;
8use crate::{
9    AccessibleRole, Adjustment, Align, Buildable, ConstraintTarget, CornerType, DirectionType,
10    LayoutManager, Overflow, PolicyType, PositionType, ScrollType, Widget, ffi,
11};
12use glib::{
13    object::ObjectType as _,
14    prelude::*,
15    signal::{SignalHandlerId, connect_raw},
16    translate::*,
17};
18use std::boxed::Box as Box_;
19
20#[cfg(feature = "v4_10")]
21#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
22glib::wrapper! {
23    /// Makes its child scrollable.
24    ///
25    /// <picture>
26    ///   <source srcset="scrolledwindow-dark.png" media="(prefers-color-scheme: dark)">
27    ///   <img alt="An example GtkScrolledWindow" src="scrolledwindow.png">
28    /// </picture>
29    ///
30    /// It does so using either internally added scrollbars or externally
31    /// associated adjustments, and optionally draws a frame around the child.
32    ///
33    /// Widgets with native scrolling support, i.e. those whose classes implement
34    /// the [`Scrollable`][crate::Scrollable] interface, are added directly. For other types
35    /// of widget, the class [`Viewport`][crate::Viewport] acts as an adaptor, giving
36    /// scrollability to other widgets. [`set_child()`][Self::set_child()]
37    /// intelligently accounts for whether or not the added child is a [`Scrollable`][crate::Scrollable].
38    /// If it isn’t, then it wraps the child in a [`Viewport`][crate::Viewport]. Therefore, you can
39    /// just add any child widget and not worry about the details.
40    ///
41    /// If [`set_child()`][Self::set_child()] has added a [`Viewport`][crate::Viewport] for you,
42    /// it will be automatically removed when you unset the child.
43    /// Unless [`hscrollbar-policy`][struct@crate::ScrolledWindow#hscrollbar-policy] and
44    /// [`vscrollbar-policy`][struct@crate::ScrolledWindow#vscrollbar-policy] are [`PolicyType::Never`][crate::PolicyType::Never] or
45    /// [`PolicyType::External`][crate::PolicyType::External], [`ScrolledWindow`][crate::ScrolledWindow] adds internal [`Scrollbar`][crate::Scrollbar] widgets
46    /// around its child. The scroll position of the child, and if applicable the
47    /// scrollbars, is controlled by the [`hadjustment`][struct@crate::ScrolledWindow#hadjustment]
48    /// and [`vadjustment`][struct@crate::ScrolledWindow#vadjustment] that are associated with the
49    /// [`ScrolledWindow`][crate::ScrolledWindow]. See the docs on [`Scrollbar`][crate::Scrollbar] for the details,
50    /// but note that the “step_increment” and “page_increment” fields are only
51    /// effective if the policy causes scrollbars to be present.
52    ///
53    /// If a [`ScrolledWindow`][crate::ScrolledWindow] doesn’t behave quite as you would like, or
54    /// doesn’t have exactly the right layout, it’s very possible to set up
55    /// your own scrolling with [`Scrollbar`][crate::Scrollbar] and for example a [`Grid`][crate::Grid].
56    ///
57    /// # Touch support
58    ///
59    /// [`ScrolledWindow`][crate::ScrolledWindow] has built-in support for touch devices. When a
60    /// touchscreen is used, swiping will move the scrolled window, and will
61    /// expose 'kinetic' behavior. This can be turned off with the
62    /// [`kinetic-scrolling`][struct@crate::ScrolledWindow#kinetic-scrolling] property if it is undesired.
63    ///
64    /// [`ScrolledWindow`][crate::ScrolledWindow] also displays visual 'overshoot' indication when
65    /// the content is pulled beyond the end, and this situation can be
66    /// captured with the [`edge-overshot`][struct@crate::ScrolledWindow#edge-overshot] signal.
67    ///
68    /// If no mouse device is present, the scrollbars will overlaid as
69    /// narrow, auto-hiding indicators over the content. If traditional
70    /// scrollbars are desired although no mouse is present, this behaviour
71    /// can be turned off with the [`overlay-scrolling`][struct@crate::ScrolledWindow#overlay-scrolling]
72    /// property.
73    ///
74    /// # Shortcuts and Gestures
75    ///
76    /// The following signals have default keybindings:
77    ///
78    /// - [`scroll-child`][struct@crate::ScrolledWindow#scroll-child]
79    ///
80    /// # CSS nodes
81    ///
82    /// [`ScrolledWindow`][crate::ScrolledWindow] has a main CSS node with name scrolledwindow.
83    /// It gets a .frame style class added when [`has-frame`][struct@crate::ScrolledWindow#has-frame]
84    /// is [`true`].
85    ///
86    /// It uses subnodes with names overshoot and undershoot to draw the overflow
87    /// and underflow indications. These nodes get the .left, .right, .top or .bottom
88    /// style class added depending on where the indication is drawn.
89    ///
90    /// [`ScrolledWindow`][crate::ScrolledWindow] also sets the positional style classes (.left, .right,
91    /// .top, .bottom) and style classes related to overlay scrolling
92    /// (.overlay-indicator, .dragging, .hovering) on its scrollbars.
93    ///
94    /// If both scrollbars are visible, the area where they meet is drawn
95    /// with a subnode named junction.
96    ///
97    /// # Accessibility
98    ///
99    /// Until GTK 4.10, [`ScrolledWindow`][crate::ScrolledWindow] used the [enum@Gtk.AccessibleRole.group] role.
100    ///
101    /// Starting from GTK 4.12, [`ScrolledWindow`][crate::ScrolledWindow] uses the [enum@Gtk.AccessibleRole.generic]
102    /// role.
103    ///
104    /// ## Properties
105    ///
106    ///
107    /// #### `child`
108    ///  The child widget.
109    ///
110    /// When setting this property, if the child widget does not implement
111    /// [`Scrollable`][crate::Scrollable], the scrolled window will add the child to
112    /// a [`Viewport`][crate::Viewport] and then set the viewport as the child.
113    ///
114    /// Readable | Writable
115    ///
116    ///
117    /// #### `hadjustment`
118    ///  The [`Adjustment`][crate::Adjustment] for the horizontal position.
119    ///
120    /// Readable | Writable | Construct
121    ///
122    ///
123    /// #### `has-frame`
124    ///  Whether to draw a frame around the contents.
125    ///
126    /// Readable | Writable
127    ///
128    ///
129    /// #### `hscrollbar-policy`
130    ///  When the horizontal scrollbar is displayed.
131    ///
132    /// Use [`ScrolledWindow::set_policy()`][crate::ScrolledWindow::set_policy()] to set
133    /// this property.
134    ///
135    /// Readable | Writable
136    ///
137    ///
138    /// #### `kinetic-scrolling`
139    ///  Whether kinetic scrolling is enabled or not.
140    ///
141    /// Kinetic scrolling only applies to devices with source `GDK_SOURCE_TOUCHSCREEN`.
142    ///
143    /// Readable | Writable
144    ///
145    ///
146    /// #### `max-content-height`
147    ///  The maximum content height of @scrolled_window.
148    ///
149    /// Readable | Writable
150    ///
151    ///
152    /// #### `max-content-width`
153    ///  The maximum content width of @scrolled_window.
154    ///
155    /// Readable | Writable
156    ///
157    ///
158    /// #### `min-content-height`
159    ///  The minimum content height of @scrolled_window.
160    ///
161    /// Readable | Writable
162    ///
163    ///
164    /// #### `min-content-width`
165    ///  The minimum content width of @scrolled_window.
166    ///
167    /// Readable | Writable
168    ///
169    ///
170    /// #### `overlay-scrolling`
171    ///  Whether overlay scrolling is enabled or not.
172    ///
173    /// If it is, the scrollbars are only added as traditional widgets
174    /// when a mouse is present. Otherwise, they are overlaid on top of
175    /// the content, as narrow indicators.
176    ///
177    /// Note that overlay scrolling can also be globally disabled, with
178    /// the [`gtk-overlay-scrolling`][struct@crate::Settings#gtk-overlay-scrolling] setting.
179    ///
180    /// Readable | Writable
181    ///
182    ///
183    /// #### `propagate-natural-height`
184    ///  Whether the natural height of the child should be calculated and propagated
185    /// through the scrolled window’s requested natural height.
186    ///
187    /// This is useful in cases where an attempt should be made to allocate exactly
188    /// enough space for the natural size of the child.
189    ///
190    /// Readable | Writable
191    ///
192    ///
193    /// #### `propagate-natural-width`
194    ///  Whether the natural width of the child should be calculated and propagated
195    /// through the scrolled window’s requested natural width.
196    ///
197    /// This is useful in cases where an attempt should be made to allocate exactly
198    /// enough space for the natural size of the child.
199    ///
200    /// Readable | Writable
201    ///
202    ///
203    /// #### `vadjustment`
204    ///  The [`Adjustment`][crate::Adjustment] for the vertical position.
205    ///
206    /// Readable | Writable | Construct
207    ///
208    ///
209    /// #### `vscrollbar-policy`
210    ///  When the vertical scrollbar is displayed.
211    ///
212    /// Use [`ScrolledWindow::set_policy()`][crate::ScrolledWindow::set_policy()] to set
213    /// this property.
214    ///
215    /// Readable | Writable
216    ///
217    ///
218    /// #### `window-placement`
219    ///  Where the contents are located with respect to the scrollbars.
220    ///
221    /// Readable | Writable
222    /// <details><summary><h4>Widget</h4></summary>
223    ///
224    ///
225    /// #### `can-focus`
226    ///  Whether the widget or any of its descendents can accept
227    /// the input focus.
228    ///
229    /// This property is meant to be set by widget implementations,
230    /// typically in their instance init function.
231    ///
232    /// Readable | Writable
233    ///
234    ///
235    /// #### `can-target`
236    ///  Whether the widget can receive pointer events.
237    ///
238    /// Readable | Writable
239    ///
240    ///
241    /// #### `css-classes`
242    ///  A list of css classes applied to this widget.
243    ///
244    /// Readable | Writable
245    ///
246    ///
247    /// #### `css-name`
248    ///  The name of this widget in the CSS tree.
249    ///
250    /// This property is meant to be set by widget implementations,
251    /// typically in their instance init function.
252    ///
253    /// Readable | Writable | Construct Only
254    ///
255    ///
256    /// #### `cursor`
257    ///  The cursor used by @widget.
258    ///
259    /// Readable | Writable
260    ///
261    ///
262    /// #### `focus-on-click`
263    ///  Whether the widget should grab focus when it is clicked with the mouse.
264    ///
265    /// This property is only relevant for widgets that can take focus.
266    ///
267    /// Readable | Writable
268    ///
269    ///
270    /// #### `focusable`
271    ///  Whether this widget itself will accept the input focus.
272    ///
273    /// Readable | Writable
274    ///
275    ///
276    /// #### `halign`
277    ///  How to distribute horizontal space if widget gets extra space.
278    ///
279    /// Readable | Writable
280    ///
281    ///
282    /// #### `has-default`
283    ///  Whether the widget is the default widget.
284    ///
285    /// Readable
286    ///
287    ///
288    /// #### `has-focus`
289    ///  Whether the widget has the input focus.
290    ///
291    /// Readable
292    ///
293    ///
294    /// #### `has-tooltip`
295    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
296    /// signal on @widget.
297    ///
298    /// A true value indicates that @widget can have a tooltip, in this case
299    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
300    /// determine whether it will provide a tooltip or not.
301    ///
302    /// Readable | Writable
303    ///
304    ///
305    /// #### `height-request`
306    ///  Overrides for height request of the widget.
307    ///
308    /// If this is -1, the natural request will be used.
309    ///
310    /// Readable | Writable
311    ///
312    ///
313    /// #### `hexpand`
314    ///  Whether to expand horizontally.
315    ///
316    /// Readable | Writable
317    ///
318    ///
319    /// #### `hexpand-set`
320    ///  Whether to use the `hexpand` property.
321    ///
322    /// Readable | Writable
323    ///
324    ///
325    /// #### `layout-manager`
326    ///  The [`LayoutManager`][crate::LayoutManager] instance to use to compute
327    /// the preferred size of the widget, and allocate its children.
328    ///
329    /// This property is meant to be set by widget implementations,
330    /// typically in their instance init function.
331    ///
332    /// Readable | Writable
333    ///
334    ///
335    /// #### `limit-events`
336    ///  Makes this widget act like a modal dialog, with respect to
337    /// event delivery.
338    ///
339    /// Global event controllers will not handle events with targets
340    /// inside the widget, unless they are set up to ignore propagation
341    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
342    ///
343    /// Readable | Writable
344    ///
345    ///
346    /// #### `margin-bottom`
347    ///  Margin on bottom side of widget.
348    ///
349    /// This property adds margin outside of the widget's normal size
350    /// request, the margin will be added in addition to the size from
351    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
352    ///
353    /// Readable | Writable
354    ///
355    ///
356    /// #### `margin-end`
357    ///  Margin on end of widget, horizontally.
358    ///
359    /// This property supports left-to-right and right-to-left text
360    /// directions.
361    ///
362    /// This property adds margin outside of the widget's normal size
363    /// request, the margin will be added in addition to the size from
364    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
365    ///
366    /// Readable | Writable
367    ///
368    ///
369    /// #### `margin-start`
370    ///  Margin on start of widget, horizontally.
371    ///
372    /// This property supports left-to-right and right-to-left text
373    /// directions.
374    ///
375    /// This property adds margin outside of the widget's normal size
376    /// request, the margin will be added in addition to the size from
377    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
378    ///
379    /// Readable | Writable
380    ///
381    ///
382    /// #### `margin-top`
383    ///  Margin on top side of widget.
384    ///
385    /// This property adds margin outside of the widget's normal size
386    /// request, the margin will be added in addition to the size from
387    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
388    ///
389    /// Readable | Writable
390    ///
391    ///
392    /// #### `name`
393    ///  The name of the widget.
394    ///
395    /// Readable | Writable
396    ///
397    ///
398    /// #### `opacity`
399    ///  The requested opacity of the widget.
400    ///
401    /// Readable | Writable
402    ///
403    ///
404    /// #### `overflow`
405    ///  How content outside the widget's content area is treated.
406    ///
407    /// This property is meant to be set by widget implementations,
408    /// typically in their instance init function.
409    ///
410    /// Readable | Writable
411    ///
412    ///
413    /// #### `parent`
414    ///  The parent widget of this widget.
415    ///
416    /// Readable
417    ///
418    ///
419    /// #### `receives-default`
420    ///  Whether the widget will receive the default action when it is focused.
421    ///
422    /// Readable | Writable
423    ///
424    ///
425    /// #### `root`
426    ///  The [`Root`][crate::Root] widget of the widget tree containing this widget.
427    ///
428    /// This will be `NULL` if the widget is not contained in a root widget.
429    ///
430    /// Readable
431    ///
432    ///
433    /// #### `scale-factor`
434    ///  The scale factor of the widget.
435    ///
436    /// Readable
437    ///
438    ///
439    /// #### `sensitive`
440    ///  Whether the widget responds to input.
441    ///
442    /// Readable | Writable
443    ///
444    ///
445    /// #### `tooltip-markup`
446    ///  Sets the text of tooltip to be the given string, which is marked up
447    /// with Pango markup.
448    ///
449    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
450    ///
451    /// This is a convenience property which will take care of getting the
452    /// tooltip shown if the given string is not `NULL`:
453    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
454    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
455    /// the default signal handler.
456    ///
457    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
458    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
459    ///
460    /// Readable | Writable
461    ///
462    ///
463    /// #### `tooltip-text`
464    ///  Sets the text of tooltip to be the given string.
465    ///
466    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
467    ///
468    /// This is a convenience property which will take care of getting the
469    /// tooltip shown if the given string is not `NULL`:
470    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
471    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
472    /// the default signal handler.
473    ///
474    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
475    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
476    ///
477    /// Readable | Writable
478    ///
479    ///
480    /// #### `valign`
481    ///  How to distribute vertical space if widget gets extra space.
482    ///
483    /// Readable | Writable
484    ///
485    ///
486    /// #### `vexpand`
487    ///  Whether to expand vertically.
488    ///
489    /// Readable | Writable
490    ///
491    ///
492    /// #### `vexpand-set`
493    ///  Whether to use the `vexpand` property.
494    ///
495    /// Readable | Writable
496    ///
497    ///
498    /// #### `visible`
499    ///  Whether the widget is visible.
500    ///
501    /// Readable | Writable
502    ///
503    ///
504    /// #### `width-request`
505    ///  Overrides for width request of the widget.
506    ///
507    /// If this is -1, the natural request will be used.
508    ///
509    /// Readable | Writable
510    /// </details>
511    /// <details><summary><h4>Accessible</h4></summary>
512    ///
513    ///
514    /// #### `accessible-role`
515    ///  The accessible role of the given [`Accessible`][crate::Accessible] implementation.
516    ///
517    /// The accessible role cannot be changed once set.
518    ///
519    /// Readable | Writable
520    /// </details>
521    ///
522    /// ## Signals
523    ///
524    ///
525    /// #### `edge-overshot`
526    ///  Emitted whenever user initiated scrolling makes the scrolled
527    /// window firmly surpass the limits defined by the adjustment
528    /// in that orientation.
529    ///
530    /// A similar behavior without edge resistance is provided by the
531    /// [`edge-reached`][struct@crate::ScrolledWindow#edge-reached] signal.
532    ///
533    /// Note: The @pos argument is LTR/RTL aware, so callers should be
534    /// aware too if intending to provide behavior on horizontal edges.
535    ///
536    ///
537    ///
538    ///
539    /// #### `edge-reached`
540    ///  Emitted whenever user-initiated scrolling makes the scrolled
541    /// window exactly reach the lower or upper limits defined by the
542    /// adjustment in that orientation.
543    ///
544    /// A similar behavior with edge resistance is provided by the
545    /// [`edge-overshot`][struct@crate::ScrolledWindow#edge-overshot] signal.
546    ///
547    /// Note: The @pos argument is LTR/RTL aware, so callers should be
548    /// aware too if intending to provide behavior on horizontal edges.
549    ///
550    ///
551    ///
552    ///
553    /// #### `move-focus-out`
554    ///  Emitted when focus is moved away from the scrolled window by a
555    /// keybinding.
556    ///
557    /// This is a [keybinding signal](class.SignalAction.html).
558    ///
559    /// The default bindings for this signal are
560    /// <kbd>Ctrl</kbd>+<kbd>Tab</kbd> to move forward and
561    /// <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Tab</kbd>` to move backward.
562    ///
563    /// Action
564    ///
565    ///
566    /// #### `scroll-child`
567    ///  Emitted when a keybinding that scrolls is pressed.
568    ///
569    /// This is a [keybinding signal](class.SignalAction.html).
570    ///
571    /// The horizontal or vertical adjustment is updated which triggers a
572    /// signal that the scrolled window’s child may listen to and scroll itself.
573    ///
574    /// Action
575    /// <details><summary><h4>Widget</h4></summary>
576    ///
577    ///
578    /// #### `destroy`
579    ///  Signals that all holders of a reference to the widget should release
580    /// the reference that they hold.
581    ///
582    /// May result in finalization of the widget if all references are released.
583    ///
584    /// This signal is not suitable for saving widget state.
585    ///
586    ///
587    ///
588    ///
589    /// #### `direction-changed`
590    ///  Emitted when the text direction of a widget changes.
591    ///
592    ///
593    ///
594    ///
595    /// #### `hide`
596    ///  Emitted when @widget is hidden.
597    ///
598    ///
599    ///
600    ///
601    /// #### `keynav-failed`
602    ///  Emitted if keyboard navigation fails.
603    ///
604    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
605    ///
606    ///
607    ///
608    ///
609    /// #### `map`
610    ///  Emitted when @widget is going to be mapped.
611    ///
612    /// A widget is mapped when the widget is visible (which is controlled with
613    /// [`visible`][struct@crate::Widget#visible]) and all its parents up to the toplevel widget
614    /// are also visible.
615    ///
616    /// The `::map` signal can be used to determine whether a widget will be drawn,
617    /// for instance it can resume an animation that was stopped during the
618    /// emission of [`unmap`][struct@crate::Widget#unmap].
619    ///
620    ///
621    ///
622    ///
623    /// #### `mnemonic-activate`
624    ///  Emitted when a widget is activated via a mnemonic.
625    ///
626    /// The default handler for this signal activates @widget if @group_cycling
627    /// is false, or just makes @widget grab focus if @group_cycling is true.
628    ///
629    ///
630    ///
631    ///
632    /// #### `move-focus`
633    ///  Emitted when the focus is moved.
634    ///
635    /// The `::move-focus` signal is a [keybinding signal](class.SignalAction.html).
636    ///
637    /// The default bindings for this signal are <kbd>Tab</kbd> to move forward,
638    /// and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move backward.
639    ///
640    /// Action
641    ///
642    ///
643    /// #### `query-tooltip`
644    ///  Emitted when the widget’s tooltip is about to be shown.
645    ///
646    /// This happens when the [`has-tooltip`][struct@crate::Widget#has-tooltip] property
647    /// is true and the hover timeout has expired with the cursor hovering
648    /// above @widget; or emitted when @widget got focus in keyboard mode.
649    ///
650    /// Using the given coordinates, the signal handler should determine
651    /// whether a tooltip should be shown for @widget. If this is the case
652    /// true should be returned, false otherwise. Note that if @keyboard_mode
653    /// is true, the values of @x and @y are undefined and should not be used.
654    ///
655    /// The signal handler is free to manipulate @tooltip with the therefore
656    /// destined function calls.
657    ///
658    ///
659    ///
660    ///
661    /// #### `realize`
662    ///  Emitted when @widget is associated with a [`gdk::Surface`][crate::gdk::Surface].
663    ///
664    /// This means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called
665    /// or the widget has been mapped (that is, it is going to be drawn).
666    ///
667    ///
668    ///
669    ///
670    /// #### `show`
671    ///  Emitted when @widget is shown.
672    ///
673    ///
674    ///
675    ///
676    /// #### `state-flags-changed`
677    ///  Emitted when the widget state changes.
678    ///
679    /// See [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
680    ///
681    ///
682    ///
683    ///
684    /// #### `unmap`
685    ///  Emitted when @widget is going to be unmapped.
686    ///
687    /// A widget is unmapped when either it or any of its parents up to the
688    /// toplevel widget have been set as hidden.
689    ///
690    /// As `::unmap` indicates that a widget will not be shown any longer,
691    /// it can be used to, for example, stop an animation on the widget.
692    ///
693    ///
694    ///
695    ///
696    /// #### `unrealize`
697    ///  Emitted when the [`gdk::Surface`][crate::gdk::Surface] associated with @widget is destroyed.
698    ///
699    /// This means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been called
700    /// or the widget has been unmapped (that is, it is going to be hidden).
701    ///
702    ///
703    /// </details>
704    ///
705    /// # Implements
706    ///
707    /// [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual]
708    #[doc(alias = "GtkScrolledWindow")]
709    pub struct ScrolledWindow(Object<ffi::GtkScrolledWindow>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget;
710
711    match fn {
712        type_ => || ffi::gtk_scrolled_window_get_type(),
713    }
714}
715
716#[cfg(not(feature = "v4_10"))]
717glib::wrapper! {
718    #[doc(alias = "GtkScrolledWindow")]
719    pub struct ScrolledWindow(Object<ffi::GtkScrolledWindow>) @extends Widget, @implements Buildable, ConstraintTarget;
720
721    match fn {
722        type_ => || ffi::gtk_scrolled_window_get_type(),
723    }
724}
725
726impl ScrolledWindow {
727    /// Creates a new scrolled window.
728    ///
729    /// # Returns
730    ///
731    /// a new scrolled window
732    #[doc(alias = "gtk_scrolled_window_new")]
733    pub fn new() -> ScrolledWindow {
734        assert_initialized_main_thread!();
735        unsafe { Widget::from_glib_none(ffi::gtk_scrolled_window_new()).unsafe_cast() }
736    }
737
738    // rustdoc-stripper-ignore-next
739    /// Creates a new builder-pattern struct instance to construct [`ScrolledWindow`] objects.
740    ///
741    /// This method returns an instance of [`ScrolledWindowBuilder`](crate::builders::ScrolledWindowBuilder) which can be used to create [`ScrolledWindow`] objects.
742    pub fn builder() -> ScrolledWindowBuilder {
743        ScrolledWindowBuilder::new()
744    }
745
746    /// Gets the child widget of @self.
747    ///
748    /// If the scrolled window automatically added a [`Viewport`][crate::Viewport], this
749    /// function will return the viewport widget, and you can retrieve its child
750    /// using [`Viewport::child()`][crate::Viewport::child()].
751    ///
752    /// # Returns
753    ///
754    /// the child widget of @self
755    #[doc(alias = "gtk_scrolled_window_get_child")]
756    #[doc(alias = "get_child")]
757    pub fn child(&self) -> Option<Widget> {
758        unsafe { from_glib_none(ffi::gtk_scrolled_window_get_child(self.to_glib_none().0)) }
759    }
760
761    /// Returns the horizontal scrollbar’s adjustment.
762    ///
763    /// This is the adjustment used to connect the horizontal scrollbar
764    /// to the child widget’s horizontal scroll functionality.
765    ///
766    /// # Returns
767    ///
768    /// the horizontal [`Adjustment`][crate::Adjustment]
769    #[doc(alias = "gtk_scrolled_window_get_hadjustment")]
770    #[doc(alias = "get_hadjustment")]
771    pub fn hadjustment(&self) -> Adjustment {
772        unsafe {
773            from_glib_none(ffi::gtk_scrolled_window_get_hadjustment(
774                self.to_glib_none().0,
775            ))
776        }
777    }
778
779    /// Gets whether the scrolled window draws a frame.
780    ///
781    /// # Returns
782    ///
783    /// [`true`] if the @self has a frame
784    #[doc(alias = "gtk_scrolled_window_get_has_frame")]
785    #[doc(alias = "get_has_frame")]
786    #[doc(alias = "has-frame")]
787    pub fn has_frame(&self) -> bool {
788        unsafe {
789            from_glib(ffi::gtk_scrolled_window_get_has_frame(
790                self.to_glib_none().0,
791            ))
792        }
793    }
794
795    /// Returns the horizontal scrollbar of @self.
796    ///
797    /// # Returns
798    ///
799    /// the horizontal scrollbar of the scrolled window.
800    #[doc(alias = "gtk_scrolled_window_get_hscrollbar")]
801    #[doc(alias = "get_hscrollbar")]
802    pub fn hscrollbar(&self) -> Widget {
803        unsafe {
804            from_glib_none(ffi::gtk_scrolled_window_get_hscrollbar(
805                self.to_glib_none().0,
806            ))
807        }
808    }
809
810    /// Returns the specified kinetic scrolling behavior.
811    ///
812    /// # Returns
813    ///
814    /// the scrolling behavior flags.
815    #[doc(alias = "gtk_scrolled_window_get_kinetic_scrolling")]
816    #[doc(alias = "get_kinetic_scrolling")]
817    #[doc(alias = "kinetic-scrolling")]
818    pub fn is_kinetic_scrolling(&self) -> bool {
819        unsafe {
820            from_glib(ffi::gtk_scrolled_window_get_kinetic_scrolling(
821                self.to_glib_none().0,
822            ))
823        }
824    }
825
826    /// Returns the maximum content height set.
827    ///
828    /// # Returns
829    ///
830    /// the maximum content height, or -1
831    #[doc(alias = "gtk_scrolled_window_get_max_content_height")]
832    #[doc(alias = "get_max_content_height")]
833    #[doc(alias = "max-content-height")]
834    pub fn max_content_height(&self) -> i32 {
835        unsafe { ffi::gtk_scrolled_window_get_max_content_height(self.to_glib_none().0) }
836    }
837
838    /// Returns the maximum content width set.
839    ///
840    /// # Returns
841    ///
842    /// the maximum content width, or -1
843    #[doc(alias = "gtk_scrolled_window_get_max_content_width")]
844    #[doc(alias = "get_max_content_width")]
845    #[doc(alias = "max-content-width")]
846    pub fn max_content_width(&self) -> i32 {
847        unsafe { ffi::gtk_scrolled_window_get_max_content_width(self.to_glib_none().0) }
848    }
849
850    /// Gets the minimal content height of @self.
851    ///
852    /// # Returns
853    ///
854    /// the minimal content height
855    #[doc(alias = "gtk_scrolled_window_get_min_content_height")]
856    #[doc(alias = "get_min_content_height")]
857    #[doc(alias = "min-content-height")]
858    pub fn min_content_height(&self) -> i32 {
859        unsafe { ffi::gtk_scrolled_window_get_min_content_height(self.to_glib_none().0) }
860    }
861
862    /// Gets the minimum content width of @self.
863    ///
864    /// # Returns
865    ///
866    /// the minimum content width
867    #[doc(alias = "gtk_scrolled_window_get_min_content_width")]
868    #[doc(alias = "get_min_content_width")]
869    #[doc(alias = "min-content-width")]
870    pub fn min_content_width(&self) -> i32 {
871        unsafe { ffi::gtk_scrolled_window_get_min_content_width(self.to_glib_none().0) }
872    }
873
874    /// Returns whether overlay scrolling is enabled for this scrolled window.
875    ///
876    /// # Returns
877    ///
878    /// [`true`] if overlay scrolling is enabled
879    #[doc(alias = "gtk_scrolled_window_get_overlay_scrolling")]
880    #[doc(alias = "get_overlay_scrolling")]
881    #[doc(alias = "overlay-scrolling")]
882    pub fn is_overlay_scrolling(&self) -> bool {
883        unsafe {
884            from_glib(ffi::gtk_scrolled_window_get_overlay_scrolling(
885                self.to_glib_none().0,
886            ))
887        }
888    }
889
890    /// Gets the placement of the contents with respect to the scrollbars.
891    ///
892    /// # Returns
893    ///
894    /// the current placement value.
895    #[doc(alias = "gtk_scrolled_window_get_placement")]
896    #[doc(alias = "get_placement")]
897    #[doc(alias = "window-placement")]
898    pub fn placement(&self) -> CornerType {
899        unsafe {
900            from_glib(ffi::gtk_scrolled_window_get_placement(
901                self.to_glib_none().0,
902            ))
903        }
904    }
905
906    /// Retrieves the current policy values for the horizontal and vertical
907    /// scrollbars.
908    ///
909    /// See [`set_policy()`][Self::set_policy()].
910    ///
911    /// # Returns
912    ///
913    ///
914    /// ## `hscrollbar_policy`
915    /// location to store the policy
916    ///   for the horizontal scrollbar
917    ///
918    /// ## `vscrollbar_policy`
919    /// location to store the policy
920    ///   for the vertical scrollbar
921    #[doc(alias = "gtk_scrolled_window_get_policy")]
922    #[doc(alias = "get_policy")]
923    pub fn policy(&self) -> (PolicyType, PolicyType) {
924        unsafe {
925            let mut hscrollbar_policy = std::mem::MaybeUninit::uninit();
926            let mut vscrollbar_policy = std::mem::MaybeUninit::uninit();
927            ffi::gtk_scrolled_window_get_policy(
928                self.to_glib_none().0,
929                hscrollbar_policy.as_mut_ptr(),
930                vscrollbar_policy.as_mut_ptr(),
931            );
932            (
933                from_glib(hscrollbar_policy.assume_init()),
934                from_glib(vscrollbar_policy.assume_init()),
935            )
936        }
937    }
938
939    /// Reports whether the natural height of the child will be calculated
940    /// and propagated through the scrolled window’s requested natural height.
941    ///
942    /// # Returns
943    ///
944    /// whether natural height propagation is enabled.
945    #[doc(alias = "gtk_scrolled_window_get_propagate_natural_height")]
946    #[doc(alias = "get_propagate_natural_height")]
947    #[doc(alias = "propagate-natural-height")]
948    pub fn propagates_natural_height(&self) -> bool {
949        unsafe {
950            from_glib(ffi::gtk_scrolled_window_get_propagate_natural_height(
951                self.to_glib_none().0,
952            ))
953        }
954    }
955
956    /// Reports whether the natural width of the child will be calculated
957    /// and propagated through the scrolled window’s requested natural width.
958    ///
959    /// # Returns
960    ///
961    /// whether natural width propagation is enabled.
962    #[doc(alias = "gtk_scrolled_window_get_propagate_natural_width")]
963    #[doc(alias = "get_propagate_natural_width")]
964    #[doc(alias = "propagate-natural-width")]
965    pub fn propagates_natural_width(&self) -> bool {
966        unsafe {
967            from_glib(ffi::gtk_scrolled_window_get_propagate_natural_width(
968                self.to_glib_none().0,
969            ))
970        }
971    }
972
973    /// Returns the vertical scrollbar’s adjustment.
974    ///
975    /// This is the adjustment used to connect the vertical
976    /// scrollbar to the child widget’s vertical scroll functionality.
977    ///
978    /// # Returns
979    ///
980    /// the vertical [`Adjustment`][crate::Adjustment]
981    #[doc(alias = "gtk_scrolled_window_get_vadjustment")]
982    #[doc(alias = "get_vadjustment")]
983    pub fn vadjustment(&self) -> Adjustment {
984        unsafe {
985            from_glib_none(ffi::gtk_scrolled_window_get_vadjustment(
986                self.to_glib_none().0,
987            ))
988        }
989    }
990
991    /// Returns the vertical scrollbar of @self.
992    ///
993    /// # Returns
994    ///
995    /// the vertical scrollbar of the scrolled window.
996    #[doc(alias = "gtk_scrolled_window_get_vscrollbar")]
997    #[doc(alias = "get_vscrollbar")]
998    pub fn vscrollbar(&self) -> Widget {
999        unsafe {
1000            from_glib_none(ffi::gtk_scrolled_window_get_vscrollbar(
1001                self.to_glib_none().0,
1002            ))
1003        }
1004    }
1005
1006    /// Sets the child widget of @self.
1007    ///
1008    /// If @child does not implement the [`Scrollable`][crate::Scrollable] interface,
1009    /// the scrolled window will add @child to a [`Viewport`][crate::Viewport] instance
1010    /// and then add the viewport as its child widget.
1011    /// ## `child`
1012    /// the child widget
1013    #[doc(alias = "gtk_scrolled_window_set_child")]
1014    #[doc(alias = "child")]
1015    pub fn set_child(&self, child: Option<&impl IsA<Widget>>) {
1016        unsafe {
1017            ffi::gtk_scrolled_window_set_child(
1018                self.to_glib_none().0,
1019                child.map(|p| p.as_ref()).to_glib_none().0,
1020            );
1021        }
1022    }
1023
1024    /// Sets the [`Adjustment`][crate::Adjustment] for the horizontal scrollbar.
1025    /// ## `hadjustment`
1026    /// the [`Adjustment`][crate::Adjustment] to use, or [`None`] to create a new one
1027    #[doc(alias = "gtk_scrolled_window_set_hadjustment")]
1028    #[doc(alias = "hadjustment")]
1029    pub fn set_hadjustment(&self, hadjustment: Option<&impl IsA<Adjustment>>) {
1030        unsafe {
1031            ffi::gtk_scrolled_window_set_hadjustment(
1032                self.to_glib_none().0,
1033                hadjustment.map(|p| p.as_ref()).to_glib_none().0,
1034            );
1035        }
1036    }
1037
1038    /// Changes the frame drawn around the contents of @self.
1039    /// ## `has_frame`
1040    /// whether to draw a frame around scrolled window contents
1041    #[doc(alias = "gtk_scrolled_window_set_has_frame")]
1042    #[doc(alias = "has-frame")]
1043    pub fn set_has_frame(&self, has_frame: bool) {
1044        unsafe {
1045            ffi::gtk_scrolled_window_set_has_frame(self.to_glib_none().0, has_frame.into_glib());
1046        }
1047    }
1048
1049    /// Turns kinetic scrolling on or off.
1050    ///
1051    /// Kinetic scrolling only applies to devices with source
1052    /// `GDK_SOURCE_TOUCHSCREEN`.
1053    /// ## `kinetic_scrolling`
1054    /// [`true`] to enable kinetic scrolling
1055    #[doc(alias = "gtk_scrolled_window_set_kinetic_scrolling")]
1056    #[doc(alias = "kinetic-scrolling")]
1057    pub fn set_kinetic_scrolling(&self, kinetic_scrolling: bool) {
1058        unsafe {
1059            ffi::gtk_scrolled_window_set_kinetic_scrolling(
1060                self.to_glib_none().0,
1061                kinetic_scrolling.into_glib(),
1062            );
1063        }
1064    }
1065
1066    /// Sets the maximum height that @self should keep visible.
1067    ///
1068    /// The @self will grow up to this height before it starts
1069    /// scrolling the content.
1070    ///
1071    /// It is a programming error to set the maximum content height to a value
1072    /// smaller than [`min-content-height`][struct@crate::ScrolledWindow#min-content-height].
1073    /// ## `height`
1074    /// the maximum content height
1075    #[doc(alias = "gtk_scrolled_window_set_max_content_height")]
1076    #[doc(alias = "max-content-height")]
1077    pub fn set_max_content_height(&self, height: i32) {
1078        unsafe {
1079            ffi::gtk_scrolled_window_set_max_content_height(self.to_glib_none().0, height);
1080        }
1081    }
1082
1083    /// Sets the maximum width that @self should keep visible.
1084    ///
1085    /// The @self will grow up to this width before it starts
1086    /// scrolling the content.
1087    ///
1088    /// It is a programming error to set the maximum content width to a
1089    /// value smaller than [`min-content-width`][struct@crate::ScrolledWindow#min-content-width].
1090    /// ## `width`
1091    /// the maximum content width
1092    #[doc(alias = "gtk_scrolled_window_set_max_content_width")]
1093    #[doc(alias = "max-content-width")]
1094    pub fn set_max_content_width(&self, width: i32) {
1095        unsafe {
1096            ffi::gtk_scrolled_window_set_max_content_width(self.to_glib_none().0, width);
1097        }
1098    }
1099
1100    /// Sets the minimum height that @self should keep visible.
1101    ///
1102    /// Note that this can and (usually will) be smaller than the minimum
1103    /// size of the content.
1104    ///
1105    /// It is a programming error to set the minimum content height to a
1106    /// value greater than [`max-content-height`][struct@crate::ScrolledWindow#max-content-height].
1107    /// ## `height`
1108    /// the minimal content height
1109    #[doc(alias = "gtk_scrolled_window_set_min_content_height")]
1110    #[doc(alias = "min-content-height")]
1111    pub fn set_min_content_height(&self, height: i32) {
1112        unsafe {
1113            ffi::gtk_scrolled_window_set_min_content_height(self.to_glib_none().0, height);
1114        }
1115    }
1116
1117    /// Sets the minimum width that @self should keep visible.
1118    ///
1119    /// Note that this can and (usually will) be smaller than the minimum
1120    /// size of the content.
1121    ///
1122    /// It is a programming error to set the minimum content width to a
1123    /// value greater than [`max-content-width`][struct@crate::ScrolledWindow#max-content-width].
1124    /// ## `width`
1125    /// the minimal content width
1126    #[doc(alias = "gtk_scrolled_window_set_min_content_width")]
1127    #[doc(alias = "min-content-width")]
1128    pub fn set_min_content_width(&self, width: i32) {
1129        unsafe {
1130            ffi::gtk_scrolled_window_set_min_content_width(self.to_glib_none().0, width);
1131        }
1132    }
1133
1134    /// Enables or disables overlay scrolling for this scrolled window.
1135    /// ## `overlay_scrolling`
1136    /// whether to enable overlay scrolling
1137    #[doc(alias = "gtk_scrolled_window_set_overlay_scrolling")]
1138    #[doc(alias = "overlay-scrolling")]
1139    pub fn set_overlay_scrolling(&self, overlay_scrolling: bool) {
1140        unsafe {
1141            ffi::gtk_scrolled_window_set_overlay_scrolling(
1142                self.to_glib_none().0,
1143                overlay_scrolling.into_glib(),
1144            );
1145        }
1146    }
1147
1148    /// Sets the placement of the contents with respect to the scrollbars
1149    /// for the scrolled window.
1150    ///
1151    /// The default is [`CornerType::TopLeft`][crate::CornerType::TopLeft], meaning the child is
1152    /// in the top left, with the scrollbars underneath and to the right.
1153    /// Other values in [`CornerType`][crate::CornerType] are [`CornerType::TopRight`][crate::CornerType::TopRight],
1154    /// [`CornerType::BottomLeft`][crate::CornerType::BottomLeft], and [`CornerType::BottomRight`][crate::CornerType::BottomRight].
1155    ///
1156    /// See also [`placement()`][Self::placement()] and
1157    /// [`unset_placement()`][Self::unset_placement()].
1158    /// ## `window_placement`
1159    /// position of the child window
1160    #[doc(alias = "gtk_scrolled_window_set_placement")]
1161    #[doc(alias = "window-placement")]
1162    pub fn set_placement(&self, window_placement: CornerType) {
1163        unsafe {
1164            ffi::gtk_scrolled_window_set_placement(
1165                self.to_glib_none().0,
1166                window_placement.into_glib(),
1167            );
1168        }
1169    }
1170
1171    /// Sets the scrollbar policy for the horizontal and vertical scrollbars.
1172    ///
1173    /// The policy determines when the scrollbar should appear; it is a value
1174    /// from the [`PolicyType`][crate::PolicyType] enumeration. If [`PolicyType::Always`][crate::PolicyType::Always], the
1175    /// scrollbar is always present; if [`PolicyType::Never`][crate::PolicyType::Never], the scrollbar is
1176    /// never present; if [`PolicyType::Automatic`][crate::PolicyType::Automatic], the scrollbar is present only
1177    /// if needed (that is, if the slider part of the bar would be smaller
1178    /// than the trough — the display is larger than the page size).
1179    /// ## `hscrollbar_policy`
1180    /// policy for horizontal bar
1181    /// ## `vscrollbar_policy`
1182    /// policy for vertical bar
1183    #[doc(alias = "gtk_scrolled_window_set_policy")]
1184    pub fn set_policy(&self, hscrollbar_policy: PolicyType, vscrollbar_policy: PolicyType) {
1185        unsafe {
1186            ffi::gtk_scrolled_window_set_policy(
1187                self.to_glib_none().0,
1188                hscrollbar_policy.into_glib(),
1189                vscrollbar_policy.into_glib(),
1190            );
1191        }
1192    }
1193
1194    /// Sets whether the natural height of the child should be calculated
1195    /// and propagated through the scrolled window’s requested natural height.
1196    /// ## `propagate`
1197    /// whether to propagate natural height
1198    #[doc(alias = "gtk_scrolled_window_set_propagate_natural_height")]
1199    #[doc(alias = "propagate-natural-height")]
1200    pub fn set_propagate_natural_height(&self, propagate: bool) {
1201        unsafe {
1202            ffi::gtk_scrolled_window_set_propagate_natural_height(
1203                self.to_glib_none().0,
1204                propagate.into_glib(),
1205            );
1206        }
1207    }
1208
1209    /// Sets whether the natural width of the child should be calculated
1210    /// and propagated through the scrolled window’s requested natural width.
1211    /// ## `propagate`
1212    /// whether to propagate natural width
1213    #[doc(alias = "gtk_scrolled_window_set_propagate_natural_width")]
1214    #[doc(alias = "propagate-natural-width")]
1215    pub fn set_propagate_natural_width(&self, propagate: bool) {
1216        unsafe {
1217            ffi::gtk_scrolled_window_set_propagate_natural_width(
1218                self.to_glib_none().0,
1219                propagate.into_glib(),
1220            );
1221        }
1222    }
1223
1224    /// Sets the [`Adjustment`][crate::Adjustment] for the vertical scrollbar.
1225    /// ## `vadjustment`
1226    /// the [`Adjustment`][crate::Adjustment] to use, or [`None`] to create a new one
1227    #[doc(alias = "gtk_scrolled_window_set_vadjustment")]
1228    #[doc(alias = "vadjustment")]
1229    pub fn set_vadjustment(&self, vadjustment: Option<&impl IsA<Adjustment>>) {
1230        unsafe {
1231            ffi::gtk_scrolled_window_set_vadjustment(
1232                self.to_glib_none().0,
1233                vadjustment.map(|p| p.as_ref()).to_glib_none().0,
1234            );
1235        }
1236    }
1237
1238    /// Unsets the placement of the contents with respect to the scrollbars.
1239    ///
1240    /// If no window placement is set for a scrolled window,
1241    /// it defaults to [`CornerType::TopLeft`][crate::CornerType::TopLeft].
1242    #[doc(alias = "gtk_scrolled_window_unset_placement")]
1243    pub fn unset_placement(&self) {
1244        unsafe {
1245            ffi::gtk_scrolled_window_unset_placement(self.to_glib_none().0);
1246        }
1247    }
1248
1249    /// When the horizontal scrollbar is displayed.
1250    ///
1251    /// Use [`set_policy()`][Self::set_policy()] to set
1252    /// this property.
1253    #[doc(alias = "hscrollbar-policy")]
1254    pub fn hscrollbar_policy(&self) -> PolicyType {
1255        ObjectExt::property(self, "hscrollbar-policy")
1256    }
1257
1258    /// When the horizontal scrollbar is displayed.
1259    ///
1260    /// Use [`set_policy()`][Self::set_policy()] to set
1261    /// this property.
1262    #[doc(alias = "hscrollbar-policy")]
1263    pub fn set_hscrollbar_policy(&self, hscrollbar_policy: PolicyType) {
1264        ObjectExt::set_property(self, "hscrollbar-policy", hscrollbar_policy)
1265    }
1266
1267    /// When the vertical scrollbar is displayed.
1268    ///
1269    /// Use [`set_policy()`][Self::set_policy()] to set
1270    /// this property.
1271    #[doc(alias = "vscrollbar-policy")]
1272    pub fn vscrollbar_policy(&self) -> PolicyType {
1273        ObjectExt::property(self, "vscrollbar-policy")
1274    }
1275
1276    /// When the vertical scrollbar is displayed.
1277    ///
1278    /// Use [`set_policy()`][Self::set_policy()] to set
1279    /// this property.
1280    #[doc(alias = "vscrollbar-policy")]
1281    pub fn set_vscrollbar_policy(&self, vscrollbar_policy: PolicyType) {
1282        ObjectExt::set_property(self, "vscrollbar-policy", vscrollbar_policy)
1283    }
1284
1285    /// Emitted whenever user initiated scrolling makes the scrolled
1286    /// window firmly surpass the limits defined by the adjustment
1287    /// in that orientation.
1288    ///
1289    /// A similar behavior without edge resistance is provided by the
1290    /// [`edge-reached`][struct@crate::ScrolledWindow#edge-reached] signal.
1291    ///
1292    /// Note: The @pos argument is LTR/RTL aware, so callers should be
1293    /// aware too if intending to provide behavior on horizontal edges.
1294    /// ## `pos`
1295    /// edge side that was hit
1296    #[doc(alias = "edge-overshot")]
1297    pub fn connect_edge_overshot<F: Fn(&Self, PositionType) + 'static>(
1298        &self,
1299        f: F,
1300    ) -> SignalHandlerId {
1301        unsafe extern "C" fn edge_overshot_trampoline<
1302            F: Fn(&ScrolledWindow, PositionType) + 'static,
1303        >(
1304            this: *mut ffi::GtkScrolledWindow,
1305            pos: ffi::GtkPositionType,
1306            f: glib::ffi::gpointer,
1307        ) {
1308            unsafe {
1309                let f: &F = &*(f as *const F);
1310                f(&from_glib_borrow(this), from_glib(pos))
1311            }
1312        }
1313        unsafe {
1314            let f: Box_<F> = Box_::new(f);
1315            connect_raw(
1316                self.as_ptr() as *mut _,
1317                c"edge-overshot".as_ptr(),
1318                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1319                    edge_overshot_trampoline::<F> as *const (),
1320                )),
1321                Box_::into_raw(f),
1322            )
1323        }
1324    }
1325
1326    /// Emitted whenever user-initiated scrolling makes the scrolled
1327    /// window exactly reach the lower or upper limits defined by the
1328    /// adjustment in that orientation.
1329    ///
1330    /// A similar behavior with edge resistance is provided by the
1331    /// [`edge-overshot`][struct@crate::ScrolledWindow#edge-overshot] signal.
1332    ///
1333    /// Note: The @pos argument is LTR/RTL aware, so callers should be
1334    /// aware too if intending to provide behavior on horizontal edges.
1335    /// ## `pos`
1336    /// edge side that was reached
1337    #[doc(alias = "edge-reached")]
1338    pub fn connect_edge_reached<F: Fn(&Self, PositionType) + 'static>(
1339        &self,
1340        f: F,
1341    ) -> SignalHandlerId {
1342        unsafe extern "C" fn edge_reached_trampoline<
1343            F: Fn(&ScrolledWindow, PositionType) + 'static,
1344        >(
1345            this: *mut ffi::GtkScrolledWindow,
1346            pos: ffi::GtkPositionType,
1347            f: glib::ffi::gpointer,
1348        ) {
1349            unsafe {
1350                let f: &F = &*(f as *const F);
1351                f(&from_glib_borrow(this), from_glib(pos))
1352            }
1353        }
1354        unsafe {
1355            let f: Box_<F> = Box_::new(f);
1356            connect_raw(
1357                self.as_ptr() as *mut _,
1358                c"edge-reached".as_ptr(),
1359                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1360                    edge_reached_trampoline::<F> as *const (),
1361                )),
1362                Box_::into_raw(f),
1363            )
1364        }
1365    }
1366
1367    /// Emitted when focus is moved away from the scrolled window by a
1368    /// keybinding.
1369    ///
1370    /// This is a [keybinding signal](class.SignalAction.html).
1371    ///
1372    /// The default bindings for this signal are
1373    /// <kbd>Ctrl</kbd>+<kbd>Tab</kbd> to move forward and
1374    /// <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Tab</kbd>` to move backward.
1375    /// ## `direction_type`
1376    /// either [`DirectionType::TabForward`][crate::DirectionType::TabForward] or
1377    ///   [`DirectionType::TabBackward`][crate::DirectionType::TabBackward]
1378    #[doc(alias = "move-focus-out")]
1379    pub fn connect_move_focus_out<F: Fn(&Self, DirectionType) + 'static>(
1380        &self,
1381        f: F,
1382    ) -> SignalHandlerId {
1383        unsafe extern "C" fn move_focus_out_trampoline<
1384            F: Fn(&ScrolledWindow, DirectionType) + 'static,
1385        >(
1386            this: *mut ffi::GtkScrolledWindow,
1387            direction_type: ffi::GtkDirectionType,
1388            f: glib::ffi::gpointer,
1389        ) {
1390            unsafe {
1391                let f: &F = &*(f as *const F);
1392                f(&from_glib_borrow(this), from_glib(direction_type))
1393            }
1394        }
1395        unsafe {
1396            let f: Box_<F> = Box_::new(f);
1397            connect_raw(
1398                self.as_ptr() as *mut _,
1399                c"move-focus-out".as_ptr(),
1400                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1401                    move_focus_out_trampoline::<F> as *const (),
1402                )),
1403                Box_::into_raw(f),
1404            )
1405        }
1406    }
1407
1408    pub fn emit_move_focus_out(&self, direction_type: DirectionType) {
1409        self.emit_by_name::<()>("move-focus-out", &[&direction_type]);
1410    }
1411
1412    /// Emitted when a keybinding that scrolls is pressed.
1413    ///
1414    /// This is a [keybinding signal](class.SignalAction.html).
1415    ///
1416    /// The horizontal or vertical adjustment is updated which triggers a
1417    /// signal that the scrolled window’s child may listen to and scroll itself.
1418    /// ## `scroll`
1419    /// a [`ScrollType`][crate::ScrollType] describing how much to scroll
1420    /// ## `horizontal`
1421    /// whether the keybinding scrolls the child
1422    ///   horizontally or not
1423    ///
1424    /// # Returns
1425    ///
1426    /// whether the scroll happened
1427    #[doc(alias = "scroll-child")]
1428    pub fn connect_scroll_child<F: Fn(&Self, ScrollType, bool) -> bool + 'static>(
1429        &self,
1430        f: F,
1431    ) -> SignalHandlerId {
1432        unsafe extern "C" fn scroll_child_trampoline<
1433            F: Fn(&ScrolledWindow, ScrollType, bool) -> bool + 'static,
1434        >(
1435            this: *mut ffi::GtkScrolledWindow,
1436            scroll: ffi::GtkScrollType,
1437            horizontal: glib::ffi::gboolean,
1438            f: glib::ffi::gpointer,
1439        ) -> glib::ffi::gboolean {
1440            unsafe {
1441                let f: &F = &*(f as *const F);
1442                f(
1443                    &from_glib_borrow(this),
1444                    from_glib(scroll),
1445                    from_glib(horizontal),
1446                )
1447                .into_glib()
1448            }
1449        }
1450        unsafe {
1451            let f: Box_<F> = Box_::new(f);
1452            connect_raw(
1453                self.as_ptr() as *mut _,
1454                c"scroll-child".as_ptr(),
1455                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1456                    scroll_child_trampoline::<F> as *const (),
1457                )),
1458                Box_::into_raw(f),
1459            )
1460        }
1461    }
1462
1463    pub fn emit_scroll_child(&self, scroll: ScrollType, horizontal: bool) -> bool {
1464        self.emit_by_name("scroll-child", &[&scroll, &horizontal])
1465    }
1466
1467    #[doc(alias = "child")]
1468    pub fn connect_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1469        unsafe extern "C" fn notify_child_trampoline<F: Fn(&ScrolledWindow) + 'static>(
1470            this: *mut ffi::GtkScrolledWindow,
1471            _param_spec: glib::ffi::gpointer,
1472            f: glib::ffi::gpointer,
1473        ) {
1474            unsafe {
1475                let f: &F = &*(f as *const F);
1476                f(&from_glib_borrow(this))
1477            }
1478        }
1479        unsafe {
1480            let f: Box_<F> = Box_::new(f);
1481            connect_raw(
1482                self.as_ptr() as *mut _,
1483                c"notify::child".as_ptr(),
1484                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1485                    notify_child_trampoline::<F> as *const (),
1486                )),
1487                Box_::into_raw(f),
1488            )
1489        }
1490    }
1491
1492    #[doc(alias = "hadjustment")]
1493    pub fn connect_hadjustment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1494        unsafe extern "C" fn notify_hadjustment_trampoline<F: Fn(&ScrolledWindow) + 'static>(
1495            this: *mut ffi::GtkScrolledWindow,
1496            _param_spec: glib::ffi::gpointer,
1497            f: glib::ffi::gpointer,
1498        ) {
1499            unsafe {
1500                let f: &F = &*(f as *const F);
1501                f(&from_glib_borrow(this))
1502            }
1503        }
1504        unsafe {
1505            let f: Box_<F> = Box_::new(f);
1506            connect_raw(
1507                self.as_ptr() as *mut _,
1508                c"notify::hadjustment".as_ptr(),
1509                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1510                    notify_hadjustment_trampoline::<F> as *const (),
1511                )),
1512                Box_::into_raw(f),
1513            )
1514        }
1515    }
1516
1517    #[doc(alias = "has-frame")]
1518    pub fn connect_has_frame_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1519        unsafe extern "C" fn notify_has_frame_trampoline<F: Fn(&ScrolledWindow) + 'static>(
1520            this: *mut ffi::GtkScrolledWindow,
1521            _param_spec: glib::ffi::gpointer,
1522            f: glib::ffi::gpointer,
1523        ) {
1524            unsafe {
1525                let f: &F = &*(f as *const F);
1526                f(&from_glib_borrow(this))
1527            }
1528        }
1529        unsafe {
1530            let f: Box_<F> = Box_::new(f);
1531            connect_raw(
1532                self.as_ptr() as *mut _,
1533                c"notify::has-frame".as_ptr(),
1534                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1535                    notify_has_frame_trampoline::<F> as *const (),
1536                )),
1537                Box_::into_raw(f),
1538            )
1539        }
1540    }
1541
1542    #[doc(alias = "hscrollbar-policy")]
1543    pub fn connect_hscrollbar_policy_notify<F: Fn(&Self) + 'static>(
1544        &self,
1545        f: F,
1546    ) -> SignalHandlerId {
1547        unsafe extern "C" fn notify_hscrollbar_policy_trampoline<
1548            F: Fn(&ScrolledWindow) + 'static,
1549        >(
1550            this: *mut ffi::GtkScrolledWindow,
1551            _param_spec: glib::ffi::gpointer,
1552            f: glib::ffi::gpointer,
1553        ) {
1554            unsafe {
1555                let f: &F = &*(f as *const F);
1556                f(&from_glib_borrow(this))
1557            }
1558        }
1559        unsafe {
1560            let f: Box_<F> = Box_::new(f);
1561            connect_raw(
1562                self.as_ptr() as *mut _,
1563                c"notify::hscrollbar-policy".as_ptr(),
1564                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1565                    notify_hscrollbar_policy_trampoline::<F> as *const (),
1566                )),
1567                Box_::into_raw(f),
1568            )
1569        }
1570    }
1571
1572    #[doc(alias = "kinetic-scrolling")]
1573    pub fn connect_kinetic_scrolling_notify<F: Fn(&Self) + 'static>(
1574        &self,
1575        f: F,
1576    ) -> SignalHandlerId {
1577        unsafe extern "C" fn notify_kinetic_scrolling_trampoline<
1578            F: Fn(&ScrolledWindow) + 'static,
1579        >(
1580            this: *mut ffi::GtkScrolledWindow,
1581            _param_spec: glib::ffi::gpointer,
1582            f: glib::ffi::gpointer,
1583        ) {
1584            unsafe {
1585                let f: &F = &*(f as *const F);
1586                f(&from_glib_borrow(this))
1587            }
1588        }
1589        unsafe {
1590            let f: Box_<F> = Box_::new(f);
1591            connect_raw(
1592                self.as_ptr() as *mut _,
1593                c"notify::kinetic-scrolling".as_ptr(),
1594                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1595                    notify_kinetic_scrolling_trampoline::<F> as *const (),
1596                )),
1597                Box_::into_raw(f),
1598            )
1599        }
1600    }
1601
1602    #[doc(alias = "max-content-height")]
1603    pub fn connect_max_content_height_notify<F: Fn(&Self) + 'static>(
1604        &self,
1605        f: F,
1606    ) -> SignalHandlerId {
1607        unsafe extern "C" fn notify_max_content_height_trampoline<
1608            F: Fn(&ScrolledWindow) + 'static,
1609        >(
1610            this: *mut ffi::GtkScrolledWindow,
1611            _param_spec: glib::ffi::gpointer,
1612            f: glib::ffi::gpointer,
1613        ) {
1614            unsafe {
1615                let f: &F = &*(f as *const F);
1616                f(&from_glib_borrow(this))
1617            }
1618        }
1619        unsafe {
1620            let f: Box_<F> = Box_::new(f);
1621            connect_raw(
1622                self.as_ptr() as *mut _,
1623                c"notify::max-content-height".as_ptr(),
1624                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1625                    notify_max_content_height_trampoline::<F> as *const (),
1626                )),
1627                Box_::into_raw(f),
1628            )
1629        }
1630    }
1631
1632    #[doc(alias = "max-content-width")]
1633    pub fn connect_max_content_width_notify<F: Fn(&Self) + 'static>(
1634        &self,
1635        f: F,
1636    ) -> SignalHandlerId {
1637        unsafe extern "C" fn notify_max_content_width_trampoline<
1638            F: Fn(&ScrolledWindow) + 'static,
1639        >(
1640            this: *mut ffi::GtkScrolledWindow,
1641            _param_spec: glib::ffi::gpointer,
1642            f: glib::ffi::gpointer,
1643        ) {
1644            unsafe {
1645                let f: &F = &*(f as *const F);
1646                f(&from_glib_borrow(this))
1647            }
1648        }
1649        unsafe {
1650            let f: Box_<F> = Box_::new(f);
1651            connect_raw(
1652                self.as_ptr() as *mut _,
1653                c"notify::max-content-width".as_ptr(),
1654                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1655                    notify_max_content_width_trampoline::<F> as *const (),
1656                )),
1657                Box_::into_raw(f),
1658            )
1659        }
1660    }
1661
1662    #[doc(alias = "min-content-height")]
1663    pub fn connect_min_content_height_notify<F: Fn(&Self) + 'static>(
1664        &self,
1665        f: F,
1666    ) -> SignalHandlerId {
1667        unsafe extern "C" fn notify_min_content_height_trampoline<
1668            F: Fn(&ScrolledWindow) + 'static,
1669        >(
1670            this: *mut ffi::GtkScrolledWindow,
1671            _param_spec: glib::ffi::gpointer,
1672            f: glib::ffi::gpointer,
1673        ) {
1674            unsafe {
1675                let f: &F = &*(f as *const F);
1676                f(&from_glib_borrow(this))
1677            }
1678        }
1679        unsafe {
1680            let f: Box_<F> = Box_::new(f);
1681            connect_raw(
1682                self.as_ptr() as *mut _,
1683                c"notify::min-content-height".as_ptr(),
1684                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1685                    notify_min_content_height_trampoline::<F> as *const (),
1686                )),
1687                Box_::into_raw(f),
1688            )
1689        }
1690    }
1691
1692    #[doc(alias = "min-content-width")]
1693    pub fn connect_min_content_width_notify<F: Fn(&Self) + 'static>(
1694        &self,
1695        f: F,
1696    ) -> SignalHandlerId {
1697        unsafe extern "C" fn notify_min_content_width_trampoline<
1698            F: Fn(&ScrolledWindow) + 'static,
1699        >(
1700            this: *mut ffi::GtkScrolledWindow,
1701            _param_spec: glib::ffi::gpointer,
1702            f: glib::ffi::gpointer,
1703        ) {
1704            unsafe {
1705                let f: &F = &*(f as *const F);
1706                f(&from_glib_borrow(this))
1707            }
1708        }
1709        unsafe {
1710            let f: Box_<F> = Box_::new(f);
1711            connect_raw(
1712                self.as_ptr() as *mut _,
1713                c"notify::min-content-width".as_ptr(),
1714                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1715                    notify_min_content_width_trampoline::<F> as *const (),
1716                )),
1717                Box_::into_raw(f),
1718            )
1719        }
1720    }
1721
1722    #[doc(alias = "overlay-scrolling")]
1723    pub fn connect_overlay_scrolling_notify<F: Fn(&Self) + 'static>(
1724        &self,
1725        f: F,
1726    ) -> SignalHandlerId {
1727        unsafe extern "C" fn notify_overlay_scrolling_trampoline<
1728            F: Fn(&ScrolledWindow) + 'static,
1729        >(
1730            this: *mut ffi::GtkScrolledWindow,
1731            _param_spec: glib::ffi::gpointer,
1732            f: glib::ffi::gpointer,
1733        ) {
1734            unsafe {
1735                let f: &F = &*(f as *const F);
1736                f(&from_glib_borrow(this))
1737            }
1738        }
1739        unsafe {
1740            let f: Box_<F> = Box_::new(f);
1741            connect_raw(
1742                self.as_ptr() as *mut _,
1743                c"notify::overlay-scrolling".as_ptr(),
1744                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1745                    notify_overlay_scrolling_trampoline::<F> as *const (),
1746                )),
1747                Box_::into_raw(f),
1748            )
1749        }
1750    }
1751
1752    #[doc(alias = "propagate-natural-height")]
1753    pub fn connect_propagate_natural_height_notify<F: Fn(&Self) + 'static>(
1754        &self,
1755        f: F,
1756    ) -> SignalHandlerId {
1757        unsafe extern "C" fn notify_propagate_natural_height_trampoline<
1758            F: Fn(&ScrolledWindow) + 'static,
1759        >(
1760            this: *mut ffi::GtkScrolledWindow,
1761            _param_spec: glib::ffi::gpointer,
1762            f: glib::ffi::gpointer,
1763        ) {
1764            unsafe {
1765                let f: &F = &*(f as *const F);
1766                f(&from_glib_borrow(this))
1767            }
1768        }
1769        unsafe {
1770            let f: Box_<F> = Box_::new(f);
1771            connect_raw(
1772                self.as_ptr() as *mut _,
1773                c"notify::propagate-natural-height".as_ptr(),
1774                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1775                    notify_propagate_natural_height_trampoline::<F> as *const (),
1776                )),
1777                Box_::into_raw(f),
1778            )
1779        }
1780    }
1781
1782    #[doc(alias = "propagate-natural-width")]
1783    pub fn connect_propagate_natural_width_notify<F: Fn(&Self) + 'static>(
1784        &self,
1785        f: F,
1786    ) -> SignalHandlerId {
1787        unsafe extern "C" fn notify_propagate_natural_width_trampoline<
1788            F: Fn(&ScrolledWindow) + 'static,
1789        >(
1790            this: *mut ffi::GtkScrolledWindow,
1791            _param_spec: glib::ffi::gpointer,
1792            f: glib::ffi::gpointer,
1793        ) {
1794            unsafe {
1795                let f: &F = &*(f as *const F);
1796                f(&from_glib_borrow(this))
1797            }
1798        }
1799        unsafe {
1800            let f: Box_<F> = Box_::new(f);
1801            connect_raw(
1802                self.as_ptr() as *mut _,
1803                c"notify::propagate-natural-width".as_ptr(),
1804                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1805                    notify_propagate_natural_width_trampoline::<F> as *const (),
1806                )),
1807                Box_::into_raw(f),
1808            )
1809        }
1810    }
1811
1812    #[doc(alias = "vadjustment")]
1813    pub fn connect_vadjustment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1814        unsafe extern "C" fn notify_vadjustment_trampoline<F: Fn(&ScrolledWindow) + 'static>(
1815            this: *mut ffi::GtkScrolledWindow,
1816            _param_spec: glib::ffi::gpointer,
1817            f: glib::ffi::gpointer,
1818        ) {
1819            unsafe {
1820                let f: &F = &*(f as *const F);
1821                f(&from_glib_borrow(this))
1822            }
1823        }
1824        unsafe {
1825            let f: Box_<F> = Box_::new(f);
1826            connect_raw(
1827                self.as_ptr() as *mut _,
1828                c"notify::vadjustment".as_ptr(),
1829                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1830                    notify_vadjustment_trampoline::<F> as *const (),
1831                )),
1832                Box_::into_raw(f),
1833            )
1834        }
1835    }
1836
1837    #[doc(alias = "vscrollbar-policy")]
1838    pub fn connect_vscrollbar_policy_notify<F: Fn(&Self) + 'static>(
1839        &self,
1840        f: F,
1841    ) -> SignalHandlerId {
1842        unsafe extern "C" fn notify_vscrollbar_policy_trampoline<
1843            F: Fn(&ScrolledWindow) + 'static,
1844        >(
1845            this: *mut ffi::GtkScrolledWindow,
1846            _param_spec: glib::ffi::gpointer,
1847            f: glib::ffi::gpointer,
1848        ) {
1849            unsafe {
1850                let f: &F = &*(f as *const F);
1851                f(&from_glib_borrow(this))
1852            }
1853        }
1854        unsafe {
1855            let f: Box_<F> = Box_::new(f);
1856            connect_raw(
1857                self.as_ptr() as *mut _,
1858                c"notify::vscrollbar-policy".as_ptr(),
1859                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1860                    notify_vscrollbar_policy_trampoline::<F> as *const (),
1861                )),
1862                Box_::into_raw(f),
1863            )
1864        }
1865    }
1866
1867    #[doc(alias = "window-placement")]
1868    pub fn connect_window_placement_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1869        unsafe extern "C" fn notify_window_placement_trampoline<
1870            F: Fn(&ScrolledWindow) + 'static,
1871        >(
1872            this: *mut ffi::GtkScrolledWindow,
1873            _param_spec: glib::ffi::gpointer,
1874            f: glib::ffi::gpointer,
1875        ) {
1876            unsafe {
1877                let f: &F = &*(f as *const F);
1878                f(&from_glib_borrow(this))
1879            }
1880        }
1881        unsafe {
1882            let f: Box_<F> = Box_::new(f);
1883            connect_raw(
1884                self.as_ptr() as *mut _,
1885                c"notify::window-placement".as_ptr(),
1886                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1887                    notify_window_placement_trampoline::<F> as *const (),
1888                )),
1889                Box_::into_raw(f),
1890            )
1891        }
1892    }
1893}
1894
1895impl Default for ScrolledWindow {
1896    fn default() -> Self {
1897        Self::new()
1898    }
1899}
1900
1901// rustdoc-stripper-ignore-next
1902/// A [builder-pattern] type to construct [`ScrolledWindow`] objects.
1903///
1904/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1905#[must_use = "The builder must be built to be used"]
1906pub struct ScrolledWindowBuilder {
1907    builder: glib::object::ObjectBuilder<'static, ScrolledWindow>,
1908}
1909
1910impl ScrolledWindowBuilder {
1911    fn new() -> Self {
1912        Self {
1913            builder: glib::object::Object::builder(),
1914        }
1915    }
1916
1917    /// The child widget.
1918    ///
1919    /// When setting this property, if the child widget does not implement
1920    /// [`Scrollable`][crate::Scrollable], the scrolled window will add the child to
1921    /// a [`Viewport`][crate::Viewport] and then set the viewport as the child.
1922    pub fn child(self, child: &impl IsA<Widget>) -> Self {
1923        Self {
1924            builder: self.builder.property("child", child.clone().upcast()),
1925        }
1926    }
1927
1928    /// The [`Adjustment`][crate::Adjustment] for the horizontal position.
1929    pub fn hadjustment(self, hadjustment: &impl IsA<Adjustment>) -> Self {
1930        Self {
1931            builder: self
1932                .builder
1933                .property("hadjustment", hadjustment.clone().upcast()),
1934        }
1935    }
1936
1937    /// Whether to draw a frame around the contents.
1938    pub fn has_frame(self, has_frame: bool) -> Self {
1939        Self {
1940            builder: self.builder.property("has-frame", has_frame),
1941        }
1942    }
1943
1944    /// When the horizontal scrollbar is displayed.
1945    ///
1946    /// Use [`ScrolledWindow::set_policy()`][crate::ScrolledWindow::set_policy()] to set
1947    /// this property.
1948    pub fn hscrollbar_policy(self, hscrollbar_policy: PolicyType) -> Self {
1949        Self {
1950            builder: self
1951                .builder
1952                .property("hscrollbar-policy", hscrollbar_policy),
1953        }
1954    }
1955
1956    /// Whether kinetic scrolling is enabled or not.
1957    ///
1958    /// Kinetic scrolling only applies to devices with source `GDK_SOURCE_TOUCHSCREEN`.
1959    pub fn kinetic_scrolling(self, kinetic_scrolling: bool) -> Self {
1960        Self {
1961            builder: self
1962                .builder
1963                .property("kinetic-scrolling", kinetic_scrolling),
1964        }
1965    }
1966
1967    /// The maximum content height of @scrolled_window.
1968    pub fn max_content_height(self, max_content_height: i32) -> Self {
1969        Self {
1970            builder: self
1971                .builder
1972                .property("max-content-height", max_content_height),
1973        }
1974    }
1975
1976    /// The maximum content width of @scrolled_window.
1977    pub fn max_content_width(self, max_content_width: i32) -> Self {
1978        Self {
1979            builder: self
1980                .builder
1981                .property("max-content-width", max_content_width),
1982        }
1983    }
1984
1985    /// The minimum content height of @scrolled_window.
1986    pub fn min_content_height(self, min_content_height: i32) -> Self {
1987        Self {
1988            builder: self
1989                .builder
1990                .property("min-content-height", min_content_height),
1991        }
1992    }
1993
1994    /// The minimum content width of @scrolled_window.
1995    pub fn min_content_width(self, min_content_width: i32) -> Self {
1996        Self {
1997            builder: self
1998                .builder
1999                .property("min-content-width", min_content_width),
2000        }
2001    }
2002
2003    /// Whether overlay scrolling is enabled or not.
2004    ///
2005    /// If it is, the scrollbars are only added as traditional widgets
2006    /// when a mouse is present. Otherwise, they are overlaid on top of
2007    /// the content, as narrow indicators.
2008    ///
2009    /// Note that overlay scrolling can also be globally disabled, with
2010    /// the [`gtk-overlay-scrolling`][struct@crate::Settings#gtk-overlay-scrolling] setting.
2011    pub fn overlay_scrolling(self, overlay_scrolling: bool) -> Self {
2012        Self {
2013            builder: self
2014                .builder
2015                .property("overlay-scrolling", overlay_scrolling),
2016        }
2017    }
2018
2019    /// Whether the natural height of the child should be calculated and propagated
2020    /// through the scrolled window’s requested natural height.
2021    ///
2022    /// This is useful in cases where an attempt should be made to allocate exactly
2023    /// enough space for the natural size of the child.
2024    pub fn propagate_natural_height(self, propagate_natural_height: bool) -> Self {
2025        Self {
2026            builder: self
2027                .builder
2028                .property("propagate-natural-height", propagate_natural_height),
2029        }
2030    }
2031
2032    /// Whether the natural width of the child should be calculated and propagated
2033    /// through the scrolled window’s requested natural width.
2034    ///
2035    /// This is useful in cases where an attempt should be made to allocate exactly
2036    /// enough space for the natural size of the child.
2037    pub fn propagate_natural_width(self, propagate_natural_width: bool) -> Self {
2038        Self {
2039            builder: self
2040                .builder
2041                .property("propagate-natural-width", propagate_natural_width),
2042        }
2043    }
2044
2045    /// The [`Adjustment`][crate::Adjustment] for the vertical position.
2046    pub fn vadjustment(self, vadjustment: &impl IsA<Adjustment>) -> Self {
2047        Self {
2048            builder: self
2049                .builder
2050                .property("vadjustment", vadjustment.clone().upcast()),
2051        }
2052    }
2053
2054    /// When the vertical scrollbar is displayed.
2055    ///
2056    /// Use [`ScrolledWindow::set_policy()`][crate::ScrolledWindow::set_policy()] to set
2057    /// this property.
2058    pub fn vscrollbar_policy(self, vscrollbar_policy: PolicyType) -> Self {
2059        Self {
2060            builder: self
2061                .builder
2062                .property("vscrollbar-policy", vscrollbar_policy),
2063        }
2064    }
2065
2066    /// Where the contents are located with respect to the scrollbars.
2067    pub fn window_placement(self, window_placement: CornerType) -> Self {
2068        Self {
2069            builder: self.builder.property("window-placement", window_placement),
2070        }
2071    }
2072
2073    /// Whether the widget or any of its descendents can accept
2074    /// the input focus.
2075    ///
2076    /// This property is meant to be set by widget implementations,
2077    /// typically in their instance init function.
2078    pub fn can_focus(self, can_focus: bool) -> Self {
2079        Self {
2080            builder: self.builder.property("can-focus", can_focus),
2081        }
2082    }
2083
2084    /// Whether the widget can receive pointer events.
2085    pub fn can_target(self, can_target: bool) -> Self {
2086        Self {
2087            builder: self.builder.property("can-target", can_target),
2088        }
2089    }
2090
2091    /// A list of css classes applied to this widget.
2092    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
2093        Self {
2094            builder: self.builder.property("css-classes", css_classes.into()),
2095        }
2096    }
2097
2098    /// The name of this widget in the CSS tree.
2099    ///
2100    /// This property is meant to be set by widget implementations,
2101    /// typically in their instance init function.
2102    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
2103        Self {
2104            builder: self.builder.property("css-name", css_name.into()),
2105        }
2106    }
2107
2108    /// The cursor used by @widget.
2109    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
2110        Self {
2111            builder: self.builder.property("cursor", cursor.clone()),
2112        }
2113    }
2114
2115    /// Whether the widget should grab focus when it is clicked with the mouse.
2116    ///
2117    /// This property is only relevant for widgets that can take focus.
2118    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
2119        Self {
2120            builder: self.builder.property("focus-on-click", focus_on_click),
2121        }
2122    }
2123
2124    /// Whether this widget itself will accept the input focus.
2125    pub fn focusable(self, focusable: bool) -> Self {
2126        Self {
2127            builder: self.builder.property("focusable", focusable),
2128        }
2129    }
2130
2131    /// How to distribute horizontal space if widget gets extra space.
2132    pub fn halign(self, halign: Align) -> Self {
2133        Self {
2134            builder: self.builder.property("halign", halign),
2135        }
2136    }
2137
2138    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
2139    /// signal on @widget.
2140    ///
2141    /// A true value indicates that @widget can have a tooltip, in this case
2142    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
2143    /// determine whether it will provide a tooltip or not.
2144    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
2145        Self {
2146            builder: self.builder.property("has-tooltip", has_tooltip),
2147        }
2148    }
2149
2150    /// Overrides for height request of the widget.
2151    ///
2152    /// If this is -1, the natural request will be used.
2153    pub fn height_request(self, height_request: i32) -> Self {
2154        Self {
2155            builder: self.builder.property("height-request", height_request),
2156        }
2157    }
2158
2159    /// Whether to expand horizontally.
2160    pub fn hexpand(self, hexpand: bool) -> Self {
2161        Self {
2162            builder: self.builder.property("hexpand", hexpand),
2163        }
2164    }
2165
2166    /// Whether to use the `hexpand` property.
2167    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
2168        Self {
2169            builder: self.builder.property("hexpand-set", hexpand_set),
2170        }
2171    }
2172
2173    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
2174    /// the preferred size of the widget, and allocate its children.
2175    ///
2176    /// This property is meant to be set by widget implementations,
2177    /// typically in their instance init function.
2178    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
2179        Self {
2180            builder: self
2181                .builder
2182                .property("layout-manager", layout_manager.clone().upcast()),
2183        }
2184    }
2185
2186    /// Makes this widget act like a modal dialog, with respect to
2187    /// event delivery.
2188    ///
2189    /// Global event controllers will not handle events with targets
2190    /// inside the widget, unless they are set up to ignore propagation
2191    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
2192    #[cfg(feature = "v4_18")]
2193    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
2194    pub fn limit_events(self, limit_events: bool) -> Self {
2195        Self {
2196            builder: self.builder.property("limit-events", limit_events),
2197        }
2198    }
2199
2200    /// Margin on bottom side of widget.
2201    ///
2202    /// This property adds margin outside of the widget's normal size
2203    /// request, the margin will be added in addition to the size from
2204    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2205    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
2206        Self {
2207            builder: self.builder.property("margin-bottom", margin_bottom),
2208        }
2209    }
2210
2211    /// Margin on end of widget, horizontally.
2212    ///
2213    /// This property supports left-to-right and right-to-left text
2214    /// directions.
2215    ///
2216    /// This property adds margin outside of the widget's normal size
2217    /// request, the margin will be added in addition to the size from
2218    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2219    pub fn margin_end(self, margin_end: i32) -> Self {
2220        Self {
2221            builder: self.builder.property("margin-end", margin_end),
2222        }
2223    }
2224
2225    /// Margin on start of widget, horizontally.
2226    ///
2227    /// This property supports left-to-right and right-to-left text
2228    /// directions.
2229    ///
2230    /// This property adds margin outside of the widget's normal size
2231    /// request, the margin will be added in addition to the size from
2232    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2233    pub fn margin_start(self, margin_start: i32) -> Self {
2234        Self {
2235            builder: self.builder.property("margin-start", margin_start),
2236        }
2237    }
2238
2239    /// Margin on top side of widget.
2240    ///
2241    /// This property adds margin outside of the widget's normal size
2242    /// request, the margin will be added in addition to the size from
2243    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2244    pub fn margin_top(self, margin_top: i32) -> Self {
2245        Self {
2246            builder: self.builder.property("margin-top", margin_top),
2247        }
2248    }
2249
2250    /// The name of the widget.
2251    pub fn name(self, name: impl Into<glib::GString>) -> Self {
2252        Self {
2253            builder: self.builder.property("name", name.into()),
2254        }
2255    }
2256
2257    /// The requested opacity of the widget.
2258    pub fn opacity(self, opacity: f64) -> Self {
2259        Self {
2260            builder: self.builder.property("opacity", opacity),
2261        }
2262    }
2263
2264    /// How content outside the widget's content area is treated.
2265    ///
2266    /// This property is meant to be set by widget implementations,
2267    /// typically in their instance init function.
2268    pub fn overflow(self, overflow: Overflow) -> Self {
2269        Self {
2270            builder: self.builder.property("overflow", overflow),
2271        }
2272    }
2273
2274    /// Whether the widget will receive the default action when it is focused.
2275    pub fn receives_default(self, receives_default: bool) -> Self {
2276        Self {
2277            builder: self.builder.property("receives-default", receives_default),
2278        }
2279    }
2280
2281    /// Whether the widget responds to input.
2282    pub fn sensitive(self, sensitive: bool) -> Self {
2283        Self {
2284            builder: self.builder.property("sensitive", sensitive),
2285        }
2286    }
2287
2288    /// Sets the text of tooltip to be the given string, which is marked up
2289    /// with Pango markup.
2290    ///
2291    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
2292    ///
2293    /// This is a convenience property which will take care of getting the
2294    /// tooltip shown if the given string is not `NULL`:
2295    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
2296    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
2297    /// the default signal handler.
2298    ///
2299    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
2300    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
2301    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
2302        Self {
2303            builder: self
2304                .builder
2305                .property("tooltip-markup", tooltip_markup.into()),
2306        }
2307    }
2308
2309    /// Sets the text of tooltip to be the given string.
2310    ///
2311    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
2312    ///
2313    /// This is a convenience property which will take care of getting the
2314    /// tooltip shown if the given string is not `NULL`:
2315    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
2316    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
2317    /// the default signal handler.
2318    ///
2319    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
2320    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
2321    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
2322        Self {
2323            builder: self.builder.property("tooltip-text", tooltip_text.into()),
2324        }
2325    }
2326
2327    /// How to distribute vertical space if widget gets extra space.
2328    pub fn valign(self, valign: Align) -> Self {
2329        Self {
2330            builder: self.builder.property("valign", valign),
2331        }
2332    }
2333
2334    /// Whether to expand vertically.
2335    pub fn vexpand(self, vexpand: bool) -> Self {
2336        Self {
2337            builder: self.builder.property("vexpand", vexpand),
2338        }
2339    }
2340
2341    /// Whether to use the `vexpand` property.
2342    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
2343        Self {
2344            builder: self.builder.property("vexpand-set", vexpand_set),
2345        }
2346    }
2347
2348    /// Whether the widget is visible.
2349    pub fn visible(self, visible: bool) -> Self {
2350        Self {
2351            builder: self.builder.property("visible", visible),
2352        }
2353    }
2354
2355    /// Overrides for width request of the widget.
2356    ///
2357    /// If this is -1, the natural request will be used.
2358    pub fn width_request(self, width_request: i32) -> Self {
2359        Self {
2360            builder: self.builder.property("width-request", width_request),
2361        }
2362    }
2363
2364    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
2365    ///
2366    /// The accessible role cannot be changed once set.
2367    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
2368        Self {
2369            builder: self.builder.property("accessible-role", accessible_role),
2370        }
2371    }
2372
2373    // rustdoc-stripper-ignore-next
2374    /// Build the [`ScrolledWindow`].
2375    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
2376    pub fn build(self) -> ScrolledWindow {
2377        assert_initialized_main_thread!();
2378        self.builder.build()
2379    }
2380}