1#![allow(deprecated)]
6
7use crate::{
8 ffi, FlapFoldPolicy, FlapTransitionType, FoldThresholdPolicy, SpringParams, Swipeable,
9};
10use glib::{
11 prelude::*,
12 signal::{connect_raw, SignalHandlerId},
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 let f: &F = &*(f as *const F);
346 f(&from_glib_borrow(this))
347 }
348 unsafe {
349 let f: Box_<F> = Box_::new(f);
350 connect_raw(
351 self.as_ptr() as *mut _,
352 c"notify::content".as_ptr() as *const _,
353 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
354 notify_content_trampoline::<F> as *const (),
355 )),
356 Box_::into_raw(f),
357 )
358 }
359 }
360
361 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
362 #[doc(alias = "flap")]
363 pub fn connect_flap_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
364 unsafe extern "C" fn notify_flap_trampoline<F: Fn(&Flap) + 'static>(
365 this: *mut ffi::AdwFlap,
366 _param_spec: glib::ffi::gpointer,
367 f: glib::ffi::gpointer,
368 ) {
369 let f: &F = &*(f as *const F);
370 f(&from_glib_borrow(this))
371 }
372 unsafe {
373 let f: Box_<F> = Box_::new(f);
374 connect_raw(
375 self.as_ptr() as *mut _,
376 c"notify::flap".as_ptr() as *const _,
377 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
378 notify_flap_trampoline::<F> as *const (),
379 )),
380 Box_::into_raw(f),
381 )
382 }
383 }
384
385 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
386 #[doc(alias = "flap-position")]
387 pub fn connect_flap_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
388 unsafe extern "C" fn notify_flap_position_trampoline<F: Fn(&Flap) + 'static>(
389 this: *mut ffi::AdwFlap,
390 _param_spec: glib::ffi::gpointer,
391 f: glib::ffi::gpointer,
392 ) {
393 let f: &F = &*(f as *const F);
394 f(&from_glib_borrow(this))
395 }
396 unsafe {
397 let f: Box_<F> = Box_::new(f);
398 connect_raw(
399 self.as_ptr() as *mut _,
400 c"notify::flap-position".as_ptr() as *const _,
401 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
402 notify_flap_position_trampoline::<F> as *const (),
403 )),
404 Box_::into_raw(f),
405 )
406 }
407 }
408
409 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
410 #[doc(alias = "fold-duration")]
411 pub fn connect_fold_duration_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
412 unsafe extern "C" fn notify_fold_duration_trampoline<F: Fn(&Flap) + 'static>(
413 this: *mut ffi::AdwFlap,
414 _param_spec: glib::ffi::gpointer,
415 f: glib::ffi::gpointer,
416 ) {
417 let f: &F = &*(f as *const F);
418 f(&from_glib_borrow(this))
419 }
420 unsafe {
421 let f: Box_<F> = Box_::new(f);
422 connect_raw(
423 self.as_ptr() as *mut _,
424 c"notify::fold-duration".as_ptr() as *const _,
425 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
426 notify_fold_duration_trampoline::<F> as *const (),
427 )),
428 Box_::into_raw(f),
429 )
430 }
431 }
432
433 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
434 #[doc(alias = "fold-policy")]
435 pub fn connect_fold_policy_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
436 unsafe extern "C" fn notify_fold_policy_trampoline<F: Fn(&Flap) + 'static>(
437 this: *mut ffi::AdwFlap,
438 _param_spec: glib::ffi::gpointer,
439 f: glib::ffi::gpointer,
440 ) {
441 let f: &F = &*(f as *const F);
442 f(&from_glib_borrow(this))
443 }
444 unsafe {
445 let f: Box_<F> = Box_::new(f);
446 connect_raw(
447 self.as_ptr() as *mut _,
448 c"notify::fold-policy".as_ptr() as *const _,
449 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
450 notify_fold_policy_trampoline::<F> as *const (),
451 )),
452 Box_::into_raw(f),
453 )
454 }
455 }
456
457 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
458 #[doc(alias = "fold-threshold-policy")]
459 pub fn connect_fold_threshold_policy_notify<F: Fn(&Self) + 'static>(
460 &self,
461 f: F,
462 ) -> SignalHandlerId {
463 unsafe extern "C" fn notify_fold_threshold_policy_trampoline<F: Fn(&Flap) + 'static>(
464 this: *mut ffi::AdwFlap,
465 _param_spec: glib::ffi::gpointer,
466 f: glib::ffi::gpointer,
467 ) {
468 let f: &F = &*(f as *const F);
469 f(&from_glib_borrow(this))
470 }
471 unsafe {
472 let f: Box_<F> = Box_::new(f);
473 connect_raw(
474 self.as_ptr() as *mut _,
475 c"notify::fold-threshold-policy".as_ptr() as *const _,
476 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
477 notify_fold_threshold_policy_trampoline::<F> as *const (),
478 )),
479 Box_::into_raw(f),
480 )
481 }
482 }
483
484 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
485 #[doc(alias = "folded")]
486 pub fn connect_folded_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
487 unsafe extern "C" fn notify_folded_trampoline<F: Fn(&Flap) + 'static>(
488 this: *mut ffi::AdwFlap,
489 _param_spec: glib::ffi::gpointer,
490 f: glib::ffi::gpointer,
491 ) {
492 let f: &F = &*(f as *const F);
493 f(&from_glib_borrow(this))
494 }
495 unsafe {
496 let f: Box_<F> = Box_::new(f);
497 connect_raw(
498 self.as_ptr() as *mut _,
499 c"notify::folded".as_ptr() as *const _,
500 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
501 notify_folded_trampoline::<F> as *const (),
502 )),
503 Box_::into_raw(f),
504 )
505 }
506 }
507
508 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
509 #[doc(alias = "locked")]
510 pub fn connect_locked_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
511 unsafe extern "C" fn notify_locked_trampoline<F: Fn(&Flap) + 'static>(
512 this: *mut ffi::AdwFlap,
513 _param_spec: glib::ffi::gpointer,
514 f: glib::ffi::gpointer,
515 ) {
516 let f: &F = &*(f as *const F);
517 f(&from_glib_borrow(this))
518 }
519 unsafe {
520 let f: Box_<F> = Box_::new(f);
521 connect_raw(
522 self.as_ptr() as *mut _,
523 c"notify::locked".as_ptr() as *const _,
524 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
525 notify_locked_trampoline::<F> as *const (),
526 )),
527 Box_::into_raw(f),
528 )
529 }
530 }
531
532 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
533 #[doc(alias = "modal")]
534 pub fn connect_modal_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
535 unsafe extern "C" fn notify_modal_trampoline<F: Fn(&Flap) + 'static>(
536 this: *mut ffi::AdwFlap,
537 _param_spec: glib::ffi::gpointer,
538 f: glib::ffi::gpointer,
539 ) {
540 let f: &F = &*(f as *const F);
541 f(&from_glib_borrow(this))
542 }
543 unsafe {
544 let f: Box_<F> = Box_::new(f);
545 connect_raw(
546 self.as_ptr() as *mut _,
547 c"notify::modal".as_ptr() as *const _,
548 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
549 notify_modal_trampoline::<F> as *const (),
550 )),
551 Box_::into_raw(f),
552 )
553 }
554 }
555
556 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
557 #[doc(alias = "reveal-flap")]
558 pub fn connect_reveal_flap_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
559 unsafe extern "C" fn notify_reveal_flap_trampoline<F: Fn(&Flap) + 'static>(
560 this: *mut ffi::AdwFlap,
561 _param_spec: glib::ffi::gpointer,
562 f: glib::ffi::gpointer,
563 ) {
564 let f: &F = &*(f as *const F);
565 f(&from_glib_borrow(this))
566 }
567 unsafe {
568 let f: Box_<F> = Box_::new(f);
569 connect_raw(
570 self.as_ptr() as *mut _,
571 c"notify::reveal-flap".as_ptr() as *const _,
572 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
573 notify_reveal_flap_trampoline::<F> as *const (),
574 )),
575 Box_::into_raw(f),
576 )
577 }
578 }
579
580 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
581 #[doc(alias = "reveal-params")]
582 pub fn connect_reveal_params_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
583 unsafe extern "C" fn notify_reveal_params_trampoline<F: Fn(&Flap) + 'static>(
584 this: *mut ffi::AdwFlap,
585 _param_spec: glib::ffi::gpointer,
586 f: glib::ffi::gpointer,
587 ) {
588 let f: &F = &*(f as *const F);
589 f(&from_glib_borrow(this))
590 }
591 unsafe {
592 let f: Box_<F> = Box_::new(f);
593 connect_raw(
594 self.as_ptr() as *mut _,
595 c"notify::reveal-params".as_ptr() as *const _,
596 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
597 notify_reveal_params_trampoline::<F> as *const (),
598 )),
599 Box_::into_raw(f),
600 )
601 }
602 }
603
604 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
605 #[doc(alias = "reveal-progress")]
606 pub fn connect_reveal_progress_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
607 unsafe extern "C" fn notify_reveal_progress_trampoline<F: Fn(&Flap) + 'static>(
608 this: *mut ffi::AdwFlap,
609 _param_spec: glib::ffi::gpointer,
610 f: glib::ffi::gpointer,
611 ) {
612 let f: &F = &*(f as *const F);
613 f(&from_glib_borrow(this))
614 }
615 unsafe {
616 let f: Box_<F> = Box_::new(f);
617 connect_raw(
618 self.as_ptr() as *mut _,
619 c"notify::reveal-progress".as_ptr() as *const _,
620 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
621 notify_reveal_progress_trampoline::<F> as *const (),
622 )),
623 Box_::into_raw(f),
624 )
625 }
626 }
627
628 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
629 #[doc(alias = "separator")]
630 pub fn connect_separator_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
631 unsafe extern "C" fn notify_separator_trampoline<F: Fn(&Flap) + 'static>(
632 this: *mut ffi::AdwFlap,
633 _param_spec: glib::ffi::gpointer,
634 f: glib::ffi::gpointer,
635 ) {
636 let f: &F = &*(f as *const F);
637 f(&from_glib_borrow(this))
638 }
639 unsafe {
640 let f: Box_<F> = Box_::new(f);
641 connect_raw(
642 self.as_ptr() as *mut _,
643 c"notify::separator".as_ptr() as *const _,
644 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
645 notify_separator_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 = "swipe-to-close")]
654 pub fn connect_swipe_to_close_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
655 unsafe extern "C" fn notify_swipe_to_close_trampoline<F: Fn(&Flap) + 'static>(
656 this: *mut ffi::AdwFlap,
657 _param_spec: glib::ffi::gpointer,
658 f: glib::ffi::gpointer,
659 ) {
660 let f: &F = &*(f as *const F);
661 f(&from_glib_borrow(this))
662 }
663 unsafe {
664 let f: Box_<F> = Box_::new(f);
665 connect_raw(
666 self.as_ptr() as *mut _,
667 c"notify::swipe-to-close".as_ptr() as *const _,
668 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
669 notify_swipe_to_close_trampoline::<F> as *const (),
670 )),
671 Box_::into_raw(f),
672 )
673 }
674 }
675
676 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
677 #[doc(alias = "swipe-to-open")]
678 pub fn connect_swipe_to_open_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
679 unsafe extern "C" fn notify_swipe_to_open_trampoline<F: Fn(&Flap) + 'static>(
680 this: *mut ffi::AdwFlap,
681 _param_spec: glib::ffi::gpointer,
682 f: glib::ffi::gpointer,
683 ) {
684 let f: &F = &*(f as *const F);
685 f(&from_glib_borrow(this))
686 }
687 unsafe {
688 let f: Box_<F> = Box_::new(f);
689 connect_raw(
690 self.as_ptr() as *mut _,
691 c"notify::swipe-to-open".as_ptr() as *const _,
692 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
693 notify_swipe_to_open_trampoline::<F> as *const (),
694 )),
695 Box_::into_raw(f),
696 )
697 }
698 }
699
700 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
701 #[doc(alias = "transition-type")]
702 pub fn connect_transition_type_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
703 unsafe extern "C" fn notify_transition_type_trampoline<F: Fn(&Flap) + 'static>(
704 this: *mut ffi::AdwFlap,
705 _param_spec: glib::ffi::gpointer,
706 f: glib::ffi::gpointer,
707 ) {
708 let f: &F = &*(f as *const F);
709 f(&from_glib_borrow(this))
710 }
711 unsafe {
712 let f: Box_<F> = Box_::new(f);
713 connect_raw(
714 self.as_ptr() as *mut _,
715 c"notify::transition-type".as_ptr() as *const _,
716 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
717 notify_transition_type_trampoline::<F> as *const (),
718 )),
719 Box_::into_raw(f),
720 )
721 }
722 }
723}
724
725impl Default for Flap {
726 fn default() -> Self {
727 Self::new()
728 }
729}
730
731#[must_use = "The builder must be built to be used"]
736pub struct FlapBuilder {
737 builder: glib::object::ObjectBuilder<'static, Flap>,
738}
739
740impl FlapBuilder {
741 fn new() -> Self {
742 Self {
743 builder: glib::object::Object::builder(),
744 }
745 }
746
747 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
748 pub fn content(self, content: &impl IsA<gtk::Widget>) -> Self {
749 Self {
750 builder: self.builder.property("content", content.clone().upcast()),
751 }
752 }
753
754 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
755 pub fn flap(self, flap: &impl IsA<gtk::Widget>) -> Self {
756 Self {
757 builder: self.builder.property("flap", flap.clone().upcast()),
758 }
759 }
760
761 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
762 pub fn flap_position(self, flap_position: gtk::PackType) -> Self {
763 Self {
764 builder: self.builder.property("flap-position", flap_position),
765 }
766 }
767
768 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
769 pub fn fold_duration(self, fold_duration: u32) -> Self {
770 Self {
771 builder: self.builder.property("fold-duration", fold_duration),
772 }
773 }
774
775 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
776 pub fn fold_policy(self, fold_policy: FlapFoldPolicy) -> Self {
777 Self {
778 builder: self.builder.property("fold-policy", fold_policy),
779 }
780 }
781
782 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
783 pub fn fold_threshold_policy(self, fold_threshold_policy: FoldThresholdPolicy) -> Self {
784 Self {
785 builder: self
786 .builder
787 .property("fold-threshold-policy", fold_threshold_policy),
788 }
789 }
790
791 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
792 pub fn locked(self, locked: bool) -> Self {
793 Self {
794 builder: self.builder.property("locked", locked),
795 }
796 }
797
798 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
799 pub fn modal(self, modal: bool) -> Self {
800 Self {
801 builder: self.builder.property("modal", modal),
802 }
803 }
804
805 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
806 pub fn reveal_flap(self, reveal_flap: bool) -> Self {
807 Self {
808 builder: self.builder.property("reveal-flap", reveal_flap),
809 }
810 }
811
812 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
813 pub fn reveal_params(self, reveal_params: &SpringParams) -> Self {
814 Self {
815 builder: self
816 .builder
817 .property("reveal-params", reveal_params.clone()),
818 }
819 }
820
821 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
822 pub fn separator(self, separator: &impl IsA<gtk::Widget>) -> Self {
823 Self {
824 builder: self
825 .builder
826 .property("separator", separator.clone().upcast()),
827 }
828 }
829
830 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
831 pub fn swipe_to_close(self, swipe_to_close: bool) -> Self {
832 Self {
833 builder: self.builder.property("swipe-to-close", swipe_to_close),
834 }
835 }
836
837 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
838 pub fn swipe_to_open(self, swipe_to_open: bool) -> Self {
839 Self {
840 builder: self.builder.property("swipe-to-open", swipe_to_open),
841 }
842 }
843
844 #[cfg_attr(feature = "v1_4", deprecated = "Since 1.4")]
845 pub fn transition_type(self, transition_type: FlapTransitionType) -> Self {
846 Self {
847 builder: self.builder.property("transition-type", transition_type),
848 }
849 }
850
851 pub fn can_focus(self, can_focus: bool) -> Self {
852 Self {
853 builder: self.builder.property("can-focus", can_focus),
854 }
855 }
856
857 pub fn can_target(self, can_target: bool) -> Self {
858 Self {
859 builder: self.builder.property("can-target", can_target),
860 }
861 }
862
863 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
864 Self {
865 builder: self.builder.property("css-classes", css_classes.into()),
866 }
867 }
868
869 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
870 Self {
871 builder: self.builder.property("css-name", css_name.into()),
872 }
873 }
874
875 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
876 Self {
877 builder: self.builder.property("cursor", cursor.clone()),
878 }
879 }
880
881 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
882 Self {
883 builder: self.builder.property("focus-on-click", focus_on_click),
884 }
885 }
886
887 pub fn focusable(self, focusable: bool) -> Self {
888 Self {
889 builder: self.builder.property("focusable", focusable),
890 }
891 }
892
893 pub fn halign(self, halign: gtk::Align) -> Self {
894 Self {
895 builder: self.builder.property("halign", halign),
896 }
897 }
898
899 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
900 Self {
901 builder: self.builder.property("has-tooltip", has_tooltip),
902 }
903 }
904
905 pub fn height_request(self, height_request: i32) -> Self {
906 Self {
907 builder: self.builder.property("height-request", height_request),
908 }
909 }
910
911 pub fn hexpand(self, hexpand: bool) -> Self {
912 Self {
913 builder: self.builder.property("hexpand", hexpand),
914 }
915 }
916
917 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
918 Self {
919 builder: self.builder.property("hexpand-set", hexpand_set),
920 }
921 }
922
923 pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
924 Self {
925 builder: self
926 .builder
927 .property("layout-manager", layout_manager.clone().upcast()),
928 }
929 }
930
931 #[cfg(feature = "gtk_v4_18")]
932 #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
933 pub fn limit_events(self, limit_events: bool) -> Self {
934 Self {
935 builder: self.builder.property("limit-events", limit_events),
936 }
937 }
938
939 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
940 Self {
941 builder: self.builder.property("margin-bottom", margin_bottom),
942 }
943 }
944
945 pub fn margin_end(self, margin_end: i32) -> Self {
946 Self {
947 builder: self.builder.property("margin-end", margin_end),
948 }
949 }
950
951 pub fn margin_start(self, margin_start: i32) -> Self {
952 Self {
953 builder: self.builder.property("margin-start", margin_start),
954 }
955 }
956
957 pub fn margin_top(self, margin_top: i32) -> Self {
958 Self {
959 builder: self.builder.property("margin-top", margin_top),
960 }
961 }
962
963 pub fn name(self, name: impl Into<glib::GString>) -> Self {
964 Self {
965 builder: self.builder.property("name", name.into()),
966 }
967 }
968
969 pub fn opacity(self, opacity: f64) -> Self {
970 Self {
971 builder: self.builder.property("opacity", opacity),
972 }
973 }
974
975 pub fn overflow(self, overflow: gtk::Overflow) -> Self {
976 Self {
977 builder: self.builder.property("overflow", overflow),
978 }
979 }
980
981 pub fn receives_default(self, receives_default: bool) -> Self {
982 Self {
983 builder: self.builder.property("receives-default", receives_default),
984 }
985 }
986
987 pub fn sensitive(self, sensitive: bool) -> Self {
988 Self {
989 builder: self.builder.property("sensitive", sensitive),
990 }
991 }
992
993 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
994 Self {
995 builder: self
996 .builder
997 .property("tooltip-markup", tooltip_markup.into()),
998 }
999 }
1000
1001 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1002 Self {
1003 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1004 }
1005 }
1006
1007 pub fn valign(self, valign: gtk::Align) -> Self {
1008 Self {
1009 builder: self.builder.property("valign", valign),
1010 }
1011 }
1012
1013 pub fn vexpand(self, vexpand: bool) -> Self {
1014 Self {
1015 builder: self.builder.property("vexpand", vexpand),
1016 }
1017 }
1018
1019 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1020 Self {
1021 builder: self.builder.property("vexpand-set", vexpand_set),
1022 }
1023 }
1024
1025 pub fn visible(self, visible: bool) -> Self {
1026 Self {
1027 builder: self.builder.property("visible", visible),
1028 }
1029 }
1030
1031 pub fn width_request(self, width_request: i32) -> Self {
1032 Self {
1033 builder: self.builder.property("width-request", width_request),
1034 }
1035 }
1036
1037 pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
1038 Self {
1039 builder: self.builder.property("accessible-role", accessible_role),
1040 }
1041 }
1042
1043 pub fn orientation(self, orientation: gtk::Orientation) -> Self {
1044 Self {
1045 builder: self.builder.property("orientation", orientation),
1046 }
1047 }
1048
1049 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1052 pub fn build(self) -> Flap {
1053 assert_initialized_main_thread!();
1054 self.builder.build()
1055 }
1056}