libadwaita/auto/
wrap_layout.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::{ffi, JustifyMode, LengthUnit, PackDirection, WrapPolicy};
7use glib::{
8    prelude::*,
9    signal::{connect_raw, SignalHandlerId},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15    #[doc(alias = "AdwWrapLayout")]
16    pub struct WrapLayout(Object<ffi::AdwWrapLayout, ffi::AdwWrapLayoutClass>) @extends gtk::LayoutManager, @implements gtk::Orientable;
17
18    match fn {
19        type_ => || ffi::adw_wrap_layout_get_type(),
20    }
21}
22
23impl WrapLayout {
24    #[doc(alias = "adw_wrap_layout_new")]
25    pub fn new() -> WrapLayout {
26        assert_initialized_main_thread!();
27        unsafe { gtk::LayoutManager::from_glib_full(ffi::adw_wrap_layout_new()).unsafe_cast() }
28    }
29
30    // rustdoc-stripper-ignore-next
31    /// Creates a new builder-pattern struct instance to construct [`WrapLayout`] objects.
32    ///
33    /// This method returns an instance of [`WrapLayoutBuilder`](crate::builders::WrapLayoutBuilder) which can be used to create [`WrapLayout`] objects.
34    pub fn builder() -> WrapLayoutBuilder {
35        WrapLayoutBuilder::new()
36    }
37
38    #[doc(alias = "adw_wrap_layout_get_align")]
39    #[doc(alias = "get_align")]
40    pub fn align(&self) -> f32 {
41        unsafe { ffi::adw_wrap_layout_get_align(self.to_glib_none().0) }
42    }
43
44    #[doc(alias = "adw_wrap_layout_get_child_spacing")]
45    #[doc(alias = "get_child_spacing")]
46    #[doc(alias = "child-spacing")]
47    pub fn child_spacing(&self) -> i32 {
48        unsafe { ffi::adw_wrap_layout_get_child_spacing(self.to_glib_none().0) }
49    }
50
51    #[doc(alias = "adw_wrap_layout_get_child_spacing_unit")]
52    #[doc(alias = "get_child_spacing_unit")]
53    #[doc(alias = "child-spacing-unit")]
54    pub fn child_spacing_unit(&self) -> LengthUnit {
55        unsafe {
56            from_glib(ffi::adw_wrap_layout_get_child_spacing_unit(
57                self.to_glib_none().0,
58            ))
59        }
60    }
61
62    #[doc(alias = "adw_wrap_layout_get_justify")]
63    #[doc(alias = "get_justify")]
64    pub fn justify(&self) -> JustifyMode {
65        unsafe { from_glib(ffi::adw_wrap_layout_get_justify(self.to_glib_none().0)) }
66    }
67
68    #[doc(alias = "adw_wrap_layout_get_justify_last_line")]
69    #[doc(alias = "get_justify_last_line")]
70    #[doc(alias = "justify-last-line")]
71    pub fn is_justify_last_line(&self) -> bool {
72        unsafe {
73            from_glib(ffi::adw_wrap_layout_get_justify_last_line(
74                self.to_glib_none().0,
75            ))
76        }
77    }
78
79    #[doc(alias = "adw_wrap_layout_get_line_homogeneous")]
80    #[doc(alias = "get_line_homogeneous")]
81    #[doc(alias = "line-homogeneous")]
82    pub fn is_line_homogeneous(&self) -> bool {
83        unsafe {
84            from_glib(ffi::adw_wrap_layout_get_line_homogeneous(
85                self.to_glib_none().0,
86            ))
87        }
88    }
89
90    #[doc(alias = "adw_wrap_layout_get_line_spacing")]
91    #[doc(alias = "get_line_spacing")]
92    #[doc(alias = "line-spacing")]
93    pub fn line_spacing(&self) -> i32 {
94        unsafe { ffi::adw_wrap_layout_get_line_spacing(self.to_glib_none().0) }
95    }
96
97    #[doc(alias = "adw_wrap_layout_get_line_spacing_unit")]
98    #[doc(alias = "get_line_spacing_unit")]
99    #[doc(alias = "line-spacing-unit")]
100    pub fn line_spacing_unit(&self) -> LengthUnit {
101        unsafe {
102            from_glib(ffi::adw_wrap_layout_get_line_spacing_unit(
103                self.to_glib_none().0,
104            ))
105        }
106    }
107
108    #[doc(alias = "adw_wrap_layout_get_natural_line_length")]
109    #[doc(alias = "get_natural_line_length")]
110    #[doc(alias = "natural-line-length")]
111    pub fn natural_line_length(&self) -> i32 {
112        unsafe { ffi::adw_wrap_layout_get_natural_line_length(self.to_glib_none().0) }
113    }
114
115    #[doc(alias = "adw_wrap_layout_get_natural_line_length_unit")]
116    #[doc(alias = "get_natural_line_length_unit")]
117    #[doc(alias = "natural-line-length-unit")]
118    pub fn natural_line_length_unit(&self) -> LengthUnit {
119        unsafe {
120            from_glib(ffi::adw_wrap_layout_get_natural_line_length_unit(
121                self.to_glib_none().0,
122            ))
123        }
124    }
125
126    #[doc(alias = "adw_wrap_layout_get_pack_direction")]
127    #[doc(alias = "get_pack_direction")]
128    #[doc(alias = "pack-direction")]
129    pub fn pack_direction(&self) -> PackDirection {
130        unsafe {
131            from_glib(ffi::adw_wrap_layout_get_pack_direction(
132                self.to_glib_none().0,
133            ))
134        }
135    }
136
137    #[doc(alias = "adw_wrap_layout_get_wrap_policy")]
138    #[doc(alias = "get_wrap_policy")]
139    #[doc(alias = "wrap-policy")]
140    pub fn wrap_policy(&self) -> WrapPolicy {
141        unsafe { from_glib(ffi::adw_wrap_layout_get_wrap_policy(self.to_glib_none().0)) }
142    }
143
144    #[doc(alias = "adw_wrap_layout_get_wrap_reverse")]
145    #[doc(alias = "get_wrap_reverse")]
146    #[doc(alias = "wrap-reverse")]
147    pub fn wraps_reverse(&self) -> bool {
148        unsafe { from_glib(ffi::adw_wrap_layout_get_wrap_reverse(self.to_glib_none().0)) }
149    }
150
151    #[doc(alias = "adw_wrap_layout_set_align")]
152    #[doc(alias = "align")]
153    pub fn set_align(&self, align: f32) {
154        unsafe {
155            ffi::adw_wrap_layout_set_align(self.to_glib_none().0, align);
156        }
157    }
158
159    #[doc(alias = "adw_wrap_layout_set_child_spacing")]
160    #[doc(alias = "child-spacing")]
161    pub fn set_child_spacing(&self, child_spacing: i32) {
162        unsafe {
163            ffi::adw_wrap_layout_set_child_spacing(self.to_glib_none().0, child_spacing);
164        }
165    }
166
167    #[doc(alias = "adw_wrap_layout_set_child_spacing_unit")]
168    #[doc(alias = "child-spacing-unit")]
169    pub fn set_child_spacing_unit(&self, unit: LengthUnit) {
170        unsafe {
171            ffi::adw_wrap_layout_set_child_spacing_unit(self.to_glib_none().0, unit.into_glib());
172        }
173    }
174
175    #[doc(alias = "adw_wrap_layout_set_justify")]
176    #[doc(alias = "justify")]
177    pub fn set_justify(&self, justify: JustifyMode) {
178        unsafe {
179            ffi::adw_wrap_layout_set_justify(self.to_glib_none().0, justify.into_glib());
180        }
181    }
182
183    #[doc(alias = "adw_wrap_layout_set_justify_last_line")]
184    #[doc(alias = "justify-last-line")]
185    pub fn set_justify_last_line(&self, justify_last_line: bool) {
186        unsafe {
187            ffi::adw_wrap_layout_set_justify_last_line(
188                self.to_glib_none().0,
189                justify_last_line.into_glib(),
190            );
191        }
192    }
193
194    #[doc(alias = "adw_wrap_layout_set_line_homogeneous")]
195    #[doc(alias = "line-homogeneous")]
196    pub fn set_line_homogeneous(&self, homogeneous: bool) {
197        unsafe {
198            ffi::adw_wrap_layout_set_line_homogeneous(
199                self.to_glib_none().0,
200                homogeneous.into_glib(),
201            );
202        }
203    }
204
205    #[doc(alias = "adw_wrap_layout_set_line_spacing")]
206    #[doc(alias = "line-spacing")]
207    pub fn set_line_spacing(&self, line_spacing: i32) {
208        unsafe {
209            ffi::adw_wrap_layout_set_line_spacing(self.to_glib_none().0, line_spacing);
210        }
211    }
212
213    #[doc(alias = "adw_wrap_layout_set_line_spacing_unit")]
214    #[doc(alias = "line-spacing-unit")]
215    pub fn set_line_spacing_unit(&self, unit: LengthUnit) {
216        unsafe {
217            ffi::adw_wrap_layout_set_line_spacing_unit(self.to_glib_none().0, unit.into_glib());
218        }
219    }
220
221    #[doc(alias = "adw_wrap_layout_set_natural_line_length")]
222    #[doc(alias = "natural-line-length")]
223    pub fn set_natural_line_length(&self, natural_line_length: i32) {
224        unsafe {
225            ffi::adw_wrap_layout_set_natural_line_length(
226                self.to_glib_none().0,
227                natural_line_length,
228            );
229        }
230    }
231
232    #[doc(alias = "adw_wrap_layout_set_natural_line_length_unit")]
233    #[doc(alias = "natural-line-length-unit")]
234    pub fn set_natural_line_length_unit(&self, unit: LengthUnit) {
235        unsafe {
236            ffi::adw_wrap_layout_set_natural_line_length_unit(
237                self.to_glib_none().0,
238                unit.into_glib(),
239            );
240        }
241    }
242
243    #[doc(alias = "adw_wrap_layout_set_pack_direction")]
244    #[doc(alias = "pack-direction")]
245    pub fn set_pack_direction(&self, pack_direction: PackDirection) {
246        unsafe {
247            ffi::adw_wrap_layout_set_pack_direction(
248                self.to_glib_none().0,
249                pack_direction.into_glib(),
250            );
251        }
252    }
253
254    #[doc(alias = "adw_wrap_layout_set_wrap_policy")]
255    #[doc(alias = "wrap-policy")]
256    pub fn set_wrap_policy(&self, wrap_policy: WrapPolicy) {
257        unsafe {
258            ffi::adw_wrap_layout_set_wrap_policy(self.to_glib_none().0, wrap_policy.into_glib());
259        }
260    }
261
262    #[doc(alias = "adw_wrap_layout_set_wrap_reverse")]
263    #[doc(alias = "wrap-reverse")]
264    pub fn set_wrap_reverse(&self, wrap_reverse: bool) {
265        unsafe {
266            ffi::adw_wrap_layout_set_wrap_reverse(self.to_glib_none().0, wrap_reverse.into_glib());
267        }
268    }
269
270    #[cfg(feature = "v1_7")]
271    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
272    #[doc(alias = "align")]
273    pub fn connect_align_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
274        unsafe extern "C" fn notify_align_trampoline<F: Fn(&WrapLayout) + 'static>(
275            this: *mut ffi::AdwWrapLayout,
276            _param_spec: glib::ffi::gpointer,
277            f: glib::ffi::gpointer,
278        ) {
279            let f: &F = &*(f as *const F);
280            f(&from_glib_borrow(this))
281        }
282        unsafe {
283            let f: Box_<F> = Box_::new(f);
284            connect_raw(
285                self.as_ptr() as *mut _,
286                c"notify::align".as_ptr() as *const _,
287                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
288                    notify_align_trampoline::<F> as *const (),
289                )),
290                Box_::into_raw(f),
291            )
292        }
293    }
294
295    #[cfg(feature = "v1_7")]
296    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
297    #[doc(alias = "child-spacing")]
298    pub fn connect_child_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
299        unsafe extern "C" fn notify_child_spacing_trampoline<F: Fn(&WrapLayout) + 'static>(
300            this: *mut ffi::AdwWrapLayout,
301            _param_spec: glib::ffi::gpointer,
302            f: glib::ffi::gpointer,
303        ) {
304            let f: &F = &*(f as *const F);
305            f(&from_glib_borrow(this))
306        }
307        unsafe {
308            let f: Box_<F> = Box_::new(f);
309            connect_raw(
310                self.as_ptr() as *mut _,
311                c"notify::child-spacing".as_ptr() as *const _,
312                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
313                    notify_child_spacing_trampoline::<F> as *const (),
314                )),
315                Box_::into_raw(f),
316            )
317        }
318    }
319
320    #[cfg(feature = "v1_7")]
321    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
322    #[doc(alias = "child-spacing-unit")]
323    pub fn connect_child_spacing_unit_notify<F: Fn(&Self) + 'static>(
324        &self,
325        f: F,
326    ) -> SignalHandlerId {
327        unsafe extern "C" fn notify_child_spacing_unit_trampoline<F: Fn(&WrapLayout) + 'static>(
328            this: *mut ffi::AdwWrapLayout,
329            _param_spec: glib::ffi::gpointer,
330            f: glib::ffi::gpointer,
331        ) {
332            let f: &F = &*(f as *const F);
333            f(&from_glib_borrow(this))
334        }
335        unsafe {
336            let f: Box_<F> = Box_::new(f);
337            connect_raw(
338                self.as_ptr() as *mut _,
339                c"notify::child-spacing-unit".as_ptr() as *const _,
340                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
341                    notify_child_spacing_unit_trampoline::<F> as *const (),
342                )),
343                Box_::into_raw(f),
344            )
345        }
346    }
347
348    #[cfg(feature = "v1_7")]
349    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
350    #[doc(alias = "justify")]
351    pub fn connect_justify_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
352        unsafe extern "C" fn notify_justify_trampoline<F: Fn(&WrapLayout) + 'static>(
353            this: *mut ffi::AdwWrapLayout,
354            _param_spec: glib::ffi::gpointer,
355            f: glib::ffi::gpointer,
356        ) {
357            let f: &F = &*(f as *const F);
358            f(&from_glib_borrow(this))
359        }
360        unsafe {
361            let f: Box_<F> = Box_::new(f);
362            connect_raw(
363                self.as_ptr() as *mut _,
364                c"notify::justify".as_ptr() as *const _,
365                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
366                    notify_justify_trampoline::<F> as *const (),
367                )),
368                Box_::into_raw(f),
369            )
370        }
371    }
372
373    #[cfg(feature = "v1_7")]
374    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
375    #[doc(alias = "justify-last-line")]
376    pub fn connect_justify_last_line_notify<F: Fn(&Self) + 'static>(
377        &self,
378        f: F,
379    ) -> SignalHandlerId {
380        unsafe extern "C" fn notify_justify_last_line_trampoline<F: Fn(&WrapLayout) + 'static>(
381            this: *mut ffi::AdwWrapLayout,
382            _param_spec: glib::ffi::gpointer,
383            f: glib::ffi::gpointer,
384        ) {
385            let f: &F = &*(f as *const F);
386            f(&from_glib_borrow(this))
387        }
388        unsafe {
389            let f: Box_<F> = Box_::new(f);
390            connect_raw(
391                self.as_ptr() as *mut _,
392                c"notify::justify-last-line".as_ptr() as *const _,
393                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
394                    notify_justify_last_line_trampoline::<F> as *const (),
395                )),
396                Box_::into_raw(f),
397            )
398        }
399    }
400
401    #[cfg(feature = "v1_7")]
402    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
403    #[doc(alias = "line-homogeneous")]
404    pub fn connect_line_homogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
405        unsafe extern "C" fn notify_line_homogeneous_trampoline<F: Fn(&WrapLayout) + 'static>(
406            this: *mut ffi::AdwWrapLayout,
407            _param_spec: glib::ffi::gpointer,
408            f: glib::ffi::gpointer,
409        ) {
410            let f: &F = &*(f as *const F);
411            f(&from_glib_borrow(this))
412        }
413        unsafe {
414            let f: Box_<F> = Box_::new(f);
415            connect_raw(
416                self.as_ptr() as *mut _,
417                c"notify::line-homogeneous".as_ptr() as *const _,
418                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
419                    notify_line_homogeneous_trampoline::<F> as *const (),
420                )),
421                Box_::into_raw(f),
422            )
423        }
424    }
425
426    #[cfg(feature = "v1_7")]
427    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
428    #[doc(alias = "line-spacing")]
429    pub fn connect_line_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
430        unsafe extern "C" fn notify_line_spacing_trampoline<F: Fn(&WrapLayout) + 'static>(
431            this: *mut ffi::AdwWrapLayout,
432            _param_spec: glib::ffi::gpointer,
433            f: glib::ffi::gpointer,
434        ) {
435            let f: &F = &*(f as *const F);
436            f(&from_glib_borrow(this))
437        }
438        unsafe {
439            let f: Box_<F> = Box_::new(f);
440            connect_raw(
441                self.as_ptr() as *mut _,
442                c"notify::line-spacing".as_ptr() as *const _,
443                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
444                    notify_line_spacing_trampoline::<F> as *const (),
445                )),
446                Box_::into_raw(f),
447            )
448        }
449    }
450
451    #[cfg(feature = "v1_7")]
452    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
453    #[doc(alias = "line-spacing-unit")]
454    pub fn connect_line_spacing_unit_notify<F: Fn(&Self) + 'static>(
455        &self,
456        f: F,
457    ) -> SignalHandlerId {
458        unsafe extern "C" fn notify_line_spacing_unit_trampoline<F: Fn(&WrapLayout) + 'static>(
459            this: *mut ffi::AdwWrapLayout,
460            _param_spec: glib::ffi::gpointer,
461            f: glib::ffi::gpointer,
462        ) {
463            let f: &F = &*(f as *const F);
464            f(&from_glib_borrow(this))
465        }
466        unsafe {
467            let f: Box_<F> = Box_::new(f);
468            connect_raw(
469                self.as_ptr() as *mut _,
470                c"notify::line-spacing-unit".as_ptr() as *const _,
471                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
472                    notify_line_spacing_unit_trampoline::<F> as *const (),
473                )),
474                Box_::into_raw(f),
475            )
476        }
477    }
478
479    #[cfg(feature = "v1_7")]
480    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
481    #[doc(alias = "natural-line-length")]
482    pub fn connect_natural_line_length_notify<F: Fn(&Self) + 'static>(
483        &self,
484        f: F,
485    ) -> SignalHandlerId {
486        unsafe extern "C" fn notify_natural_line_length_trampoline<F: Fn(&WrapLayout) + 'static>(
487            this: *mut ffi::AdwWrapLayout,
488            _param_spec: glib::ffi::gpointer,
489            f: glib::ffi::gpointer,
490        ) {
491            let f: &F = &*(f as *const F);
492            f(&from_glib_borrow(this))
493        }
494        unsafe {
495            let f: Box_<F> = Box_::new(f);
496            connect_raw(
497                self.as_ptr() as *mut _,
498                c"notify::natural-line-length".as_ptr() as *const _,
499                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
500                    notify_natural_line_length_trampoline::<F> as *const (),
501                )),
502                Box_::into_raw(f),
503            )
504        }
505    }
506
507    #[cfg(feature = "v1_7")]
508    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
509    #[doc(alias = "natural-line-length-unit")]
510    pub fn connect_natural_line_length_unit_notify<F: Fn(&Self) + 'static>(
511        &self,
512        f: F,
513    ) -> SignalHandlerId {
514        unsafe extern "C" fn notify_natural_line_length_unit_trampoline<
515            F: Fn(&WrapLayout) + 'static,
516        >(
517            this: *mut ffi::AdwWrapLayout,
518            _param_spec: glib::ffi::gpointer,
519            f: glib::ffi::gpointer,
520        ) {
521            let f: &F = &*(f as *const F);
522            f(&from_glib_borrow(this))
523        }
524        unsafe {
525            let f: Box_<F> = Box_::new(f);
526            connect_raw(
527                self.as_ptr() as *mut _,
528                c"notify::natural-line-length-unit".as_ptr() as *const _,
529                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
530                    notify_natural_line_length_unit_trampoline::<F> as *const (),
531                )),
532                Box_::into_raw(f),
533            )
534        }
535    }
536
537    #[cfg(feature = "v1_7")]
538    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
539    #[doc(alias = "pack-direction")]
540    pub fn connect_pack_direction_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
541        unsafe extern "C" fn notify_pack_direction_trampoline<F: Fn(&WrapLayout) + 'static>(
542            this: *mut ffi::AdwWrapLayout,
543            _param_spec: glib::ffi::gpointer,
544            f: glib::ffi::gpointer,
545        ) {
546            let f: &F = &*(f as *const F);
547            f(&from_glib_borrow(this))
548        }
549        unsafe {
550            let f: Box_<F> = Box_::new(f);
551            connect_raw(
552                self.as_ptr() as *mut _,
553                c"notify::pack-direction".as_ptr() as *const _,
554                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
555                    notify_pack_direction_trampoline::<F> as *const (),
556                )),
557                Box_::into_raw(f),
558            )
559        }
560    }
561
562    #[cfg(feature = "v1_7")]
563    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
564    #[doc(alias = "wrap-policy")]
565    pub fn connect_wrap_policy_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
566        unsafe extern "C" fn notify_wrap_policy_trampoline<F: Fn(&WrapLayout) + 'static>(
567            this: *mut ffi::AdwWrapLayout,
568            _param_spec: glib::ffi::gpointer,
569            f: glib::ffi::gpointer,
570        ) {
571            let f: &F = &*(f as *const F);
572            f(&from_glib_borrow(this))
573        }
574        unsafe {
575            let f: Box_<F> = Box_::new(f);
576            connect_raw(
577                self.as_ptr() as *mut _,
578                c"notify::wrap-policy".as_ptr() as *const _,
579                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
580                    notify_wrap_policy_trampoline::<F> as *const (),
581                )),
582                Box_::into_raw(f),
583            )
584        }
585    }
586
587    #[cfg(feature = "v1_7")]
588    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
589    #[doc(alias = "wrap-reverse")]
590    pub fn connect_wrap_reverse_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
591        unsafe extern "C" fn notify_wrap_reverse_trampoline<F: Fn(&WrapLayout) + 'static>(
592            this: *mut ffi::AdwWrapLayout,
593            _param_spec: glib::ffi::gpointer,
594            f: glib::ffi::gpointer,
595        ) {
596            let f: &F = &*(f as *const F);
597            f(&from_glib_borrow(this))
598        }
599        unsafe {
600            let f: Box_<F> = Box_::new(f);
601            connect_raw(
602                self.as_ptr() as *mut _,
603                c"notify::wrap-reverse".as_ptr() as *const _,
604                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
605                    notify_wrap_reverse_trampoline::<F> as *const (),
606                )),
607                Box_::into_raw(f),
608            )
609        }
610    }
611}
612
613#[cfg(feature = "v1_7")]
614#[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
615impl Default for WrapLayout {
616    fn default() -> Self {
617        Self::new()
618    }
619}
620
621// rustdoc-stripper-ignore-next
622/// A [builder-pattern] type to construct [`WrapLayout`] objects.
623///
624/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
625#[must_use = "The builder must be built to be used"]
626pub struct WrapLayoutBuilder {
627    builder: glib::object::ObjectBuilder<'static, WrapLayout>,
628}
629
630impl WrapLayoutBuilder {
631    fn new() -> Self {
632        Self {
633            builder: glib::object::Object::builder(),
634        }
635    }
636
637    #[cfg(feature = "v1_7")]
638    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
639    pub fn align(self, align: f32) -> Self {
640        Self {
641            builder: self.builder.property("align", align),
642        }
643    }
644
645    #[cfg(feature = "v1_7")]
646    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
647    pub fn child_spacing(self, child_spacing: i32) -> Self {
648        Self {
649            builder: self.builder.property("child-spacing", child_spacing),
650        }
651    }
652
653    #[cfg(feature = "v1_7")]
654    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
655    pub fn child_spacing_unit(self, child_spacing_unit: LengthUnit) -> Self {
656        Self {
657            builder: self
658                .builder
659                .property("child-spacing-unit", child_spacing_unit),
660        }
661    }
662
663    #[cfg(feature = "v1_7")]
664    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
665    pub fn justify(self, justify: JustifyMode) -> Self {
666        Self {
667            builder: self.builder.property("justify", justify),
668        }
669    }
670
671    #[cfg(feature = "v1_7")]
672    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
673    pub fn justify_last_line(self, justify_last_line: bool) -> Self {
674        Self {
675            builder: self
676                .builder
677                .property("justify-last-line", justify_last_line),
678        }
679    }
680
681    #[cfg(feature = "v1_7")]
682    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
683    pub fn line_homogeneous(self, line_homogeneous: bool) -> Self {
684        Self {
685            builder: self.builder.property("line-homogeneous", line_homogeneous),
686        }
687    }
688
689    #[cfg(feature = "v1_7")]
690    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
691    pub fn line_spacing(self, line_spacing: i32) -> Self {
692        Self {
693            builder: self.builder.property("line-spacing", line_spacing),
694        }
695    }
696
697    #[cfg(feature = "v1_7")]
698    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
699    pub fn line_spacing_unit(self, line_spacing_unit: LengthUnit) -> Self {
700        Self {
701            builder: self
702                .builder
703                .property("line-spacing-unit", line_spacing_unit),
704        }
705    }
706
707    #[cfg(feature = "v1_7")]
708    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
709    pub fn natural_line_length(self, natural_line_length: i32) -> Self {
710        Self {
711            builder: self
712                .builder
713                .property("natural-line-length", natural_line_length),
714        }
715    }
716
717    #[cfg(feature = "v1_7")]
718    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
719    pub fn natural_line_length_unit(self, natural_line_length_unit: LengthUnit) -> Self {
720        Self {
721            builder: self
722                .builder
723                .property("natural-line-length-unit", natural_line_length_unit),
724        }
725    }
726
727    #[cfg(feature = "v1_7")]
728    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
729    pub fn pack_direction(self, pack_direction: PackDirection) -> Self {
730        Self {
731            builder: self.builder.property("pack-direction", pack_direction),
732        }
733    }
734
735    #[cfg(feature = "v1_7")]
736    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
737    pub fn wrap_policy(self, wrap_policy: WrapPolicy) -> Self {
738        Self {
739            builder: self.builder.property("wrap-policy", wrap_policy),
740        }
741    }
742
743    #[cfg(feature = "v1_7")]
744    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
745    pub fn wrap_reverse(self, wrap_reverse: bool) -> Self {
746        Self {
747            builder: self.builder.property("wrap-reverse", wrap_reverse),
748        }
749    }
750
751    pub fn orientation(self, orientation: gtk::Orientation) -> Self {
752        Self {
753            builder: self.builder.property("orientation", orientation),
754        }
755    }
756
757    // rustdoc-stripper-ignore-next
758    /// Build the [`WrapLayout`].
759    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
760    pub fn build(self) -> WrapLayout {
761        assert_initialized_main_thread!();
762        self.builder.build()
763    }
764}