Skip to main content

gtk4/auto/
scrolled_window.rs

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