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
5use crate::{
6    Accessible, AccessibleRole, Adjustment, Align, Buildable, ConstraintTarget, CornerType,
7    DirectionType, LayoutManager, Overflow, PolicyType, PositionType, ScrollType, Widget, ffi,
8};
9use glib::{
10    object::ObjectType as _,
11    prelude::*,
12    signal::{SignalHandlerId, connect_raw},
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            unsafe {
1294                let f: &F = &*(f as *const F);
1295                f(&from_glib_borrow(this), from_glib(pos))
1296            }
1297        }
1298        unsafe {
1299            let f: Box_<F> = Box_::new(f);
1300            connect_raw(
1301                self.as_ptr() as *mut _,
1302                c"edge-overshot".as_ptr() as *const _,
1303                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1304                    edge_overshot_trampoline::<F> as *const (),
1305                )),
1306                Box_::into_raw(f),
1307            )
1308        }
1309    }
1310
1311    /// Emitted whenever user-initiated scrolling makes the scrolled
1312    /// window exactly reach the lower or upper limits defined by the
1313    /// adjustment in that orientation.
1314    ///
1315    /// A similar behavior with edge resistance is provided by the
1316    /// [`edge-overshot`][struct@crate::ScrolledWindow#edge-overshot] signal.
1317    ///
1318    /// Note: The @pos argument is LTR/RTL aware, so callers should be
1319    /// aware too if intending to provide behavior on horizontal edges.
1320    /// ## `pos`
1321    /// edge side that was reached
1322    #[doc(alias = "edge-reached")]
1323    pub fn connect_edge_reached<F: Fn(&Self, PositionType) + 'static>(
1324        &self,
1325        f: F,
1326    ) -> SignalHandlerId {
1327        unsafe extern "C" fn edge_reached_trampoline<
1328            F: Fn(&ScrolledWindow, PositionType) + 'static,
1329        >(
1330            this: *mut ffi::GtkScrolledWindow,
1331            pos: ffi::GtkPositionType,
1332            f: glib::ffi::gpointer,
1333        ) {
1334            unsafe {
1335                let f: &F = &*(f as *const F);
1336                f(&from_glib_borrow(this), from_glib(pos))
1337            }
1338        }
1339        unsafe {
1340            let f: Box_<F> = Box_::new(f);
1341            connect_raw(
1342                self.as_ptr() as *mut _,
1343                c"edge-reached".as_ptr() as *const _,
1344                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1345                    edge_reached_trampoline::<F> as *const (),
1346                )),
1347                Box_::into_raw(f),
1348            )
1349        }
1350    }
1351
1352    /// Emitted when focus is moved away from the scrolled window by a
1353    /// keybinding.
1354    ///
1355    /// This is a [keybinding signal](class.SignalAction.html).
1356    ///
1357    /// The default bindings for this signal are
1358    /// <kbd>Ctrl</kbd>+<kbd>Tab</kbd> to move forward and
1359    /// <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>Tab</kbd>` to move backward.
1360    /// ## `direction_type`
1361    /// either [`DirectionType::TabForward`][crate::DirectionType::TabForward] or
1362    ///   [`DirectionType::TabBackward`][crate::DirectionType::TabBackward]
1363    #[doc(alias = "move-focus-out")]
1364    pub fn connect_move_focus_out<F: Fn(&Self, DirectionType) + 'static>(
1365        &self,
1366        f: F,
1367    ) -> SignalHandlerId {
1368        unsafe extern "C" fn move_focus_out_trampoline<
1369            F: Fn(&ScrolledWindow, DirectionType) + 'static,
1370        >(
1371            this: *mut ffi::GtkScrolledWindow,
1372            direction_type: ffi::GtkDirectionType,
1373            f: glib::ffi::gpointer,
1374        ) {
1375            unsafe {
1376                let f: &F = &*(f as *const F);
1377                f(&from_glib_borrow(this), from_glib(direction_type))
1378            }
1379        }
1380        unsafe {
1381            let f: Box_<F> = Box_::new(f);
1382            connect_raw(
1383                self.as_ptr() as *mut _,
1384                c"move-focus-out".as_ptr() as *const _,
1385                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1386                    move_focus_out_trampoline::<F> as *const (),
1387                )),
1388                Box_::into_raw(f),
1389            )
1390        }
1391    }
1392
1393    pub fn emit_move_focus_out(&self, direction_type: DirectionType) {
1394        self.emit_by_name::<()>("move-focus-out", &[&direction_type]);
1395    }
1396
1397    /// Emitted when a keybinding that scrolls is pressed.
1398    ///
1399    /// This is a [keybinding signal](class.SignalAction.html).
1400    ///
1401    /// The horizontal or vertical adjustment is updated which triggers a
1402    /// signal that the scrolled window’s child may listen to and scroll itself.
1403    /// ## `scroll`
1404    /// a [`ScrollType`][crate::ScrollType] describing how much to scroll
1405    /// ## `horizontal`
1406    /// whether the keybinding scrolls the child
1407    ///   horizontally or not
1408    ///
1409    /// # Returns
1410    ///
1411    /// whether the scroll happened
1412    #[doc(alias = "scroll-child")]
1413    pub fn connect_scroll_child<F: Fn(&Self, ScrollType, bool) -> bool + 'static>(
1414        &self,
1415        f: F,
1416    ) -> SignalHandlerId {
1417        unsafe extern "C" fn scroll_child_trampoline<
1418            F: Fn(&ScrolledWindow, ScrollType, bool) -> bool + 'static,
1419        >(
1420            this: *mut ffi::GtkScrolledWindow,
1421            scroll: ffi::GtkScrollType,
1422            horizontal: glib::ffi::gboolean,
1423            f: glib::ffi::gpointer,
1424        ) -> glib::ffi::gboolean {
1425            unsafe {
1426                let f: &F = &*(f as *const F);
1427                f(
1428                    &from_glib_borrow(this),
1429                    from_glib(scroll),
1430                    from_glib(horizontal),
1431                )
1432                .into_glib()
1433            }
1434        }
1435        unsafe {
1436            let f: Box_<F> = Box_::new(f);
1437            connect_raw(
1438                self.as_ptr() as *mut _,
1439                c"scroll-child".as_ptr() as *const _,
1440                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1441                    scroll_child_trampoline::<F> as *const (),
1442                )),
1443                Box_::into_raw(f),
1444            )
1445        }
1446    }
1447
1448    pub fn emit_scroll_child(&self, scroll: ScrollType, horizontal: bool) -> bool {
1449        self.emit_by_name("scroll-child", &[&scroll, &horizontal])
1450    }
1451
1452    #[doc(alias = "child")]
1453    pub fn connect_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1454        unsafe extern "C" fn notify_child_trampoline<F: Fn(&ScrolledWindow) + 'static>(
1455            this: *mut ffi::GtkScrolledWindow,
1456            _param_spec: glib::ffi::gpointer,
1457            f: glib::ffi::gpointer,
1458        ) {
1459            unsafe {
1460                let f: &F = &*(f as *const F);
1461                f(&from_glib_borrow(this))
1462            }
1463        }
1464        unsafe {
1465            let f: Box_<F> = Box_::new(f);
1466            connect_raw(
1467                self.as_ptr() as *mut _,
1468                c"notify::child".as_ptr() as *const _,
1469                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1470                    notify_child_trampoline::<F> as *const (),
1471                )),
1472                Box_::into_raw(f),
1473            )
1474        }
1475    }
1476
1477    #[doc(alias = "hadjustment")]
1478    pub fn connect_hadjustment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1479        unsafe extern "C" fn notify_hadjustment_trampoline<F: Fn(&ScrolledWindow) + 'static>(
1480            this: *mut ffi::GtkScrolledWindow,
1481            _param_spec: glib::ffi::gpointer,
1482            f: glib::ffi::gpointer,
1483        ) {
1484            unsafe {
1485                let f: &F = &*(f as *const F);
1486                f(&from_glib_borrow(this))
1487            }
1488        }
1489        unsafe {
1490            let f: Box_<F> = Box_::new(f);
1491            connect_raw(
1492                self.as_ptr() as *mut _,
1493                c"notify::hadjustment".as_ptr() as *const _,
1494                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1495                    notify_hadjustment_trampoline::<F> as *const (),
1496                )),
1497                Box_::into_raw(f),
1498            )
1499        }
1500    }
1501
1502    #[doc(alias = "has-frame")]
1503    pub fn connect_has_frame_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1504        unsafe extern "C" fn notify_has_frame_trampoline<F: Fn(&ScrolledWindow) + 'static>(
1505            this: *mut ffi::GtkScrolledWindow,
1506            _param_spec: glib::ffi::gpointer,
1507            f: glib::ffi::gpointer,
1508        ) {
1509            unsafe {
1510                let f: &F = &*(f as *const F);
1511                f(&from_glib_borrow(this))
1512            }
1513        }
1514        unsafe {
1515            let f: Box_<F> = Box_::new(f);
1516            connect_raw(
1517                self.as_ptr() as *mut _,
1518                c"notify::has-frame".as_ptr() as *const _,
1519                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1520                    notify_has_frame_trampoline::<F> as *const (),
1521                )),
1522                Box_::into_raw(f),
1523            )
1524        }
1525    }
1526
1527    #[doc(alias = "hscrollbar-policy")]
1528    pub fn connect_hscrollbar_policy_notify<F: Fn(&Self) + 'static>(
1529        &self,
1530        f: F,
1531    ) -> SignalHandlerId {
1532        unsafe extern "C" fn notify_hscrollbar_policy_trampoline<
1533            F: Fn(&ScrolledWindow) + 'static,
1534        >(
1535            this: *mut ffi::GtkScrolledWindow,
1536            _param_spec: glib::ffi::gpointer,
1537            f: glib::ffi::gpointer,
1538        ) {
1539            unsafe {
1540                let f: &F = &*(f as *const F);
1541                f(&from_glib_borrow(this))
1542            }
1543        }
1544        unsafe {
1545            let f: Box_<F> = Box_::new(f);
1546            connect_raw(
1547                self.as_ptr() as *mut _,
1548                c"notify::hscrollbar-policy".as_ptr() as *const _,
1549                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1550                    notify_hscrollbar_policy_trampoline::<F> as *const (),
1551                )),
1552                Box_::into_raw(f),
1553            )
1554        }
1555    }
1556
1557    #[doc(alias = "kinetic-scrolling")]
1558    pub fn connect_kinetic_scrolling_notify<F: Fn(&Self) + 'static>(
1559        &self,
1560        f: F,
1561    ) -> SignalHandlerId {
1562        unsafe extern "C" fn notify_kinetic_scrolling_trampoline<
1563            F: Fn(&ScrolledWindow) + 'static,
1564        >(
1565            this: *mut ffi::GtkScrolledWindow,
1566            _param_spec: glib::ffi::gpointer,
1567            f: glib::ffi::gpointer,
1568        ) {
1569            unsafe {
1570                let f: &F = &*(f as *const F);
1571                f(&from_glib_borrow(this))
1572            }
1573        }
1574        unsafe {
1575            let f: Box_<F> = Box_::new(f);
1576            connect_raw(
1577                self.as_ptr() as *mut _,
1578                c"notify::kinetic-scrolling".as_ptr() as *const _,
1579                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1580                    notify_kinetic_scrolling_trampoline::<F> as *const (),
1581                )),
1582                Box_::into_raw(f),
1583            )
1584        }
1585    }
1586
1587    #[doc(alias = "max-content-height")]
1588    pub fn connect_max_content_height_notify<F: Fn(&Self) + 'static>(
1589        &self,
1590        f: F,
1591    ) -> SignalHandlerId {
1592        unsafe extern "C" fn notify_max_content_height_trampoline<
1593            F: Fn(&ScrolledWindow) + 'static,
1594        >(
1595            this: *mut ffi::GtkScrolledWindow,
1596            _param_spec: glib::ffi::gpointer,
1597            f: glib::ffi::gpointer,
1598        ) {
1599            unsafe {
1600                let f: &F = &*(f as *const F);
1601                f(&from_glib_borrow(this))
1602            }
1603        }
1604        unsafe {
1605            let f: Box_<F> = Box_::new(f);
1606            connect_raw(
1607                self.as_ptr() as *mut _,
1608                c"notify::max-content-height".as_ptr() as *const _,
1609                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1610                    notify_max_content_height_trampoline::<F> as *const (),
1611                )),
1612                Box_::into_raw(f),
1613            )
1614        }
1615    }
1616
1617    #[doc(alias = "max-content-width")]
1618    pub fn connect_max_content_width_notify<F: Fn(&Self) + 'static>(
1619        &self,
1620        f: F,
1621    ) -> SignalHandlerId {
1622        unsafe extern "C" fn notify_max_content_width_trampoline<
1623            F: Fn(&ScrolledWindow) + 'static,
1624        >(
1625            this: *mut ffi::GtkScrolledWindow,
1626            _param_spec: glib::ffi::gpointer,
1627            f: glib::ffi::gpointer,
1628        ) {
1629            unsafe {
1630                let f: &F = &*(f as *const F);
1631                f(&from_glib_borrow(this))
1632            }
1633        }
1634        unsafe {
1635            let f: Box_<F> = Box_::new(f);
1636            connect_raw(
1637                self.as_ptr() as *mut _,
1638                c"notify::max-content-width".as_ptr() as *const _,
1639                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1640                    notify_max_content_width_trampoline::<F> as *const (),
1641                )),
1642                Box_::into_raw(f),
1643            )
1644        }
1645    }
1646
1647    #[doc(alias = "min-content-height")]
1648    pub fn connect_min_content_height_notify<F: Fn(&Self) + 'static>(
1649        &self,
1650        f: F,
1651    ) -> SignalHandlerId {
1652        unsafe extern "C" fn notify_min_content_height_trampoline<
1653            F: Fn(&ScrolledWindow) + 'static,
1654        >(
1655            this: *mut ffi::GtkScrolledWindow,
1656            _param_spec: glib::ffi::gpointer,
1657            f: glib::ffi::gpointer,
1658        ) {
1659            unsafe {
1660                let f: &F = &*(f as *const F);
1661                f(&from_glib_borrow(this))
1662            }
1663        }
1664        unsafe {
1665            let f: Box_<F> = Box_::new(f);
1666            connect_raw(
1667                self.as_ptr() as *mut _,
1668                c"notify::min-content-height".as_ptr() as *const _,
1669                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1670                    notify_min_content_height_trampoline::<F> as *const (),
1671                )),
1672                Box_::into_raw(f),
1673            )
1674        }
1675    }
1676
1677    #[doc(alias = "min-content-width")]
1678    pub fn connect_min_content_width_notify<F: Fn(&Self) + 'static>(
1679        &self,
1680        f: F,
1681    ) -> SignalHandlerId {
1682        unsafe extern "C" fn notify_min_content_width_trampoline<
1683            F: Fn(&ScrolledWindow) + 'static,
1684        >(
1685            this: *mut ffi::GtkScrolledWindow,
1686            _param_spec: glib::ffi::gpointer,
1687            f: glib::ffi::gpointer,
1688        ) {
1689            unsafe {
1690                let f: &F = &*(f as *const F);
1691                f(&from_glib_borrow(this))
1692            }
1693        }
1694        unsafe {
1695            let f: Box_<F> = Box_::new(f);
1696            connect_raw(
1697                self.as_ptr() as *mut _,
1698                c"notify::min-content-width".as_ptr() as *const _,
1699                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1700                    notify_min_content_width_trampoline::<F> as *const (),
1701                )),
1702                Box_::into_raw(f),
1703            )
1704        }
1705    }
1706
1707    #[doc(alias = "overlay-scrolling")]
1708    pub fn connect_overlay_scrolling_notify<F: Fn(&Self) + 'static>(
1709        &self,
1710        f: F,
1711    ) -> SignalHandlerId {
1712        unsafe extern "C" fn notify_overlay_scrolling_trampoline<
1713            F: Fn(&ScrolledWindow) + 'static,
1714        >(
1715            this: *mut ffi::GtkScrolledWindow,
1716            _param_spec: glib::ffi::gpointer,
1717            f: glib::ffi::gpointer,
1718        ) {
1719            unsafe {
1720                let f: &F = &*(f as *const F);
1721                f(&from_glib_borrow(this))
1722            }
1723        }
1724        unsafe {
1725            let f: Box_<F> = Box_::new(f);
1726            connect_raw(
1727                self.as_ptr() as *mut _,
1728                c"notify::overlay-scrolling".as_ptr() as *const _,
1729                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1730                    notify_overlay_scrolling_trampoline::<F> as *const (),
1731                )),
1732                Box_::into_raw(f),
1733            )
1734        }
1735    }
1736
1737    #[doc(alias = "propagate-natural-height")]
1738    pub fn connect_propagate_natural_height_notify<F: Fn(&Self) + 'static>(
1739        &self,
1740        f: F,
1741    ) -> SignalHandlerId {
1742        unsafe extern "C" fn notify_propagate_natural_height_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            unsafe {
1750                let f: &F = &*(f as *const F);
1751                f(&from_glib_borrow(this))
1752            }
1753        }
1754        unsafe {
1755            let f: Box_<F> = Box_::new(f);
1756            connect_raw(
1757                self.as_ptr() as *mut _,
1758                c"notify::propagate-natural-height".as_ptr() as *const _,
1759                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1760                    notify_propagate_natural_height_trampoline::<F> as *const (),
1761                )),
1762                Box_::into_raw(f),
1763            )
1764        }
1765    }
1766
1767    #[doc(alias = "propagate-natural-width")]
1768    pub fn connect_propagate_natural_width_notify<F: Fn(&Self) + 'static>(
1769        &self,
1770        f: F,
1771    ) -> SignalHandlerId {
1772        unsafe extern "C" fn notify_propagate_natural_width_trampoline<
1773            F: Fn(&ScrolledWindow) + 'static,
1774        >(
1775            this: *mut ffi::GtkScrolledWindow,
1776            _param_spec: glib::ffi::gpointer,
1777            f: glib::ffi::gpointer,
1778        ) {
1779            unsafe {
1780                let f: &F = &*(f as *const F);
1781                f(&from_glib_borrow(this))
1782            }
1783        }
1784        unsafe {
1785            let f: Box_<F> = Box_::new(f);
1786            connect_raw(
1787                self.as_ptr() as *mut _,
1788                c"notify::propagate-natural-width".as_ptr() as *const _,
1789                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1790                    notify_propagate_natural_width_trampoline::<F> as *const (),
1791                )),
1792                Box_::into_raw(f),
1793            )
1794        }
1795    }
1796
1797    #[doc(alias = "vadjustment")]
1798    pub fn connect_vadjustment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1799        unsafe extern "C" fn notify_vadjustment_trampoline<F: Fn(&ScrolledWindow) + 'static>(
1800            this: *mut ffi::GtkScrolledWindow,
1801            _param_spec: glib::ffi::gpointer,
1802            f: glib::ffi::gpointer,
1803        ) {
1804            unsafe {
1805                let f: &F = &*(f as *const F);
1806                f(&from_glib_borrow(this))
1807            }
1808        }
1809        unsafe {
1810            let f: Box_<F> = Box_::new(f);
1811            connect_raw(
1812                self.as_ptr() as *mut _,
1813                c"notify::vadjustment".as_ptr() as *const _,
1814                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1815                    notify_vadjustment_trampoline::<F> as *const (),
1816                )),
1817                Box_::into_raw(f),
1818            )
1819        }
1820    }
1821
1822    #[doc(alias = "vscrollbar-policy")]
1823    pub fn connect_vscrollbar_policy_notify<F: Fn(&Self) + 'static>(
1824        &self,
1825        f: F,
1826    ) -> SignalHandlerId {
1827        unsafe extern "C" fn notify_vscrollbar_policy_trampoline<
1828            F: Fn(&ScrolledWindow) + 'static,
1829        >(
1830            this: *mut ffi::GtkScrolledWindow,
1831            _param_spec: glib::ffi::gpointer,
1832            f: glib::ffi::gpointer,
1833        ) {
1834            unsafe {
1835                let f: &F = &*(f as *const F);
1836                f(&from_glib_borrow(this))
1837            }
1838        }
1839        unsafe {
1840            let f: Box_<F> = Box_::new(f);
1841            connect_raw(
1842                self.as_ptr() as *mut _,
1843                c"notify::vscrollbar-policy".as_ptr() as *const _,
1844                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1845                    notify_vscrollbar_policy_trampoline::<F> as *const (),
1846                )),
1847                Box_::into_raw(f),
1848            )
1849        }
1850    }
1851
1852    #[doc(alias = "window-placement")]
1853    pub fn connect_window_placement_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1854        unsafe extern "C" fn notify_window_placement_trampoline<
1855            F: Fn(&ScrolledWindow) + 'static,
1856        >(
1857            this: *mut ffi::GtkScrolledWindow,
1858            _param_spec: glib::ffi::gpointer,
1859            f: glib::ffi::gpointer,
1860        ) {
1861            unsafe {
1862                let f: &F = &*(f as *const F);
1863                f(&from_glib_borrow(this))
1864            }
1865        }
1866        unsafe {
1867            let f: Box_<F> = Box_::new(f);
1868            connect_raw(
1869                self.as_ptr() as *mut _,
1870                c"notify::window-placement".as_ptr() as *const _,
1871                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1872                    notify_window_placement_trampoline::<F> as *const (),
1873                )),
1874                Box_::into_raw(f),
1875            )
1876        }
1877    }
1878}
1879
1880impl Default for ScrolledWindow {
1881    fn default() -> Self {
1882        Self::new()
1883    }
1884}
1885
1886// rustdoc-stripper-ignore-next
1887/// A [builder-pattern] type to construct [`ScrolledWindow`] objects.
1888///
1889/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1890#[must_use = "The builder must be built to be used"]
1891pub struct ScrolledWindowBuilder {
1892    builder: glib::object::ObjectBuilder<'static, ScrolledWindow>,
1893}
1894
1895impl ScrolledWindowBuilder {
1896    fn new() -> Self {
1897        Self {
1898            builder: glib::object::Object::builder(),
1899        }
1900    }
1901
1902    /// The child widget.
1903    ///
1904    /// When setting this property, if the child widget does not implement
1905    /// [`Scrollable`][crate::Scrollable], the scrolled window will add the child to
1906    /// a [`Viewport`][crate::Viewport] and then set the viewport as the child.
1907    pub fn child(self, child: &impl IsA<Widget>) -> Self {
1908        Self {
1909            builder: self.builder.property("child", child.clone().upcast()),
1910        }
1911    }
1912
1913    /// The [`Adjustment`][crate::Adjustment] for the horizontal position.
1914    pub fn hadjustment(self, hadjustment: &impl IsA<Adjustment>) -> Self {
1915        Self {
1916            builder: self
1917                .builder
1918                .property("hadjustment", hadjustment.clone().upcast()),
1919        }
1920    }
1921
1922    /// Whether to draw a frame around the contents.
1923    pub fn has_frame(self, has_frame: bool) -> Self {
1924        Self {
1925            builder: self.builder.property("has-frame", has_frame),
1926        }
1927    }
1928
1929    /// When the horizontal scrollbar is displayed.
1930    ///
1931    /// Use [`ScrolledWindow::set_policy()`][crate::ScrolledWindow::set_policy()] to set
1932    /// this property.
1933    pub fn hscrollbar_policy(self, hscrollbar_policy: PolicyType) -> Self {
1934        Self {
1935            builder: self
1936                .builder
1937                .property("hscrollbar-policy", hscrollbar_policy),
1938        }
1939    }
1940
1941    /// Whether kinetic scrolling is enabled or not.
1942    ///
1943    /// Kinetic scrolling only applies to devices with source `GDK_SOURCE_TOUCHSCREEN`.
1944    pub fn kinetic_scrolling(self, kinetic_scrolling: bool) -> Self {
1945        Self {
1946            builder: self
1947                .builder
1948                .property("kinetic-scrolling", kinetic_scrolling),
1949        }
1950    }
1951
1952    /// The maximum content height of @scrolled_window.
1953    pub fn max_content_height(self, max_content_height: i32) -> Self {
1954        Self {
1955            builder: self
1956                .builder
1957                .property("max-content-height", max_content_height),
1958        }
1959    }
1960
1961    /// The maximum content width of @scrolled_window.
1962    pub fn max_content_width(self, max_content_width: i32) -> Self {
1963        Self {
1964            builder: self
1965                .builder
1966                .property("max-content-width", max_content_width),
1967        }
1968    }
1969
1970    /// The minimum content height of @scrolled_window.
1971    pub fn min_content_height(self, min_content_height: i32) -> Self {
1972        Self {
1973            builder: self
1974                .builder
1975                .property("min-content-height", min_content_height),
1976        }
1977    }
1978
1979    /// The minimum content width of @scrolled_window.
1980    pub fn min_content_width(self, min_content_width: i32) -> Self {
1981        Self {
1982            builder: self
1983                .builder
1984                .property("min-content-width", min_content_width),
1985        }
1986    }
1987
1988    /// Whether overlay scrolling is enabled or not.
1989    ///
1990    /// If it is, the scrollbars are only added as traditional widgets
1991    /// when a mouse is present. Otherwise, they are overlaid on top of
1992    /// the content, as narrow indicators.
1993    ///
1994    /// Note that overlay scrolling can also be globally disabled, with
1995    /// the [`gtk-overlay-scrolling`][struct@crate::Settings#gtk-overlay-scrolling] setting.
1996    pub fn overlay_scrolling(self, overlay_scrolling: bool) -> Self {
1997        Self {
1998            builder: self
1999                .builder
2000                .property("overlay-scrolling", overlay_scrolling),
2001        }
2002    }
2003
2004    /// Whether the natural height of the child should be calculated and propagated
2005    /// through the scrolled window’s requested natural height.
2006    ///
2007    /// This is useful in cases where an attempt should be made to allocate exactly
2008    /// enough space for the natural size of the child.
2009    pub fn propagate_natural_height(self, propagate_natural_height: bool) -> Self {
2010        Self {
2011            builder: self
2012                .builder
2013                .property("propagate-natural-height", propagate_natural_height),
2014        }
2015    }
2016
2017    /// Whether the natural width of the child should be calculated and propagated
2018    /// through the scrolled window’s requested natural width.
2019    ///
2020    /// This is useful in cases where an attempt should be made to allocate exactly
2021    /// enough space for the natural size of the child.
2022    pub fn propagate_natural_width(self, propagate_natural_width: bool) -> Self {
2023        Self {
2024            builder: self
2025                .builder
2026                .property("propagate-natural-width", propagate_natural_width),
2027        }
2028    }
2029
2030    /// The [`Adjustment`][crate::Adjustment] for the vertical position.
2031    pub fn vadjustment(self, vadjustment: &impl IsA<Adjustment>) -> Self {
2032        Self {
2033            builder: self
2034                .builder
2035                .property("vadjustment", vadjustment.clone().upcast()),
2036        }
2037    }
2038
2039    /// When the vertical scrollbar is displayed.
2040    ///
2041    /// Use [`ScrolledWindow::set_policy()`][crate::ScrolledWindow::set_policy()] to set
2042    /// this property.
2043    pub fn vscrollbar_policy(self, vscrollbar_policy: PolicyType) -> Self {
2044        Self {
2045            builder: self
2046                .builder
2047                .property("vscrollbar-policy", vscrollbar_policy),
2048        }
2049    }
2050
2051    /// Where the contents are located with respect to the scrollbars.
2052    pub fn window_placement(self, window_placement: CornerType) -> Self {
2053        Self {
2054            builder: self.builder.property("window-placement", window_placement),
2055        }
2056    }
2057
2058    /// Whether the widget or any of its descendents can accept
2059    /// the input focus.
2060    ///
2061    /// This property is meant to be set by widget implementations,
2062    /// typically in their instance init function.
2063    pub fn can_focus(self, can_focus: bool) -> Self {
2064        Self {
2065            builder: self.builder.property("can-focus", can_focus),
2066        }
2067    }
2068
2069    /// Whether the widget can receive pointer events.
2070    pub fn can_target(self, can_target: bool) -> Self {
2071        Self {
2072            builder: self.builder.property("can-target", can_target),
2073        }
2074    }
2075
2076    /// A list of css classes applied to this widget.
2077    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
2078        Self {
2079            builder: self.builder.property("css-classes", css_classes.into()),
2080        }
2081    }
2082
2083    /// The name of this widget in the CSS tree.
2084    ///
2085    /// This property is meant to be set by widget implementations,
2086    /// typically in their instance init function.
2087    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
2088        Self {
2089            builder: self.builder.property("css-name", css_name.into()),
2090        }
2091    }
2092
2093    /// The cursor used by @widget.
2094    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
2095        Self {
2096            builder: self.builder.property("cursor", cursor.clone()),
2097        }
2098    }
2099
2100    /// Whether the widget should grab focus when it is clicked with the mouse.
2101    ///
2102    /// This property is only relevant for widgets that can take focus.
2103    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
2104        Self {
2105            builder: self.builder.property("focus-on-click", focus_on_click),
2106        }
2107    }
2108
2109    /// Whether this widget itself will accept the input focus.
2110    pub fn focusable(self, focusable: bool) -> Self {
2111        Self {
2112            builder: self.builder.property("focusable", focusable),
2113        }
2114    }
2115
2116    /// How to distribute horizontal space if widget gets extra space.
2117    pub fn halign(self, halign: Align) -> Self {
2118        Self {
2119            builder: self.builder.property("halign", halign),
2120        }
2121    }
2122
2123    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
2124    /// signal on @widget.
2125    ///
2126    /// A true value indicates that @widget can have a tooltip, in this case
2127    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
2128    /// determine whether it will provide a tooltip or not.
2129    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
2130        Self {
2131            builder: self.builder.property("has-tooltip", has_tooltip),
2132        }
2133    }
2134
2135    /// Overrides for height request of the widget.
2136    ///
2137    /// If this is -1, the natural request will be used.
2138    pub fn height_request(self, height_request: i32) -> Self {
2139        Self {
2140            builder: self.builder.property("height-request", height_request),
2141        }
2142    }
2143
2144    /// Whether to expand horizontally.
2145    pub fn hexpand(self, hexpand: bool) -> Self {
2146        Self {
2147            builder: self.builder.property("hexpand", hexpand),
2148        }
2149    }
2150
2151    /// Whether to use the `hexpand` property.
2152    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
2153        Self {
2154            builder: self.builder.property("hexpand-set", hexpand_set),
2155        }
2156    }
2157
2158    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
2159    /// the preferred size of the widget, and allocate its children.
2160    ///
2161    /// This property is meant to be set by widget implementations,
2162    /// typically in their instance init function.
2163    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
2164        Self {
2165            builder: self
2166                .builder
2167                .property("layout-manager", layout_manager.clone().upcast()),
2168        }
2169    }
2170
2171    /// Makes this widget act like a modal dialog, with respect to
2172    /// event delivery.
2173    ///
2174    /// Global event controllers will not handle events with targets
2175    /// inside the widget, unless they are set up to ignore propagation
2176    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
2177    #[cfg(feature = "v4_18")]
2178    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
2179    pub fn limit_events(self, limit_events: bool) -> Self {
2180        Self {
2181            builder: self.builder.property("limit-events", limit_events),
2182        }
2183    }
2184
2185    /// Margin on bottom side of widget.
2186    ///
2187    /// This property adds margin outside of the widget's normal size
2188    /// request, the margin will be added in addition to the size from
2189    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2190    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
2191        Self {
2192            builder: self.builder.property("margin-bottom", margin_bottom),
2193        }
2194    }
2195
2196    /// Margin on end of widget, horizontally.
2197    ///
2198    /// This property supports left-to-right and right-to-left text
2199    /// directions.
2200    ///
2201    /// This property adds margin outside of the widget's normal size
2202    /// request, the margin will be added in addition to the size from
2203    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2204    pub fn margin_end(self, margin_end: i32) -> Self {
2205        Self {
2206            builder: self.builder.property("margin-end", margin_end),
2207        }
2208    }
2209
2210    /// Margin on start of widget, horizontally.
2211    ///
2212    /// This property supports left-to-right and right-to-left text
2213    /// directions.
2214    ///
2215    /// This property adds margin outside of the widget's normal size
2216    /// request, the margin will be added in addition to the size from
2217    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2218    pub fn margin_start(self, margin_start: i32) -> Self {
2219        Self {
2220            builder: self.builder.property("margin-start", margin_start),
2221        }
2222    }
2223
2224    /// Margin on top side of widget.
2225    ///
2226    /// This property adds margin outside of the widget's normal size
2227    /// request, the margin will be added in addition to the size from
2228    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
2229    pub fn margin_top(self, margin_top: i32) -> Self {
2230        Self {
2231            builder: self.builder.property("margin-top", margin_top),
2232        }
2233    }
2234
2235    /// The name of the widget.
2236    pub fn name(self, name: impl Into<glib::GString>) -> Self {
2237        Self {
2238            builder: self.builder.property("name", name.into()),
2239        }
2240    }
2241
2242    /// The requested opacity of the widget.
2243    pub fn opacity(self, opacity: f64) -> Self {
2244        Self {
2245            builder: self.builder.property("opacity", opacity),
2246        }
2247    }
2248
2249    /// How content outside the widget's content area is treated.
2250    ///
2251    /// This property is meant to be set by widget implementations,
2252    /// typically in their instance init function.
2253    pub fn overflow(self, overflow: Overflow) -> Self {
2254        Self {
2255            builder: self.builder.property("overflow", overflow),
2256        }
2257    }
2258
2259    /// Whether the widget will receive the default action when it is focused.
2260    pub fn receives_default(self, receives_default: bool) -> Self {
2261        Self {
2262            builder: self.builder.property("receives-default", receives_default),
2263        }
2264    }
2265
2266    /// Whether the widget responds to input.
2267    pub fn sensitive(self, sensitive: bool) -> Self {
2268        Self {
2269            builder: self.builder.property("sensitive", sensitive),
2270        }
2271    }
2272
2273    /// Sets the text of tooltip to be the given string, which is marked up
2274    /// with Pango markup.
2275    ///
2276    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
2277    ///
2278    /// This is a convenience property which will take care of getting the
2279    /// tooltip shown if the given string is not `NULL`:
2280    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
2281    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
2282    /// the default signal handler.
2283    ///
2284    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
2285    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
2286    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
2287        Self {
2288            builder: self
2289                .builder
2290                .property("tooltip-markup", tooltip_markup.into()),
2291        }
2292    }
2293
2294    /// Sets the text of tooltip to be the given string.
2295    ///
2296    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
2297    ///
2298    /// This is a convenience property which will take care of getting the
2299    /// tooltip shown if the given string is not `NULL`:
2300    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
2301    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
2302    /// the default signal handler.
2303    ///
2304    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
2305    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
2306    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
2307        Self {
2308            builder: self.builder.property("tooltip-text", tooltip_text.into()),
2309        }
2310    }
2311
2312    /// How to distribute vertical space if widget gets extra space.
2313    pub fn valign(self, valign: Align) -> Self {
2314        Self {
2315            builder: self.builder.property("valign", valign),
2316        }
2317    }
2318
2319    /// Whether to expand vertically.
2320    pub fn vexpand(self, vexpand: bool) -> Self {
2321        Self {
2322            builder: self.builder.property("vexpand", vexpand),
2323        }
2324    }
2325
2326    /// Whether to use the `vexpand` property.
2327    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
2328        Self {
2329            builder: self.builder.property("vexpand-set", vexpand_set),
2330        }
2331    }
2332
2333    /// Whether the widget is visible.
2334    pub fn visible(self, visible: bool) -> Self {
2335        Self {
2336            builder: self.builder.property("visible", visible),
2337        }
2338    }
2339
2340    /// Overrides for width request of the widget.
2341    ///
2342    /// If this is -1, the natural request will be used.
2343    pub fn width_request(self, width_request: i32) -> Self {
2344        Self {
2345            builder: self.builder.property("width-request", width_request),
2346        }
2347    }
2348
2349    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
2350    ///
2351    /// The accessible role cannot be changed once set.
2352    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
2353        Self {
2354            builder: self.builder.property("accessible-role", accessible_role),
2355        }
2356    }
2357
2358    // rustdoc-stripper-ignore-next
2359    /// Build the [`ScrolledWindow`].
2360    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
2361    pub fn build(self) -> ScrolledWindow {
2362        assert_initialized_main_thread!();
2363        self.builder.build()
2364    }
2365}