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