libadwaita/auto/bottom_sheet.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from
3// from gir-files (https://github.com/gtk-rs/gir-files.git)
4// DO NOT EDIT
5
6use crate::{Swipeable, ffi};
7use glib::{
8 object::ObjectType as _,
9 prelude::*,
10 signal::{SignalHandlerId, connect_raw},
11 translate::*,
12};
13use std::boxed::Box as Box_;
14
15glib::wrapper! {
16 /// A bottom sheet with an optional bottom bar.
17 ///
18 /// <picture>
19 /// <source srcset="bottom-sheet-dark.png" media="(prefers-color-scheme: dark)">
20 /// <img src="bottom-sheet.png" alt="bottom-sheet">
21 /// </picture>
22 ///
23 /// [`BottomSheet`][crate::BottomSheet] has three child widgets. [`content`][struct@crate::BottomSheet#content] is
24 /// shown persistently. [`sheet`][struct@crate::BottomSheet#sheet] is displayed above it when
25 /// it's open, and [`bottom-bar`][struct@crate::BottomSheet#bottom-bar] is displayed when it's not.
26 ///
27 /// Bottom sheet and bottom bar are attached to the bottom edge of the widget.
28 /// They take the full width by default, but can only take a portion of it if
29 /// [`full-width`][struct@crate::BottomSheet#full-width] is set to `FALSE`. In this case,
30 /// [`align`][struct@crate::BottomSheet#align] determines where along the bottom edge they are
31 /// placed.
32 ///
33 /// Bottom bar can be hidden using the [`reveal-bottom-bar`][struct@crate::BottomSheet#reveal-bottom-bar]
34 /// property.
35 ///
36 /// [`BottomSheet`][crate::BottomSheet] can be useful for applications such as music players, that
37 /// want to have a persistent bottom bar that expands into a bottom sheet when
38 /// clicked. It's meant for cases where a bottom sheet is tightly integrated into
39 /// the UI. For more transient bottom sheets, see [`Dialog`][crate::Dialog].
40 ///
41 /// To open or close the bottom sheet, use the [`open`][struct@crate::BottomSheet#open]
42 /// property.
43 ///
44 /// By default, the bottom sheet has an overlaid drag handle. It can be disabled
45 /// by setting [`show-drag-handle`][struct@crate::BottomSheet#show-drag-handle] to `FALSE`. Note that the
46 /// handle also controls whether the sheet can be dragged using a pointer.
47 ///
48 /// Bottom sheets are modal by default, meaning that the content is dimmed and
49 /// cannot be accessed while the sheet is open. Set [`modal`][struct@crate::BottomSheet#modal]
50 /// to `FALSE` if this behavior is unwanted.
51 ///
52 /// To disable user interactions for opening or closing the bottom sheet (such as
53 /// swipes or clicking the bottom bar or close button), set
54 /// [`can-open`][struct@crate::BottomSheet#can-open] or [`can-close`][struct@crate::BottomSheet#can-close] to
55 /// `FALSE`.
56 ///
57 /// In some cases, particularly when using a full-width bottom bar, it may be
58 /// necessary to shift [`content`][struct@crate::BottomSheet#content] upwards. Use the
59 /// [`bottom-bar-height`][struct@crate::BottomSheet#bottom-bar-height] and
60 /// [`sheet-height`][struct@crate::BottomSheet#sheet-height] for that.
61 ///
62 /// [`BottomSheet`][crate::BottomSheet] is not adaptive, and for larger window sizes applications
63 /// may want to replace it with another UI, such as a sidebar. This can be done
64 /// using [`MultiLayoutView`][crate::MultiLayoutView].
65 ///
66 /// ## Sizing
67 ///
68 /// Unlike [`Dialog`][crate::Dialog] presented as a bottom sheet, [`BottomSheet`][crate::BottomSheet] just
69 /// follows the content's natural size, and it's up to the applications to make
70 /// sure their content provides one. For example, when using
71 /// [`gtk::ScrolledWindow`][crate::gtk::ScrolledWindow], make sure to set
72 /// [`propagate-natural-height`][struct@crate::gtk::ScrolledWindow#propagate-natural-height] to `TRUE`.
73 ///
74 /// ## Header Bar Integration
75 ///
76 /// When placed inside an [`BottomSheet`][crate::BottomSheet], [`HeaderBar`][crate::HeaderBar] will not show the
77 /// title when [`show-drag-handle`][struct@crate::BottomSheet#show-drag-handle] is `TRUE`, regardless of
78 /// [`show-title`][struct@crate::HeaderBar#show-title]. This only applies to the default title,
79 /// titles set with [`title-widget`][struct@crate::HeaderBar#title-widget] will still be shown.
80 ///
81 /// ## [`BottomSheet`][crate::BottomSheet] as [`gtk::Buildable`][crate::gtk::Buildable]:
82 ///
83 /// The [`BottomSheet`][crate::BottomSheet] implementation of the [`gtk::Buildable`][crate::gtk::Buildable] interface
84 /// supports setting the sheet widget by specifying “sheet” as the “type”
85 /// attribute of a `<child>` element, and the bottom bar by specifying
86 /// “bottom-bar”. Specifying “content” or omitting the child type results in
87 /// setting the content child.
88 ///
89 /// ## Properties
90 ///
91 ///
92 /// #### `align`
93 /// Horizontal alignment of the bottom sheet.
94 ///
95 /// 0 means the bottom sheet is flush with the start edge, 1 means it's flush
96 /// with the end edge. 0.5 means it's centered.
97 ///
98 /// Only used when [`full-width`][struct@crate::BottomSheet#full-width] is set to `FALSE`.
99 ///
100 /// Readable | Writeable
101 ///
102 ///
103 /// #### `bottom-bar`
104 /// The bottom bar widget.
105 ///
106 /// Shown when [`open`][struct@crate::BottomSheet#open] is `FALSE`. When open, morphs into
107 /// the [`sheet`][struct@crate::BottomSheet#sheet].
108 ///
109 /// Bottom bar can be temporarily hidden using the
110 /// [`reveal-bottom-bar`][struct@crate::BottomSheet#reveal-bottom-bar] property.
111 ///
112 /// Readable | Writeable
113 ///
114 ///
115 /// #### `bottom-bar-height`
116 /// The current bottom bar height.
117 ///
118 /// It can be used to shift the content upwards permanently to accommodate for
119 /// the bottom bar.
120 ///
121 /// Readable
122 ///
123 ///
124 /// #### `can-close`
125 /// Whether the bottom sheet can be closed by user.
126 ///
127 /// It can be closed via the close button, swiping down, pressing
128 /// <kbd>Escape</kbd> or clicking the content dimming (when modal).
129 ///
130 /// Bottom sheet can still be closed using [`open`][struct@crate::BottomSheet#open].
131 ///
132 /// Readable | Writeable
133 ///
134 ///
135 /// #### `can-open`
136 /// Whether the bottom sheet can be opened by user.
137 ///
138 /// It can be opened via clicking or swiping up from the bottom bar.
139 ///
140 /// Does nothing if [`bottom-bar`][struct@crate::BottomSheet#bottom-bar] is not set.
141 ///
142 /// Bottom sheet can still be opened using [`open`][struct@crate::BottomSheet#open].
143 ///
144 /// Readable | Writeable
145 ///
146 ///
147 /// #### `content`
148 /// The content widget.
149 ///
150 /// It's always shown, and the bottom sheet is overlaid over it.
151 ///
152 /// Readable | Writeable
153 ///
154 ///
155 /// #### `full-width`
156 /// Whether the bottom sheet takes the full width.
157 ///
158 /// When full width, [`align`][struct@crate::BottomSheet#align] is ignored.
159 ///
160 /// Readable | Writeable
161 ///
162 ///
163 /// #### `modal`
164 /// Whether the bottom sheet is modal.
165 ///
166 /// When modal, [`content`][struct@crate::BottomSheet#content] will be dimmed when the bottom
167 /// sheet is open, and clicking it will close the bottom sheet. It also cannot
168 /// be focused with keyboard.
169 ///
170 /// Otherwise, the content is accessible even when the bottom sheet is open.
171 ///
172 /// Readable | Writeable
173 ///
174 ///
175 /// #### `open`
176 /// Whether the bottom sheet is open.
177 ///
178 /// Readable | Writeable
179 ///
180 ///
181 /// #### `reveal-bottom-bar`
182 /// Whether to reveal the bottom bar.
183 ///
184 /// The transition will be animated.
185 ///
186 /// See [`bottom-bar`][struct@crate::BottomSheet#bottom-bar] and
187 /// [`bottom-bar-height`][struct@crate::BottomSheet#bottom-bar-height].
188 ///
189 /// Readable | Writeable
190 ///
191 ///
192 /// #### `sheet`
193 /// The bottom sheet widget.
194 ///
195 /// Only shown when [`open`][struct@crate::BottomSheet#open] is `TRUE`.
196 ///
197 /// Readable | Writeable
198 ///
199 ///
200 /// #### `sheet-height`
201 /// The current bottom sheet height.
202 ///
203 /// It can be used to shift the content upwards when the bottom sheet is open.
204 ///
205 /// Readable
206 ///
207 ///
208 /// #### `show-drag-handle`
209 /// Whether to overlay a drag handle in the bottom sheet.
210 ///
211 /// The handle will be overlaid over [`sheet`][struct@crate::BottomSheet#sheet].
212 ///
213 /// When the handle is shown, [`HeaderBar`][crate::HeaderBar] will hide its default title,
214 /// and [`ToolbarView`][crate::ToolbarView] will reserve space if there are no top bars.
215 ///
216 /// Showing drag handle also allows to swipe the bottom sheet down (and to
217 /// swipe the bottom bar up) with a pointer, instead of just touchscreen.
218 ///
219 /// Readable | Writeable
220 /// <details><summary><h4>Widget</h4></summary>
221 ///
222 ///
223 /// #### `can-focus`
224 /// Whether the widget or any of its descendents can accept
225 /// the input focus.
226 ///
227 /// This property is meant to be set by widget implementations,
228 /// typically in their instance init function.
229 ///
230 /// Readable | Writeable
231 ///
232 ///
233 /// #### `can-target`
234 /// Whether the widget can receive pointer events.
235 ///
236 /// Readable | Writeable
237 ///
238 ///
239 /// #### `css-classes`
240 /// A list of css classes applied to this widget.
241 ///
242 /// Readable | Writeable
243 ///
244 ///
245 /// #### `css-name`
246 /// The name of this widget in the CSS tree.
247 ///
248 /// This property is meant to be set by widget implementations,
249 /// typically in their instance init function.
250 ///
251 /// Readable | Writeable | Construct Only
252 ///
253 ///
254 /// #### `cursor`
255 /// The cursor used by @widget.
256 ///
257 /// Readable | Writeable
258 ///
259 ///
260 /// #### `focus-on-click`
261 /// Whether the widget should grab focus when it is clicked with the mouse.
262 ///
263 /// This property is only relevant for widgets that can take focus.
264 ///
265 /// Readable | Writeable
266 ///
267 ///
268 /// #### `focusable`
269 /// Whether this widget itself will accept the input focus.
270 ///
271 /// Readable | Writeable
272 ///
273 ///
274 /// #### `halign`
275 /// How to distribute horizontal space if widget gets extra space.
276 ///
277 /// Readable | Writeable
278 ///
279 ///
280 /// #### `has-default`
281 /// Whether the widget is the default widget.
282 ///
283 /// Readable
284 ///
285 ///
286 /// #### `has-focus`
287 /// Whether the widget has the input focus.
288 ///
289 /// Readable
290 ///
291 ///
292 /// #### `has-tooltip`
293 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip]
294 /// signal on @widget.
295 ///
296 /// A true value indicates that @widget can have a tooltip, in this case
297 /// the widget will be queried using [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] to
298 /// determine whether it will provide a tooltip or not.
299 ///
300 /// Readable | Writeable
301 ///
302 ///
303 /// #### `height-request`
304 /// Overrides for height request of the widget.
305 ///
306 /// If this is -1, the natural request will be used.
307 ///
308 /// Readable | Writeable
309 ///
310 ///
311 /// #### `hexpand`
312 /// Whether to expand horizontally.
313 ///
314 /// Readable | Writeable
315 ///
316 ///
317 /// #### `hexpand-set`
318 /// Whether to use the `hexpand` property.
319 ///
320 /// Readable | Writeable
321 ///
322 ///
323 /// #### `layout-manager`
324 /// The [`gtk::LayoutManager`][crate::gtk::LayoutManager] instance to use to compute
325 /// the preferred size of the widget, and allocate its children.
326 ///
327 /// This property is meant to be set by widget implementations,
328 /// typically in their instance init function.
329 ///
330 /// Readable | Writeable
331 ///
332 ///
333 /// #### `limit-events`
334 /// Makes this widget act like a modal dialog, with respect to
335 /// event delivery.
336 ///
337 /// Global event controllers will not handle events with targets
338 /// inside the widget, unless they are set up to ignore propagation
339 /// limits. See `Gtk::EventController::set_propagation_limit()`.
340 ///
341 /// Readable | Writeable
342 ///
343 ///
344 /// #### `margin-bottom`
345 /// Margin on bottom side of widget.
346 ///
347 /// This property adds margin outside of the widget's normal size
348 /// request, the margin will be added in addition to the size from
349 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
350 ///
351 /// Readable | Writeable
352 ///
353 ///
354 /// #### `margin-end`
355 /// Margin on end of widget, horizontally.
356 ///
357 /// This property supports left-to-right and right-to-left text
358 /// directions.
359 ///
360 /// This property adds margin outside of the widget's normal size
361 /// request, the margin will be added in addition to the size from
362 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
363 ///
364 /// Readable | Writeable
365 ///
366 ///
367 /// #### `margin-start`
368 /// Margin on start of widget, horizontally.
369 ///
370 /// This property supports left-to-right and right-to-left text
371 /// directions.
372 ///
373 /// This property adds margin outside of the widget's normal size
374 /// request, the margin will be added in addition to the size from
375 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
376 ///
377 /// Readable | Writeable
378 ///
379 ///
380 /// #### `margin-top`
381 /// Margin on top side of widget.
382 ///
383 /// This property adds margin outside of the widget's normal size
384 /// request, the margin will be added in addition to the size from
385 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
386 ///
387 /// Readable | Writeable
388 ///
389 ///
390 /// #### `name`
391 /// The name of the widget.
392 ///
393 /// Readable | Writeable
394 ///
395 ///
396 /// #### `opacity`
397 /// The requested opacity of the widget.
398 ///
399 /// Readable | Writeable
400 ///
401 ///
402 /// #### `overflow`
403 /// How content outside the widget's content area is treated.
404 ///
405 /// This property is meant to be set by widget implementations,
406 /// typically in their instance init function.
407 ///
408 /// Readable | Writeable
409 ///
410 ///
411 /// #### `parent`
412 /// The parent widget of this widget.
413 ///
414 /// Readable
415 ///
416 ///
417 /// #### `receives-default`
418 /// Whether the widget will receive the default action when it is focused.
419 ///
420 /// Readable | Writeable
421 ///
422 ///
423 /// #### `root`
424 /// The [`gtk::Root`][crate::gtk::Root] widget of the widget tree containing this widget.
425 ///
426 /// This will be `NULL` if the widget is not contained in a root widget.
427 ///
428 /// Readable
429 ///
430 ///
431 /// #### `scale-factor`
432 /// The scale factor of the widget.
433 ///
434 /// Readable
435 ///
436 ///
437 /// #### `sensitive`
438 /// Whether the widget responds to input.
439 ///
440 /// Readable | Writeable
441 ///
442 ///
443 /// #### `tooltip-markup`
444 /// Sets the text of tooltip to be the given string, which is marked up
445 /// with Pango markup.
446 ///
447 /// Also see `Gtk::Tooltip::set_markup()`.
448 ///
449 /// This is a convenience property which will take care of getting the
450 /// tooltip shown if the given string is not `NULL`:
451 /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
452 /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
453 /// the default signal handler.
454 ///
455 /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
456 /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
457 ///
458 /// Readable | Writeable
459 ///
460 ///
461 /// #### `tooltip-text`
462 /// Sets the text of tooltip to be the given string.
463 ///
464 /// Also see `Gtk::Tooltip::set_text()`.
465 ///
466 /// This is a convenience property which will take care of getting the
467 /// tooltip shown if the given string is not `NULL`:
468 /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
469 /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
470 /// the default signal handler.
471 ///
472 /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
473 /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
474 ///
475 /// Readable | Writeable
476 ///
477 ///
478 /// #### `valign`
479 /// How to distribute vertical space if widget gets extra space.
480 ///
481 /// Readable | Writeable
482 ///
483 ///
484 /// #### `vexpand`
485 /// Whether to expand vertically.
486 ///
487 /// Readable | Writeable
488 ///
489 ///
490 /// #### `vexpand-set`
491 /// Whether to use the `vexpand` property.
492 ///
493 /// Readable | Writeable
494 ///
495 ///
496 /// #### `visible`
497 /// Whether the widget is visible.
498 ///
499 /// Readable | Writeable
500 ///
501 ///
502 /// #### `width-request`
503 /// Overrides for width request of the widget.
504 ///
505 /// If this is -1, the natural request will be used.
506 ///
507 /// Readable | Writeable
508 /// </details>
509 /// <details><summary><h4>Accessible</h4></summary>
510 ///
511 ///
512 /// #### `accessible-role`
513 /// The accessible role of the given [`gtk::Accessible`][crate::gtk::Accessible] implementation.
514 ///
515 /// The accessible role cannot be changed once set.
516 ///
517 /// Readable | Writeable
518 /// </details>
519 ///
520 /// ## Signals
521 ///
522 ///
523 /// #### `close-attempt`
524 /// Emitted when the close button or shortcut is used while
525 /// [`can-close`][struct@crate::Dialog#can-close] is set to `FALSE`.
526 ///
527 ///
528 /// <details><summary><h4>Widget</h4></summary>
529 ///
530 ///
531 /// #### `destroy`
532 /// Signals that all holders of a reference to the widget should release
533 /// the reference that they hold.
534 ///
535 /// May result in finalization of the widget if all references are released.
536 ///
537 /// This signal is not suitable for saving widget state.
538 ///
539 ///
540 ///
541 ///
542 /// #### `direction-changed`
543 /// Emitted when the text direction of a widget changes.
544 ///
545 ///
546 ///
547 ///
548 /// #### `hide`
549 /// Emitted when @widget is hidden.
550 ///
551 ///
552 ///
553 ///
554 /// #### `keynav-failed`
555 /// Emitted if keyboard navigation fails.
556 ///
557 /// See [`WidgetExtManual::keynav_failed()`][crate::gtk::prelude::WidgetExtManual::keynav_failed()] for details.
558 ///
559 ///
560 ///
561 ///
562 /// #### `map`
563 /// Emitted when @widget is going to be mapped.
564 ///
565 /// A widget is mapped when the widget is visible (which is controlled with
566 /// [`visible`][struct@crate::gtk::Widget#visible]) and all its parents up to the toplevel widget
567 /// are also visible.
568 ///
569 /// The `::map` signal can be used to determine whether a widget will be drawn,
570 /// for instance it can resume an animation that was stopped during the
571 /// emission of [`unmap`][struct@crate::gtk::Widget#unmap].
572 ///
573 ///
574 ///
575 ///
576 /// #### `mnemonic-activate`
577 /// Emitted when a widget is activated via a mnemonic.
578 ///
579 /// The default handler for this signal activates @widget if @group_cycling
580 /// is false, or just makes @widget grab focus if @group_cycling is true.
581 ///
582 ///
583 ///
584 ///
585 /// #### `move-focus`
586 /// Emitted when the focus is moved.
587 ///
588 /// The `::move-focus` signal is a [keybinding signal](class.SignalAction.html).
589 ///
590 /// The default bindings for this signal are <kbd>Tab</kbd> to move forward,
591 /// and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move backward.
592 ///
593 /// Action
594 ///
595 ///
596 /// #### `query-tooltip`
597 /// Emitted when the widget’s tooltip is about to be shown.
598 ///
599 /// This happens when the [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] property
600 /// is true and the hover timeout has expired with the cursor hovering
601 /// above @widget; or emitted when @widget got focus in keyboard mode.
602 ///
603 /// Using the given coordinates, the signal handler should determine
604 /// whether a tooltip should be shown for @widget. If this is the case
605 /// true should be returned, false otherwise. Note that if @keyboard_mode
606 /// is true, the values of @x and @y are undefined and should not be used.
607 ///
608 /// The signal handler is free to manipulate @tooltip with the therefore
609 /// destined function calls.
610 ///
611 ///
612 ///
613 ///
614 /// #### `realize`
615 /// Emitted when @widget is associated with a `GdkSurface`.
616 ///
617 /// This means that [`WidgetExtManual::realize()`][crate::gtk::prelude::WidgetExtManual::realize()] has been called
618 /// or the widget has been mapped (that is, it is going to be drawn).
619 ///
620 ///
621 ///
622 ///
623 /// #### `show`
624 /// Emitted when @widget is shown.
625 ///
626 ///
627 ///
628 ///
629 /// #### `state-flags-changed`
630 /// Emitted when the widget state changes.
631 ///
632 /// See [`WidgetExtManual::state_flags()`][crate::gtk::prelude::WidgetExtManual::state_flags()].
633 ///
634 ///
635 ///
636 ///
637 /// #### `unmap`
638 /// Emitted when @widget is going to be unmapped.
639 ///
640 /// A widget is unmapped when either it or any of its parents up to the
641 /// toplevel widget have been set as hidden.
642 ///
643 /// As `::unmap` indicates that a widget will not be shown any longer,
644 /// it can be used to, for example, stop an animation on the widget.
645 ///
646 ///
647 ///
648 ///
649 /// #### `unrealize`
650 /// Emitted when the `GdkSurface` associated with @widget is destroyed.
651 ///
652 /// This means that [`WidgetExtManual::unrealize()`][crate::gtk::prelude::WidgetExtManual::unrealize()] has been called
653 /// or the widget has been unmapped (that is, it is going to be hidden).
654 ///
655 ///
656 /// </details>
657 ///
658 /// # Implements
659 ///
660 /// [`trait@gtk::prelude::WidgetExt`], [`trait@glib::ObjectExt`], [`trait@gtk::prelude::AccessibleExt`], [`trait@gtk::prelude::BuildableExt`], [`trait@gtk::prelude::ConstraintTargetExt`], [`SwipeableExt`][trait@crate::prelude::SwipeableExt]
661 #[doc(alias = "AdwBottomSheet")]
662 pub struct BottomSheet(Object<ffi::AdwBottomSheet, ffi::AdwBottomSheetClass>) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, Swipeable;
663
664 match fn {
665 type_ => || ffi::adw_bottom_sheet_get_type(),
666 }
667}
668
669impl BottomSheet {
670 /// Creates a new [`BottomSheet`][crate::BottomSheet].
671 ///
672 /// # Returns
673 ///
674 /// the new created [`BottomSheet`][crate::BottomSheet]
675 #[doc(alias = "adw_bottom_sheet_new")]
676 pub fn new() -> BottomSheet {
677 assert_initialized_main_thread!();
678 unsafe { gtk::Widget::from_glib_none(ffi::adw_bottom_sheet_new()).unsafe_cast() }
679 }
680
681 // rustdoc-stripper-ignore-next
682 /// Creates a new builder-pattern struct instance to construct [`BottomSheet`] objects.
683 ///
684 /// This method returns an instance of [`BottomSheetBuilder`](crate::builders::BottomSheetBuilder) which can be used to create [`BottomSheet`] objects.
685 pub fn builder() -> BottomSheetBuilder {
686 BottomSheetBuilder::new()
687 }
688
689 /// Gets horizontal alignment of the bottom sheet.
690 ///
691 /// # Returns
692 ///
693 /// the horizontal alignment
694 #[doc(alias = "adw_bottom_sheet_get_align")]
695 #[doc(alias = "get_align")]
696 pub fn align(&self) -> f32 {
697 unsafe { ffi::adw_bottom_sheet_get_align(self.to_glib_none().0) }
698 }
699
700 /// Gets the bottom bar widget for @self.
701 ///
702 /// # Returns
703 ///
704 /// the bottom bar widget
705 #[doc(alias = "adw_bottom_sheet_get_bottom_bar")]
706 #[doc(alias = "get_bottom_bar")]
707 #[doc(alias = "bottom-bar")]
708 pub fn bottom_bar(&self) -> Option<gtk::Widget> {
709 unsafe { from_glib_none(ffi::adw_bottom_sheet_get_bottom_bar(self.to_glib_none().0)) }
710 }
711
712 /// Gets the current bottom bar height.
713 ///
714 /// It can be used to shift the content upwards permanently to accommodate for
715 /// the bottom bar.
716 ///
717 /// # Returns
718 ///
719 /// the bottom bar height
720 #[doc(alias = "adw_bottom_sheet_get_bottom_bar_height")]
721 #[doc(alias = "get_bottom_bar_height")]
722 #[doc(alias = "bottom-bar-height")]
723 pub fn bottom_bar_height(&self) -> i32 {
724 unsafe { ffi::adw_bottom_sheet_get_bottom_bar_height(self.to_glib_none().0) }
725 }
726
727 /// Gets whether the bottom sheet can be closed by user.
728 ///
729 /// # Returns
730 ///
731 /// whether the sheet can be closed by user
732 #[doc(alias = "adw_bottom_sheet_get_can_close")]
733 #[doc(alias = "get_can_close")]
734 #[doc(alias = "can-close")]
735 pub fn can_close(&self) -> bool {
736 unsafe { from_glib(ffi::adw_bottom_sheet_get_can_close(self.to_glib_none().0)) }
737 }
738
739 /// Gets whether the bottom sheet can be opened by user.
740 ///
741 /// # Returns
742 ///
743 /// whether the sheet can be opened by user.
744 #[doc(alias = "adw_bottom_sheet_get_can_open")]
745 #[doc(alias = "get_can_open")]
746 #[doc(alias = "can-open")]
747 pub fn can_open(&self) -> bool {
748 unsafe { from_glib(ffi::adw_bottom_sheet_get_can_open(self.to_glib_none().0)) }
749 }
750
751 /// Gets the content widget for @self.
752 ///
753 /// # Returns
754 ///
755 /// the content widget
756 #[doc(alias = "adw_bottom_sheet_get_content")]
757 #[doc(alias = "get_content")]
758 pub fn content(&self) -> Option<gtk::Widget> {
759 unsafe { from_glib_none(ffi::adw_bottom_sheet_get_content(self.to_glib_none().0)) }
760 }
761
762 /// Gets whether the bottom sheet takes the full width.
763 ///
764 /// # Returns
765 ///
766 /// whether the sheet takes up the full width
767 #[doc(alias = "adw_bottom_sheet_get_full_width")]
768 #[doc(alias = "get_full_width")]
769 #[doc(alias = "full-width")]
770 pub fn is_full_width(&self) -> bool {
771 unsafe { from_glib(ffi::adw_bottom_sheet_get_full_width(self.to_glib_none().0)) }
772 }
773
774 /// Gets whether the bottom sheet is modal.
775 ///
776 /// # Returns
777 ///
778 /// whether the sheet is modal
779 #[doc(alias = "adw_bottom_sheet_get_modal")]
780 #[doc(alias = "get_modal")]
781 #[doc(alias = "modal")]
782 pub fn is_modal(&self) -> bool {
783 unsafe { from_glib(ffi::adw_bottom_sheet_get_modal(self.to_glib_none().0)) }
784 }
785
786 /// Gets whether the bottom sheet is open.
787 ///
788 /// # Returns
789 ///
790 /// whether the sheet is open
791 #[doc(alias = "adw_bottom_sheet_get_open")]
792 #[doc(alias = "get_open")]
793 #[doc(alias = "open")]
794 pub fn is_open(&self) -> bool {
795 unsafe { from_glib(ffi::adw_bottom_sheet_get_open(self.to_glib_none().0)) }
796 }
797
798 /// Gets whether the bottom bar is revealed.
799 ///
800 /// # Returns
801 ///
802 /// whether the bottom bar is revealed
803 #[cfg(feature = "v1_7")]
804 #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
805 #[doc(alias = "adw_bottom_sheet_get_reveal_bottom_bar")]
806 #[doc(alias = "get_reveal_bottom_bar")]
807 #[doc(alias = "reveal-bottom-bar")]
808 pub fn reveals_bottom_bar(&self) -> bool {
809 unsafe {
810 from_glib(ffi::adw_bottom_sheet_get_reveal_bottom_bar(
811 self.to_glib_none().0,
812 ))
813 }
814 }
815
816 /// Gets the bottom sheet widget for @self.
817 ///
818 /// # Returns
819 ///
820 /// the sheet widget
821 #[doc(alias = "adw_bottom_sheet_get_sheet")]
822 #[doc(alias = "get_sheet")]
823 pub fn sheet(&self) -> Option<gtk::Widget> {
824 unsafe { from_glib_none(ffi::adw_bottom_sheet_get_sheet(self.to_glib_none().0)) }
825 }
826
827 /// Gets the current bottom sheet height.
828 ///
829 /// It can be used to shift the content upwards when the bottom sheet is open.
830 ///
831 /// # Returns
832 ///
833 /// the sheet height
834 #[doc(alias = "adw_bottom_sheet_get_sheet_height")]
835 #[doc(alias = "get_sheet_height")]
836 #[doc(alias = "sheet-height")]
837 pub fn sheet_height(&self) -> i32 {
838 unsafe { ffi::adw_bottom_sheet_get_sheet_height(self.to_glib_none().0) }
839 }
840
841 /// Gets whether to show a drag handle in the bottom sheet.
842 ///
843 /// # Returns
844 ///
845 /// whether to show the drag handle
846 #[doc(alias = "adw_bottom_sheet_get_show_drag_handle")]
847 #[doc(alias = "get_show_drag_handle")]
848 #[doc(alias = "show-drag-handle")]
849 pub fn shows_drag_handle(&self) -> bool {
850 unsafe {
851 from_glib(ffi::adw_bottom_sheet_get_show_drag_handle(
852 self.to_glib_none().0,
853 ))
854 }
855 }
856
857 /// Sets horizontal alignment of the bottom sheet.
858 ///
859 /// 0 means the bottom sheet is flush with the start edge, 1 means it's flush
860 /// with the end edge. 0.5 means it's centered.
861 ///
862 /// Only used when [`full-width`][struct@crate::BottomSheet#full-width] is set to `FALSE`.
863 /// ## `align`
864 /// the new alignment
865 #[doc(alias = "adw_bottom_sheet_set_align")]
866 #[doc(alias = "align")]
867 pub fn set_align(&self, align: f32) {
868 unsafe {
869 ffi::adw_bottom_sheet_set_align(self.to_glib_none().0, align);
870 }
871 }
872
873 /// Sets the bottom bar widget for @self.
874 ///
875 /// Shown when [`open`][struct@crate::BottomSheet#open] is `FALSE`. When open, morphs into
876 /// the [`sheet`][struct@crate::BottomSheet#sheet].
877 ///
878 /// Bottom bar can be temporarily hidden using the
879 /// [`reveal-bottom-bar`][struct@crate::BottomSheet#reveal-bottom-bar] property.
880 /// ## `bottom_bar`
881 /// the bottom bar widget
882 #[doc(alias = "adw_bottom_sheet_set_bottom_bar")]
883 #[doc(alias = "bottom-bar")]
884 pub fn set_bottom_bar(&self, bottom_bar: Option<&impl IsA<gtk::Widget>>) {
885 unsafe {
886 ffi::adw_bottom_sheet_set_bottom_bar(
887 self.to_glib_none().0,
888 bottom_bar.map(|p| p.as_ref()).to_glib_none().0,
889 );
890 }
891 }
892
893 /// Sets whether the bottom sheet can be closed by user.
894 ///
895 /// It can be closed via the close button, swiping down, pressing
896 /// <kbd>Escape</kbd> or clicking the content dimming (when modal).
897 ///
898 /// Bottom sheet can still be closed using [`open`][struct@crate::BottomSheet#open].
899 /// ## `can_close`
900 /// whether the sheet can be closed by user
901 #[doc(alias = "adw_bottom_sheet_set_can_close")]
902 #[doc(alias = "can-close")]
903 pub fn set_can_close(&self, can_close: bool) {
904 unsafe {
905 ffi::adw_bottom_sheet_set_can_close(self.to_glib_none().0, can_close.into_glib());
906 }
907 }
908
909 /// Sets whether the bottom sheet can be opened by user.
910 ///
911 /// It can be opened via clicking or swiping up from the bottom bar.
912 ///
913 /// Does nothing if [`bottom-bar`][struct@crate::BottomSheet#bottom-bar] is not set.
914 ///
915 /// Bottom sheet can still be opened using [`open`][struct@crate::BottomSheet#open].
916 /// ## `can_open`
917 /// whether the sheet can be opened by user.
918 #[doc(alias = "adw_bottom_sheet_set_can_open")]
919 #[doc(alias = "can-open")]
920 pub fn set_can_open(&self, can_open: bool) {
921 unsafe {
922 ffi::adw_bottom_sheet_set_can_open(self.to_glib_none().0, can_open.into_glib());
923 }
924 }
925
926 /// Sets the content widget for @self.
927 ///
928 /// It's always shown, and the bottom sheet is overlaid over it.
929 /// ## `content`
930 /// the content widget
931 #[doc(alias = "adw_bottom_sheet_set_content")]
932 #[doc(alias = "content")]
933 pub fn set_content(&self, content: Option<&impl IsA<gtk::Widget>>) {
934 unsafe {
935 ffi::adw_bottom_sheet_set_content(
936 self.to_glib_none().0,
937 content.map(|p| p.as_ref()).to_glib_none().0,
938 );
939 }
940 }
941
942 /// Sets whether the bottom sheet takes the full width.
943 ///
944 /// When full width, [`align`][struct@crate::BottomSheet#align] is ignored.
945 /// ## `full_width`
946 /// whether the sheet takes up the full width
947 #[doc(alias = "adw_bottom_sheet_set_full_width")]
948 #[doc(alias = "full-width")]
949 pub fn set_full_width(&self, full_width: bool) {
950 unsafe {
951 ffi::adw_bottom_sheet_set_full_width(self.to_glib_none().0, full_width.into_glib());
952 }
953 }
954
955 /// Sets whether the bottom sheet is modal.
956 ///
957 /// When modal, [`content`][struct@crate::BottomSheet#content] will be dimmed when the bottom
958 /// sheet is open, and clicking it will close the bottom sheet. It also cannot be
959 /// focused with keyboard.
960 ///
961 /// Otherwise, the content is accessible even when the bottom sheet is open.
962 /// ## `modal`
963 /// whether the sheet is modal
964 #[doc(alias = "adw_bottom_sheet_set_modal")]
965 #[doc(alias = "modal")]
966 pub fn set_modal(&self, modal: bool) {
967 unsafe {
968 ffi::adw_bottom_sheet_set_modal(self.to_glib_none().0, modal.into_glib());
969 }
970 }
971
972 /// Sets whether the bottom sheet is open.
973 /// ## `open`
974 /// whether to open the sheet
975 #[doc(alias = "adw_bottom_sheet_set_open")]
976 #[doc(alias = "open")]
977 pub fn set_open(&self, open: bool) {
978 unsafe {
979 ffi::adw_bottom_sheet_set_open(self.to_glib_none().0, open.into_glib());
980 }
981 }
982
983 /// Sets whether to reveal the bottom bar.
984 ///
985 /// The transition will be animated.
986 ///
987 /// See [`bottom-bar`][struct@crate::BottomSheet#bottom-bar] and
988 /// [`bottom-bar-height`][struct@crate::BottomSheet#bottom-bar-height].
989 /// ## `reveal`
990 /// whether to reveal the bottom bar
991 #[cfg(feature = "v1_7")]
992 #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
993 #[doc(alias = "adw_bottom_sheet_set_reveal_bottom_bar")]
994 #[doc(alias = "reveal-bottom-bar")]
995 pub fn set_reveal_bottom_bar(&self, reveal: bool) {
996 unsafe {
997 ffi::adw_bottom_sheet_set_reveal_bottom_bar(self.to_glib_none().0, reveal.into_glib());
998 }
999 }
1000
1001 /// Sets the bottom sheet widget for @self.
1002 ///
1003 /// Only shown when [`open`][struct@crate::BottomSheet#open] is `TRUE`.
1004 /// ## `sheet`
1005 /// the sheet widget
1006 #[doc(alias = "adw_bottom_sheet_set_sheet")]
1007 #[doc(alias = "sheet")]
1008 pub fn set_sheet(&self, sheet: Option<&impl IsA<gtk::Widget>>) {
1009 unsafe {
1010 ffi::adw_bottom_sheet_set_sheet(
1011 self.to_glib_none().0,
1012 sheet.map(|p| p.as_ref()).to_glib_none().0,
1013 );
1014 }
1015 }
1016
1017 /// Sets whether to show a drag handle in the bottom sheet.
1018 ///
1019 /// The handle will be overlaid over [`sheet`][struct@crate::BottomSheet#sheet].
1020 ///
1021 /// When the handle is shown, [`HeaderBar`][crate::HeaderBar] will hide its default title, and
1022 /// [`ToolbarView`][crate::ToolbarView] will reserve space if there are no top bars.
1023 ///
1024 /// Showing drag handle also allows to swipe the bottom sheet down (and to swipe
1025 /// the bottom bar up) with a pointer, instead of just touchscreen.
1026 /// ## `show_drag_handle`
1027 /// whether to show the drag handle
1028 #[doc(alias = "adw_bottom_sheet_set_show_drag_handle")]
1029 #[doc(alias = "show-drag-handle")]
1030 pub fn set_show_drag_handle(&self, show_drag_handle: bool) {
1031 unsafe {
1032 ffi::adw_bottom_sheet_set_show_drag_handle(
1033 self.to_glib_none().0,
1034 show_drag_handle.into_glib(),
1035 );
1036 }
1037 }
1038
1039 /// Emitted when the close button or shortcut is used while
1040 /// [`can-close`][struct@crate::Dialog#can-close] is set to `FALSE`.
1041 #[cfg(feature = "v1_6")]
1042 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
1043 #[doc(alias = "close-attempt")]
1044 pub fn connect_close_attempt<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1045 unsafe extern "C" fn close_attempt_trampoline<F: Fn(&BottomSheet) + 'static>(
1046 this: *mut ffi::AdwBottomSheet,
1047 f: glib::ffi::gpointer,
1048 ) {
1049 unsafe {
1050 let f: &F = &*(f as *const F);
1051 f(&from_glib_borrow(this))
1052 }
1053 }
1054 unsafe {
1055 let f: Box_<F> = Box_::new(f);
1056 connect_raw(
1057 self.as_ptr() as *mut _,
1058 c"close-attempt".as_ptr(),
1059 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1060 close_attempt_trampoline::<F> as *const (),
1061 )),
1062 Box_::into_raw(f),
1063 )
1064 }
1065 }
1066
1067 #[cfg(feature = "v1_6")]
1068 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
1069 #[doc(alias = "align")]
1070 pub fn connect_align_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1071 unsafe extern "C" fn notify_align_trampoline<F: Fn(&BottomSheet) + 'static>(
1072 this: *mut ffi::AdwBottomSheet,
1073 _param_spec: glib::ffi::gpointer,
1074 f: glib::ffi::gpointer,
1075 ) {
1076 unsafe {
1077 let f: &F = &*(f as *const F);
1078 f(&from_glib_borrow(this))
1079 }
1080 }
1081 unsafe {
1082 let f: Box_<F> = Box_::new(f);
1083 connect_raw(
1084 self.as_ptr() as *mut _,
1085 c"notify::align".as_ptr(),
1086 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1087 notify_align_trampoline::<F> as *const (),
1088 )),
1089 Box_::into_raw(f),
1090 )
1091 }
1092 }
1093
1094 #[cfg(feature = "v1_6")]
1095 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
1096 #[doc(alias = "bottom-bar")]
1097 pub fn connect_bottom_bar_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1098 unsafe extern "C" fn notify_bottom_bar_trampoline<F: Fn(&BottomSheet) + 'static>(
1099 this: *mut ffi::AdwBottomSheet,
1100 _param_spec: glib::ffi::gpointer,
1101 f: glib::ffi::gpointer,
1102 ) {
1103 unsafe {
1104 let f: &F = &*(f as *const F);
1105 f(&from_glib_borrow(this))
1106 }
1107 }
1108 unsafe {
1109 let f: Box_<F> = Box_::new(f);
1110 connect_raw(
1111 self.as_ptr() as *mut _,
1112 c"notify::bottom-bar".as_ptr(),
1113 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1114 notify_bottom_bar_trampoline::<F> as *const (),
1115 )),
1116 Box_::into_raw(f),
1117 )
1118 }
1119 }
1120
1121 #[cfg(feature = "v1_6")]
1122 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
1123 #[doc(alias = "bottom-bar-height")]
1124 pub fn connect_bottom_bar_height_notify<F: Fn(&Self) + 'static>(
1125 &self,
1126 f: F,
1127 ) -> SignalHandlerId {
1128 unsafe extern "C" fn notify_bottom_bar_height_trampoline<F: Fn(&BottomSheet) + 'static>(
1129 this: *mut ffi::AdwBottomSheet,
1130 _param_spec: glib::ffi::gpointer,
1131 f: glib::ffi::gpointer,
1132 ) {
1133 unsafe {
1134 let f: &F = &*(f as *const F);
1135 f(&from_glib_borrow(this))
1136 }
1137 }
1138 unsafe {
1139 let f: Box_<F> = Box_::new(f);
1140 connect_raw(
1141 self.as_ptr() as *mut _,
1142 c"notify::bottom-bar-height".as_ptr(),
1143 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1144 notify_bottom_bar_height_trampoline::<F> as *const (),
1145 )),
1146 Box_::into_raw(f),
1147 )
1148 }
1149 }
1150
1151 #[cfg(feature = "v1_6")]
1152 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
1153 #[doc(alias = "can-close")]
1154 pub fn connect_can_close_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1155 unsafe extern "C" fn notify_can_close_trampoline<F: Fn(&BottomSheet) + 'static>(
1156 this: *mut ffi::AdwBottomSheet,
1157 _param_spec: glib::ffi::gpointer,
1158 f: glib::ffi::gpointer,
1159 ) {
1160 unsafe {
1161 let f: &F = &*(f as *const F);
1162 f(&from_glib_borrow(this))
1163 }
1164 }
1165 unsafe {
1166 let f: Box_<F> = Box_::new(f);
1167 connect_raw(
1168 self.as_ptr() as *mut _,
1169 c"notify::can-close".as_ptr(),
1170 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1171 notify_can_close_trampoline::<F> as *const (),
1172 )),
1173 Box_::into_raw(f),
1174 )
1175 }
1176 }
1177
1178 #[cfg(feature = "v1_6")]
1179 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
1180 #[doc(alias = "can-open")]
1181 pub fn connect_can_open_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1182 unsafe extern "C" fn notify_can_open_trampoline<F: Fn(&BottomSheet) + 'static>(
1183 this: *mut ffi::AdwBottomSheet,
1184 _param_spec: glib::ffi::gpointer,
1185 f: glib::ffi::gpointer,
1186 ) {
1187 unsafe {
1188 let f: &F = &*(f as *const F);
1189 f(&from_glib_borrow(this))
1190 }
1191 }
1192 unsafe {
1193 let f: Box_<F> = Box_::new(f);
1194 connect_raw(
1195 self.as_ptr() as *mut _,
1196 c"notify::can-open".as_ptr(),
1197 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1198 notify_can_open_trampoline::<F> as *const (),
1199 )),
1200 Box_::into_raw(f),
1201 )
1202 }
1203 }
1204
1205 #[cfg(feature = "v1_6")]
1206 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
1207 #[doc(alias = "content")]
1208 pub fn connect_content_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1209 unsafe extern "C" fn notify_content_trampoline<F: Fn(&BottomSheet) + 'static>(
1210 this: *mut ffi::AdwBottomSheet,
1211 _param_spec: glib::ffi::gpointer,
1212 f: glib::ffi::gpointer,
1213 ) {
1214 unsafe {
1215 let f: &F = &*(f as *const F);
1216 f(&from_glib_borrow(this))
1217 }
1218 }
1219 unsafe {
1220 let f: Box_<F> = Box_::new(f);
1221 connect_raw(
1222 self.as_ptr() as *mut _,
1223 c"notify::content".as_ptr(),
1224 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1225 notify_content_trampoline::<F> as *const (),
1226 )),
1227 Box_::into_raw(f),
1228 )
1229 }
1230 }
1231
1232 #[cfg(feature = "v1_6")]
1233 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
1234 #[doc(alias = "full-width")]
1235 pub fn connect_full_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1236 unsafe extern "C" fn notify_full_width_trampoline<F: Fn(&BottomSheet) + 'static>(
1237 this: *mut ffi::AdwBottomSheet,
1238 _param_spec: glib::ffi::gpointer,
1239 f: glib::ffi::gpointer,
1240 ) {
1241 unsafe {
1242 let f: &F = &*(f as *const F);
1243 f(&from_glib_borrow(this))
1244 }
1245 }
1246 unsafe {
1247 let f: Box_<F> = Box_::new(f);
1248 connect_raw(
1249 self.as_ptr() as *mut _,
1250 c"notify::full-width".as_ptr(),
1251 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1252 notify_full_width_trampoline::<F> as *const (),
1253 )),
1254 Box_::into_raw(f),
1255 )
1256 }
1257 }
1258
1259 #[cfg(feature = "v1_6")]
1260 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
1261 #[doc(alias = "modal")]
1262 pub fn connect_modal_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1263 unsafe extern "C" fn notify_modal_trampoline<F: Fn(&BottomSheet) + 'static>(
1264 this: *mut ffi::AdwBottomSheet,
1265 _param_spec: glib::ffi::gpointer,
1266 f: glib::ffi::gpointer,
1267 ) {
1268 unsafe {
1269 let f: &F = &*(f as *const F);
1270 f(&from_glib_borrow(this))
1271 }
1272 }
1273 unsafe {
1274 let f: Box_<F> = Box_::new(f);
1275 connect_raw(
1276 self.as_ptr() as *mut _,
1277 c"notify::modal".as_ptr(),
1278 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1279 notify_modal_trampoline::<F> as *const (),
1280 )),
1281 Box_::into_raw(f),
1282 )
1283 }
1284 }
1285
1286 #[cfg(feature = "v1_6")]
1287 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
1288 #[doc(alias = "open")]
1289 pub fn connect_open_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1290 unsafe extern "C" fn notify_open_trampoline<F: Fn(&BottomSheet) + 'static>(
1291 this: *mut ffi::AdwBottomSheet,
1292 _param_spec: glib::ffi::gpointer,
1293 f: glib::ffi::gpointer,
1294 ) {
1295 unsafe {
1296 let f: &F = &*(f as *const F);
1297 f(&from_glib_borrow(this))
1298 }
1299 }
1300 unsafe {
1301 let f: Box_<F> = Box_::new(f);
1302 connect_raw(
1303 self.as_ptr() as *mut _,
1304 c"notify::open".as_ptr(),
1305 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1306 notify_open_trampoline::<F> as *const (),
1307 )),
1308 Box_::into_raw(f),
1309 )
1310 }
1311 }
1312
1313 #[cfg(feature = "v1_7")]
1314 #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
1315 #[doc(alias = "reveal-bottom-bar")]
1316 pub fn connect_reveal_bottom_bar_notify<F: Fn(&Self) + 'static>(
1317 &self,
1318 f: F,
1319 ) -> SignalHandlerId {
1320 unsafe extern "C" fn notify_reveal_bottom_bar_trampoline<F: Fn(&BottomSheet) + 'static>(
1321 this: *mut ffi::AdwBottomSheet,
1322 _param_spec: glib::ffi::gpointer,
1323 f: glib::ffi::gpointer,
1324 ) {
1325 unsafe {
1326 let f: &F = &*(f as *const F);
1327 f(&from_glib_borrow(this))
1328 }
1329 }
1330 unsafe {
1331 let f: Box_<F> = Box_::new(f);
1332 connect_raw(
1333 self.as_ptr() as *mut _,
1334 c"notify::reveal-bottom-bar".as_ptr(),
1335 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1336 notify_reveal_bottom_bar_trampoline::<F> as *const (),
1337 )),
1338 Box_::into_raw(f),
1339 )
1340 }
1341 }
1342
1343 #[cfg(feature = "v1_6")]
1344 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
1345 #[doc(alias = "sheet")]
1346 pub fn connect_sheet_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1347 unsafe extern "C" fn notify_sheet_trampoline<F: Fn(&BottomSheet) + 'static>(
1348 this: *mut ffi::AdwBottomSheet,
1349 _param_spec: glib::ffi::gpointer,
1350 f: glib::ffi::gpointer,
1351 ) {
1352 unsafe {
1353 let f: &F = &*(f as *const F);
1354 f(&from_glib_borrow(this))
1355 }
1356 }
1357 unsafe {
1358 let f: Box_<F> = Box_::new(f);
1359 connect_raw(
1360 self.as_ptr() as *mut _,
1361 c"notify::sheet".as_ptr(),
1362 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1363 notify_sheet_trampoline::<F> as *const (),
1364 )),
1365 Box_::into_raw(f),
1366 )
1367 }
1368 }
1369
1370 #[cfg(feature = "v1_6")]
1371 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
1372 #[doc(alias = "sheet-height")]
1373 pub fn connect_sheet_height_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1374 unsafe extern "C" fn notify_sheet_height_trampoline<F: Fn(&BottomSheet) + 'static>(
1375 this: *mut ffi::AdwBottomSheet,
1376 _param_spec: glib::ffi::gpointer,
1377 f: glib::ffi::gpointer,
1378 ) {
1379 unsafe {
1380 let f: &F = &*(f as *const F);
1381 f(&from_glib_borrow(this))
1382 }
1383 }
1384 unsafe {
1385 let f: Box_<F> = Box_::new(f);
1386 connect_raw(
1387 self.as_ptr() as *mut _,
1388 c"notify::sheet-height".as_ptr(),
1389 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1390 notify_sheet_height_trampoline::<F> as *const (),
1391 )),
1392 Box_::into_raw(f),
1393 )
1394 }
1395 }
1396
1397 #[cfg(feature = "v1_6")]
1398 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
1399 #[doc(alias = "show-drag-handle")]
1400 pub fn connect_show_drag_handle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1401 unsafe extern "C" fn notify_show_drag_handle_trampoline<F: Fn(&BottomSheet) + 'static>(
1402 this: *mut ffi::AdwBottomSheet,
1403 _param_spec: glib::ffi::gpointer,
1404 f: glib::ffi::gpointer,
1405 ) {
1406 unsafe {
1407 let f: &F = &*(f as *const F);
1408 f(&from_glib_borrow(this))
1409 }
1410 }
1411 unsafe {
1412 let f: Box_<F> = Box_::new(f);
1413 connect_raw(
1414 self.as_ptr() as *mut _,
1415 c"notify::show-drag-handle".as_ptr(),
1416 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1417 notify_show_drag_handle_trampoline::<F> as *const (),
1418 )),
1419 Box_::into_raw(f),
1420 )
1421 }
1422 }
1423}
1424
1425#[cfg(feature = "v1_6")]
1426#[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
1427impl Default for BottomSheet {
1428 fn default() -> Self {
1429 Self::new()
1430 }
1431}
1432
1433// rustdoc-stripper-ignore-next
1434/// A [builder-pattern] type to construct [`BottomSheet`] objects.
1435///
1436/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1437#[must_use = "The builder must be built to be used"]
1438pub struct BottomSheetBuilder {
1439 builder: glib::object::ObjectBuilder<'static, BottomSheet>,
1440}
1441
1442impl BottomSheetBuilder {
1443 fn new() -> Self {
1444 Self {
1445 builder: glib::object::Object::builder(),
1446 }
1447 }
1448
1449 /// Horizontal alignment of the bottom sheet.
1450 ///
1451 /// 0 means the bottom sheet is flush with the start edge, 1 means it's flush
1452 /// with the end edge. 0.5 means it's centered.
1453 ///
1454 /// Only used when [`full-width`][struct@crate::BottomSheet#full-width] is set to `FALSE`.
1455 #[cfg(feature = "v1_6")]
1456 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
1457 pub fn align(self, align: f32) -> Self {
1458 Self {
1459 builder: self.builder.property("align", align),
1460 }
1461 }
1462
1463 /// The bottom bar widget.
1464 ///
1465 /// Shown when [`open`][struct@crate::BottomSheet#open] is `FALSE`. When open, morphs into
1466 /// the [`sheet`][struct@crate::BottomSheet#sheet].
1467 ///
1468 /// Bottom bar can be temporarily hidden using the
1469 /// [`reveal-bottom-bar`][struct@crate::BottomSheet#reveal-bottom-bar] property.
1470 #[cfg(feature = "v1_6")]
1471 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
1472 pub fn bottom_bar(self, bottom_bar: &impl IsA<gtk::Widget>) -> Self {
1473 Self {
1474 builder: self
1475 .builder
1476 .property("bottom-bar", bottom_bar.clone().upcast()),
1477 }
1478 }
1479
1480 /// Whether the bottom sheet can be closed by user.
1481 ///
1482 /// It can be closed via the close button, swiping down, pressing
1483 /// <kbd>Escape</kbd> or clicking the content dimming (when modal).
1484 ///
1485 /// Bottom sheet can still be closed using [`open`][struct@crate::BottomSheet#open].
1486 #[cfg(feature = "v1_6")]
1487 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
1488 pub fn can_close(self, can_close: bool) -> Self {
1489 Self {
1490 builder: self.builder.property("can-close", can_close),
1491 }
1492 }
1493
1494 /// Whether the bottom sheet can be opened by user.
1495 ///
1496 /// It can be opened via clicking or swiping up from the bottom bar.
1497 ///
1498 /// Does nothing if [`bottom-bar`][struct@crate::BottomSheet#bottom-bar] is not set.
1499 ///
1500 /// Bottom sheet can still be opened using [`open`][struct@crate::BottomSheet#open].
1501 #[cfg(feature = "v1_6")]
1502 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
1503 pub fn can_open(self, can_open: bool) -> Self {
1504 Self {
1505 builder: self.builder.property("can-open", can_open),
1506 }
1507 }
1508
1509 /// The content widget.
1510 ///
1511 /// It's always shown, and the bottom sheet is overlaid over it.
1512 #[cfg(feature = "v1_6")]
1513 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
1514 pub fn content(self, content: &impl IsA<gtk::Widget>) -> Self {
1515 Self {
1516 builder: self.builder.property("content", content.clone().upcast()),
1517 }
1518 }
1519
1520 /// Whether the bottom sheet takes the full width.
1521 ///
1522 /// When full width, [`align`][struct@crate::BottomSheet#align] is ignored.
1523 #[cfg(feature = "v1_6")]
1524 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
1525 pub fn full_width(self, full_width: bool) -> Self {
1526 Self {
1527 builder: self.builder.property("full-width", full_width),
1528 }
1529 }
1530
1531 /// Whether the bottom sheet is modal.
1532 ///
1533 /// When modal, [`content`][struct@crate::BottomSheet#content] will be dimmed when the bottom
1534 /// sheet is open, and clicking it will close the bottom sheet. It also cannot
1535 /// be focused with keyboard.
1536 ///
1537 /// Otherwise, the content is accessible even when the bottom sheet is open.
1538 #[cfg(feature = "v1_6")]
1539 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
1540 pub fn modal(self, modal: bool) -> Self {
1541 Self {
1542 builder: self.builder.property("modal", modal),
1543 }
1544 }
1545
1546 /// Whether the bottom sheet is open.
1547 #[cfg(feature = "v1_6")]
1548 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
1549 pub fn open(self, open: bool) -> Self {
1550 Self {
1551 builder: self.builder.property("open", open),
1552 }
1553 }
1554
1555 /// Whether to reveal the bottom bar.
1556 ///
1557 /// The transition will be animated.
1558 ///
1559 /// See [`bottom-bar`][struct@crate::BottomSheet#bottom-bar] and
1560 /// [`bottom-bar-height`][struct@crate::BottomSheet#bottom-bar-height].
1561 #[cfg(feature = "v1_7")]
1562 #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
1563 pub fn reveal_bottom_bar(self, reveal_bottom_bar: bool) -> Self {
1564 Self {
1565 builder: self
1566 .builder
1567 .property("reveal-bottom-bar", reveal_bottom_bar),
1568 }
1569 }
1570
1571 /// The bottom sheet widget.
1572 ///
1573 /// Only shown when [`open`][struct@crate::BottomSheet#open] is `TRUE`.
1574 #[cfg(feature = "v1_6")]
1575 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
1576 pub fn sheet(self, sheet: &impl IsA<gtk::Widget>) -> Self {
1577 Self {
1578 builder: self.builder.property("sheet", sheet.clone().upcast()),
1579 }
1580 }
1581
1582 /// Whether to overlay a drag handle in the bottom sheet.
1583 ///
1584 /// The handle will be overlaid over [`sheet`][struct@crate::BottomSheet#sheet].
1585 ///
1586 /// When the handle is shown, [`HeaderBar`][crate::HeaderBar] will hide its default title,
1587 /// and [`ToolbarView`][crate::ToolbarView] will reserve space if there are no top bars.
1588 ///
1589 /// Showing drag handle also allows to swipe the bottom sheet down (and to
1590 /// swipe the bottom bar up) with a pointer, instead of just touchscreen.
1591 #[cfg(feature = "v1_6")]
1592 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
1593 pub fn show_drag_handle(self, show_drag_handle: bool) -> Self {
1594 Self {
1595 builder: self.builder.property("show-drag-handle", show_drag_handle),
1596 }
1597 }
1598
1599 /// Whether the widget or any of its descendents can accept
1600 /// the input focus.
1601 ///
1602 /// This property is meant to be set by widget implementations,
1603 /// typically in their instance init function.
1604 pub fn can_focus(self, can_focus: bool) -> Self {
1605 Self {
1606 builder: self.builder.property("can-focus", can_focus),
1607 }
1608 }
1609
1610 /// Whether the widget can receive pointer events.
1611 pub fn can_target(self, can_target: bool) -> Self {
1612 Self {
1613 builder: self.builder.property("can-target", can_target),
1614 }
1615 }
1616
1617 /// A list of css classes applied to this widget.
1618 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1619 Self {
1620 builder: self.builder.property("css-classes", css_classes.into()),
1621 }
1622 }
1623
1624 /// The name of this widget in the CSS tree.
1625 ///
1626 /// This property is meant to be set by widget implementations,
1627 /// typically in their instance init function.
1628 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1629 Self {
1630 builder: self.builder.property("css-name", css_name.into()),
1631 }
1632 }
1633
1634 /// The cursor used by @widget.
1635 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1636 Self {
1637 builder: self.builder.property("cursor", cursor.clone()),
1638 }
1639 }
1640
1641 /// Whether the widget should grab focus when it is clicked with the mouse.
1642 ///
1643 /// This property is only relevant for widgets that can take focus.
1644 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1645 Self {
1646 builder: self.builder.property("focus-on-click", focus_on_click),
1647 }
1648 }
1649
1650 /// Whether this widget itself will accept the input focus.
1651 pub fn focusable(self, focusable: bool) -> Self {
1652 Self {
1653 builder: self.builder.property("focusable", focusable),
1654 }
1655 }
1656
1657 /// How to distribute horizontal space if widget gets extra space.
1658 pub fn halign(self, halign: gtk::Align) -> Self {
1659 Self {
1660 builder: self.builder.property("halign", halign),
1661 }
1662 }
1663
1664 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip]
1665 /// signal on @widget.
1666 ///
1667 /// A true value indicates that @widget can have a tooltip, in this case
1668 /// the widget will be queried using [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] to
1669 /// determine whether it will provide a tooltip or not.
1670 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1671 Self {
1672 builder: self.builder.property("has-tooltip", has_tooltip),
1673 }
1674 }
1675
1676 /// Overrides for height request of the widget.
1677 ///
1678 /// If this is -1, the natural request will be used.
1679 pub fn height_request(self, height_request: i32) -> Self {
1680 Self {
1681 builder: self.builder.property("height-request", height_request),
1682 }
1683 }
1684
1685 /// Whether to expand horizontally.
1686 pub fn hexpand(self, hexpand: bool) -> Self {
1687 Self {
1688 builder: self.builder.property("hexpand", hexpand),
1689 }
1690 }
1691
1692 /// Whether to use the `hexpand` property.
1693 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1694 Self {
1695 builder: self.builder.property("hexpand-set", hexpand_set),
1696 }
1697 }
1698
1699 /// The [`gtk::LayoutManager`][crate::gtk::LayoutManager] instance to use to compute
1700 /// the preferred size of the widget, and allocate its children.
1701 ///
1702 /// This property is meant to be set by widget implementations,
1703 /// typically in their instance init function.
1704 pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
1705 Self {
1706 builder: self
1707 .builder
1708 .property("layout-manager", layout_manager.clone().upcast()),
1709 }
1710 }
1711
1712 /// Makes this widget act like a modal dialog, with respect to
1713 /// event delivery.
1714 ///
1715 /// Global event controllers will not handle events with targets
1716 /// inside the widget, unless they are set up to ignore propagation
1717 /// limits. See `Gtk::EventController::set_propagation_limit()`.
1718 #[cfg(feature = "gtk_v4_18")]
1719 #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
1720 pub fn limit_events(self, limit_events: bool) -> Self {
1721 Self {
1722 builder: self.builder.property("limit-events", limit_events),
1723 }
1724 }
1725
1726 /// Margin on bottom side of widget.
1727 ///
1728 /// This property adds margin outside of the widget's normal size
1729 /// request, the margin will be added in addition to the size from
1730 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1731 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1732 Self {
1733 builder: self.builder.property("margin-bottom", margin_bottom),
1734 }
1735 }
1736
1737 /// Margin on end of widget, horizontally.
1738 ///
1739 /// This property supports left-to-right and right-to-left text
1740 /// directions.
1741 ///
1742 /// This property adds margin outside of the widget's normal size
1743 /// request, the margin will be added in addition to the size from
1744 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1745 pub fn margin_end(self, margin_end: i32) -> Self {
1746 Self {
1747 builder: self.builder.property("margin-end", margin_end),
1748 }
1749 }
1750
1751 /// Margin on start of widget, horizontally.
1752 ///
1753 /// This property supports left-to-right and right-to-left text
1754 /// directions.
1755 ///
1756 /// This property adds margin outside of the widget's normal size
1757 /// request, the margin will be added in addition to the size from
1758 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1759 pub fn margin_start(self, margin_start: i32) -> Self {
1760 Self {
1761 builder: self.builder.property("margin-start", margin_start),
1762 }
1763 }
1764
1765 /// Margin on top side of widget.
1766 ///
1767 /// This property adds margin outside of the widget's normal size
1768 /// request, the margin will be added in addition to the size from
1769 /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
1770 pub fn margin_top(self, margin_top: i32) -> Self {
1771 Self {
1772 builder: self.builder.property("margin-top", margin_top),
1773 }
1774 }
1775
1776 /// The name of the widget.
1777 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1778 Self {
1779 builder: self.builder.property("name", name.into()),
1780 }
1781 }
1782
1783 /// The requested opacity of the widget.
1784 pub fn opacity(self, opacity: f64) -> Self {
1785 Self {
1786 builder: self.builder.property("opacity", opacity),
1787 }
1788 }
1789
1790 /// How content outside the widget's content area is treated.
1791 ///
1792 /// This property is meant to be set by widget implementations,
1793 /// typically in their instance init function.
1794 pub fn overflow(self, overflow: gtk::Overflow) -> Self {
1795 Self {
1796 builder: self.builder.property("overflow", overflow),
1797 }
1798 }
1799
1800 /// Whether the widget will receive the default action when it is focused.
1801 pub fn receives_default(self, receives_default: bool) -> Self {
1802 Self {
1803 builder: self.builder.property("receives-default", receives_default),
1804 }
1805 }
1806
1807 /// Whether the widget responds to input.
1808 pub fn sensitive(self, sensitive: bool) -> Self {
1809 Self {
1810 builder: self.builder.property("sensitive", sensitive),
1811 }
1812 }
1813
1814 /// Sets the text of tooltip to be the given string, which is marked up
1815 /// with Pango markup.
1816 ///
1817 /// Also see `Gtk::Tooltip::set_markup()`.
1818 ///
1819 /// This is a convenience property which will take care of getting the
1820 /// tooltip shown if the given string is not `NULL`:
1821 /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
1822 /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
1823 /// the default signal handler.
1824 ///
1825 /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
1826 /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
1827 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1828 Self {
1829 builder: self
1830 .builder
1831 .property("tooltip-markup", tooltip_markup.into()),
1832 }
1833 }
1834
1835 /// Sets the text of tooltip to be the given string.
1836 ///
1837 /// Also see `Gtk::Tooltip::set_text()`.
1838 ///
1839 /// This is a convenience property which will take care of getting the
1840 /// tooltip shown if the given string is not `NULL`:
1841 /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
1842 /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
1843 /// the default signal handler.
1844 ///
1845 /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
1846 /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
1847 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1848 Self {
1849 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1850 }
1851 }
1852
1853 /// How to distribute vertical space if widget gets extra space.
1854 pub fn valign(self, valign: gtk::Align) -> Self {
1855 Self {
1856 builder: self.builder.property("valign", valign),
1857 }
1858 }
1859
1860 /// Whether to expand vertically.
1861 pub fn vexpand(self, vexpand: bool) -> Self {
1862 Self {
1863 builder: self.builder.property("vexpand", vexpand),
1864 }
1865 }
1866
1867 /// Whether to use the `vexpand` property.
1868 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1869 Self {
1870 builder: self.builder.property("vexpand-set", vexpand_set),
1871 }
1872 }
1873
1874 /// Whether the widget is visible.
1875 pub fn visible(self, visible: bool) -> Self {
1876 Self {
1877 builder: self.builder.property("visible", visible),
1878 }
1879 }
1880
1881 /// Overrides for width request of the widget.
1882 ///
1883 /// If this is -1, the natural request will be used.
1884 pub fn width_request(self, width_request: i32) -> Self {
1885 Self {
1886 builder: self.builder.property("width-request", width_request),
1887 }
1888 }
1889
1890 /// The accessible role of the given [`gtk::Accessible`][crate::gtk::Accessible] implementation.
1891 ///
1892 /// The accessible role cannot be changed once set.
1893 pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
1894 Self {
1895 builder: self.builder.property("accessible-role", accessible_role),
1896 }
1897 }
1898
1899 // rustdoc-stripper-ignore-next
1900 /// Build the [`BottomSheet`].
1901 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1902 pub fn build(self) -> BottomSheet {
1903 assert_initialized_main_thread!();
1904 self.builder.build()
1905 }
1906}