1#![allow(deprecated)]
6
7use crate::{
8 FlapFoldPolicy, FlapTransitionType, FoldThresholdPolicy, SpringParams, Swipeable, ffi,
9};
10use glib::{
11 prelude::*,
12 signal::{SignalHandlerId, connect_raw},
13 translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18 #[doc(alias = "AdwFlap")]
19 pub struct Flap(Object<ffi::AdwFlap, ffi::AdwFlapClass>) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, Swipeable, gtk::Orientable;
20
21 match fn {
22 type_ => || ffi::adw_flap_get_type(),
23 }
24}
25
26impl Flap {
27 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
28 #[allow(deprecated)]
29 #[doc(alias = "adw_flap_new")]
30 pub fn new() -> Flap {
31 assert_initialized_main_thread!();
32 unsafe { gtk::Widget::from_glib_none(ffi::adw_flap_new()).unsafe_cast() }
33 }
34
35 pub fn builder() -> FlapBuilder {
40 FlapBuilder::new()
41 }
42
43 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
44 #[allow(deprecated)]
45 #[doc(alias = "adw_flap_get_content")]
46 #[doc(alias = "get_content")]
47 pub fn content(&self) -> Option<gtk::Widget> {
48 unsafe { from_glib_none(ffi::adw_flap_get_content(self.to_glib_none().0)) }
49 }
50
51 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
52 #[allow(deprecated)]
53 #[doc(alias = "adw_flap_get_flap")]
54 #[doc(alias = "get_flap")]
55 pub fn flap(&self) -> Option<gtk::Widget> {
56 unsafe { from_glib_none(ffi::adw_flap_get_flap(self.to_glib_none().0)) }
57 }
58
59 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
60 #[allow(deprecated)]
61 #[doc(alias = "adw_flap_get_flap_position")]
62 #[doc(alias = "get_flap_position")]
63 #[doc(alias = "flap-position")]
64 pub fn flap_position(&self) -> gtk::PackType {
65 unsafe { from_glib(ffi::adw_flap_get_flap_position(self.to_glib_none().0)) }
66 }
67
68 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
69 #[allow(deprecated)]
70 #[doc(alias = "adw_flap_get_fold_duration")]
71 #[doc(alias = "get_fold_duration")]
72 #[doc(alias = "fold-duration")]
73 pub fn fold_duration(&self) -> u32 {
74 unsafe { ffi::adw_flap_get_fold_duration(self.to_glib_none().0) }
75 }
76
77 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
78 #[allow(deprecated)]
79 #[doc(alias = "adw_flap_get_fold_policy")]
80 #[doc(alias = "get_fold_policy")]
81 #[doc(alias = "fold-policy")]
82 pub fn fold_policy(&self) -> FlapFoldPolicy {
83 unsafe { from_glib(ffi::adw_flap_get_fold_policy(self.to_glib_none().0)) }
84 }
85
86 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
87 #[allow(deprecated)]
88 #[doc(alias = "adw_flap_get_fold_threshold_policy")]
89 #[doc(alias = "get_fold_threshold_policy")]
90 #[doc(alias = "fold-threshold-policy")]
91 pub fn fold_threshold_policy(&self) -> FoldThresholdPolicy {
92 unsafe {
93 from_glib(ffi::adw_flap_get_fold_threshold_policy(
94 self.to_glib_none().0,
95 ))
96 }
97 }
98
99 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
100 #[allow(deprecated)]
101 #[doc(alias = "adw_flap_get_folded")]
102 #[doc(alias = "get_folded")]
103 #[doc(alias = "folded")]
104 pub fn is_folded(&self) -> bool {
105 unsafe { from_glib(ffi::adw_flap_get_folded(self.to_glib_none().0)) }
106 }
107
108 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
109 #[allow(deprecated)]
110 #[doc(alias = "adw_flap_get_locked")]
111 #[doc(alias = "get_locked")]
112 #[doc(alias = "locked")]
113 pub fn is_locked(&self) -> bool {
114 unsafe { from_glib(ffi::adw_flap_get_locked(self.to_glib_none().0)) }
115 }
116
117 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
118 #[allow(deprecated)]
119 #[doc(alias = "adw_flap_get_modal")]
120 #[doc(alias = "get_modal")]
121 #[doc(alias = "modal")]
122 pub fn is_modal(&self) -> bool {
123 unsafe { from_glib(ffi::adw_flap_get_modal(self.to_glib_none().0)) }
124 }
125
126 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
127 #[allow(deprecated)]
128 #[doc(alias = "adw_flap_get_reveal_flap")]
129 #[doc(alias = "get_reveal_flap")]
130 #[doc(alias = "reveal-flap")]
131 pub fn reveals_flap(&self) -> bool {
132 unsafe { from_glib(ffi::adw_flap_get_reveal_flap(self.to_glib_none().0)) }
133 }
134
135 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
136 #[allow(deprecated)]
137 #[doc(alias = "adw_flap_get_reveal_params")]
138 #[doc(alias = "get_reveal_params")]
139 #[doc(alias = "reveal-params")]
140 pub fn reveal_params(&self) -> SpringParams {
141 unsafe { from_glib_full(ffi::adw_flap_get_reveal_params(self.to_glib_none().0)) }
142 }
143
144 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
145 #[allow(deprecated)]
146 #[doc(alias = "adw_flap_get_reveal_progress")]
147 #[doc(alias = "get_reveal_progress")]
148 #[doc(alias = "reveal-progress")]
149 pub fn reveal_progress(&self) -> f64 {
150 unsafe { ffi::adw_flap_get_reveal_progress(self.to_glib_none().0) }
151 }
152
153 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
154 #[allow(deprecated)]
155 #[doc(alias = "adw_flap_get_separator")]
156 #[doc(alias = "get_separator")]
157 pub fn separator(&self) -> Option<gtk::Widget> {
158 unsafe { from_glib_none(ffi::adw_flap_get_separator(self.to_glib_none().0)) }
159 }
160
161 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
162 #[allow(deprecated)]
163 #[doc(alias = "adw_flap_get_swipe_to_close")]
164 #[doc(alias = "get_swipe_to_close")]
165 #[doc(alias = "swipe-to-close")]
166 pub fn is_swipe_to_close(&self) -> bool {
167 unsafe { from_glib(ffi::adw_flap_get_swipe_to_close(self.to_glib_none().0)) }
168 }
169
170 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
171 #[allow(deprecated)]
172 #[doc(alias = "adw_flap_get_swipe_to_open")]
173 #[doc(alias = "get_swipe_to_open")]
174 #[doc(alias = "swipe-to-open")]
175 pub fn is_swipe_to_open(&self) -> bool {
176 unsafe { from_glib(ffi::adw_flap_get_swipe_to_open(self.to_glib_none().0)) }
177 }
178
179 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
180 #[allow(deprecated)]
181 #[doc(alias = "adw_flap_get_transition_type")]
182 #[doc(alias = "get_transition_type")]
183 #[doc(alias = "transition-type")]
184 pub fn transition_type(&self) -> FlapTransitionType {
185 unsafe { from_glib(ffi::adw_flap_get_transition_type(self.to_glib_none().0)) }
186 }
187
188 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
189 #[allow(deprecated)]
190 #[doc(alias = "adw_flap_set_content")]
191 #[doc(alias = "content")]
192 pub fn set_content(&self, content: Option<&impl IsA<gtk::Widget>>) {
193 unsafe {
194 ffi::adw_flap_set_content(
195 self.to_glib_none().0,
196 content.map(|p| p.as_ref()).to_glib_none().0,
197 );
198 }
199 }
200
201 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
202 #[allow(deprecated)]
203 #[doc(alias = "adw_flap_set_flap")]
204 #[doc(alias = "flap")]
205 pub fn set_flap(&self, flap: Option<&impl IsA<gtk::Widget>>) {
206 unsafe {
207 ffi::adw_flap_set_flap(
208 self.to_glib_none().0,
209 flap.map(|p| p.as_ref()).to_glib_none().0,
210 );
211 }
212 }
213
214 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
215 #[allow(deprecated)]
216 #[doc(alias = "adw_flap_set_flap_position")]
217 #[doc(alias = "flap-position")]
218 pub fn set_flap_position(&self, position: gtk::PackType) {
219 unsafe {
220 ffi::adw_flap_set_flap_position(self.to_glib_none().0, position.into_glib());
221 }
222 }
223
224 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
225 #[allow(deprecated)]
226 #[doc(alias = "adw_flap_set_fold_duration")]
227 #[doc(alias = "fold-duration")]
228 pub fn set_fold_duration(&self, duration: u32) {
229 unsafe {
230 ffi::adw_flap_set_fold_duration(self.to_glib_none().0, duration);
231 }
232 }
233
234 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
235 #[allow(deprecated)]
236 #[doc(alias = "adw_flap_set_fold_policy")]
237 #[doc(alias = "fold-policy")]
238 pub fn set_fold_policy(&self, policy: FlapFoldPolicy) {
239 unsafe {
240 ffi::adw_flap_set_fold_policy(self.to_glib_none().0, policy.into_glib());
241 }
242 }
243
244 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
245 #[allow(deprecated)]
246 #[doc(alias = "adw_flap_set_fold_threshold_policy")]
247 #[doc(alias = "fold-threshold-policy")]
248 pub fn set_fold_threshold_policy(&self, policy: FoldThresholdPolicy) {
249 unsafe {
250 ffi::adw_flap_set_fold_threshold_policy(self.to_glib_none().0, policy.into_glib());
251 }
252 }
253
254 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
255 #[allow(deprecated)]
256 #[doc(alias = "adw_flap_set_locked")]
257 #[doc(alias = "locked")]
258 pub fn set_locked(&self, locked: bool) {
259 unsafe {
260 ffi::adw_flap_set_locked(self.to_glib_none().0, locked.into_glib());
261 }
262 }
263
264 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
265 #[allow(deprecated)]
266 #[doc(alias = "adw_flap_set_modal")]
267 #[doc(alias = "modal")]
268 pub fn set_modal(&self, modal: bool) {
269 unsafe {
270 ffi::adw_flap_set_modal(self.to_glib_none().0, modal.into_glib());
271 }
272 }
273
274 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
275 #[allow(deprecated)]
276 #[doc(alias = "adw_flap_set_reveal_flap")]
277 #[doc(alias = "reveal-flap")]
278 pub fn set_reveal_flap(&self, reveal_flap: bool) {
279 unsafe {
280 ffi::adw_flap_set_reveal_flap(self.to_glib_none().0, reveal_flap.into_glib());
281 }
282 }
283
284 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
285 #[allow(deprecated)]
286 #[doc(alias = "adw_flap_set_reveal_params")]
287 #[doc(alias = "reveal-params")]
288 pub fn set_reveal_params(&self, params: &SpringParams) {
289 unsafe {
290 ffi::adw_flap_set_reveal_params(self.to_glib_none().0, params.to_glib_none().0);
291 }
292 }
293
294 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
295 #[allow(deprecated)]
296 #[doc(alias = "adw_flap_set_separator")]
297 #[doc(alias = "separator")]
298 pub fn set_separator(&self, separator: Option<&impl IsA<gtk::Widget>>) {
299 unsafe {
300 ffi::adw_flap_set_separator(
301 self.to_glib_none().0,
302 separator.map(|p| p.as_ref()).to_glib_none().0,
303 );
304 }
305 }
306
307 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
308 #[allow(deprecated)]
309 #[doc(alias = "adw_flap_set_swipe_to_close")]
310 #[doc(alias = "swipe-to-close")]
311 pub fn set_swipe_to_close(&self, swipe_to_close: bool) {
312 unsafe {
313 ffi::adw_flap_set_swipe_to_close(self.to_glib_none().0, swipe_to_close.into_glib());
314 }
315 }
316
317 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
318 #[allow(deprecated)]
319 #[doc(alias = "adw_flap_set_swipe_to_open")]
320 #[doc(alias = "swipe-to-open")]
321 pub fn set_swipe_to_open(&self, swipe_to_open: bool) {
322 unsafe {
323 ffi::adw_flap_set_swipe_to_open(self.to_glib_none().0, swipe_to_open.into_glib());
324 }
325 }
326
327 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
328 #[allow(deprecated)]
329 #[doc(alias = "adw_flap_set_transition_type")]
330 #[doc(alias = "transition-type")]
331 pub fn set_transition_type(&self, transition_type: FlapTransitionType) {
332 unsafe {
333 ffi::adw_flap_set_transition_type(self.to_glib_none().0, transition_type.into_glib());
334 }
335 }
336
337 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
338 #[doc(alias = "content")]
339 pub fn connect_content_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
340 unsafe extern "C" fn notify_content_trampoline<F: Fn(&Flap) + 'static>(
341 this: *mut ffi::AdwFlap,
342 _param_spec: glib::ffi::gpointer,
343 f: glib::ffi::gpointer,
344 ) {
345 unsafe {
346 let f: &F = &*(f as *const F);
347 f(&from_glib_borrow(this))
348 }
349 }
350 unsafe {
351 let f: Box_<F> = Box_::new(f);
352 connect_raw(
353 self.as_ptr() as *mut _,
354 c"notify::content".as_ptr(),
355 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
356 notify_content_trampoline::<F> as *const (),
357 )),
358 Box_::into_raw(f),
359 )
360 }
361 }
362
363 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
364 #[doc(alias = "flap")]
365 pub fn connect_flap_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
366 unsafe extern "C" fn notify_flap_trampoline<F: Fn(&Flap) + 'static>(
367 this: *mut ffi::AdwFlap,
368 _param_spec: glib::ffi::gpointer,
369 f: glib::ffi::gpointer,
370 ) {
371 unsafe {
372 let f: &F = &*(f as *const F);
373 f(&from_glib_borrow(this))
374 }
375 }
376 unsafe {
377 let f: Box_<F> = Box_::new(f);
378 connect_raw(
379 self.as_ptr() as *mut _,
380 c"notify::flap".as_ptr(),
381 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
382 notify_flap_trampoline::<F> as *const (),
383 )),
384 Box_::into_raw(f),
385 )
386 }
387 }
388
389 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
390 #[doc(alias = "flap-position")]
391 pub fn connect_flap_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
392 unsafe extern "C" fn notify_flap_position_trampoline<F: Fn(&Flap) + 'static>(
393 this: *mut ffi::AdwFlap,
394 _param_spec: glib::ffi::gpointer,
395 f: glib::ffi::gpointer,
396 ) {
397 unsafe {
398 let f: &F = &*(f as *const F);
399 f(&from_glib_borrow(this))
400 }
401 }
402 unsafe {
403 let f: Box_<F> = Box_::new(f);
404 connect_raw(
405 self.as_ptr() as *mut _,
406 c"notify::flap-position".as_ptr(),
407 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
408 notify_flap_position_trampoline::<F> as *const (),
409 )),
410 Box_::into_raw(f),
411 )
412 }
413 }
414
415 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
416 #[doc(alias = "fold-duration")]
417 pub fn connect_fold_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
418 unsafe extern "C" fn notify_fold_duration_trampoline<F: Fn(&Flap) + 'static>(
419 this: *mut ffi::AdwFlap,
420 _param_spec: glib::ffi::gpointer,
421 f: glib::ffi::gpointer,
422 ) {
423 unsafe {
424 let f: &F = &*(f as *const F);
425 f(&from_glib_borrow(this))
426 }
427 }
428 unsafe {
429 let f: Box_<F> = Box_::new(f);
430 connect_raw(
431 self.as_ptr() as *mut _,
432 c"notify::fold-duration".as_ptr(),
433 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
434 notify_fold_duration_trampoline::<F> as *const (),
435 )),
436 Box_::into_raw(f),
437 )
438 }
439 }
440
441 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
442 #[doc(alias = "fold-policy")]
443 pub fn connect_fold_policy_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
444 unsafe extern "C" fn notify_fold_policy_trampoline<F: Fn(&Flap) + 'static>(
445 this: *mut ffi::AdwFlap,
446 _param_spec: glib::ffi::gpointer,
447 f: glib::ffi::gpointer,
448 ) {
449 unsafe {
450 let f: &F = &*(f as *const F);
451 f(&from_glib_borrow(this))
452 }
453 }
454 unsafe {
455 let f: Box_<F> = Box_::new(f);
456 connect_raw(
457 self.as_ptr() as *mut _,
458 c"notify::fold-policy".as_ptr(),
459 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
460 notify_fold_policy_trampoline::<F> as *const (),
461 )),
462 Box_::into_raw(f),
463 )
464 }
465 }
466
467 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
468 #[doc(alias = "fold-threshold-policy")]
469 pub fn connect_fold_threshold_policy_notify<F: Fn(&Self) + 'static>(
470 &self,
471 f: F,
472 ) -> SignalHandlerId {
473 unsafe extern "C" fn notify_fold_threshold_policy_trampoline<F: Fn(&Flap) + 'static>(
474 this: *mut ffi::AdwFlap,
475 _param_spec: glib::ffi::gpointer,
476 f: glib::ffi::gpointer,
477 ) {
478 unsafe {
479 let f: &F = &*(f as *const F);
480 f(&from_glib_borrow(this))
481 }
482 }
483 unsafe {
484 let f: Box_<F> = Box_::new(f);
485 connect_raw(
486 self.as_ptr() as *mut _,
487 c"notify::fold-threshold-policy".as_ptr(),
488 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
489 notify_fold_threshold_policy_trampoline::<F> as *const (),
490 )),
491 Box_::into_raw(f),
492 )
493 }
494 }
495
496 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
497 #[doc(alias = "folded")]
498 pub fn connect_folded_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
499 unsafe extern "C" fn notify_folded_trampoline<F: Fn(&Flap) + 'static>(
500 this: *mut ffi::AdwFlap,
501 _param_spec: glib::ffi::gpointer,
502 f: glib::ffi::gpointer,
503 ) {
504 unsafe {
505 let f: &F = &*(f as *const F);
506 f(&from_glib_borrow(this))
507 }
508 }
509 unsafe {
510 let f: Box_<F> = Box_::new(f);
511 connect_raw(
512 self.as_ptr() as *mut _,
513 c"notify::folded".as_ptr(),
514 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
515 notify_folded_trampoline::<F> as *const (),
516 )),
517 Box_::into_raw(f),
518 )
519 }
520 }
521
522 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
523 #[doc(alias = "locked")]
524 pub fn connect_locked_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
525 unsafe extern "C" fn notify_locked_trampoline<F: Fn(&Flap) + 'static>(
526 this: *mut ffi::AdwFlap,
527 _param_spec: glib::ffi::gpointer,
528 f: glib::ffi::gpointer,
529 ) {
530 unsafe {
531 let f: &F = &*(f as *const F);
532 f(&from_glib_borrow(this))
533 }
534 }
535 unsafe {
536 let f: Box_<F> = Box_::new(f);
537 connect_raw(
538 self.as_ptr() as *mut _,
539 c"notify::locked".as_ptr(),
540 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
541 notify_locked_trampoline::<F> as *const (),
542 )),
543 Box_::into_raw(f),
544 )
545 }
546 }
547
548 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
549 #[doc(alias = "modal")]
550 pub fn connect_modal_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
551 unsafe extern "C" fn notify_modal_trampoline<F: Fn(&Flap) + 'static>(
552 this: *mut ffi::AdwFlap,
553 _param_spec: glib::ffi::gpointer,
554 f: glib::ffi::gpointer,
555 ) {
556 unsafe {
557 let f: &F = &*(f as *const F);
558 f(&from_glib_borrow(this))
559 }
560 }
561 unsafe {
562 let f: Box_<F> = Box_::new(f);
563 connect_raw(
564 self.as_ptr() as *mut _,
565 c"notify::modal".as_ptr(),
566 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
567 notify_modal_trampoline::<F> as *const (),
568 )),
569 Box_::into_raw(f),
570 )
571 }
572 }
573
574 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
575 #[doc(alias = "reveal-flap")]
576 pub fn connect_reveal_flap_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
577 unsafe extern "C" fn notify_reveal_flap_trampoline<F: Fn(&Flap) + 'static>(
578 this: *mut ffi::AdwFlap,
579 _param_spec: glib::ffi::gpointer,
580 f: glib::ffi::gpointer,
581 ) {
582 unsafe {
583 let f: &F = &*(f as *const F);
584 f(&from_glib_borrow(this))
585 }
586 }
587 unsafe {
588 let f: Box_<F> = Box_::new(f);
589 connect_raw(
590 self.as_ptr() as *mut _,
591 c"notify::reveal-flap".as_ptr(),
592 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
593 notify_reveal_flap_trampoline::<F> as *const (),
594 )),
595 Box_::into_raw(f),
596 )
597 }
598 }
599
600 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
601 #[doc(alias = "reveal-params")]
602 pub fn connect_reveal_params_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
603 unsafe extern "C" fn notify_reveal_params_trampoline<F: Fn(&Flap) + 'static>(
604 this: *mut ffi::AdwFlap,
605 _param_spec: glib::ffi::gpointer,
606 f: glib::ffi::gpointer,
607 ) {
608 unsafe {
609 let f: &F = &*(f as *const F);
610 f(&from_glib_borrow(this))
611 }
612 }
613 unsafe {
614 let f: Box_<F> = Box_::new(f);
615 connect_raw(
616 self.as_ptr() as *mut _,
617 c"notify::reveal-params".as_ptr(),
618 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
619 notify_reveal_params_trampoline::<F> as *const (),
620 )),
621 Box_::into_raw(f),
622 )
623 }
624 }
625
626 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
627 #[doc(alias = "reveal-progress")]
628 pub fn connect_reveal_progress_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
629 unsafe extern "C" fn notify_reveal_progress_trampoline<F: Fn(&Flap) + 'static>(
630 this: *mut ffi::AdwFlap,
631 _param_spec: glib::ffi::gpointer,
632 f: glib::ffi::gpointer,
633 ) {
634 unsafe {
635 let f: &F = &*(f as *const F);
636 f(&from_glib_borrow(this))
637 }
638 }
639 unsafe {
640 let f: Box_<F> = Box_::new(f);
641 connect_raw(
642 self.as_ptr() as *mut _,
643 c"notify::reveal-progress".as_ptr(),
644 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
645 notify_reveal_progress_trampoline::<F> as *const (),
646 )),
647 Box_::into_raw(f),
648 )
649 }
650 }
651
652 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
653 #[doc(alias = "separator")]
654 pub fn connect_separator_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
655 unsafe extern "C" fn notify_separator_trampoline<F: Fn(&Flap) + 'static>(
656 this: *mut ffi::AdwFlap,
657 _param_spec: glib::ffi::gpointer,
658 f: glib::ffi::gpointer,
659 ) {
660 unsafe {
661 let f: &F = &*(f as *const F);
662 f(&from_glib_borrow(this))
663 }
664 }
665 unsafe {
666 let f: Box_<F> = Box_::new(f);
667 connect_raw(
668 self.as_ptr() as *mut _,
669 c"notify::separator".as_ptr(),
670 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
671 notify_separator_trampoline::<F> as *const (),
672 )),
673 Box_::into_raw(f),
674 )
675 }
676 }
677
678 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
679 #[doc(alias = "swipe-to-close")]
680 pub fn connect_swipe_to_close_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
681 unsafe extern "C" fn notify_swipe_to_close_trampoline<F: Fn(&Flap) + 'static>(
682 this: *mut ffi::AdwFlap,
683 _param_spec: glib::ffi::gpointer,
684 f: glib::ffi::gpointer,
685 ) {
686 unsafe {
687 let f: &F = &*(f as *const F);
688 f(&from_glib_borrow(this))
689 }
690 }
691 unsafe {
692 let f: Box_<F> = Box_::new(f);
693 connect_raw(
694 self.as_ptr() as *mut _,
695 c"notify::swipe-to-close".as_ptr(),
696 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
697 notify_swipe_to_close_trampoline::<F> as *const (),
698 )),
699 Box_::into_raw(f),
700 )
701 }
702 }
703
704 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
705 #[doc(alias = "swipe-to-open")]
706 pub fn connect_swipe_to_open_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
707 unsafe extern "C" fn notify_swipe_to_open_trampoline<F: Fn(&Flap) + 'static>(
708 this: *mut ffi::AdwFlap,
709 _param_spec: glib::ffi::gpointer,
710 f: glib::ffi::gpointer,
711 ) {
712 unsafe {
713 let f: &F = &*(f as *const F);
714 f(&from_glib_borrow(this))
715 }
716 }
717 unsafe {
718 let f: Box_<F> = Box_::new(f);
719 connect_raw(
720 self.as_ptr() as *mut _,
721 c"notify::swipe-to-open".as_ptr(),
722 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
723 notify_swipe_to_open_trampoline::<F> as *const (),
724 )),
725 Box_::into_raw(f),
726 )
727 }
728 }
729
730 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
731 #[doc(alias = "transition-type")]
732 pub fn connect_transition_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
733 unsafe extern "C" fn notify_transition_type_trampoline<F: Fn(&Flap) + 'static>(
734 this: *mut ffi::AdwFlap,
735 _param_spec: glib::ffi::gpointer,
736 f: glib::ffi::gpointer,
737 ) {
738 unsafe {
739 let f: &F = &*(f as *const F);
740 f(&from_glib_borrow(this))
741 }
742 }
743 unsafe {
744 let f: Box_<F> = Box_::new(f);
745 connect_raw(
746 self.as_ptr() as *mut _,
747 c"notify::transition-type".as_ptr(),
748 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
749 notify_transition_type_trampoline::<F> as *const (),
750 )),
751 Box_::into_raw(f),
752 )
753 }
754 }
755}
756
757impl Default for Flap {
758 fn default() -> Self {
759 Self::new()
760 }
761}
762
763#[must_use = "The builder must be built to be used"]
768pub struct FlapBuilder {
769 builder: glib::object::ObjectBuilder<'static, Flap>,
770}
771
772impl FlapBuilder {
773 fn new() -> Self {
774 Self {
775 builder: glib::object::Object::builder(),
776 }
777 }
778
779 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
780 pub fn content(self, content: &impl IsA<gtk::Widget>) -> Self {
781 Self {
782 builder: self.builder.property("content", content.clone().upcast()),
783 }
784 }
785
786 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
787 pub fn flap(self, flap: &impl IsA<gtk::Widget>) -> Self {
788 Self {
789 builder: self.builder.property("flap", flap.clone().upcast()),
790 }
791 }
792
793 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
794 pub fn flap_position(self, flap_position: gtk::PackType) -> Self {
795 Self {
796 builder: self.builder.property("flap-position", flap_position),
797 }
798 }
799
800 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
801 pub fn fold_duration(self, fold_duration: u32) -> Self {
802 Self {
803 builder: self.builder.property("fold-duration", fold_duration),
804 }
805 }
806
807 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
808 pub fn fold_policy(self, fold_policy: FlapFoldPolicy) -> Self {
809 Self {
810 builder: self.builder.property("fold-policy", fold_policy),
811 }
812 }
813
814 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
815 pub fn fold_threshold_policy(self, fold_threshold_policy: FoldThresholdPolicy) -> Self {
816 Self {
817 builder: self
818 .builder
819 .property("fold-threshold-policy", fold_threshold_policy),
820 }
821 }
822
823 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
824 pub fn locked(self, locked: bool) -> Self {
825 Self {
826 builder: self.builder.property("locked", locked),
827 }
828 }
829
830 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
831 pub fn modal(self, modal: bool) -> Self {
832 Self {
833 builder: self.builder.property("modal", modal),
834 }
835 }
836
837 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
838 pub fn reveal_flap(self, reveal_flap: bool) -> Self {
839 Self {
840 builder: self.builder.property("reveal-flap", reveal_flap),
841 }
842 }
843
844 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
845 pub fn reveal_params(self, reveal_params: &SpringParams) -> Self {
846 Self {
847 builder: self
848 .builder
849 .property("reveal-params", reveal_params.clone()),
850 }
851 }
852
853 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
854 pub fn separator(self, separator: &impl IsA<gtk::Widget>) -> Self {
855 Self {
856 builder: self
857 .builder
858 .property("separator", separator.clone().upcast()),
859 }
860 }
861
862 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
863 pub fn swipe_to_close(self, swipe_to_close: bool) -> Self {
864 Self {
865 builder: self.builder.property("swipe-to-close", swipe_to_close),
866 }
867 }
868
869 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
870 pub fn swipe_to_open(self, swipe_to_open: bool) -> Self {
871 Self {
872 builder: self.builder.property("swipe-to-open", swipe_to_open),
873 }
874 }
875
876 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
877 pub fn transition_type(self, transition_type: FlapTransitionType) -> Self {
878 Self {
879 builder: self.builder.property("transition-type", transition_type),
880 }
881 }
882
883 pub fn can_focus(self, can_focus: bool) -> Self {
884 Self {
885 builder: self.builder.property("can-focus", can_focus),
886 }
887 }
888
889 pub fn can_target(self, can_target: bool) -> Self {
890 Self {
891 builder: self.builder.property("can-target", can_target),
892 }
893 }
894
895 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
896 Self {
897 builder: self.builder.property("css-classes", css_classes.into()),
898 }
899 }
900
901 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
902 Self {
903 builder: self.builder.property("css-name", css_name.into()),
904 }
905 }
906
907 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
908 Self {
909 builder: self.builder.property("cursor", cursor.clone()),
910 }
911 }
912
913 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
914 Self {
915 builder: self.builder.property("focus-on-click", focus_on_click),
916 }
917 }
918
919 pub fn focusable(self, focusable: bool) -> Self {
920 Self {
921 builder: self.builder.property("focusable", focusable),
922 }
923 }
924
925 pub fn halign(self, halign: gtk::Align) -> Self {
926 Self {
927 builder: self.builder.property("halign", halign),
928 }
929 }
930
931 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
932 Self {
933 builder: self.builder.property("has-tooltip", has_tooltip),
934 }
935 }
936
937 pub fn height_request(self, height_request: i32) -> Self {
938 Self {
939 builder: self.builder.property("height-request", height_request),
940 }
941 }
942
943 pub fn hexpand(self, hexpand: bool) -> Self {
944 Self {
945 builder: self.builder.property("hexpand", hexpand),
946 }
947 }
948
949 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
950 Self {
951 builder: self.builder.property("hexpand-set", hexpand_set),
952 }
953 }
954
955 pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
956 Self {
957 builder: self
958 .builder
959 .property("layout-manager", layout_manager.clone().upcast()),
960 }
961 }
962
963 #[cfg(feature = "gtk_v4_18")]
964 #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
965 pub fn limit_events(self, limit_events: bool) -> Self {
966 Self {
967 builder: self.builder.property("limit-events", limit_events),
968 }
969 }
970
971 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
972 Self {
973 builder: self.builder.property("margin-bottom", margin_bottom),
974 }
975 }
976
977 pub fn margin_end(self, margin_end: i32) -> Self {
978 Self {
979 builder: self.builder.property("margin-end", margin_end),
980 }
981 }
982
983 pub fn margin_start(self, margin_start: i32) -> Self {
984 Self {
985 builder: self.builder.property("margin-start", margin_start),
986 }
987 }
988
989 pub fn margin_top(self, margin_top: i32) -> Self {
990 Self {
991 builder: self.builder.property("margin-top", margin_top),
992 }
993 }
994
995 pub fn name(self, name: impl Into<glib::GString>) -> Self {
996 Self {
997 builder: self.builder.property("name", name.into()),
998 }
999 }
1000
1001 pub fn opacity(self, opacity: f64) -> Self {
1002 Self {
1003 builder: self.builder.property("opacity", opacity),
1004 }
1005 }
1006
1007 pub fn overflow(self, overflow: gtk::Overflow) -> Self {
1008 Self {
1009 builder: self.builder.property("overflow", overflow),
1010 }
1011 }
1012
1013 pub fn receives_default(self, receives_default: bool) -> Self {
1014 Self {
1015 builder: self.builder.property("receives-default", receives_default),
1016 }
1017 }
1018
1019 pub fn sensitive(self, sensitive: bool) -> Self {
1020 Self {
1021 builder: self.builder.property("sensitive", sensitive),
1022 }
1023 }
1024
1025 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1026 Self {
1027 builder: self
1028 .builder
1029 .property("tooltip-markup", tooltip_markup.into()),
1030 }
1031 }
1032
1033 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1034 Self {
1035 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1036 }
1037 }
1038
1039 pub fn valign(self, valign: gtk::Align) -> Self {
1040 Self {
1041 builder: self.builder.property("valign", valign),
1042 }
1043 }
1044
1045 pub fn vexpand(self, vexpand: bool) -> Self {
1046 Self {
1047 builder: self.builder.property("vexpand", vexpand),
1048 }
1049 }
1050
1051 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1052 Self {
1053 builder: self.builder.property("vexpand-set", vexpand_set),
1054 }
1055 }
1056
1057 pub fn visible(self, visible: bool) -> Self {
1058 Self {
1059 builder: self.builder.property("visible", visible),
1060 }
1061 }
1062
1063 pub fn width_request(self, width_request: i32) -> Self {
1064 Self {
1065 builder: self.builder.property("width-request", width_request),
1066 }
1067 }
1068
1069 pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
1070 Self {
1071 builder: self.builder.property("accessible-role", accessible_role),
1072 }
1073 }
1074
1075 pub fn orientation(self, orientation: gtk::Orientation) -> Self {
1076 Self {
1077 builder: self.builder.property("orientation", orientation),
1078 }
1079 }
1080
1081 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1084 pub fn build(self) -> Flap {
1085 assert_initialized_main_thread!();
1086 self.builder.build()
1087 }
1088}