gtk/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 Adjustment, Align, Bin, Buildable, Container, CornerType, DirectionType, PolicyType,
7 PositionType, ResizeMode, ScrollType, ShadowType, 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 ///
19 /// GtkWidget *scrolled_window = gtk_scrolled_window_new (NULL, NULL);
20 /// GtkWidget *child_widget = gtk_button_new ();
21 ///
22 /// // GtkButton is not a GtkScrollable, so GtkScrolledWindow will automatically
23 /// // add a GtkViewport.
24 /// gtk_container_add (GTK_CONTAINER (scrolled_window),
25 /// child_widget);
26 ///
27 /// // Either of these will result in child_widget being unparented:
28 /// gtk_container_remove (GTK_CONTAINER (scrolled_window),
29 /// child_widget);
30 /// // or
31 /// gtk_container_remove (GTK_CONTAINER (scrolled_window),
32 /// gtk_bin_get_child (GTK_BIN (scrolled_window)));
33 /// ]|
34 ///
35 /// Unless [`policy`][struct@crate::ScrolledWindow#policy] is GTK_POLICY_NEVER or GTK_POLICY_EXTERNAL,
36 /// GtkScrolledWindow adds internal [`Scrollbar`][crate::Scrollbar] widgets around its child. The
37 /// scroll position of the child, and if applicable the scrollbars, is controlled
38 /// by the [`hadjustment`][struct@crate::ScrolledWindow#hadjustment] and [`vadjustment`][struct@crate::ScrolledWindow#vadjustment]
39 /// that are associated with the GtkScrolledWindow. See the docs on [`Scrollbar`][crate::Scrollbar]
40 /// for the details, but note that the “step_increment” and “page_increment”
41 /// fields are only effective if the policy causes scrollbars to be present.
42 ///
43 /// If a GtkScrolledWindow doesn’t behave quite as you would like, or
44 /// doesn’t have exactly the right layout, it’s very possible to set up
45 /// your own scrolling with [`Scrollbar`][crate::Scrollbar] and for example a [`Grid`][crate::Grid].
46 ///
47 /// # Touch support
48 ///
49 /// GtkScrolledWindow has built-in support for touch devices. When a
50 /// touchscreen is used, swiping will move the scrolled window, and will
51 /// expose 'kinetic' behavior. This can be turned off with the
52 /// [`kinetic-scrolling`][struct@crate::ScrolledWindow#kinetic-scrolling] property if it is undesired.
53 ///
54 /// GtkScrolledWindow also displays visual 'overshoot' indication when
55 /// the content is pulled beyond the end, and this situation can be
56 /// captured with the [`edge-overshot`][struct@crate::ScrolledWindow#edge-overshot] signal.
57 ///
58 /// If no mouse device is present, the scrollbars will overlayed as
59 /// narrow, auto-hiding indicators over the content. If traditional
60 /// scrollbars are desired although no mouse is present, this behaviour
61 /// can be turned off with the [`overlay-scrolling`][struct@crate::ScrolledWindow#overlay-scrolling]
62 /// property.
63 ///
64 /// # CSS nodes
65 ///
66 /// GtkScrolledWindow has a main CSS node with name scrolledwindow.
67 ///
68 /// It uses subnodes with names overshoot and undershoot to
69 /// draw the overflow and underflow indications. These nodes get
70 /// the .left, .right, .top or .bottom style class added depending
71 /// on where the indication is drawn.
72 ///
73 /// GtkScrolledWindow also sets the positional style classes (.left,
74 /// .right, .top, .bottom) and style classes related to overlay
75 /// scrolling (.overlay-indicator, .dragging, .hovering) on its scrollbars.
76 ///
77 /// If both scrollbars are visible, the area where they meet is drawn
78 /// with a subnode named junction.
79 ///
80 /// ## Properties
81 ///
82 ///
83 /// #### `hadjustment`
84 /// Readable | Writable | Construct
85 ///
86 ///
87 /// #### `hscrollbar-policy`
88 /// Readable | Writable
89 ///
90 ///
91 /// #### `kinetic-scrolling`
92 /// Whether kinetic scrolling is enabled or not. Kinetic scrolling
93 /// only applies to devices with source `GDK_SOURCE_TOUCHSCREEN`.
94 ///
95 /// Readable | Writable
96 ///
97 ///
98 /// #### `max-content-height`
99 /// The maximum content height of `scrolled_window`, or -1 if not set.
100 ///
101 /// Readable | Writable
102 ///
103 ///
104 /// #### `max-content-width`
105 /// The maximum content width of `scrolled_window`, or -1 if not set.
106 ///
107 /// Readable | Writable
108 ///
109 ///
110 /// #### `min-content-height`
111 /// The minimum content height of `scrolled_window`, or -1 if not set.
112 ///
113 /// Readable | Writable
114 ///
115 ///
116 /// #### `min-content-width`
117 /// The minimum content width of `scrolled_window`, or -1 if not set.
118 ///
119 /// Readable | Writable
120 ///
121 ///
122 /// #### `overlay-scrolling`
123 /// Whether overlay scrolling is enabled or not. If it is, the
124 /// scrollbars are only added as traditional widgets when a mouse
125 /// is present. Otherwise, they are overlayed on top of the content,
126 /// as narrow indicators.
127 ///
128 /// Note that overlay scrolling can also be globally disabled, with
129 /// the [`gtk-overlay-scrolling`][struct@crate::Settings#gtk-overlay-scrolling] setting.
130 ///
131 /// Readable | Writable
132 ///
133 ///
134 /// #### `propagate-natural-height`
135 /// Whether the natural height of the child should be calculated and propagated
136 /// through the scrolled window’s requested natural height.
137 ///
138 /// This is useful in cases where an attempt should be made to allocate exactly
139 /// enough space for the natural size of the child.
140 ///
141 /// Readable | Writable
142 ///
143 ///
144 /// #### `propagate-natural-width`
145 /// Whether the natural width of the child should be calculated and propagated
146 /// through the scrolled window’s requested natural width.
147 ///
148 /// This is useful in cases where an attempt should be made to allocate exactly
149 /// enough space for the natural size of the child.
150 ///
151 /// Readable | Writable
152 ///
153 ///
154 /// #### `shadow-type`
155 /// Readable | Writable
156 ///
157 ///
158 /// #### `vadjustment`
159 /// Readable | Writable | Construct
160 ///
161 ///
162 /// #### `vscrollbar-policy`
163 /// Readable | Writable
164 ///
165 ///
166 /// #### `window-placement`
167 /// Readable | Writable
168 ///
169 ///
170 /// #### `window-placement-set`
171 /// Whether "window-placement" should be used to determine the location
172 /// of the contents with respect to the scrollbars.
173 ///
174 /// Readable | Writable
175 /// <details><summary><h4>Container</h4></summary>
176 ///
177 ///
178 /// #### `border-width`
179 /// Readable | Writable
180 ///
181 ///
182 /// #### `child`
183 /// Writable
184 ///
185 ///
186 /// #### `resize-mode`
187 /// Readable | Writable
188 /// </details>
189 /// <details><summary><h4>Widget</h4></summary>
190 ///
191 ///
192 /// #### `app-paintable`
193 /// Readable | Writable
194 ///
195 ///
196 /// #### `can-default`
197 /// Readable | Writable
198 ///
199 ///
200 /// #### `can-focus`
201 /// Readable | Writable
202 ///
203 ///
204 /// #### `composite-child`
205 /// Readable
206 ///
207 ///
208 /// #### `double-buffered`
209 /// Whether the widget is double buffered.
210 ///
211 /// Readable | Writable
212 ///
213 ///
214 /// #### `events`
215 /// Readable | Writable
216 ///
217 ///
218 /// #### `expand`
219 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
220 ///
221 /// Readable | Writable
222 ///
223 ///
224 /// #### `focus-on-click`
225 /// Whether the widget should grab focus when it is clicked with the mouse.
226 ///
227 /// This property is only relevant for widgets that can take focus.
228 ///
229 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
230 /// GtkComboBox) implemented this property individually.
231 ///
232 /// Readable | Writable
233 ///
234 ///
235 /// #### `halign`
236 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
237 ///
238 /// Readable | Writable
239 ///
240 ///
241 /// #### `has-default`
242 /// Readable | Writable
243 ///
244 ///
245 /// #### `has-focus`
246 /// Readable | Writable
247 ///
248 ///
249 /// #### `has-tooltip`
250 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
251 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
252 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
253 /// whether it will provide a tooltip or not.
254 ///
255 /// Note that setting this property to [`true`] for the first time will change
256 /// the event masks of the GdkWindows of this widget to include leave-notify
257 /// and motion-notify events. This cannot and will not be undone when the
258 /// property is set to [`false`] again.
259 ///
260 /// Readable | Writable
261 ///
262 ///
263 /// #### `height-request`
264 /// Readable | Writable
265 ///
266 ///
267 /// #### `hexpand`
268 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
269 ///
270 /// Readable | Writable
271 ///
272 ///
273 /// #### `hexpand-set`
274 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
275 ///
276 /// Readable | Writable
277 ///
278 ///
279 /// #### `is-focus`
280 /// Readable | Writable
281 ///
282 ///
283 /// #### `margin`
284 /// Sets all four sides' margin at once. If read, returns max
285 /// margin on any side.
286 ///
287 /// Readable | Writable
288 ///
289 ///
290 /// #### `margin-bottom`
291 /// Margin on bottom side of widget.
292 ///
293 /// This property adds margin outside of the widget's normal size
294 /// request, the margin will be added in addition to the size from
295 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
296 ///
297 /// Readable | Writable
298 ///
299 ///
300 /// #### `margin-end`
301 /// Margin on end of widget, horizontally. This property supports
302 /// left-to-right and right-to-left text directions.
303 ///
304 /// This property adds margin outside of the widget's normal size
305 /// request, the margin will be added in addition to the size from
306 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
307 ///
308 /// Readable | Writable
309 ///
310 ///
311 /// #### `margin-left`
312 /// Margin on left side of widget.
313 ///
314 /// This property adds margin outside of the widget's normal size
315 /// request, the margin will be added in addition to the size from
316 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
317 ///
318 /// Readable | Writable
319 ///
320 ///
321 /// #### `margin-right`
322 /// Margin on right side of widget.
323 ///
324 /// This property adds margin outside of the widget's normal size
325 /// request, the margin will be added in addition to the size from
326 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
327 ///
328 /// Readable | Writable
329 ///
330 ///
331 /// #### `margin-start`
332 /// Margin on start of widget, horizontally. This property supports
333 /// left-to-right and right-to-left text directions.
334 ///
335 /// This property adds margin outside of the widget's normal size
336 /// request, the margin will be added in addition to the size from
337 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
338 ///
339 /// Readable | Writable
340 ///
341 ///
342 /// #### `margin-top`
343 /// Margin on top side of widget.
344 ///
345 /// This property adds margin outside of the widget's normal size
346 /// request, the margin will be added in addition to the size from
347 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
348 ///
349 /// Readable | Writable
350 ///
351 ///
352 /// #### `name`
353 /// Readable | Writable
354 ///
355 ///
356 /// #### `no-show-all`
357 /// Readable | Writable
358 ///
359 ///
360 /// #### `opacity`
361 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
362 /// more details about window opacity.
363 ///
364 /// Before 3.8 this was only available in GtkWindow
365 ///
366 /// Readable | Writable
367 ///
368 ///
369 /// #### `parent`
370 /// Readable | Writable
371 ///
372 ///
373 /// #### `receives-default`
374 /// Readable | Writable
375 ///
376 ///
377 /// #### `scale-factor`
378 /// The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
379 /// more details about widget scaling.
380 ///
381 /// Readable
382 ///
383 ///
384 /// #### `sensitive`
385 /// Readable | Writable
386 ///
387 ///
388 /// #### `style`
389 /// The style of the widget, which contains information about how it will look (colors, etc).
390 ///
391 /// Readable | Writable
392 ///
393 ///
394 /// #### `tooltip-markup`
395 /// Sets the text of tooltip to be the given string, which is marked up
396 /// with the [Pango text markup language][PangoMarkupFormat].
397 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
398 ///
399 /// This is a convenience property which will take care of getting the
400 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
401 /// will automatically be set to [`true`] and there will be taken care of
402 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
403 ///
404 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
405 /// are set, the last one wins.
406 ///
407 /// Readable | Writable
408 ///
409 ///
410 /// #### `tooltip-text`
411 /// Sets the text of tooltip to be the given string.
412 ///
413 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
414 ///
415 /// This is a convenience property which will take care of getting the
416 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
417 /// will automatically be set to [`true`] and there will be taken care of
418 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
419 ///
420 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
421 /// are set, the last one wins.
422 ///
423 /// Readable | Writable
424 ///
425 ///
426 /// #### `valign`
427 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
428 ///
429 /// Readable | Writable
430 ///
431 ///
432 /// #### `vexpand`
433 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
434 ///
435 /// Readable | Writable
436 ///
437 ///
438 /// #### `vexpand-set`
439 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
440 ///
441 /// Readable | Writable
442 ///
443 ///
444 /// #### `visible`
445 /// Readable | Writable
446 ///
447 ///
448 /// #### `width-request`
449 /// Readable | Writable
450 ///
451 ///
452 /// #### `window`
453 /// The widget's window if it is realized, [`None`] otherwise.
454 ///
455 /// Readable
456 /// </details>
457 ///
458 /// ## Signals
459 ///
460 ///
461 /// #### `edge-overshot`
462 /// The ::edge-overshot signal is emitted whenever user initiated scrolling
463 /// makes the scrolled window firmly surpass (i.e. with some edge resistance)
464 /// the lower or upper limits defined by the adjustment in that orientation.
465 ///
466 /// A similar behavior without edge resistance is provided by the
467 /// [`edge-reached`][struct@crate::ScrolledWindow#edge-reached] signal.
468 ///
469 /// Note: The `pos` argument is LTR/RTL aware, so callers should be aware too
470 /// if intending to provide behavior on horizontal edges.
471 ///
472 ///
473 ///
474 ///
475 /// #### `edge-reached`
476 /// The ::edge-reached signal is emitted whenever user-initiated scrolling
477 /// makes the scrolled window exactly reach the lower or upper limits
478 /// defined by the adjustment in that orientation.
479 ///
480 /// A similar behavior with edge resistance is provided by the
481 /// [`edge-overshot`][struct@crate::ScrolledWindow#edge-overshot] signal.
482 ///
483 /// Note: The `pos` argument is LTR/RTL aware, so callers should be aware too
484 /// if intending to provide behavior on horizontal edges.
485 ///
486 ///
487 ///
488 ///
489 /// #### `move-focus-out`
490 /// The ::move-focus-out signal is a
491 /// [keybinding signal][GtkBindingSignal] which gets
492 /// emitted when focus is moved away from the scrolled window by a
493 /// keybinding. The [`move-focus`][struct@crate::Widget#move-focus] signal is emitted with
494 /// `direction_type` on this scrolled window’s toplevel parent in the
495 /// container hierarchy. The default bindings for this signal are
496 /// `Ctrl + Tab` to move forward and `Ctrl + Shift + Tab` to move backward.
497 ///
498 /// Action
499 ///
500 ///
501 /// #### `scroll-child`
502 /// The ::scroll-child signal is a
503 /// [keybinding signal][GtkBindingSignal]
504 /// which gets emitted when a keybinding that scrolls is pressed.
505 /// The horizontal or vertical adjustment is updated which triggers a
506 /// signal that the scrolled window’s child may listen to and scroll itself.
507 ///
508 /// Action
509 /// <details><summary><h4>Container</h4></summary>
510 ///
511 ///
512 /// #### `add`
513 ///
514 ///
515 ///
516 /// #### `check-resize`
517 ///
518 ///
519 ///
520 /// #### `remove`
521 ///
522 ///
523 ///
524 /// #### `set-focus-child`
525 ///
526 /// </details>
527 /// <details><summary><h4>Widget</h4></summary>
528 ///
529 ///
530 /// #### `accel-closures-changed`
531 ///
532 ///
533 ///
534 /// #### `button-press-event`
535 /// The ::button-press-event signal will be emitted when a button
536 /// (typically from a mouse) is pressed.
537 ///
538 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
539 /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
540 ///
541 /// This signal will be sent to the grab widget if there is one.
542 ///
543 ///
544 ///
545 ///
546 /// #### `button-release-event`
547 /// The ::button-release-event signal will be emitted when a button
548 /// (typically from a mouse) is released.
549 ///
550 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
551 /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
552 ///
553 /// This signal will be sent to the grab widget if there is one.
554 ///
555 ///
556 ///
557 ///
558 /// #### `can-activate-accel`
559 /// Determines whether an accelerator that activates the signal
560 /// identified by `signal_id` can currently be activated.
561 /// This signal is present to allow applications and derived
562 /// widgets to override the default [`Widget`][crate::Widget] handling
563 /// for determining whether an accelerator can be activated.
564 ///
565 ///
566 ///
567 ///
568 /// #### `child-notify`
569 /// The ::child-notify signal is emitted for each
570 /// [child property][child-properties] that has
571 /// changed on an object. The signal's detail holds the property name.
572 ///
573 /// Detailed
574 ///
575 ///
576 /// #### `composited-changed`
577 /// The ::composited-changed signal is emitted when the composited
578 /// status of `widgets` screen changes.
579 /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
580 ///
581 /// Action
582 ///
583 ///
584 /// #### `configure-event`
585 /// The ::configure-event signal will be emitted when the size, position or
586 /// stacking of the `widget`'s window has changed.
587 ///
588 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
589 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
590 /// automatically for all new windows.
591 ///
592 ///
593 ///
594 ///
595 /// #### `damage-event`
596 /// Emitted when a redirected window belonging to `widget` gets drawn into.
597 /// The region/area members of the event shows what area of the redirected
598 /// drawable was drawn into.
599 ///
600 ///
601 ///
602 ///
603 /// #### `delete-event`
604 /// The ::delete-event signal is emitted if a user requests that
605 /// a toplevel window is closed. The default handler for this signal
606 /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
607 /// this signal will cause the window to be hidden instead, so that
608 /// it can later be shown again without reconstructing it.
609 ///
610 ///
611 ///
612 ///
613 /// #### `destroy`
614 /// Signals that all holders of a reference to the widget should release
615 /// the reference that they hold. May result in finalization of the widget
616 /// if all references are released.
617 ///
618 /// This signal is not suitable for saving widget state.
619 ///
620 ///
621 ///
622 ///
623 /// #### `destroy-event`
624 /// The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
625 /// You rarely get this signal, because most widgets disconnect themselves
626 /// from their window before they destroy it, so no widget owns the
627 /// window at destroy time.
628 ///
629 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
630 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
631 /// automatically for all new windows.
632 ///
633 ///
634 ///
635 ///
636 /// #### `direction-changed`
637 /// The ::direction-changed signal is emitted when the text direction
638 /// of a widget changes.
639 ///
640 ///
641 ///
642 ///
643 /// #### `drag-begin`
644 /// The ::drag-begin signal is emitted on the drag source when a drag is
645 /// started. A typical reason to connect to this signal is to set up a
646 /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
647 ///
648 /// Note that some widgets set up a drag icon in the default handler of
649 /// this signal, so you may have to use `g_signal_connect_after()` to
650 /// override what the default handler did.
651 ///
652 ///
653 ///
654 ///
655 /// #### `drag-data-delete`
656 /// The ::drag-data-delete signal is emitted on the drag source when a drag
657 /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
658 /// handler is responsible for deleting the data that has been dropped. What
659 /// "delete" means depends on the context of the drag operation.
660 ///
661 ///
662 ///
663 ///
664 /// #### `drag-data-get`
665 /// The ::drag-data-get signal is emitted on the drag source when the drop
666 /// site requests the data which is dragged. It is the responsibility of
667 /// the signal handler to fill `data` with the data in the format which
668 /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
669 /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
670 ///
671 ///
672 ///
673 ///
674 /// #### `drag-data-received`
675 /// format == 8))
676 /// {
677 /// GdkDragAction action;
678 ///
679 /// // handle data here
680 ///
681 /// action = gdk_drag_context_get_selected_action (context);
682 /// if (action == GDK_ACTION_ASK)
683 /// {
684 /// GtkWidget *dialog;
685 /// gint response;
686 ///
687 /// dialog = gtk_message_dialog_new (NULL,
688 /// GTK_DIALOG_MODAL |
689 /// GTK_DIALOG_DESTROY_WITH_PARENT,
690 /// GTK_MESSAGE_INFO,
691 /// GTK_BUTTONS_YES_NO,
692 /// "Move the data ?\n");
693 /// response = gtk_dialog_run (GTK_DIALOG (dialog));
694 /// gtk_widget_destroy (dialog);
695 ///
696 /// if (response == GTK_RESPONSE_YES)
697 /// action = GDK_ACTION_MOVE;
698 /// else
699 /// action = GDK_ACTION_COPY;
700 /// }
701 ///
702 /// gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
703 /// }
704 /// else
705 /// gtk_drag_finish (context, FALSE, FALSE, time);
706 /// }
707 /// ]|
708 ///
709 ///
710 ///
711 ///
712 /// #### `drag-drop`
713 /// The ::drag-drop signal is emitted on the drop site when the user drops
714 /// the data onto the widget. The signal handler must determine whether
715 /// the cursor position is in a drop zone or not. If it is not in a drop
716 /// zone, it returns [`false`] and no further processing is necessary.
717 /// Otherwise, the handler returns [`true`]. In this case, the handler must
718 /// ensure that `gtk_drag_finish()` is called to let the source know that
719 /// the drop is done. The call to `gtk_drag_finish()` can be done either
720 /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
721 /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
722 /// or more of the supported targets.
723 ///
724 ///
725 ///
726 ///
727 /// #### `drag-end`
728 /// The ::drag-end signal is emitted on the drag source when a drag is
729 /// finished. A typical reason to connect to this signal is to undo
730 /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
731 ///
732 ///
733 ///
734 ///
735 /// #### `drag-failed`
736 /// The ::drag-failed signal is emitted on the drag source when a drag has
737 /// failed. The signal handler may hook custom code to handle a failed DnD
738 /// operation based on the type of error, it returns [`true`] is the failure has
739 /// been already handled (not showing the default "drag operation failed"
740 /// animation), otherwise it returns [`false`].
741 ///
742 ///
743 ///
744 ///
745 /// #### `drag-leave`
746 /// The ::drag-leave signal is emitted on the drop site when the cursor
747 /// leaves the widget. A typical reason to connect to this signal is to
748 /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
749 /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
750 ///
751 ///
752 /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
753 /// ::drag-drop signal, for instance to allow cleaning up of a preview item
754 /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
755 ///
756 ///
757 ///
758 ///
759 /// #### `drag-motion`
760 /// suggested_action,
761 /// time);
762 /// }
763 /// else
764 /// {
765 /// // accept the drop
766 /// }
767 /// }
768 /// ]|
769 ///
770 ///
771 ///
772 ///
773 /// #### `draw`
774 /// This signal is emitted when a widget is supposed to render itself.
775 /// The `widget`'s top left corner must be painted at the origin of
776 /// the passed in context and be sized to the values returned by
777 /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
778 /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
779 ///
780 /// Signal handlers connected to this signal can modify the cairo
781 /// context passed as `cr` in any way they like and don't need to
782 /// restore it. The signal emission takes care of calling `cairo_save()`
783 /// before and `cairo_restore()` after invoking the handler.
784 ///
785 /// The signal handler will get a `cr` with a clip region already set to the
786 /// widget's dirty region, i.e. to the area that needs repainting. Complicated
787 /// widgets that want to avoid redrawing themselves completely can get the full
788 /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
789 /// get a finer-grained representation of the dirty region with
790 /// `cairo_copy_clip_rectangle_list()`.
791 ///
792 ///
793 ///
794 ///
795 /// #### `enter-notify-event`
796 /// The ::enter-notify-event will be emitted when the pointer enters
797 /// the `widget`'s window.
798 ///
799 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
800 /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
801 ///
802 /// This signal will be sent to the grab widget if there is one.
803 ///
804 ///
805 ///
806 ///
807 /// #### `event`
808 /// The GTK+ main loop will emit three signals for each GDK event delivered
809 /// to a widget: one generic ::event signal, another, more specific,
810 /// signal that matches the type of event delivered (e.g.
811 /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
812 /// [`event-after`][struct@crate::Widget#event-after] signal.
813 ///
814 ///
815 ///
816 ///
817 /// #### `event-after`
818 /// After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
819 /// the second more specific signal, ::event-after will be emitted
820 /// regardless of the previous two signals handlers return values.
821 ///
822 ///
823 ///
824 ///
825 /// #### `focus`
826 ///
827 ///
828 ///
829 /// #### `focus-in-event`
830 /// The ::focus-in-event signal will be emitted when the keyboard focus
831 /// enters the `widget`'s window.
832 ///
833 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
834 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
835 ///
836 ///
837 ///
838 ///
839 /// #### `focus-out-event`
840 /// The ::focus-out-event signal will be emitted when the keyboard focus
841 /// leaves the `widget`'s window.
842 ///
843 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
844 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
845 ///
846 ///
847 ///
848 ///
849 /// #### `grab-broken-event`
850 /// Emitted when a pointer or keyboard grab on a window belonging
851 /// to `widget` gets broken.
852 ///
853 /// On X11, this happens when the grab window becomes unviewable
854 /// (i.e. it or one of its ancestors is unmapped), or if the same
855 /// application grabs the pointer or keyboard again.
856 ///
857 ///
858 ///
859 ///
860 /// #### `grab-focus`
861 /// Action
862 ///
863 ///
864 /// #### `grab-notify`
865 /// The ::grab-notify signal is emitted when a widget becomes
866 /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
867 /// another widget, or when it becomes unshadowed due to a grab
868 /// being removed.
869 ///
870 /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
871 /// grab widget in the grab stack of its window group is not
872 /// its ancestor.
873 ///
874 ///
875 ///
876 ///
877 /// #### `hide`
878 /// The ::hide signal is emitted when `widget` is hidden, for example with
879 /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
880 ///
881 ///
882 ///
883 ///
884 /// #### `hierarchy-changed`
885 /// The ::hierarchy-changed signal is emitted when the
886 /// anchored state of a widget changes. A widget is
887 /// “anchored” when its toplevel
888 /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
889 /// a widget changes from un-anchored to anchored or vice-versa.
890 ///
891 ///
892 ///
893 ///
894 /// #### `key-press-event`
895 /// The ::key-press-event signal is emitted when a key is pressed. The signal
896 /// emission will reoccur at the key-repeat rate when the key is kept pressed.
897 ///
898 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
899 /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
900 ///
901 /// This signal will be sent to the grab widget if there is one.
902 ///
903 ///
904 ///
905 ///
906 /// #### `key-release-event`
907 /// The ::key-release-event signal is emitted when a key is released.
908 ///
909 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
910 /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
911 ///
912 /// This signal will be sent to the grab widget if there is one.
913 ///
914 ///
915 ///
916 ///
917 /// #### `keynav-failed`
918 /// Gets emitted if keyboard navigation fails.
919 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
920 ///
921 ///
922 ///
923 ///
924 /// #### `leave-notify-event`
925 /// The ::leave-notify-event will be emitted when the pointer leaves
926 /// the `widget`'s window.
927 ///
928 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
929 /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
930 ///
931 /// This signal will be sent to the grab widget if there is one.
932 ///
933 ///
934 ///
935 ///
936 /// #### `map`
937 /// The ::map signal is emitted when `widget` is going to be mapped, that is
938 /// when the widget is visible (which is controlled with
939 /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
940 /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
941 /// be emitted.
942 ///
943 /// The ::map signal can be used to determine whether a widget will be drawn,
944 /// for instance it can resume an animation that was stopped during the
945 /// emission of [`unmap`][struct@crate::Widget#unmap].
946 ///
947 ///
948 ///
949 ///
950 /// #### `map-event`
951 /// The ::map-event signal will be emitted when the `widget`'s window is
952 /// mapped. A window is mapped when it becomes visible on the screen.
953 ///
954 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
955 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
956 /// automatically for all new windows.
957 ///
958 ///
959 ///
960 ///
961 /// #### `mnemonic-activate`
962 /// The default handler for this signal activates `widget` if `group_cycling`
963 /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
964 ///
965 ///
966 ///
967 ///
968 /// #### `motion-notify-event`
969 /// The ::motion-notify-event signal is emitted when the pointer moves
970 /// over the widget's [`gdk::Window`][crate::gdk::Window].
971 ///
972 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
973 /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
974 ///
975 /// This signal will be sent to the grab widget if there is one.
976 ///
977 ///
978 ///
979 ///
980 /// #### `move-focus`
981 /// Action
982 ///
983 ///
984 /// #### `parent-set`
985 /// The ::parent-set signal is emitted when a new parent
986 /// has been set on a widget.
987 ///
988 ///
989 ///
990 ///
991 /// #### `popup-menu`
992 /// This signal gets emitted whenever a widget should pop up a context
993 /// menu. This usually happens through the standard key binding mechanism;
994 /// by pressing a certain key while a widget is focused, the user can cause
995 /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
996 /// a menu with clipboard commands. See the
997 /// [Popup Menu Migration Checklist][checklist-popup-menu]
998 /// for an example of how to use this signal.
999 ///
1000 /// Action
1001 ///
1002 ///
1003 /// #### `property-notify-event`
1004 /// The ::property-notify-event signal will be emitted when a property on
1005 /// the `widget`'s window has been changed or deleted.
1006 ///
1007 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1008 /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
1009 ///
1010 ///
1011 ///
1012 ///
1013 /// #### `proximity-in-event`
1014 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1015 /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
1016 ///
1017 /// This signal will be sent to the grab widget if there is one.
1018 ///
1019 ///
1020 ///
1021 ///
1022 /// #### `proximity-out-event`
1023 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1024 /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
1025 ///
1026 /// This signal will be sent to the grab widget if there is one.
1027 ///
1028 ///
1029 ///
1030 ///
1031 /// #### `query-tooltip`
1032 /// Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
1033 /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
1034 /// focus in keyboard mode.
1035 ///
1036 /// Using the given coordinates, the signal handler should determine
1037 /// whether a tooltip should be shown for `widget`. If this is the case
1038 /// [`true`] should be returned, [`false`] otherwise. Note that if
1039 /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
1040 /// should not be used.
1041 ///
1042 /// The signal handler is free to manipulate `tooltip` with the therefore
1043 /// destined function calls.
1044 ///
1045 ///
1046 ///
1047 ///
1048 /// #### `realize`
1049 /// The ::realize signal is emitted when `widget` is associated with a
1050 /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
1051 /// widget has been mapped (that is, it is going to be drawn).
1052 ///
1053 ///
1054 ///
1055 ///
1056 /// #### `screen-changed`
1057 /// The ::screen-changed signal gets emitted when the
1058 /// screen of a widget has changed.
1059 ///
1060 ///
1061 ///
1062 ///
1063 /// #### `scroll-event`
1064 /// The ::scroll-event signal is emitted when a button in the 4 to 7
1065 /// range is pressed. Wheel mice are usually configured to generate
1066 /// button press events for buttons 4 and 5 when the wheel is turned.
1067 ///
1068 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1069 /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
1070 ///
1071 /// This signal will be sent to the grab widget if there is one.
1072 ///
1073 ///
1074 ///
1075 ///
1076 /// #### `selection-clear-event`
1077 /// The ::selection-clear-event signal will be emitted when the
1078 /// the `widget`'s window has lost ownership of a selection.
1079 ///
1080 ///
1081 ///
1082 ///
1083 /// #### `selection-get`
1084 ///
1085 ///
1086 ///
1087 /// #### `selection-notify-event`
1088 ///
1089 ///
1090 ///
1091 /// #### `selection-received`
1092 ///
1093 ///
1094 ///
1095 /// #### `selection-request-event`
1096 /// The ::selection-request-event signal will be emitted when
1097 /// another client requests ownership of the selection owned by
1098 /// the `widget`'s window.
1099 ///
1100 ///
1101 ///
1102 ///
1103 /// #### `show`
1104 /// The ::show signal is emitted when `widget` is shown, for example with
1105 /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
1106 ///
1107 ///
1108 ///
1109 ///
1110 /// #### `show-help`
1111 /// Action
1112 ///
1113 ///
1114 /// #### `size-allocate`
1115 ///
1116 ///
1117 ///
1118 /// #### `state-changed`
1119 /// The ::state-changed signal is emitted when the widget state changes.
1120 /// See `gtk_widget_get_state()`.
1121 ///
1122 ///
1123 ///
1124 ///
1125 /// #### `state-flags-changed`
1126 /// The ::state-flags-changed signal is emitted when the widget state
1127 /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
1128 ///
1129 ///
1130 ///
1131 ///
1132 /// #### `style-set`
1133 /// The ::style-set signal is emitted when a new style has been set
1134 /// on a widget. Note that style-modifying functions like
1135 /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1136 ///
1137 /// Note that this signal is emitted for changes to the deprecated
1138 /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1139 /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1140 ///
1141 ///
1142 ///
1143 ///
1144 /// #### `style-updated`
1145 /// The ::style-updated signal is a convenience signal that is emitted when the
1146 /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1147 /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1148 ///
1149 /// Note that style-modifying functions like `gtk_widget_override_color()` also
1150 /// cause this signal to be emitted.
1151 ///
1152 ///
1153 ///
1154 ///
1155 /// #### `touch-event`
1156 ///
1157 ///
1158 ///
1159 /// #### `unmap`
1160 /// The ::unmap signal is emitted when `widget` is going to be unmapped, which
1161 /// means that either it or any of its parents up to the toplevel widget have
1162 /// been set as hidden.
1163 ///
1164 /// As ::unmap indicates that a widget will not be shown any longer, it can be
1165 /// used to, for example, stop an animation on the widget.
1166 ///
1167 ///
1168 ///
1169 ///
1170 /// #### `unmap-event`
1171 /// The ::unmap-event signal will be emitted when the `widget`'s window is
1172 /// unmapped. A window is unmapped when it becomes invisible on the screen.
1173 ///
1174 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1175 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1176 /// automatically for all new windows.
1177 ///
1178 ///
1179 ///
1180 ///
1181 /// #### `unrealize`
1182 /// The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1183 /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1184 /// called or the widget has been unmapped (that is, it is going to be
1185 /// hidden).
1186 ///
1187 ///
1188 ///
1189 ///
1190 /// #### `visibility-notify-event`
1191 /// The ::visibility-notify-event will be emitted when the `widget`'s
1192 /// window is obscured or unobscured.
1193 ///
1194 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1195 /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1196 ///
1197 ///
1198 ///
1199 ///
1200 /// #### `window-state-event`
1201 /// The ::window-state-event will be emitted when the state of the
1202 /// toplevel window associated to the `widget` changes.
1203 ///
1204 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1205 /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1206 /// this mask automatically for all new windows.
1207 ///
1208 ///
1209 /// </details>
1210 ///
1211 /// # Implements
1212 ///
1213 /// [`ScrolledWindowExt`][trait@crate::prelude::ScrolledWindowExt], [`BinExt`][trait@crate::prelude::BinExt], [`ContainerExt`][trait@crate::prelude::ContainerExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ContainerExtManual`][trait@crate::prelude::ContainerExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
1214 #[doc(alias = "GtkScrolledWindow")]
1215 pub struct ScrolledWindow(Object<ffi::GtkScrolledWindow, ffi::GtkScrolledWindowClass>) @extends Bin, Container, Widget, @implements Buildable;
1216
1217 match fn {
1218 type_ => || ffi::gtk_scrolled_window_get_type(),
1219 }
1220}
1221
1222impl ScrolledWindow {
1223 pub const NONE: Option<&'static ScrolledWindow> = None;
1224
1225 /// Creates a new scrolled window.
1226 ///
1227 /// The two arguments are the scrolled window’s adjustments; these will be
1228 /// shared with the scrollbars and the child widget to keep the bars in sync
1229 /// with the child. Usually you want to pass [`None`] for the adjustments, which
1230 /// will cause the scrolled window to create them for you.
1231 /// ## `hadjustment`
1232 /// horizontal adjustment
1233 /// ## `vadjustment`
1234 /// vertical adjustment
1235 ///
1236 /// # Returns
1237 ///
1238 /// a new scrolled window
1239 #[doc(alias = "gtk_scrolled_window_new")]
1240 pub fn new(
1241 hadjustment: Option<&impl IsA<Adjustment>>,
1242 vadjustment: Option<&impl IsA<Adjustment>>,
1243 ) -> ScrolledWindow {
1244 assert_initialized_main_thread!();
1245 unsafe {
1246 Widget::from_glib_none(ffi::gtk_scrolled_window_new(
1247 hadjustment.map(|p| p.as_ref()).to_glib_none().0,
1248 vadjustment.map(|p| p.as_ref()).to_glib_none().0,
1249 ))
1250 .unsafe_cast()
1251 }
1252 }
1253
1254 // rustdoc-stripper-ignore-next
1255 /// Creates a new builder-pattern struct instance to construct [`ScrolledWindow`] objects.
1256 ///
1257 /// This method returns an instance of [`ScrolledWindowBuilder`](crate::builders::ScrolledWindowBuilder) which can be used to create [`ScrolledWindow`] objects.
1258 pub fn builder() -> ScrolledWindowBuilder {
1259 ScrolledWindowBuilder::new()
1260 }
1261}
1262
1263impl Default for ScrolledWindow {
1264 fn default() -> Self {
1265 glib::object::Object::new::<Self>()
1266 }
1267}
1268
1269// rustdoc-stripper-ignore-next
1270/// A [builder-pattern] type to construct [`ScrolledWindow`] objects.
1271///
1272/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1273#[must_use = "The builder must be built to be used"]
1274pub struct ScrolledWindowBuilder {
1275 builder: glib::object::ObjectBuilder<'static, ScrolledWindow>,
1276}
1277
1278impl ScrolledWindowBuilder {
1279 fn new() -> Self {
1280 Self {
1281 builder: glib::object::Object::builder(),
1282 }
1283 }
1284
1285 pub fn hadjustment(self, hadjustment: &impl IsA<Adjustment>) -> Self {
1286 Self {
1287 builder: self
1288 .builder
1289 .property("hadjustment", hadjustment.clone().upcast()),
1290 }
1291 }
1292
1293 pub fn hscrollbar_policy(self, hscrollbar_policy: PolicyType) -> Self {
1294 Self {
1295 builder: self
1296 .builder
1297 .property("hscrollbar-policy", hscrollbar_policy),
1298 }
1299 }
1300
1301 /// Whether kinetic scrolling is enabled or not. Kinetic scrolling
1302 /// only applies to devices with source `GDK_SOURCE_TOUCHSCREEN`.
1303 pub fn kinetic_scrolling(self, kinetic_scrolling: bool) -> Self {
1304 Self {
1305 builder: self
1306 .builder
1307 .property("kinetic-scrolling", kinetic_scrolling),
1308 }
1309 }
1310
1311 /// The maximum content height of `scrolled_window`, or -1 if not set.
1312 pub fn max_content_height(self, max_content_height: i32) -> Self {
1313 Self {
1314 builder: self
1315 .builder
1316 .property("max-content-height", max_content_height),
1317 }
1318 }
1319
1320 /// The maximum content width of `scrolled_window`, or -1 if not set.
1321 pub fn max_content_width(self, max_content_width: i32) -> Self {
1322 Self {
1323 builder: self
1324 .builder
1325 .property("max-content-width", max_content_width),
1326 }
1327 }
1328
1329 /// The minimum content height of `scrolled_window`, or -1 if not set.
1330 pub fn min_content_height(self, min_content_height: i32) -> Self {
1331 Self {
1332 builder: self
1333 .builder
1334 .property("min-content-height", min_content_height),
1335 }
1336 }
1337
1338 /// The minimum content width of `scrolled_window`, or -1 if not set.
1339 pub fn min_content_width(self, min_content_width: i32) -> Self {
1340 Self {
1341 builder: self
1342 .builder
1343 .property("min-content-width", min_content_width),
1344 }
1345 }
1346
1347 /// Whether overlay scrolling is enabled or not. If it is, the
1348 /// scrollbars are only added as traditional widgets when a mouse
1349 /// is present. Otherwise, they are overlayed on top of the content,
1350 /// as narrow indicators.
1351 ///
1352 /// Note that overlay scrolling can also be globally disabled, with
1353 /// the [`gtk-overlay-scrolling`][struct@crate::Settings#gtk-overlay-scrolling] setting.
1354 pub fn overlay_scrolling(self, overlay_scrolling: bool) -> Self {
1355 Self {
1356 builder: self
1357 .builder
1358 .property("overlay-scrolling", overlay_scrolling),
1359 }
1360 }
1361
1362 /// Whether the natural height of the child should be calculated and propagated
1363 /// through the scrolled window’s requested natural height.
1364 ///
1365 /// This is useful in cases where an attempt should be made to allocate exactly
1366 /// enough space for the natural size of the child.
1367 pub fn propagate_natural_height(self, propagate_natural_height: bool) -> Self {
1368 Self {
1369 builder: self
1370 .builder
1371 .property("propagate-natural-height", propagate_natural_height),
1372 }
1373 }
1374
1375 /// Whether the natural width of the child should be calculated and propagated
1376 /// through the scrolled window’s requested natural width.
1377 ///
1378 /// This is useful in cases where an attempt should be made to allocate exactly
1379 /// enough space for the natural size of the child.
1380 pub fn propagate_natural_width(self, propagate_natural_width: bool) -> Self {
1381 Self {
1382 builder: self
1383 .builder
1384 .property("propagate-natural-width", propagate_natural_width),
1385 }
1386 }
1387
1388 pub fn shadow_type(self, shadow_type: ShadowType) -> Self {
1389 Self {
1390 builder: self.builder.property("shadow-type", shadow_type),
1391 }
1392 }
1393
1394 pub fn vadjustment(self, vadjustment: &impl IsA<Adjustment>) -> Self {
1395 Self {
1396 builder: self
1397 .builder
1398 .property("vadjustment", vadjustment.clone().upcast()),
1399 }
1400 }
1401
1402 pub fn vscrollbar_policy(self, vscrollbar_policy: PolicyType) -> Self {
1403 Self {
1404 builder: self
1405 .builder
1406 .property("vscrollbar-policy", vscrollbar_policy),
1407 }
1408 }
1409
1410 pub fn window_placement(self, window_placement: CornerType) -> Self {
1411 Self {
1412 builder: self.builder.property("window-placement", window_placement),
1413 }
1414 }
1415
1416 pub fn border_width(self, border_width: u32) -> Self {
1417 Self {
1418 builder: self.builder.property("border-width", border_width),
1419 }
1420 }
1421
1422 pub fn child(self, child: &impl IsA<Widget>) -> Self {
1423 Self {
1424 builder: self.builder.property("child", child.clone().upcast()),
1425 }
1426 }
1427
1428 pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
1429 Self {
1430 builder: self.builder.property("resize-mode", resize_mode),
1431 }
1432 }
1433
1434 pub fn app_paintable(self, app_paintable: bool) -> Self {
1435 Self {
1436 builder: self.builder.property("app-paintable", app_paintable),
1437 }
1438 }
1439
1440 pub fn can_default(self, can_default: bool) -> Self {
1441 Self {
1442 builder: self.builder.property("can-default", can_default),
1443 }
1444 }
1445
1446 pub fn can_focus(self, can_focus: bool) -> Self {
1447 Self {
1448 builder: self.builder.property("can-focus", can_focus),
1449 }
1450 }
1451
1452 pub fn events(self, events: gdk::EventMask) -> Self {
1453 Self {
1454 builder: self.builder.property("events", events),
1455 }
1456 }
1457
1458 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1459 pub fn expand(self, expand: bool) -> Self {
1460 Self {
1461 builder: self.builder.property("expand", expand),
1462 }
1463 }
1464
1465 /// Whether the widget should grab focus when it is clicked with the mouse.
1466 ///
1467 /// This property is only relevant for widgets that can take focus.
1468 ///
1469 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1470 /// GtkComboBox) implemented this property individually.
1471 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1472 Self {
1473 builder: self.builder.property("focus-on-click", focus_on_click),
1474 }
1475 }
1476
1477 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1478 pub fn halign(self, halign: Align) -> Self {
1479 Self {
1480 builder: self.builder.property("halign", halign),
1481 }
1482 }
1483
1484 pub fn has_default(self, has_default: bool) -> Self {
1485 Self {
1486 builder: self.builder.property("has-default", has_default),
1487 }
1488 }
1489
1490 pub fn has_focus(self, has_focus: bool) -> Self {
1491 Self {
1492 builder: self.builder.property("has-focus", has_focus),
1493 }
1494 }
1495
1496 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1497 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1498 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1499 /// whether it will provide a tooltip or not.
1500 ///
1501 /// Note that setting this property to [`true`] for the first time will change
1502 /// the event masks of the GdkWindows of this widget to include leave-notify
1503 /// and motion-notify events. This cannot and will not be undone when the
1504 /// property is set to [`false`] again.
1505 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1506 Self {
1507 builder: self.builder.property("has-tooltip", has_tooltip),
1508 }
1509 }
1510
1511 pub fn height_request(self, height_request: i32) -> Self {
1512 Self {
1513 builder: self.builder.property("height-request", height_request),
1514 }
1515 }
1516
1517 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1518 pub fn hexpand(self, hexpand: bool) -> Self {
1519 Self {
1520 builder: self.builder.property("hexpand", hexpand),
1521 }
1522 }
1523
1524 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1525 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1526 Self {
1527 builder: self.builder.property("hexpand-set", hexpand_set),
1528 }
1529 }
1530
1531 pub fn is_focus(self, is_focus: bool) -> Self {
1532 Self {
1533 builder: self.builder.property("is-focus", is_focus),
1534 }
1535 }
1536
1537 /// Sets all four sides' margin at once. If read, returns max
1538 /// margin on any side.
1539 pub fn margin(self, margin: i32) -> Self {
1540 Self {
1541 builder: self.builder.property("margin", margin),
1542 }
1543 }
1544
1545 /// Margin on bottom side of widget.
1546 ///
1547 /// This property adds margin outside of the widget's normal size
1548 /// request, the margin will be added in addition to the size from
1549 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1550 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1551 Self {
1552 builder: self.builder.property("margin-bottom", margin_bottom),
1553 }
1554 }
1555
1556 /// Margin on end of widget, horizontally. This property supports
1557 /// left-to-right and right-to-left text directions.
1558 ///
1559 /// This property adds margin outside of the widget's normal size
1560 /// request, the margin will be added in addition to the size from
1561 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1562 pub fn margin_end(self, margin_end: i32) -> Self {
1563 Self {
1564 builder: self.builder.property("margin-end", margin_end),
1565 }
1566 }
1567
1568 /// Margin on start of widget, horizontally. This property supports
1569 /// left-to-right and right-to-left text directions.
1570 ///
1571 /// This property adds margin outside of the widget's normal size
1572 /// request, the margin will be added in addition to the size from
1573 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1574 pub fn margin_start(self, margin_start: i32) -> Self {
1575 Self {
1576 builder: self.builder.property("margin-start", margin_start),
1577 }
1578 }
1579
1580 /// Margin on top side of widget.
1581 ///
1582 /// This property adds margin outside of the widget's normal size
1583 /// request, the margin will be added in addition to the size from
1584 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1585 pub fn margin_top(self, margin_top: i32) -> Self {
1586 Self {
1587 builder: self.builder.property("margin-top", margin_top),
1588 }
1589 }
1590
1591 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1592 Self {
1593 builder: self.builder.property("name", name.into()),
1594 }
1595 }
1596
1597 pub fn no_show_all(self, no_show_all: bool) -> Self {
1598 Self {
1599 builder: self.builder.property("no-show-all", no_show_all),
1600 }
1601 }
1602
1603 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1604 /// more details about window opacity.
1605 ///
1606 /// Before 3.8 this was only available in GtkWindow
1607 pub fn opacity(self, opacity: f64) -> Self {
1608 Self {
1609 builder: self.builder.property("opacity", opacity),
1610 }
1611 }
1612
1613 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1614 Self {
1615 builder: self.builder.property("parent", parent.clone().upcast()),
1616 }
1617 }
1618
1619 pub fn receives_default(self, receives_default: bool) -> Self {
1620 Self {
1621 builder: self.builder.property("receives-default", receives_default),
1622 }
1623 }
1624
1625 pub fn sensitive(self, sensitive: bool) -> Self {
1626 Self {
1627 builder: self.builder.property("sensitive", sensitive),
1628 }
1629 }
1630
1631 /// Sets the text of tooltip to be the given string, which is marked up
1632 /// with the [Pango text markup language][PangoMarkupFormat].
1633 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1634 ///
1635 /// This is a convenience property which will take care of getting the
1636 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1637 /// will automatically be set to [`true`] and there will be taken care of
1638 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1639 ///
1640 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1641 /// are set, the last one wins.
1642 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1643 Self {
1644 builder: self
1645 .builder
1646 .property("tooltip-markup", tooltip_markup.into()),
1647 }
1648 }
1649
1650 /// Sets the text of tooltip to be the given string.
1651 ///
1652 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1653 ///
1654 /// This is a convenience property which will take care of getting the
1655 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1656 /// will automatically be set to [`true`] and there will be taken care of
1657 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1658 ///
1659 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1660 /// are set, the last one wins.
1661 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1662 Self {
1663 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1664 }
1665 }
1666
1667 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1668 pub fn valign(self, valign: Align) -> Self {
1669 Self {
1670 builder: self.builder.property("valign", valign),
1671 }
1672 }
1673
1674 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1675 pub fn vexpand(self, vexpand: bool) -> Self {
1676 Self {
1677 builder: self.builder.property("vexpand", vexpand),
1678 }
1679 }
1680
1681 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1682 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1683 Self {
1684 builder: self.builder.property("vexpand-set", vexpand_set),
1685 }
1686 }
1687
1688 pub fn visible(self, visible: bool) -> Self {
1689 Self {
1690 builder: self.builder.property("visible", visible),
1691 }
1692 }
1693
1694 pub fn width_request(self, width_request: i32) -> Self {
1695 Self {
1696 builder: self.builder.property("width-request", width_request),
1697 }
1698 }
1699
1700 // rustdoc-stripper-ignore-next
1701 /// Build the [`ScrolledWindow`].
1702 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1703 pub fn build(self) -> ScrolledWindow {
1704 assert_initialized_main_thread!();
1705 self.builder.build()
1706 }
1707}
1708
1709/// Trait containing all [`struct@ScrolledWindow`] methods.
1710///
1711/// # Implementors
1712///
1713/// [`PlacesSidebar`][struct@crate::PlacesSidebar], [`ScrolledWindow`][struct@crate::ScrolledWindow]
1714pub trait ScrolledWindowExt: IsA<ScrolledWindow> + 'static {
1715 /// Return whether button presses are captured during kinetic
1716 /// scrolling. See [`set_capture_button_press()`][Self::set_capture_button_press()].
1717 ///
1718 /// # Returns
1719 ///
1720 /// [`true`] if button presses are captured during kinetic scrolling
1721 #[doc(alias = "gtk_scrolled_window_get_capture_button_press")]
1722 #[doc(alias = "get_capture_button_press")]
1723 fn is_capture_button_press(&self) -> bool {
1724 unsafe {
1725 from_glib(ffi::gtk_scrolled_window_get_capture_button_press(
1726 self.as_ref().to_glib_none().0,
1727 ))
1728 }
1729 }
1730
1731 /// Returns the horizontal scrollbar’s adjustment, used to connect the
1732 /// horizontal scrollbar to the child widget’s horizontal scroll
1733 /// functionality.
1734 ///
1735 /// # Returns
1736 ///
1737 /// the horizontal [`Adjustment`][crate::Adjustment]
1738 #[doc(alias = "gtk_scrolled_window_get_hadjustment")]
1739 #[doc(alias = "get_hadjustment")]
1740 fn hadjustment(&self) -> Adjustment {
1741 unsafe {
1742 from_glib_none(ffi::gtk_scrolled_window_get_hadjustment(
1743 self.as_ref().to_glib_none().0,
1744 ))
1745 }
1746 }
1747
1748 /// Returns the horizontal scrollbar of `self`.
1749 ///
1750 /// # Returns
1751 ///
1752 /// the horizontal scrollbar of the scrolled window.
1753 #[doc(alias = "gtk_scrolled_window_get_hscrollbar")]
1754 #[doc(alias = "get_hscrollbar")]
1755 fn hscrollbar(&self) -> Option<Widget> {
1756 unsafe {
1757 from_glib_none(ffi::gtk_scrolled_window_get_hscrollbar(
1758 self.as_ref().to_glib_none().0,
1759 ))
1760 }
1761 }
1762
1763 /// Returns the specified kinetic scrolling behavior.
1764 ///
1765 /// # Returns
1766 ///
1767 /// the scrolling behavior flags.
1768 #[doc(alias = "gtk_scrolled_window_get_kinetic_scrolling")]
1769 #[doc(alias = "get_kinetic_scrolling")]
1770 #[doc(alias = "kinetic-scrolling")]
1771 fn is_kinetic_scrolling(&self) -> bool {
1772 unsafe {
1773 from_glib(ffi::gtk_scrolled_window_get_kinetic_scrolling(
1774 self.as_ref().to_glib_none().0,
1775 ))
1776 }
1777 }
1778
1779 /// Returns the maximum content height set.
1780 ///
1781 /// # Returns
1782 ///
1783 /// the maximum content height, or -1
1784 #[doc(alias = "gtk_scrolled_window_get_max_content_height")]
1785 #[doc(alias = "get_max_content_height")]
1786 #[doc(alias = "max-content-height")]
1787 fn max_content_height(&self) -> i32 {
1788 unsafe { ffi::gtk_scrolled_window_get_max_content_height(self.as_ref().to_glib_none().0) }
1789 }
1790
1791 /// Returns the maximum content width set.
1792 ///
1793 /// # Returns
1794 ///
1795 /// the maximum content width, or -1
1796 #[doc(alias = "gtk_scrolled_window_get_max_content_width")]
1797 #[doc(alias = "get_max_content_width")]
1798 #[doc(alias = "max-content-width")]
1799 fn max_content_width(&self) -> i32 {
1800 unsafe { ffi::gtk_scrolled_window_get_max_content_width(self.as_ref().to_glib_none().0) }
1801 }
1802
1803 /// Gets the minimal content height of `self`, or -1 if not set.
1804 ///
1805 /// # Returns
1806 ///
1807 /// the minimal content height
1808 #[doc(alias = "gtk_scrolled_window_get_min_content_height")]
1809 #[doc(alias = "get_min_content_height")]
1810 #[doc(alias = "min-content-height")]
1811 fn min_content_height(&self) -> i32 {
1812 unsafe { ffi::gtk_scrolled_window_get_min_content_height(self.as_ref().to_glib_none().0) }
1813 }
1814
1815 /// Gets the minimum content width of `self`, or -1 if not set.
1816 ///
1817 /// # Returns
1818 ///
1819 /// the minimum content width
1820 #[doc(alias = "gtk_scrolled_window_get_min_content_width")]
1821 #[doc(alias = "get_min_content_width")]
1822 #[doc(alias = "min-content-width")]
1823 fn min_content_width(&self) -> i32 {
1824 unsafe { ffi::gtk_scrolled_window_get_min_content_width(self.as_ref().to_glib_none().0) }
1825 }
1826
1827 /// Returns whether overlay scrolling is enabled for this scrolled window.
1828 ///
1829 /// # Returns
1830 ///
1831 /// [`true`] if overlay scrolling is enabled
1832 #[doc(alias = "gtk_scrolled_window_get_overlay_scrolling")]
1833 #[doc(alias = "get_overlay_scrolling")]
1834 #[doc(alias = "overlay-scrolling")]
1835 fn is_overlay_scrolling(&self) -> bool {
1836 unsafe {
1837 from_glib(ffi::gtk_scrolled_window_get_overlay_scrolling(
1838 self.as_ref().to_glib_none().0,
1839 ))
1840 }
1841 }
1842
1843 /// Gets the placement of the contents with respect to the scrollbars
1844 /// for the scrolled window. See [`set_placement()`][Self::set_placement()].
1845 ///
1846 /// # Returns
1847 ///
1848 /// the current placement value.
1849 ///
1850 /// See also [`set_placement()`][Self::set_placement()] and
1851 /// [`unset_placement()`][Self::unset_placement()].
1852 #[doc(alias = "gtk_scrolled_window_get_placement")]
1853 #[doc(alias = "get_placement")]
1854 fn placement(&self) -> CornerType {
1855 unsafe {
1856 from_glib(ffi::gtk_scrolled_window_get_placement(
1857 self.as_ref().to_glib_none().0,
1858 ))
1859 }
1860 }
1861
1862 /// Retrieves the current policy values for the horizontal and vertical
1863 /// scrollbars. See [`set_policy()`][Self::set_policy()].
1864 ///
1865 /// # Returns
1866 ///
1867 ///
1868 /// ## `hscrollbar_policy`
1869 /// location to store the policy
1870 /// for the horizontal scrollbar, or [`None`]
1871 ///
1872 /// ## `vscrollbar_policy`
1873 /// location to store the policy
1874 /// for the vertical scrollbar, or [`None`]
1875 #[doc(alias = "gtk_scrolled_window_get_policy")]
1876 #[doc(alias = "get_policy")]
1877 fn policy(&self) -> (PolicyType, PolicyType) {
1878 unsafe {
1879 let mut hscrollbar_policy = std::mem::MaybeUninit::uninit();
1880 let mut vscrollbar_policy = std::mem::MaybeUninit::uninit();
1881 ffi::gtk_scrolled_window_get_policy(
1882 self.as_ref().to_glib_none().0,
1883 hscrollbar_policy.as_mut_ptr(),
1884 vscrollbar_policy.as_mut_ptr(),
1885 );
1886 (
1887 from_glib(hscrollbar_policy.assume_init()),
1888 from_glib(vscrollbar_policy.assume_init()),
1889 )
1890 }
1891 }
1892
1893 /// Reports whether the natural height of the child will be calculated and propagated
1894 /// through the scrolled window’s requested natural height.
1895 ///
1896 /// # Returns
1897 ///
1898 /// whether natural height propagation is enabled.
1899 #[doc(alias = "gtk_scrolled_window_get_propagate_natural_height")]
1900 #[doc(alias = "get_propagate_natural_height")]
1901 #[doc(alias = "propagate-natural-height")]
1902 fn propagates_natural_height(&self) -> bool {
1903 unsafe {
1904 from_glib(ffi::gtk_scrolled_window_get_propagate_natural_height(
1905 self.as_ref().to_glib_none().0,
1906 ))
1907 }
1908 }
1909
1910 /// Reports whether the natural width of the child will be calculated and propagated
1911 /// through the scrolled window’s requested natural width.
1912 ///
1913 /// # Returns
1914 ///
1915 /// whether natural width propagation is enabled.
1916 #[doc(alias = "gtk_scrolled_window_get_propagate_natural_width")]
1917 #[doc(alias = "get_propagate_natural_width")]
1918 #[doc(alias = "propagate-natural-width")]
1919 fn propagates_natural_width(&self) -> bool {
1920 unsafe {
1921 from_glib(ffi::gtk_scrolled_window_get_propagate_natural_width(
1922 self.as_ref().to_glib_none().0,
1923 ))
1924 }
1925 }
1926
1927 /// Gets the shadow type of the scrolled window. See
1928 /// [`set_shadow_type()`][Self::set_shadow_type()].
1929 ///
1930 /// # Returns
1931 ///
1932 /// the current shadow type
1933 #[doc(alias = "gtk_scrolled_window_get_shadow_type")]
1934 #[doc(alias = "get_shadow_type")]
1935 #[doc(alias = "shadow-type")]
1936 fn shadow_type(&self) -> ShadowType {
1937 unsafe {
1938 from_glib(ffi::gtk_scrolled_window_get_shadow_type(
1939 self.as_ref().to_glib_none().0,
1940 ))
1941 }
1942 }
1943
1944 /// Returns the vertical scrollbar’s adjustment, used to connect the
1945 /// vertical scrollbar to the child widget’s vertical scroll functionality.
1946 ///
1947 /// # Returns
1948 ///
1949 /// the vertical [`Adjustment`][crate::Adjustment]
1950 #[doc(alias = "gtk_scrolled_window_get_vadjustment")]
1951 #[doc(alias = "get_vadjustment")]
1952 fn vadjustment(&self) -> Adjustment {
1953 unsafe {
1954 from_glib_none(ffi::gtk_scrolled_window_get_vadjustment(
1955 self.as_ref().to_glib_none().0,
1956 ))
1957 }
1958 }
1959
1960 /// Returns the vertical scrollbar of `self`.
1961 ///
1962 /// # Returns
1963 ///
1964 /// the vertical scrollbar of the scrolled window.
1965 #[doc(alias = "gtk_scrolled_window_get_vscrollbar")]
1966 #[doc(alias = "get_vscrollbar")]
1967 fn vscrollbar(&self) -> Option<Widget> {
1968 unsafe {
1969 from_glib_none(ffi::gtk_scrolled_window_get_vscrollbar(
1970 self.as_ref().to_glib_none().0,
1971 ))
1972 }
1973 }
1974
1975 /// Changes the behaviour of `self` with regard to the initial
1976 /// event that possibly starts kinetic scrolling. When `capture_button_press`
1977 /// is set to [`true`], the event is captured by the scrolled window, and
1978 /// then later replayed if it is meant to go to the child widget.
1979 ///
1980 /// This should be enabled if any child widgets perform non-reversible
1981 /// actions on [`button-press-event`][struct@crate::Widget#button-press-event]. If they don't, and handle
1982 /// additionally handle [`grab-broken-event`][struct@crate::Widget#grab-broken-event], it might be better
1983 /// to set `capture_button_press` to [`false`].
1984 ///
1985 /// This setting only has an effect if kinetic scrolling is enabled.
1986 /// ## `capture_button_press`
1987 /// [`true`] to capture button presses
1988 #[doc(alias = "gtk_scrolled_window_set_capture_button_press")]
1989 fn set_capture_button_press(&self, capture_button_press: bool) {
1990 unsafe {
1991 ffi::gtk_scrolled_window_set_capture_button_press(
1992 self.as_ref().to_glib_none().0,
1993 capture_button_press.into_glib(),
1994 );
1995 }
1996 }
1997
1998 /// Sets the [`Adjustment`][crate::Adjustment] for the horizontal scrollbar.
1999 /// ## `hadjustment`
2000 /// the [`Adjustment`][crate::Adjustment] to use, or [`None`] to create a new one
2001 #[doc(alias = "gtk_scrolled_window_set_hadjustment")]
2002 #[doc(alias = "hadjustment")]
2003 fn set_hadjustment(&self, hadjustment: Option<&impl IsA<Adjustment>>) {
2004 unsafe {
2005 ffi::gtk_scrolled_window_set_hadjustment(
2006 self.as_ref().to_glib_none().0,
2007 hadjustment.map(|p| p.as_ref()).to_glib_none().0,
2008 );
2009 }
2010 }
2011
2012 /// Turns kinetic scrolling on or off.
2013 /// Kinetic scrolling only applies to devices with source
2014 /// `GDK_SOURCE_TOUCHSCREEN`.
2015 /// ## `kinetic_scrolling`
2016 /// [`true`] to enable kinetic scrolling
2017 #[doc(alias = "gtk_scrolled_window_set_kinetic_scrolling")]
2018 #[doc(alias = "kinetic-scrolling")]
2019 fn set_kinetic_scrolling(&self, kinetic_scrolling: bool) {
2020 unsafe {
2021 ffi::gtk_scrolled_window_set_kinetic_scrolling(
2022 self.as_ref().to_glib_none().0,
2023 kinetic_scrolling.into_glib(),
2024 );
2025 }
2026 }
2027
2028 /// Sets the maximum height that `self` should keep visible. The
2029 /// `self` will grow up to this height before it starts scrolling
2030 /// the content.
2031 ///
2032 /// It is a programming error to set the maximum content height to a value
2033 /// smaller than [`min-content-height`][struct@crate::ScrolledWindow#min-content-height].
2034 /// ## `height`
2035 /// the maximum content height
2036 #[doc(alias = "gtk_scrolled_window_set_max_content_height")]
2037 #[doc(alias = "max-content-height")]
2038 fn set_max_content_height(&self, height: i32) {
2039 unsafe {
2040 ffi::gtk_scrolled_window_set_max_content_height(self.as_ref().to_glib_none().0, height);
2041 }
2042 }
2043
2044 /// Sets the maximum width that `self` should keep visible. The
2045 /// `self` will grow up to this width before it starts scrolling
2046 /// the content.
2047 ///
2048 /// It is a programming error to set the maximum content width to a value
2049 /// smaller than [`min-content-width`][struct@crate::ScrolledWindow#min-content-width].
2050 /// ## `width`
2051 /// the maximum content width
2052 #[doc(alias = "gtk_scrolled_window_set_max_content_width")]
2053 #[doc(alias = "max-content-width")]
2054 fn set_max_content_width(&self, width: i32) {
2055 unsafe {
2056 ffi::gtk_scrolled_window_set_max_content_width(self.as_ref().to_glib_none().0, width);
2057 }
2058 }
2059
2060 /// Sets the minimum height that `self` should keep visible.
2061 /// Note that this can and (usually will) be smaller than the minimum
2062 /// size of the content.
2063 ///
2064 /// It is a programming error to set the minimum content height to a
2065 /// value greater than [`max-content-height`][struct@crate::ScrolledWindow#max-content-height].
2066 /// ## `height`
2067 /// the minimal content height
2068 #[doc(alias = "gtk_scrolled_window_set_min_content_height")]
2069 #[doc(alias = "min-content-height")]
2070 fn set_min_content_height(&self, height: i32) {
2071 unsafe {
2072 ffi::gtk_scrolled_window_set_min_content_height(self.as_ref().to_glib_none().0, height);
2073 }
2074 }
2075
2076 /// Sets the minimum width that `self` should keep visible.
2077 /// Note that this can and (usually will) be smaller than the minimum
2078 /// size of the content.
2079 ///
2080 /// It is a programming error to set the minimum content width to a
2081 /// value greater than [`max-content-width`][struct@crate::ScrolledWindow#max-content-width].
2082 /// ## `width`
2083 /// the minimal content width
2084 #[doc(alias = "gtk_scrolled_window_set_min_content_width")]
2085 #[doc(alias = "min-content-width")]
2086 fn set_min_content_width(&self, width: i32) {
2087 unsafe {
2088 ffi::gtk_scrolled_window_set_min_content_width(self.as_ref().to_glib_none().0, width);
2089 }
2090 }
2091
2092 /// Enables or disables overlay scrolling for this scrolled window.
2093 /// ## `overlay_scrolling`
2094 /// whether to enable overlay scrolling
2095 #[doc(alias = "gtk_scrolled_window_set_overlay_scrolling")]
2096 #[doc(alias = "overlay-scrolling")]
2097 fn set_overlay_scrolling(&self, overlay_scrolling: bool) {
2098 unsafe {
2099 ffi::gtk_scrolled_window_set_overlay_scrolling(
2100 self.as_ref().to_glib_none().0,
2101 overlay_scrolling.into_glib(),
2102 );
2103 }
2104 }
2105
2106 /// Sets the placement of the contents with respect to the scrollbars
2107 /// for the scrolled window.
2108 ///
2109 /// The default is [`CornerType::TopLeft`][crate::CornerType::TopLeft], meaning the child is
2110 /// in the top left, with the scrollbars underneath and to the right.
2111 /// Other values in [`CornerType`][crate::CornerType] are [`CornerType::TopRight`][crate::CornerType::TopRight],
2112 /// [`CornerType::BottomLeft`][crate::CornerType::BottomLeft], and [`CornerType::BottomRight`][crate::CornerType::BottomRight].
2113 ///
2114 /// See also [`placement()`][Self::placement()] and
2115 /// [`unset_placement()`][Self::unset_placement()].
2116 /// ## `window_placement`
2117 /// position of the child window
2118 #[doc(alias = "gtk_scrolled_window_set_placement")]
2119 fn set_placement(&self, window_placement: CornerType) {
2120 unsafe {
2121 ffi::gtk_scrolled_window_set_placement(
2122 self.as_ref().to_glib_none().0,
2123 window_placement.into_glib(),
2124 );
2125 }
2126 }
2127
2128 /// Sets the scrollbar policy for the horizontal and vertical scrollbars.
2129 ///
2130 /// The policy determines when the scrollbar should appear; it is a value
2131 /// from the [`PolicyType`][crate::PolicyType] enumeration. If [`PolicyType::Always`][crate::PolicyType::Always], the
2132 /// scrollbar is always present; if [`PolicyType::Never`][crate::PolicyType::Never], the scrollbar is
2133 /// never present; if [`PolicyType::Automatic`][crate::PolicyType::Automatic], the scrollbar is present only
2134 /// if needed (that is, if the slider part of the bar would be smaller
2135 /// than the trough — the display is larger than the page size).
2136 /// ## `hscrollbar_policy`
2137 /// policy for horizontal bar
2138 /// ## `vscrollbar_policy`
2139 /// policy for vertical bar
2140 #[doc(alias = "gtk_scrolled_window_set_policy")]
2141 fn set_policy(&self, hscrollbar_policy: PolicyType, vscrollbar_policy: PolicyType) {
2142 unsafe {
2143 ffi::gtk_scrolled_window_set_policy(
2144 self.as_ref().to_glib_none().0,
2145 hscrollbar_policy.into_glib(),
2146 vscrollbar_policy.into_glib(),
2147 );
2148 }
2149 }
2150
2151 /// Sets whether the natural height of the child should be calculated and propagated
2152 /// through the scrolled window’s requested natural height.
2153 /// ## `propagate`
2154 /// whether to propagate natural height
2155 #[doc(alias = "gtk_scrolled_window_set_propagate_natural_height")]
2156 #[doc(alias = "propagate-natural-height")]
2157 fn set_propagate_natural_height(&self, propagate: bool) {
2158 unsafe {
2159 ffi::gtk_scrolled_window_set_propagate_natural_height(
2160 self.as_ref().to_glib_none().0,
2161 propagate.into_glib(),
2162 );
2163 }
2164 }
2165
2166 /// Sets whether the natural width of the child should be calculated and propagated
2167 /// through the scrolled window’s requested natural width.
2168 /// ## `propagate`
2169 /// whether to propagate natural width
2170 #[doc(alias = "gtk_scrolled_window_set_propagate_natural_width")]
2171 #[doc(alias = "propagate-natural-width")]
2172 fn set_propagate_natural_width(&self, propagate: bool) {
2173 unsafe {
2174 ffi::gtk_scrolled_window_set_propagate_natural_width(
2175 self.as_ref().to_glib_none().0,
2176 propagate.into_glib(),
2177 );
2178 }
2179 }
2180
2181 /// Changes the type of shadow drawn around the contents of
2182 /// `self`.
2183 /// ## `type_`
2184 /// kind of shadow to draw around scrolled window contents
2185 #[doc(alias = "gtk_scrolled_window_set_shadow_type")]
2186 #[doc(alias = "shadow-type")]
2187 fn set_shadow_type(&self, type_: ShadowType) {
2188 unsafe {
2189 ffi::gtk_scrolled_window_set_shadow_type(
2190 self.as_ref().to_glib_none().0,
2191 type_.into_glib(),
2192 );
2193 }
2194 }
2195
2196 /// Sets the [`Adjustment`][crate::Adjustment] for the vertical scrollbar.
2197 /// ## `vadjustment`
2198 /// the [`Adjustment`][crate::Adjustment] to use, or [`None`] to create a new one
2199 #[doc(alias = "gtk_scrolled_window_set_vadjustment")]
2200 #[doc(alias = "vadjustment")]
2201 fn set_vadjustment(&self, vadjustment: Option<&impl IsA<Adjustment>>) {
2202 unsafe {
2203 ffi::gtk_scrolled_window_set_vadjustment(
2204 self.as_ref().to_glib_none().0,
2205 vadjustment.map(|p| p.as_ref()).to_glib_none().0,
2206 );
2207 }
2208 }
2209
2210 /// Unsets the placement of the contents with respect to the scrollbars
2211 /// for the scrolled window. If no window placement is set for a scrolled
2212 /// window, it defaults to [`CornerType::TopLeft`][crate::CornerType::TopLeft].
2213 ///
2214 /// See also [`set_placement()`][Self::set_placement()] and
2215 /// [`placement()`][Self::placement()].
2216 #[doc(alias = "gtk_scrolled_window_unset_placement")]
2217 fn unset_placement(&self) {
2218 unsafe {
2219 ffi::gtk_scrolled_window_unset_placement(self.as_ref().to_glib_none().0);
2220 }
2221 }
2222
2223 #[doc(alias = "hscrollbar-policy")]
2224 fn hscrollbar_policy(&self) -> PolicyType {
2225 ObjectExt::property(self.as_ref(), "hscrollbar-policy")
2226 }
2227
2228 #[doc(alias = "hscrollbar-policy")]
2229 fn set_hscrollbar_policy(&self, hscrollbar_policy: PolicyType) {
2230 ObjectExt::set_property(self.as_ref(), "hscrollbar-policy", hscrollbar_policy)
2231 }
2232
2233 #[doc(alias = "vscrollbar-policy")]
2234 fn vscrollbar_policy(&self) -> PolicyType {
2235 ObjectExt::property(self.as_ref(), "vscrollbar-policy")
2236 }
2237
2238 #[doc(alias = "vscrollbar-policy")]
2239 fn set_vscrollbar_policy(&self, vscrollbar_policy: PolicyType) {
2240 ObjectExt::set_property(self.as_ref(), "vscrollbar-policy", vscrollbar_policy)
2241 }
2242
2243 #[doc(alias = "window-placement")]
2244 fn window_placement(&self) -> CornerType {
2245 ObjectExt::property(self.as_ref(), "window-placement")
2246 }
2247
2248 #[doc(alias = "window-placement")]
2249 fn set_window_placement(&self, window_placement: CornerType) {
2250 ObjectExt::set_property(self.as_ref(), "window-placement", window_placement)
2251 }
2252
2253 /// The ::edge-overshot signal is emitted whenever user initiated scrolling
2254 /// makes the scrolled window firmly surpass (i.e. with some edge resistance)
2255 /// the lower or upper limits defined by the adjustment in that orientation.
2256 ///
2257 /// A similar behavior without edge resistance is provided by the
2258 /// [`edge-reached`][struct@crate::ScrolledWindow#edge-reached] signal.
2259 ///
2260 /// Note: The `pos` argument is LTR/RTL aware, so callers should be aware too
2261 /// if intending to provide behavior on horizontal edges.
2262 /// ## `pos`
2263 /// edge side that was hit
2264 #[doc(alias = "edge-overshot")]
2265 fn connect_edge_overshot<F: Fn(&Self, PositionType) + 'static>(&self, f: F) -> SignalHandlerId {
2266 unsafe extern "C" fn edge_overshot_trampoline<
2267 P: IsA<ScrolledWindow>,
2268 F: Fn(&P, PositionType) + 'static,
2269 >(
2270 this: *mut ffi::GtkScrolledWindow,
2271 pos: ffi::GtkPositionType,
2272 f: glib::ffi::gpointer,
2273 ) {
2274 unsafe {
2275 let f: &F = &*(f as *const F);
2276 f(
2277 ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref(),
2278 from_glib(pos),
2279 )
2280 }
2281 }
2282 unsafe {
2283 let f: Box_<F> = Box_::new(f);
2284 connect_raw(
2285 self.as_ptr() as *mut _,
2286 c"edge-overshot".as_ptr(),
2287 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2288 edge_overshot_trampoline::<Self, F> as *const (),
2289 )),
2290 Box_::into_raw(f),
2291 )
2292 }
2293 }
2294
2295 /// The ::edge-reached signal is emitted whenever user-initiated scrolling
2296 /// makes the scrolled window exactly reach the lower or upper limits
2297 /// defined by the adjustment in that orientation.
2298 ///
2299 /// A similar behavior with edge resistance is provided by the
2300 /// [`edge-overshot`][struct@crate::ScrolledWindow#edge-overshot] signal.
2301 ///
2302 /// Note: The `pos` argument is LTR/RTL aware, so callers should be aware too
2303 /// if intending to provide behavior on horizontal edges.
2304 /// ## `pos`
2305 /// edge side that was reached
2306 #[doc(alias = "edge-reached")]
2307 fn connect_edge_reached<F: Fn(&Self, PositionType) + 'static>(&self, f: F) -> SignalHandlerId {
2308 unsafe extern "C" fn edge_reached_trampoline<
2309 P: IsA<ScrolledWindow>,
2310 F: Fn(&P, PositionType) + 'static,
2311 >(
2312 this: *mut ffi::GtkScrolledWindow,
2313 pos: ffi::GtkPositionType,
2314 f: glib::ffi::gpointer,
2315 ) {
2316 unsafe {
2317 let f: &F = &*(f as *const F);
2318 f(
2319 ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref(),
2320 from_glib(pos),
2321 )
2322 }
2323 }
2324 unsafe {
2325 let f: Box_<F> = Box_::new(f);
2326 connect_raw(
2327 self.as_ptr() as *mut _,
2328 c"edge-reached".as_ptr(),
2329 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2330 edge_reached_trampoline::<Self, F> as *const (),
2331 )),
2332 Box_::into_raw(f),
2333 )
2334 }
2335 }
2336
2337 /// The ::move-focus-out signal is a
2338 /// [keybinding signal][GtkBindingSignal] which gets
2339 /// emitted when focus is moved away from the scrolled window by a
2340 /// keybinding. The [`move-focus`][struct@crate::Widget#move-focus] signal is emitted with
2341 /// `direction_type` on this scrolled window’s toplevel parent in the
2342 /// container hierarchy. The default bindings for this signal are
2343 /// `Ctrl + Tab` to move forward and `Ctrl + Shift + Tab` to move backward.
2344 /// ## `direction_type`
2345 /// either [`DirectionType::TabForward`][crate::DirectionType::TabForward] or
2346 /// [`DirectionType::TabBackward`][crate::DirectionType::TabBackward]
2347 #[doc(alias = "move-focus-out")]
2348 fn connect_move_focus_out<F: Fn(&Self, DirectionType) + 'static>(
2349 &self,
2350 f: F,
2351 ) -> SignalHandlerId {
2352 unsafe extern "C" fn move_focus_out_trampoline<
2353 P: IsA<ScrolledWindow>,
2354 F: Fn(&P, DirectionType) + 'static,
2355 >(
2356 this: *mut ffi::GtkScrolledWindow,
2357 direction_type: ffi::GtkDirectionType,
2358 f: glib::ffi::gpointer,
2359 ) {
2360 unsafe {
2361 let f: &F = &*(f as *const F);
2362 f(
2363 ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref(),
2364 from_glib(direction_type),
2365 )
2366 }
2367 }
2368 unsafe {
2369 let f: Box_<F> = Box_::new(f);
2370 connect_raw(
2371 self.as_ptr() as *mut _,
2372 c"move-focus-out".as_ptr(),
2373 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2374 move_focus_out_trampoline::<Self, F> as *const (),
2375 )),
2376 Box_::into_raw(f),
2377 )
2378 }
2379 }
2380
2381 fn emit_move_focus_out(&self, direction_type: DirectionType) {
2382 self.emit_by_name::<()>("move-focus-out", &[&direction_type]);
2383 }
2384
2385 /// The ::scroll-child signal is a
2386 /// [keybinding signal][GtkBindingSignal]
2387 /// which gets emitted when a keybinding that scrolls is pressed.
2388 /// The horizontal or vertical adjustment is updated which triggers a
2389 /// signal that the scrolled window’s child may listen to and scroll itself.
2390 /// ## `scroll`
2391 /// a [`ScrollType`][crate::ScrollType] describing how much to scroll
2392 /// ## `horizontal`
2393 /// whether the keybinding scrolls the child
2394 /// horizontally or not
2395 #[doc(alias = "scroll-child")]
2396 fn connect_scroll_child<F: Fn(&Self, ScrollType, bool) -> bool + 'static>(
2397 &self,
2398 f: F,
2399 ) -> SignalHandlerId {
2400 unsafe extern "C" fn scroll_child_trampoline<
2401 P: IsA<ScrolledWindow>,
2402 F: Fn(&P, ScrollType, bool) -> bool + 'static,
2403 >(
2404 this: *mut ffi::GtkScrolledWindow,
2405 scroll: ffi::GtkScrollType,
2406 horizontal: glib::ffi::gboolean,
2407 f: glib::ffi::gpointer,
2408 ) -> glib::ffi::gboolean {
2409 unsafe {
2410 let f: &F = &*(f as *const F);
2411 f(
2412 ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref(),
2413 from_glib(scroll),
2414 from_glib(horizontal),
2415 )
2416 .into_glib()
2417 }
2418 }
2419 unsafe {
2420 let f: Box_<F> = Box_::new(f);
2421 connect_raw(
2422 self.as_ptr() as *mut _,
2423 c"scroll-child".as_ptr(),
2424 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2425 scroll_child_trampoline::<Self, F> as *const (),
2426 )),
2427 Box_::into_raw(f),
2428 )
2429 }
2430 }
2431
2432 fn emit_scroll_child(&self, scroll: ScrollType, horizontal: bool) -> bool {
2433 self.emit_by_name("scroll-child", &[&scroll, &horizontal])
2434 }
2435
2436 #[doc(alias = "hadjustment")]
2437 fn connect_hadjustment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2438 unsafe extern "C" fn notify_hadjustment_trampoline<
2439 P: IsA<ScrolledWindow>,
2440 F: Fn(&P) + 'static,
2441 >(
2442 this: *mut ffi::GtkScrolledWindow,
2443 _param_spec: glib::ffi::gpointer,
2444 f: glib::ffi::gpointer,
2445 ) {
2446 unsafe {
2447 let f: &F = &*(f as *const F);
2448 f(ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref())
2449 }
2450 }
2451 unsafe {
2452 let f: Box_<F> = Box_::new(f);
2453 connect_raw(
2454 self.as_ptr() as *mut _,
2455 c"notify::hadjustment".as_ptr(),
2456 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2457 notify_hadjustment_trampoline::<Self, F> as *const (),
2458 )),
2459 Box_::into_raw(f),
2460 )
2461 }
2462 }
2463
2464 #[doc(alias = "hscrollbar-policy")]
2465 fn connect_hscrollbar_policy_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2466 unsafe extern "C" fn notify_hscrollbar_policy_trampoline<
2467 P: IsA<ScrolledWindow>,
2468 F: Fn(&P) + 'static,
2469 >(
2470 this: *mut ffi::GtkScrolledWindow,
2471 _param_spec: glib::ffi::gpointer,
2472 f: glib::ffi::gpointer,
2473 ) {
2474 unsafe {
2475 let f: &F = &*(f as *const F);
2476 f(ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref())
2477 }
2478 }
2479 unsafe {
2480 let f: Box_<F> = Box_::new(f);
2481 connect_raw(
2482 self.as_ptr() as *mut _,
2483 c"notify::hscrollbar-policy".as_ptr(),
2484 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2485 notify_hscrollbar_policy_trampoline::<Self, F> as *const (),
2486 )),
2487 Box_::into_raw(f),
2488 )
2489 }
2490 }
2491
2492 #[doc(alias = "kinetic-scrolling")]
2493 fn connect_kinetic_scrolling_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2494 unsafe extern "C" fn notify_kinetic_scrolling_trampoline<
2495 P: IsA<ScrolledWindow>,
2496 F: Fn(&P) + 'static,
2497 >(
2498 this: *mut ffi::GtkScrolledWindow,
2499 _param_spec: glib::ffi::gpointer,
2500 f: glib::ffi::gpointer,
2501 ) {
2502 unsafe {
2503 let f: &F = &*(f as *const F);
2504 f(ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref())
2505 }
2506 }
2507 unsafe {
2508 let f: Box_<F> = Box_::new(f);
2509 connect_raw(
2510 self.as_ptr() as *mut _,
2511 c"notify::kinetic-scrolling".as_ptr(),
2512 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2513 notify_kinetic_scrolling_trampoline::<Self, F> as *const (),
2514 )),
2515 Box_::into_raw(f),
2516 )
2517 }
2518 }
2519
2520 #[doc(alias = "max-content-height")]
2521 fn connect_max_content_height_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2522 unsafe extern "C" fn notify_max_content_height_trampoline<
2523 P: IsA<ScrolledWindow>,
2524 F: Fn(&P) + 'static,
2525 >(
2526 this: *mut ffi::GtkScrolledWindow,
2527 _param_spec: glib::ffi::gpointer,
2528 f: glib::ffi::gpointer,
2529 ) {
2530 unsafe {
2531 let f: &F = &*(f as *const F);
2532 f(ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref())
2533 }
2534 }
2535 unsafe {
2536 let f: Box_<F> = Box_::new(f);
2537 connect_raw(
2538 self.as_ptr() as *mut _,
2539 c"notify::max-content-height".as_ptr(),
2540 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2541 notify_max_content_height_trampoline::<Self, F> as *const (),
2542 )),
2543 Box_::into_raw(f),
2544 )
2545 }
2546 }
2547
2548 #[doc(alias = "max-content-width")]
2549 fn connect_max_content_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2550 unsafe extern "C" fn notify_max_content_width_trampoline<
2551 P: IsA<ScrolledWindow>,
2552 F: Fn(&P) + 'static,
2553 >(
2554 this: *mut ffi::GtkScrolledWindow,
2555 _param_spec: glib::ffi::gpointer,
2556 f: glib::ffi::gpointer,
2557 ) {
2558 unsafe {
2559 let f: &F = &*(f as *const F);
2560 f(ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref())
2561 }
2562 }
2563 unsafe {
2564 let f: Box_<F> = Box_::new(f);
2565 connect_raw(
2566 self.as_ptr() as *mut _,
2567 c"notify::max-content-width".as_ptr(),
2568 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2569 notify_max_content_width_trampoline::<Self, F> as *const (),
2570 )),
2571 Box_::into_raw(f),
2572 )
2573 }
2574 }
2575
2576 #[doc(alias = "min-content-height")]
2577 fn connect_min_content_height_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2578 unsafe extern "C" fn notify_min_content_height_trampoline<
2579 P: IsA<ScrolledWindow>,
2580 F: Fn(&P) + 'static,
2581 >(
2582 this: *mut ffi::GtkScrolledWindow,
2583 _param_spec: glib::ffi::gpointer,
2584 f: glib::ffi::gpointer,
2585 ) {
2586 unsafe {
2587 let f: &F = &*(f as *const F);
2588 f(ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref())
2589 }
2590 }
2591 unsafe {
2592 let f: Box_<F> = Box_::new(f);
2593 connect_raw(
2594 self.as_ptr() as *mut _,
2595 c"notify::min-content-height".as_ptr(),
2596 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2597 notify_min_content_height_trampoline::<Self, F> as *const (),
2598 )),
2599 Box_::into_raw(f),
2600 )
2601 }
2602 }
2603
2604 #[doc(alias = "min-content-width")]
2605 fn connect_min_content_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2606 unsafe extern "C" fn notify_min_content_width_trampoline<
2607 P: IsA<ScrolledWindow>,
2608 F: Fn(&P) + 'static,
2609 >(
2610 this: *mut ffi::GtkScrolledWindow,
2611 _param_spec: glib::ffi::gpointer,
2612 f: glib::ffi::gpointer,
2613 ) {
2614 unsafe {
2615 let f: &F = &*(f as *const F);
2616 f(ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref())
2617 }
2618 }
2619 unsafe {
2620 let f: Box_<F> = Box_::new(f);
2621 connect_raw(
2622 self.as_ptr() as *mut _,
2623 c"notify::min-content-width".as_ptr(),
2624 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2625 notify_min_content_width_trampoline::<Self, F> as *const (),
2626 )),
2627 Box_::into_raw(f),
2628 )
2629 }
2630 }
2631
2632 #[doc(alias = "overlay-scrolling")]
2633 fn connect_overlay_scrolling_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2634 unsafe extern "C" fn notify_overlay_scrolling_trampoline<
2635 P: IsA<ScrolledWindow>,
2636 F: Fn(&P) + 'static,
2637 >(
2638 this: *mut ffi::GtkScrolledWindow,
2639 _param_spec: glib::ffi::gpointer,
2640 f: glib::ffi::gpointer,
2641 ) {
2642 unsafe {
2643 let f: &F = &*(f as *const F);
2644 f(ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref())
2645 }
2646 }
2647 unsafe {
2648 let f: Box_<F> = Box_::new(f);
2649 connect_raw(
2650 self.as_ptr() as *mut _,
2651 c"notify::overlay-scrolling".as_ptr(),
2652 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2653 notify_overlay_scrolling_trampoline::<Self, F> as *const (),
2654 )),
2655 Box_::into_raw(f),
2656 )
2657 }
2658 }
2659
2660 #[doc(alias = "propagate-natural-height")]
2661 fn connect_propagate_natural_height_notify<F: Fn(&Self) + 'static>(
2662 &self,
2663 f: F,
2664 ) -> SignalHandlerId {
2665 unsafe extern "C" fn notify_propagate_natural_height_trampoline<
2666 P: IsA<ScrolledWindow>,
2667 F: Fn(&P) + 'static,
2668 >(
2669 this: *mut ffi::GtkScrolledWindow,
2670 _param_spec: glib::ffi::gpointer,
2671 f: glib::ffi::gpointer,
2672 ) {
2673 unsafe {
2674 let f: &F = &*(f as *const F);
2675 f(ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref())
2676 }
2677 }
2678 unsafe {
2679 let f: Box_<F> = Box_::new(f);
2680 connect_raw(
2681 self.as_ptr() as *mut _,
2682 c"notify::propagate-natural-height".as_ptr(),
2683 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2684 notify_propagate_natural_height_trampoline::<Self, F> as *const (),
2685 )),
2686 Box_::into_raw(f),
2687 )
2688 }
2689 }
2690
2691 #[doc(alias = "propagate-natural-width")]
2692 fn connect_propagate_natural_width_notify<F: Fn(&Self) + 'static>(
2693 &self,
2694 f: F,
2695 ) -> SignalHandlerId {
2696 unsafe extern "C" fn notify_propagate_natural_width_trampoline<
2697 P: IsA<ScrolledWindow>,
2698 F: Fn(&P) + 'static,
2699 >(
2700 this: *mut ffi::GtkScrolledWindow,
2701 _param_spec: glib::ffi::gpointer,
2702 f: glib::ffi::gpointer,
2703 ) {
2704 unsafe {
2705 let f: &F = &*(f as *const F);
2706 f(ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref())
2707 }
2708 }
2709 unsafe {
2710 let f: Box_<F> = Box_::new(f);
2711 connect_raw(
2712 self.as_ptr() as *mut _,
2713 c"notify::propagate-natural-width".as_ptr(),
2714 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2715 notify_propagate_natural_width_trampoline::<Self, F> as *const (),
2716 )),
2717 Box_::into_raw(f),
2718 )
2719 }
2720 }
2721
2722 #[doc(alias = "shadow-type")]
2723 fn connect_shadow_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2724 unsafe extern "C" fn notify_shadow_type_trampoline<
2725 P: IsA<ScrolledWindow>,
2726 F: Fn(&P) + 'static,
2727 >(
2728 this: *mut ffi::GtkScrolledWindow,
2729 _param_spec: glib::ffi::gpointer,
2730 f: glib::ffi::gpointer,
2731 ) {
2732 unsafe {
2733 let f: &F = &*(f as *const F);
2734 f(ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref())
2735 }
2736 }
2737 unsafe {
2738 let f: Box_<F> = Box_::new(f);
2739 connect_raw(
2740 self.as_ptr() as *mut _,
2741 c"notify::shadow-type".as_ptr(),
2742 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2743 notify_shadow_type_trampoline::<Self, F> as *const (),
2744 )),
2745 Box_::into_raw(f),
2746 )
2747 }
2748 }
2749
2750 #[doc(alias = "vadjustment")]
2751 fn connect_vadjustment_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2752 unsafe extern "C" fn notify_vadjustment_trampoline<
2753 P: IsA<ScrolledWindow>,
2754 F: Fn(&P) + 'static,
2755 >(
2756 this: *mut ffi::GtkScrolledWindow,
2757 _param_spec: glib::ffi::gpointer,
2758 f: glib::ffi::gpointer,
2759 ) {
2760 unsafe {
2761 let f: &F = &*(f as *const F);
2762 f(ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref())
2763 }
2764 }
2765 unsafe {
2766 let f: Box_<F> = Box_::new(f);
2767 connect_raw(
2768 self.as_ptr() as *mut _,
2769 c"notify::vadjustment".as_ptr(),
2770 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2771 notify_vadjustment_trampoline::<Self, F> as *const (),
2772 )),
2773 Box_::into_raw(f),
2774 )
2775 }
2776 }
2777
2778 #[doc(alias = "vscrollbar-policy")]
2779 fn connect_vscrollbar_policy_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2780 unsafe extern "C" fn notify_vscrollbar_policy_trampoline<
2781 P: IsA<ScrolledWindow>,
2782 F: Fn(&P) + 'static,
2783 >(
2784 this: *mut ffi::GtkScrolledWindow,
2785 _param_spec: glib::ffi::gpointer,
2786 f: glib::ffi::gpointer,
2787 ) {
2788 unsafe {
2789 let f: &F = &*(f as *const F);
2790 f(ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref())
2791 }
2792 }
2793 unsafe {
2794 let f: Box_<F> = Box_::new(f);
2795 connect_raw(
2796 self.as_ptr() as *mut _,
2797 c"notify::vscrollbar-policy".as_ptr(),
2798 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2799 notify_vscrollbar_policy_trampoline::<Self, F> as *const (),
2800 )),
2801 Box_::into_raw(f),
2802 )
2803 }
2804 }
2805
2806 #[doc(alias = "window-placement")]
2807 fn connect_window_placement_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2808 unsafe extern "C" fn notify_window_placement_trampoline<
2809 P: IsA<ScrolledWindow>,
2810 F: Fn(&P) + 'static,
2811 >(
2812 this: *mut ffi::GtkScrolledWindow,
2813 _param_spec: glib::ffi::gpointer,
2814 f: glib::ffi::gpointer,
2815 ) {
2816 unsafe {
2817 let f: &F = &*(f as *const F);
2818 f(ScrolledWindow::from_glib_borrow(this).unsafe_cast_ref())
2819 }
2820 }
2821 unsafe {
2822 let f: Box_<F> = Box_::new(f);
2823 connect_raw(
2824 self.as_ptr() as *mut _,
2825 c"notify::window-placement".as_ptr(),
2826 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2827 notify_window_placement_trampoline::<Self, F> as *const (),
2828 )),
2829 Box_::into_raw(f),
2830 )
2831 }
2832 }
2833}
2834
2835impl<O: IsA<ScrolledWindow>> ScrolledWindowExt for O {}