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