1use crate::{ffi, Swipeable};
7use glib::{
8 object::ObjectType as _,
9 prelude::*,
10 signal::{connect_raw, SignalHandlerId},
11 translate::*,
12};
13use std::boxed::Box as Box_;
14
15glib::wrapper! {
16 #[doc(alias = "AdwBottomSheet")]
17 pub struct BottomSheet(Object<ffi::AdwBottomSheet, ffi::AdwBottomSheetClass>) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, Swipeable;
18
19 match fn {
20 type_ => || ffi::adw_bottom_sheet_get_type(),
21 }
22}
23
24impl BottomSheet {
25 #[doc(alias = "adw_bottom_sheet_new")]
26 pub fn new() -> BottomSheet {
27 assert_initialized_main_thread!();
28 unsafe { gtk::Widget::from_glib_none(ffi::adw_bottom_sheet_new()).unsafe_cast() }
29 }
30
31 pub fn builder() -> BottomSheetBuilder {
36 BottomSheetBuilder::new()
37 }
38
39 #[doc(alias = "adw_bottom_sheet_get_align")]
40 #[doc(alias = "get_align")]
41 pub fn align(&self) -> f32 {
42 unsafe { ffi::adw_bottom_sheet_get_align(self.to_glib_none().0) }
43 }
44
45 #[doc(alias = "adw_bottom_sheet_get_bottom_bar")]
46 #[doc(alias = "get_bottom_bar")]
47 #[doc(alias = "bottom-bar")]
48 pub fn bottom_bar(&self) -> Option<gtk::Widget> {
49 unsafe { from_glib_none(ffi::adw_bottom_sheet_get_bottom_bar(self.to_glib_none().0)) }
50 }
51
52 #[doc(alias = "adw_bottom_sheet_get_bottom_bar_height")]
53 #[doc(alias = "get_bottom_bar_height")]
54 #[doc(alias = "bottom-bar-height")]
55 pub fn bottom_bar_height(&self) -> i32 {
56 unsafe { ffi::adw_bottom_sheet_get_bottom_bar_height(self.to_glib_none().0) }
57 }
58
59 #[doc(alias = "adw_bottom_sheet_get_can_close")]
60 #[doc(alias = "get_can_close")]
61 #[doc(alias = "can-close")]
62 pub fn can_close(&self) -> bool {
63 unsafe { from_glib(ffi::adw_bottom_sheet_get_can_close(self.to_glib_none().0)) }
64 }
65
66 #[doc(alias = "adw_bottom_sheet_get_can_open")]
67 #[doc(alias = "get_can_open")]
68 #[doc(alias = "can-open")]
69 pub fn can_open(&self) -> bool {
70 unsafe { from_glib(ffi::adw_bottom_sheet_get_can_open(self.to_glib_none().0)) }
71 }
72
73 #[doc(alias = "adw_bottom_sheet_get_content")]
74 #[doc(alias = "get_content")]
75 pub fn content(&self) -> Option<gtk::Widget> {
76 unsafe { from_glib_none(ffi::adw_bottom_sheet_get_content(self.to_glib_none().0)) }
77 }
78
79 #[doc(alias = "adw_bottom_sheet_get_full_width")]
80 #[doc(alias = "get_full_width")]
81 #[doc(alias = "full-width")]
82 pub fn is_full_width(&self) -> bool {
83 unsafe { from_glib(ffi::adw_bottom_sheet_get_full_width(self.to_glib_none().0)) }
84 }
85
86 #[doc(alias = "adw_bottom_sheet_get_modal")]
87 #[doc(alias = "get_modal")]
88 #[doc(alias = "modal")]
89 pub fn is_modal(&self) -> bool {
90 unsafe { from_glib(ffi::adw_bottom_sheet_get_modal(self.to_glib_none().0)) }
91 }
92
93 #[doc(alias = "adw_bottom_sheet_get_open")]
94 #[doc(alias = "get_open")]
95 #[doc(alias = "open")]
96 pub fn is_open(&self) -> bool {
97 unsafe { from_glib(ffi::adw_bottom_sheet_get_open(self.to_glib_none().0)) }
98 }
99
100 #[cfg(feature = "v1_7")]
101 #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
102 #[doc(alias = "adw_bottom_sheet_get_reveal_bottom_bar")]
103 #[doc(alias = "get_reveal_bottom_bar")]
104 #[doc(alias = "reveal-bottom-bar")]
105 pub fn reveals_bottom_bar(&self) -> bool {
106 unsafe {
107 from_glib(ffi::adw_bottom_sheet_get_reveal_bottom_bar(
108 self.to_glib_none().0,
109 ))
110 }
111 }
112
113 #[doc(alias = "adw_bottom_sheet_get_sheet")]
114 #[doc(alias = "get_sheet")]
115 pub fn sheet(&self) -> Option<gtk::Widget> {
116 unsafe { from_glib_none(ffi::adw_bottom_sheet_get_sheet(self.to_glib_none().0)) }
117 }
118
119 #[doc(alias = "adw_bottom_sheet_get_sheet_height")]
120 #[doc(alias = "get_sheet_height")]
121 #[doc(alias = "sheet-height")]
122 pub fn sheet_height(&self) -> i32 {
123 unsafe { ffi::adw_bottom_sheet_get_sheet_height(self.to_glib_none().0) }
124 }
125
126 #[doc(alias = "adw_bottom_sheet_get_show_drag_handle")]
127 #[doc(alias = "get_show_drag_handle")]
128 #[doc(alias = "show-drag-handle")]
129 pub fn shows_drag_handle(&self) -> bool {
130 unsafe {
131 from_glib(ffi::adw_bottom_sheet_get_show_drag_handle(
132 self.to_glib_none().0,
133 ))
134 }
135 }
136
137 #[doc(alias = "adw_bottom_sheet_set_align")]
138 #[doc(alias = "align")]
139 pub fn set_align(&self, align: f32) {
140 unsafe {
141 ffi::adw_bottom_sheet_set_align(self.to_glib_none().0, align);
142 }
143 }
144
145 #[doc(alias = "adw_bottom_sheet_set_bottom_bar")]
146 #[doc(alias = "bottom-bar")]
147 pub fn set_bottom_bar(&self, bottom_bar: Option<&impl IsA<gtk::Widget>>) {
148 unsafe {
149 ffi::adw_bottom_sheet_set_bottom_bar(
150 self.to_glib_none().0,
151 bottom_bar.map(|p| p.as_ref()).to_glib_none().0,
152 );
153 }
154 }
155
156 #[doc(alias = "adw_bottom_sheet_set_can_close")]
157 #[doc(alias = "can-close")]
158 pub fn set_can_close(&self, can_close: bool) {
159 unsafe {
160 ffi::adw_bottom_sheet_set_can_close(self.to_glib_none().0, can_close.into_glib());
161 }
162 }
163
164 #[doc(alias = "adw_bottom_sheet_set_can_open")]
165 #[doc(alias = "can-open")]
166 pub fn set_can_open(&self, can_open: bool) {
167 unsafe {
168 ffi::adw_bottom_sheet_set_can_open(self.to_glib_none().0, can_open.into_glib());
169 }
170 }
171
172 #[doc(alias = "adw_bottom_sheet_set_content")]
173 #[doc(alias = "content")]
174 pub fn set_content(&self, content: Option<&impl IsA<gtk::Widget>>) {
175 unsafe {
176 ffi::adw_bottom_sheet_set_content(
177 self.to_glib_none().0,
178 content.map(|p| p.as_ref()).to_glib_none().0,
179 );
180 }
181 }
182
183 #[doc(alias = "adw_bottom_sheet_set_full_width")]
184 #[doc(alias = "full-width")]
185 pub fn set_full_width(&self, full_width: bool) {
186 unsafe {
187 ffi::adw_bottom_sheet_set_full_width(self.to_glib_none().0, full_width.into_glib());
188 }
189 }
190
191 #[doc(alias = "adw_bottom_sheet_set_modal")]
192 #[doc(alias = "modal")]
193 pub fn set_modal(&self, modal: bool) {
194 unsafe {
195 ffi::adw_bottom_sheet_set_modal(self.to_glib_none().0, modal.into_glib());
196 }
197 }
198
199 #[doc(alias = "adw_bottom_sheet_set_open")]
200 #[doc(alias = "open")]
201 pub fn set_open(&self, open: bool) {
202 unsafe {
203 ffi::adw_bottom_sheet_set_open(self.to_glib_none().0, open.into_glib());
204 }
205 }
206
207 #[cfg(feature = "v1_7")]
208 #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
209 #[doc(alias = "adw_bottom_sheet_set_reveal_bottom_bar")]
210 #[doc(alias = "reveal-bottom-bar")]
211 pub fn set_reveal_bottom_bar(&self, reveal: bool) {
212 unsafe {
213 ffi::adw_bottom_sheet_set_reveal_bottom_bar(self.to_glib_none().0, reveal.into_glib());
214 }
215 }
216
217 #[doc(alias = "adw_bottom_sheet_set_sheet")]
218 #[doc(alias = "sheet")]
219 pub fn set_sheet(&self, sheet: Option<&impl IsA<gtk::Widget>>) {
220 unsafe {
221 ffi::adw_bottom_sheet_set_sheet(
222 self.to_glib_none().0,
223 sheet.map(|p| p.as_ref()).to_glib_none().0,
224 );
225 }
226 }
227
228 #[doc(alias = "adw_bottom_sheet_set_show_drag_handle")]
229 #[doc(alias = "show-drag-handle")]
230 pub fn set_show_drag_handle(&self, show_drag_handle: bool) {
231 unsafe {
232 ffi::adw_bottom_sheet_set_show_drag_handle(
233 self.to_glib_none().0,
234 show_drag_handle.into_glib(),
235 );
236 }
237 }
238
239 #[cfg(feature = "v1_6")]
240 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
241 #[doc(alias = "close-attempt")]
242 pub fn connect_close_attempt<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
243 unsafe extern "C" fn close_attempt_trampoline<F: Fn(&BottomSheet) + 'static>(
244 this: *mut ffi::AdwBottomSheet,
245 f: glib::ffi::gpointer,
246 ) {
247 let f: &F = &*(f as *const F);
248 f(&from_glib_borrow(this))
249 }
250 unsafe {
251 let f: Box_<F> = Box_::new(f);
252 connect_raw(
253 self.as_ptr() as *mut _,
254 c"close-attempt".as_ptr() as *const _,
255 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
256 close_attempt_trampoline::<F> as *const (),
257 )),
258 Box_::into_raw(f),
259 )
260 }
261 }
262
263 #[cfg(feature = "v1_6")]
264 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
265 #[doc(alias = "align")]
266 pub fn connect_align_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
267 unsafe extern "C" fn notify_align_trampoline<F: Fn(&BottomSheet) + 'static>(
268 this: *mut ffi::AdwBottomSheet,
269 _param_spec: glib::ffi::gpointer,
270 f: glib::ffi::gpointer,
271 ) {
272 let f: &F = &*(f as *const F);
273 f(&from_glib_borrow(this))
274 }
275 unsafe {
276 let f: Box_<F> = Box_::new(f);
277 connect_raw(
278 self.as_ptr() as *mut _,
279 c"notify::align".as_ptr() as *const _,
280 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
281 notify_align_trampoline::<F> as *const (),
282 )),
283 Box_::into_raw(f),
284 )
285 }
286 }
287
288 #[cfg(feature = "v1_6")]
289 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
290 #[doc(alias = "bottom-bar")]
291 pub fn connect_bottom_bar_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
292 unsafe extern "C" fn notify_bottom_bar_trampoline<F: Fn(&BottomSheet) + 'static>(
293 this: *mut ffi::AdwBottomSheet,
294 _param_spec: glib::ffi::gpointer,
295 f: glib::ffi::gpointer,
296 ) {
297 let f: &F = &*(f as *const F);
298 f(&from_glib_borrow(this))
299 }
300 unsafe {
301 let f: Box_<F> = Box_::new(f);
302 connect_raw(
303 self.as_ptr() as *mut _,
304 c"notify::bottom-bar".as_ptr() as *const _,
305 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
306 notify_bottom_bar_trampoline::<F> as *const (),
307 )),
308 Box_::into_raw(f),
309 )
310 }
311 }
312
313 #[cfg(feature = "v1_6")]
314 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
315 #[doc(alias = "bottom-bar-height")]
316 pub fn connect_bottom_bar_height_notify<F: Fn(&Self) + 'static>(
317 &self,
318 f: F,
319 ) -> SignalHandlerId {
320 unsafe extern "C" fn notify_bottom_bar_height_trampoline<F: Fn(&BottomSheet) + 'static>(
321 this: *mut ffi::AdwBottomSheet,
322 _param_spec: glib::ffi::gpointer,
323 f: glib::ffi::gpointer,
324 ) {
325 let f: &F = &*(f as *const F);
326 f(&from_glib_borrow(this))
327 }
328 unsafe {
329 let f: Box_<F> = Box_::new(f);
330 connect_raw(
331 self.as_ptr() as *mut _,
332 c"notify::bottom-bar-height".as_ptr() as *const _,
333 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
334 notify_bottom_bar_height_trampoline::<F> as *const (),
335 )),
336 Box_::into_raw(f),
337 )
338 }
339 }
340
341 #[cfg(feature = "v1_6")]
342 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
343 #[doc(alias = "can-close")]
344 pub fn connect_can_close_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
345 unsafe extern "C" fn notify_can_close_trampoline<F: Fn(&BottomSheet) + 'static>(
346 this: *mut ffi::AdwBottomSheet,
347 _param_spec: glib::ffi::gpointer,
348 f: glib::ffi::gpointer,
349 ) {
350 let f: &F = &*(f as *const F);
351 f(&from_glib_borrow(this))
352 }
353 unsafe {
354 let f: Box_<F> = Box_::new(f);
355 connect_raw(
356 self.as_ptr() as *mut _,
357 c"notify::can-close".as_ptr() as *const _,
358 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
359 notify_can_close_trampoline::<F> as *const (),
360 )),
361 Box_::into_raw(f),
362 )
363 }
364 }
365
366 #[cfg(feature = "v1_6")]
367 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
368 #[doc(alias = "can-open")]
369 pub fn connect_can_open_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
370 unsafe extern "C" fn notify_can_open_trampoline<F: Fn(&BottomSheet) + 'static>(
371 this: *mut ffi::AdwBottomSheet,
372 _param_spec: glib::ffi::gpointer,
373 f: glib::ffi::gpointer,
374 ) {
375 let f: &F = &*(f as *const F);
376 f(&from_glib_borrow(this))
377 }
378 unsafe {
379 let f: Box_<F> = Box_::new(f);
380 connect_raw(
381 self.as_ptr() as *mut _,
382 c"notify::can-open".as_ptr() as *const _,
383 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
384 notify_can_open_trampoline::<F> as *const (),
385 )),
386 Box_::into_raw(f),
387 )
388 }
389 }
390
391 #[cfg(feature = "v1_6")]
392 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
393 #[doc(alias = "content")]
394 pub fn connect_content_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
395 unsafe extern "C" fn notify_content_trampoline<F: Fn(&BottomSheet) + 'static>(
396 this: *mut ffi::AdwBottomSheet,
397 _param_spec: glib::ffi::gpointer,
398 f: glib::ffi::gpointer,
399 ) {
400 let f: &F = &*(f as *const F);
401 f(&from_glib_borrow(this))
402 }
403 unsafe {
404 let f: Box_<F> = Box_::new(f);
405 connect_raw(
406 self.as_ptr() as *mut _,
407 c"notify::content".as_ptr() as *const _,
408 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
409 notify_content_trampoline::<F> as *const (),
410 )),
411 Box_::into_raw(f),
412 )
413 }
414 }
415
416 #[cfg(feature = "v1_6")]
417 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
418 #[doc(alias = "full-width")]
419 pub fn connect_full_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
420 unsafe extern "C" fn notify_full_width_trampoline<F: Fn(&BottomSheet) + 'static>(
421 this: *mut ffi::AdwBottomSheet,
422 _param_spec: glib::ffi::gpointer,
423 f: glib::ffi::gpointer,
424 ) {
425 let f: &F = &*(f as *const F);
426 f(&from_glib_borrow(this))
427 }
428 unsafe {
429 let f: Box_<F> = Box_::new(f);
430 connect_raw(
431 self.as_ptr() as *mut _,
432 c"notify::full-width".as_ptr() as *const _,
433 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
434 notify_full_width_trampoline::<F> as *const (),
435 )),
436 Box_::into_raw(f),
437 )
438 }
439 }
440
441 #[cfg(feature = "v1_6")]
442 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
443 #[doc(alias = "modal")]
444 pub fn connect_modal_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
445 unsafe extern "C" fn notify_modal_trampoline<F: Fn(&BottomSheet) + 'static>(
446 this: *mut ffi::AdwBottomSheet,
447 _param_spec: glib::ffi::gpointer,
448 f: glib::ffi::gpointer,
449 ) {
450 let f: &F = &*(f as *const F);
451 f(&from_glib_borrow(this))
452 }
453 unsafe {
454 let f: Box_<F> = Box_::new(f);
455 connect_raw(
456 self.as_ptr() as *mut _,
457 c"notify::modal".as_ptr() as *const _,
458 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
459 notify_modal_trampoline::<F> as *const (),
460 )),
461 Box_::into_raw(f),
462 )
463 }
464 }
465
466 #[cfg(feature = "v1_6")]
467 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
468 #[doc(alias = "open")]
469 pub fn connect_open_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
470 unsafe extern "C" fn notify_open_trampoline<F: Fn(&BottomSheet) + 'static>(
471 this: *mut ffi::AdwBottomSheet,
472 _param_spec: glib::ffi::gpointer,
473 f: glib::ffi::gpointer,
474 ) {
475 let f: &F = &*(f as *const F);
476 f(&from_glib_borrow(this))
477 }
478 unsafe {
479 let f: Box_<F> = Box_::new(f);
480 connect_raw(
481 self.as_ptr() as *mut _,
482 c"notify::open".as_ptr() as *const _,
483 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
484 notify_open_trampoline::<F> as *const (),
485 )),
486 Box_::into_raw(f),
487 )
488 }
489 }
490
491 #[cfg(feature = "v1_7")]
492 #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
493 #[doc(alias = "reveal-bottom-bar")]
494 pub fn connect_reveal_bottom_bar_notify<F: Fn(&Self) + 'static>(
495 &self,
496 f: F,
497 ) -> SignalHandlerId {
498 unsafe extern "C" fn notify_reveal_bottom_bar_trampoline<F: Fn(&BottomSheet) + 'static>(
499 this: *mut ffi::AdwBottomSheet,
500 _param_spec: glib::ffi::gpointer,
501 f: glib::ffi::gpointer,
502 ) {
503 let f: &F = &*(f as *const F);
504 f(&from_glib_borrow(this))
505 }
506 unsafe {
507 let f: Box_<F> = Box_::new(f);
508 connect_raw(
509 self.as_ptr() as *mut _,
510 c"notify::reveal-bottom-bar".as_ptr() as *const _,
511 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
512 notify_reveal_bottom_bar_trampoline::<F> as *const (),
513 )),
514 Box_::into_raw(f),
515 )
516 }
517 }
518
519 #[cfg(feature = "v1_6")]
520 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
521 #[doc(alias = "sheet")]
522 pub fn connect_sheet_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
523 unsafe extern "C" fn notify_sheet_trampoline<F: Fn(&BottomSheet) + 'static>(
524 this: *mut ffi::AdwBottomSheet,
525 _param_spec: glib::ffi::gpointer,
526 f: glib::ffi::gpointer,
527 ) {
528 let f: &F = &*(f as *const F);
529 f(&from_glib_borrow(this))
530 }
531 unsafe {
532 let f: Box_<F> = Box_::new(f);
533 connect_raw(
534 self.as_ptr() as *mut _,
535 c"notify::sheet".as_ptr() as *const _,
536 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
537 notify_sheet_trampoline::<F> as *const (),
538 )),
539 Box_::into_raw(f),
540 )
541 }
542 }
543
544 #[cfg(feature = "v1_6")]
545 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
546 #[doc(alias = "sheet-height")]
547 pub fn connect_sheet_height_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
548 unsafe extern "C" fn notify_sheet_height_trampoline<F: Fn(&BottomSheet) + 'static>(
549 this: *mut ffi::AdwBottomSheet,
550 _param_spec: glib::ffi::gpointer,
551 f: glib::ffi::gpointer,
552 ) {
553 let f: &F = &*(f as *const F);
554 f(&from_glib_borrow(this))
555 }
556 unsafe {
557 let f: Box_<F> = Box_::new(f);
558 connect_raw(
559 self.as_ptr() as *mut _,
560 c"notify::sheet-height".as_ptr() as *const _,
561 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
562 notify_sheet_height_trampoline::<F> as *const (),
563 )),
564 Box_::into_raw(f),
565 )
566 }
567 }
568
569 #[cfg(feature = "v1_6")]
570 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
571 #[doc(alias = "show-drag-handle")]
572 pub fn connect_show_drag_handle_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
573 unsafe extern "C" fn notify_show_drag_handle_trampoline<F: Fn(&BottomSheet) + 'static>(
574 this: *mut ffi::AdwBottomSheet,
575 _param_spec: glib::ffi::gpointer,
576 f: glib::ffi::gpointer,
577 ) {
578 let f: &F = &*(f as *const F);
579 f(&from_glib_borrow(this))
580 }
581 unsafe {
582 let f: Box_<F> = Box_::new(f);
583 connect_raw(
584 self.as_ptr() as *mut _,
585 c"notify::show-drag-handle".as_ptr() as *const _,
586 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
587 notify_show_drag_handle_trampoline::<F> as *const (),
588 )),
589 Box_::into_raw(f),
590 )
591 }
592 }
593}
594
595#[cfg(feature = "v1_6")]
596#[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
597impl Default for BottomSheet {
598 fn default() -> Self {
599 Self::new()
600 }
601}
602
603#[must_use = "The builder must be built to be used"]
608pub struct BottomSheetBuilder {
609 builder: glib::object::ObjectBuilder<'static, BottomSheet>,
610}
611
612impl BottomSheetBuilder {
613 fn new() -> Self {
614 Self {
615 builder: glib::object::Object::builder(),
616 }
617 }
618
619 #[cfg(feature = "v1_6")]
620 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
621 pub fn align(self, align: f32) -> Self {
622 Self {
623 builder: self.builder.property("align", align),
624 }
625 }
626
627 #[cfg(feature = "v1_6")]
628 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
629 pub fn bottom_bar(self, bottom_bar: &impl IsA<gtk::Widget>) -> Self {
630 Self {
631 builder: self
632 .builder
633 .property("bottom-bar", bottom_bar.clone().upcast()),
634 }
635 }
636
637 #[cfg(feature = "v1_6")]
638 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
639 pub fn can_close(self, can_close: bool) -> Self {
640 Self {
641 builder: self.builder.property("can-close", can_close),
642 }
643 }
644
645 #[cfg(feature = "v1_6")]
646 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
647 pub fn can_open(self, can_open: bool) -> Self {
648 Self {
649 builder: self.builder.property("can-open", can_open),
650 }
651 }
652
653 #[cfg(feature = "v1_6")]
654 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
655 pub fn content(self, content: &impl IsA<gtk::Widget>) -> Self {
656 Self {
657 builder: self.builder.property("content", content.clone().upcast()),
658 }
659 }
660
661 #[cfg(feature = "v1_6")]
662 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
663 pub fn full_width(self, full_width: bool) -> Self {
664 Self {
665 builder: self.builder.property("full-width", full_width),
666 }
667 }
668
669 #[cfg(feature = "v1_6")]
670 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
671 pub fn modal(self, modal: bool) -> Self {
672 Self {
673 builder: self.builder.property("modal", modal),
674 }
675 }
676
677 #[cfg(feature = "v1_6")]
678 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
679 pub fn open(self, open: bool) -> Self {
680 Self {
681 builder: self.builder.property("open", open),
682 }
683 }
684
685 #[cfg(feature = "v1_7")]
686 #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
687 pub fn reveal_bottom_bar(self, reveal_bottom_bar: bool) -> Self {
688 Self {
689 builder: self
690 .builder
691 .property("reveal-bottom-bar", reveal_bottom_bar),
692 }
693 }
694
695 #[cfg(feature = "v1_6")]
696 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
697 pub fn sheet(self, sheet: &impl IsA<gtk::Widget>) -> Self {
698 Self {
699 builder: self.builder.property("sheet", sheet.clone().upcast()),
700 }
701 }
702
703 #[cfg(feature = "v1_6")]
704 #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
705 pub fn show_drag_handle(self, show_drag_handle: bool) -> Self {
706 Self {
707 builder: self.builder.property("show-drag-handle", show_drag_handle),
708 }
709 }
710
711 pub fn can_focus(self, can_focus: bool) -> Self {
712 Self {
713 builder: self.builder.property("can-focus", can_focus),
714 }
715 }
716
717 pub fn can_target(self, can_target: bool) -> Self {
718 Self {
719 builder: self.builder.property("can-target", can_target),
720 }
721 }
722
723 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
724 Self {
725 builder: self.builder.property("css-classes", css_classes.into()),
726 }
727 }
728
729 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
730 Self {
731 builder: self.builder.property("css-name", css_name.into()),
732 }
733 }
734
735 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
736 Self {
737 builder: self.builder.property("cursor", cursor.clone()),
738 }
739 }
740
741 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
742 Self {
743 builder: self.builder.property("focus-on-click", focus_on_click),
744 }
745 }
746
747 pub fn focusable(self, focusable: bool) -> Self {
748 Self {
749 builder: self.builder.property("focusable", focusable),
750 }
751 }
752
753 pub fn halign(self, halign: gtk::Align) -> Self {
754 Self {
755 builder: self.builder.property("halign", halign),
756 }
757 }
758
759 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
760 Self {
761 builder: self.builder.property("has-tooltip", has_tooltip),
762 }
763 }
764
765 pub fn height_request(self, height_request: i32) -> Self {
766 Self {
767 builder: self.builder.property("height-request", height_request),
768 }
769 }
770
771 pub fn hexpand(self, hexpand: bool) -> Self {
772 Self {
773 builder: self.builder.property("hexpand", hexpand),
774 }
775 }
776
777 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
778 Self {
779 builder: self.builder.property("hexpand-set", hexpand_set),
780 }
781 }
782
783 pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
784 Self {
785 builder: self
786 .builder
787 .property("layout-manager", layout_manager.clone().upcast()),
788 }
789 }
790
791 #[cfg(feature = "gtk_v4_18")]
792 #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
793 pub fn limit_events(self, limit_events: bool) -> Self {
794 Self {
795 builder: self.builder.property("limit-events", limit_events),
796 }
797 }
798
799 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
800 Self {
801 builder: self.builder.property("margin-bottom", margin_bottom),
802 }
803 }
804
805 pub fn margin_end(self, margin_end: i32) -> Self {
806 Self {
807 builder: self.builder.property("margin-end", margin_end),
808 }
809 }
810
811 pub fn margin_start(self, margin_start: i32) -> Self {
812 Self {
813 builder: self.builder.property("margin-start", margin_start),
814 }
815 }
816
817 pub fn margin_top(self, margin_top: i32) -> Self {
818 Self {
819 builder: self.builder.property("margin-top", margin_top),
820 }
821 }
822
823 pub fn name(self, name: impl Into<glib::GString>) -> Self {
824 Self {
825 builder: self.builder.property("name", name.into()),
826 }
827 }
828
829 pub fn opacity(self, opacity: f64) -> Self {
830 Self {
831 builder: self.builder.property("opacity", opacity),
832 }
833 }
834
835 pub fn overflow(self, overflow: gtk::Overflow) -> Self {
836 Self {
837 builder: self.builder.property("overflow", overflow),
838 }
839 }
840
841 pub fn receives_default(self, receives_default: bool) -> Self {
842 Self {
843 builder: self.builder.property("receives-default", receives_default),
844 }
845 }
846
847 pub fn sensitive(self, sensitive: bool) -> Self {
848 Self {
849 builder: self.builder.property("sensitive", sensitive),
850 }
851 }
852
853 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
854 Self {
855 builder: self
856 .builder
857 .property("tooltip-markup", tooltip_markup.into()),
858 }
859 }
860
861 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
862 Self {
863 builder: self.builder.property("tooltip-text", tooltip_text.into()),
864 }
865 }
866
867 pub fn valign(self, valign: gtk::Align) -> Self {
868 Self {
869 builder: self.builder.property("valign", valign),
870 }
871 }
872
873 pub fn vexpand(self, vexpand: bool) -> Self {
874 Self {
875 builder: self.builder.property("vexpand", vexpand),
876 }
877 }
878
879 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
880 Self {
881 builder: self.builder.property("vexpand-set", vexpand_set),
882 }
883 }
884
885 pub fn visible(self, visible: bool) -> Self {
886 Self {
887 builder: self.builder.property("visible", visible),
888 }
889 }
890
891 pub fn width_request(self, width_request: i32) -> Self {
892 Self {
893 builder: self.builder.property("width-request", width_request),
894 }
895 }
896
897 pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
898 Self {
899 builder: self.builder.property("accessible-role", accessible_role),
900 }
901 }
902
903 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
906 pub fn build(self) -> BottomSheet {
907 assert_initialized_main_thread!();
908 self.builder.build()
909 }
910}