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