libadwaita/auto/
wrap_box.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 = "AdwWrapBox")]
16    pub struct WrapBox(Object<ffi::AdwWrapBox, ffi::AdwWrapBoxClass>) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Orientable;
17
18    match fn {
19        type_ => || ffi::adw_wrap_box_get_type(),
20    }
21}
22
23impl WrapBox {
24    #[doc(alias = "adw_wrap_box_new")]
25    pub fn new() -> WrapBox {
26        assert_initialized_main_thread!();
27        unsafe { gtk::Widget::from_glib_none(ffi::adw_wrap_box_new()).unsafe_cast() }
28    }
29
30    // rustdoc-stripper-ignore-next
31    /// Creates a new builder-pattern struct instance to construct [`WrapBox`] objects.
32    ///
33    /// This method returns an instance of [`WrapBoxBuilder`](crate::builders::WrapBoxBuilder) which can be used to create [`WrapBox`] objects.
34    pub fn builder() -> WrapBoxBuilder {
35        WrapBoxBuilder::new()
36    }
37
38    #[doc(alias = "adw_wrap_box_append")]
39    pub fn append(&self, child: &impl IsA<gtk::Widget>) {
40        unsafe {
41            ffi::adw_wrap_box_append(self.to_glib_none().0, child.as_ref().to_glib_none().0);
42        }
43    }
44
45    #[doc(alias = "adw_wrap_box_get_align")]
46    #[doc(alias = "get_align")]
47    pub fn align(&self) -> f32 {
48        unsafe { ffi::adw_wrap_box_get_align(self.to_glib_none().0) }
49    }
50
51    #[doc(alias = "adw_wrap_box_get_child_spacing")]
52    #[doc(alias = "get_child_spacing")]
53    #[doc(alias = "child-spacing")]
54    pub fn child_spacing(&self) -> i32 {
55        unsafe { ffi::adw_wrap_box_get_child_spacing(self.to_glib_none().0) }
56    }
57
58    #[doc(alias = "adw_wrap_box_get_child_spacing_unit")]
59    #[doc(alias = "get_child_spacing_unit")]
60    #[doc(alias = "child-spacing-unit")]
61    pub fn child_spacing_unit(&self) -> LengthUnit {
62        unsafe {
63            from_glib(ffi::adw_wrap_box_get_child_spacing_unit(
64                self.to_glib_none().0,
65            ))
66        }
67    }
68
69    #[doc(alias = "adw_wrap_box_get_justify")]
70    #[doc(alias = "get_justify")]
71    pub fn justify(&self) -> JustifyMode {
72        unsafe { from_glib(ffi::adw_wrap_box_get_justify(self.to_glib_none().0)) }
73    }
74
75    #[doc(alias = "adw_wrap_box_get_justify_last_line")]
76    #[doc(alias = "get_justify_last_line")]
77    #[doc(alias = "justify-last-line")]
78    pub fn is_justify_last_line(&self) -> bool {
79        unsafe {
80            from_glib(ffi::adw_wrap_box_get_justify_last_line(
81                self.to_glib_none().0,
82            ))
83        }
84    }
85
86    #[doc(alias = "adw_wrap_box_get_line_homogeneous")]
87    #[doc(alias = "get_line_homogeneous")]
88    #[doc(alias = "line-homogeneous")]
89    pub fn is_line_homogeneous(&self) -> bool {
90        unsafe {
91            from_glib(ffi::adw_wrap_box_get_line_homogeneous(
92                self.to_glib_none().0,
93            ))
94        }
95    }
96
97    #[doc(alias = "adw_wrap_box_get_line_spacing")]
98    #[doc(alias = "get_line_spacing")]
99    #[doc(alias = "line-spacing")]
100    pub fn line_spacing(&self) -> i32 {
101        unsafe { ffi::adw_wrap_box_get_line_spacing(self.to_glib_none().0) }
102    }
103
104    #[doc(alias = "adw_wrap_box_get_line_spacing_unit")]
105    #[doc(alias = "get_line_spacing_unit")]
106    #[doc(alias = "line-spacing-unit")]
107    pub fn line_spacing_unit(&self) -> LengthUnit {
108        unsafe {
109            from_glib(ffi::adw_wrap_box_get_line_spacing_unit(
110                self.to_glib_none().0,
111            ))
112        }
113    }
114
115    #[doc(alias = "adw_wrap_box_get_natural_line_length")]
116    #[doc(alias = "get_natural_line_length")]
117    #[doc(alias = "natural-line-length")]
118    pub fn natural_line_length(&self) -> i32 {
119        unsafe { ffi::adw_wrap_box_get_natural_line_length(self.to_glib_none().0) }
120    }
121
122    #[doc(alias = "adw_wrap_box_get_natural_line_length_unit")]
123    #[doc(alias = "get_natural_line_length_unit")]
124    #[doc(alias = "natural-line-length-unit")]
125    pub fn natural_line_length_unit(&self) -> LengthUnit {
126        unsafe {
127            from_glib(ffi::adw_wrap_box_get_natural_line_length_unit(
128                self.to_glib_none().0,
129            ))
130        }
131    }
132
133    #[doc(alias = "adw_wrap_box_get_pack_direction")]
134    #[doc(alias = "get_pack_direction")]
135    #[doc(alias = "pack-direction")]
136    pub fn pack_direction(&self) -> PackDirection {
137        unsafe { from_glib(ffi::adw_wrap_box_get_pack_direction(self.to_glib_none().0)) }
138    }
139
140    #[doc(alias = "adw_wrap_box_get_wrap_policy")]
141    #[doc(alias = "get_wrap_policy")]
142    #[doc(alias = "wrap-policy")]
143    pub fn wrap_policy(&self) -> WrapPolicy {
144        unsafe { from_glib(ffi::adw_wrap_box_get_wrap_policy(self.to_glib_none().0)) }
145    }
146
147    #[doc(alias = "adw_wrap_box_get_wrap_reverse")]
148    #[doc(alias = "get_wrap_reverse")]
149    #[doc(alias = "wrap-reverse")]
150    pub fn wraps_reverse(&self) -> bool {
151        unsafe { from_glib(ffi::adw_wrap_box_get_wrap_reverse(self.to_glib_none().0)) }
152    }
153
154    #[doc(alias = "adw_wrap_box_insert_child_after")]
155    pub fn insert_child_after(
156        &self,
157        child: &impl IsA<gtk::Widget>,
158        sibling: Option<&impl IsA<gtk::Widget>>,
159    ) {
160        unsafe {
161            ffi::adw_wrap_box_insert_child_after(
162                self.to_glib_none().0,
163                child.as_ref().to_glib_none().0,
164                sibling.map(|p| p.as_ref()).to_glib_none().0,
165            );
166        }
167    }
168
169    #[doc(alias = "adw_wrap_box_prepend")]
170    pub fn prepend(&self, child: &impl IsA<gtk::Widget>) {
171        unsafe {
172            ffi::adw_wrap_box_prepend(self.to_glib_none().0, child.as_ref().to_glib_none().0);
173        }
174    }
175
176    #[doc(alias = "adw_wrap_box_remove")]
177    pub fn remove(&self, child: &impl IsA<gtk::Widget>) {
178        unsafe {
179            ffi::adw_wrap_box_remove(self.to_glib_none().0, child.as_ref().to_glib_none().0);
180        }
181    }
182
183    #[cfg(feature = "v1_8")]
184    #[cfg_attr(docsrs, doc(cfg(feature = "v1_8")))]
185    #[doc(alias = "adw_wrap_box_remove_all")]
186    pub fn remove_all(&self) {
187        unsafe {
188            ffi::adw_wrap_box_remove_all(self.to_glib_none().0);
189        }
190    }
191
192    #[doc(alias = "adw_wrap_box_reorder_child_after")]
193    pub fn reorder_child_after(
194        &self,
195        child: &impl IsA<gtk::Widget>,
196        sibling: Option<&impl IsA<gtk::Widget>>,
197    ) {
198        unsafe {
199            ffi::adw_wrap_box_reorder_child_after(
200                self.to_glib_none().0,
201                child.as_ref().to_glib_none().0,
202                sibling.map(|p| p.as_ref()).to_glib_none().0,
203            );
204        }
205    }
206
207    #[doc(alias = "adw_wrap_box_set_align")]
208    #[doc(alias = "align")]
209    pub fn set_align(&self, align: f32) {
210        unsafe {
211            ffi::adw_wrap_box_set_align(self.to_glib_none().0, align);
212        }
213    }
214
215    #[doc(alias = "adw_wrap_box_set_child_spacing")]
216    #[doc(alias = "child-spacing")]
217    pub fn set_child_spacing(&self, child_spacing: i32) {
218        unsafe {
219            ffi::adw_wrap_box_set_child_spacing(self.to_glib_none().0, child_spacing);
220        }
221    }
222
223    #[doc(alias = "adw_wrap_box_set_child_spacing_unit")]
224    #[doc(alias = "child-spacing-unit")]
225    pub fn set_child_spacing_unit(&self, unit: LengthUnit) {
226        unsafe {
227            ffi::adw_wrap_box_set_child_spacing_unit(self.to_glib_none().0, unit.into_glib());
228        }
229    }
230
231    #[doc(alias = "adw_wrap_box_set_justify")]
232    #[doc(alias = "justify")]
233    pub fn set_justify(&self, justify: JustifyMode) {
234        unsafe {
235            ffi::adw_wrap_box_set_justify(self.to_glib_none().0, justify.into_glib());
236        }
237    }
238
239    #[doc(alias = "adw_wrap_box_set_justify_last_line")]
240    #[doc(alias = "justify-last-line")]
241    pub fn set_justify_last_line(&self, justify_last_line: bool) {
242        unsafe {
243            ffi::adw_wrap_box_set_justify_last_line(
244                self.to_glib_none().0,
245                justify_last_line.into_glib(),
246            );
247        }
248    }
249
250    #[doc(alias = "adw_wrap_box_set_line_homogeneous")]
251    #[doc(alias = "line-homogeneous")]
252    pub fn set_line_homogeneous(&self, homogeneous: bool) {
253        unsafe {
254            ffi::adw_wrap_box_set_line_homogeneous(self.to_glib_none().0, homogeneous.into_glib());
255        }
256    }
257
258    #[doc(alias = "adw_wrap_box_set_line_spacing")]
259    #[doc(alias = "line-spacing")]
260    pub fn set_line_spacing(&self, line_spacing: i32) {
261        unsafe {
262            ffi::adw_wrap_box_set_line_spacing(self.to_glib_none().0, line_spacing);
263        }
264    }
265
266    #[doc(alias = "adw_wrap_box_set_line_spacing_unit")]
267    #[doc(alias = "line-spacing-unit")]
268    pub fn set_line_spacing_unit(&self, unit: LengthUnit) {
269        unsafe {
270            ffi::adw_wrap_box_set_line_spacing_unit(self.to_glib_none().0, unit.into_glib());
271        }
272    }
273
274    #[doc(alias = "adw_wrap_box_set_natural_line_length")]
275    #[doc(alias = "natural-line-length")]
276    pub fn set_natural_line_length(&self, natural_line_length: i32) {
277        unsafe {
278            ffi::adw_wrap_box_set_natural_line_length(self.to_glib_none().0, natural_line_length);
279        }
280    }
281
282    #[doc(alias = "adw_wrap_box_set_natural_line_length_unit")]
283    #[doc(alias = "natural-line-length-unit")]
284    pub fn set_natural_line_length_unit(&self, unit: LengthUnit) {
285        unsafe {
286            ffi::adw_wrap_box_set_natural_line_length_unit(self.to_glib_none().0, unit.into_glib());
287        }
288    }
289
290    #[doc(alias = "adw_wrap_box_set_pack_direction")]
291    #[doc(alias = "pack-direction")]
292    pub fn set_pack_direction(&self, pack_direction: PackDirection) {
293        unsafe {
294            ffi::adw_wrap_box_set_pack_direction(self.to_glib_none().0, pack_direction.into_glib());
295        }
296    }
297
298    #[doc(alias = "adw_wrap_box_set_wrap_policy")]
299    #[doc(alias = "wrap-policy")]
300    pub fn set_wrap_policy(&self, wrap_policy: WrapPolicy) {
301        unsafe {
302            ffi::adw_wrap_box_set_wrap_policy(self.to_glib_none().0, wrap_policy.into_glib());
303        }
304    }
305
306    #[doc(alias = "adw_wrap_box_set_wrap_reverse")]
307    #[doc(alias = "wrap-reverse")]
308    pub fn set_wrap_reverse(&self, wrap_reverse: bool) {
309        unsafe {
310            ffi::adw_wrap_box_set_wrap_reverse(self.to_glib_none().0, wrap_reverse.into_glib());
311        }
312    }
313
314    #[cfg(feature = "v1_7")]
315    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
316    #[doc(alias = "align")]
317    pub fn connect_align_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
318        unsafe extern "C" fn notify_align_trampoline<F: Fn(&WrapBox) + 'static>(
319            this: *mut ffi::AdwWrapBox,
320            _param_spec: glib::ffi::gpointer,
321            f: glib::ffi::gpointer,
322        ) {
323            let f: &F = &*(f as *const F);
324            f(&from_glib_borrow(this))
325        }
326        unsafe {
327            let f: Box_<F> = Box_::new(f);
328            connect_raw(
329                self.as_ptr() as *mut _,
330                c"notify::align".as_ptr() as *const _,
331                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
332                    notify_align_trampoline::<F> as *const (),
333                )),
334                Box_::into_raw(f),
335            )
336        }
337    }
338
339    #[cfg(feature = "v1_7")]
340    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
341    #[doc(alias = "child-spacing")]
342    pub fn connect_child_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
343        unsafe extern "C" fn notify_child_spacing_trampoline<F: Fn(&WrapBox) + 'static>(
344            this: *mut ffi::AdwWrapBox,
345            _param_spec: glib::ffi::gpointer,
346            f: glib::ffi::gpointer,
347        ) {
348            let f: &F = &*(f as *const F);
349            f(&from_glib_borrow(this))
350        }
351        unsafe {
352            let f: Box_<F> = Box_::new(f);
353            connect_raw(
354                self.as_ptr() as *mut _,
355                c"notify::child-spacing".as_ptr() as *const _,
356                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
357                    notify_child_spacing_trampoline::<F> as *const (),
358                )),
359                Box_::into_raw(f),
360            )
361        }
362    }
363
364    #[cfg(feature = "v1_7")]
365    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
366    #[doc(alias = "child-spacing-unit")]
367    pub fn connect_child_spacing_unit_notify<F: Fn(&Self) + 'static>(
368        &self,
369        f: F,
370    ) -> SignalHandlerId {
371        unsafe extern "C" fn notify_child_spacing_unit_trampoline<F: Fn(&WrapBox) + 'static>(
372            this: *mut ffi::AdwWrapBox,
373            _param_spec: glib::ffi::gpointer,
374            f: glib::ffi::gpointer,
375        ) {
376            let f: &F = &*(f as *const F);
377            f(&from_glib_borrow(this))
378        }
379        unsafe {
380            let f: Box_<F> = Box_::new(f);
381            connect_raw(
382                self.as_ptr() as *mut _,
383                c"notify::child-spacing-unit".as_ptr() as *const _,
384                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
385                    notify_child_spacing_unit_trampoline::<F> as *const (),
386                )),
387                Box_::into_raw(f),
388            )
389        }
390    }
391
392    #[cfg(feature = "v1_7")]
393    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
394    #[doc(alias = "justify")]
395    pub fn connect_justify_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
396        unsafe extern "C" fn notify_justify_trampoline<F: Fn(&WrapBox) + 'static>(
397            this: *mut ffi::AdwWrapBox,
398            _param_spec: glib::ffi::gpointer,
399            f: glib::ffi::gpointer,
400        ) {
401            let f: &F = &*(f as *const F);
402            f(&from_glib_borrow(this))
403        }
404        unsafe {
405            let f: Box_<F> = Box_::new(f);
406            connect_raw(
407                self.as_ptr() as *mut _,
408                c"notify::justify".as_ptr() as *const _,
409                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
410                    notify_justify_trampoline::<F> as *const (),
411                )),
412                Box_::into_raw(f),
413            )
414        }
415    }
416
417    #[cfg(feature = "v1_7")]
418    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
419    #[doc(alias = "justify-last-line")]
420    pub fn connect_justify_last_line_notify<F: Fn(&Self) + 'static>(
421        &self,
422        f: F,
423    ) -> SignalHandlerId {
424        unsafe extern "C" fn notify_justify_last_line_trampoline<F: Fn(&WrapBox) + 'static>(
425            this: *mut ffi::AdwWrapBox,
426            _param_spec: glib::ffi::gpointer,
427            f: glib::ffi::gpointer,
428        ) {
429            let f: &F = &*(f as *const F);
430            f(&from_glib_borrow(this))
431        }
432        unsafe {
433            let f: Box_<F> = Box_::new(f);
434            connect_raw(
435                self.as_ptr() as *mut _,
436                c"notify::justify-last-line".as_ptr() as *const _,
437                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
438                    notify_justify_last_line_trampoline::<F> as *const (),
439                )),
440                Box_::into_raw(f),
441            )
442        }
443    }
444
445    #[cfg(feature = "v1_7")]
446    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
447    #[doc(alias = "line-homogeneous")]
448    pub fn connect_line_homogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
449        unsafe extern "C" fn notify_line_homogeneous_trampoline<F: Fn(&WrapBox) + 'static>(
450            this: *mut ffi::AdwWrapBox,
451            _param_spec: glib::ffi::gpointer,
452            f: glib::ffi::gpointer,
453        ) {
454            let f: &F = &*(f as *const F);
455            f(&from_glib_borrow(this))
456        }
457        unsafe {
458            let f: Box_<F> = Box_::new(f);
459            connect_raw(
460                self.as_ptr() as *mut _,
461                c"notify::line-homogeneous".as_ptr() as *const _,
462                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
463                    notify_line_homogeneous_trampoline::<F> as *const (),
464                )),
465                Box_::into_raw(f),
466            )
467        }
468    }
469
470    #[cfg(feature = "v1_7")]
471    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
472    #[doc(alias = "line-spacing")]
473    pub fn connect_line_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
474        unsafe extern "C" fn notify_line_spacing_trampoline<F: Fn(&WrapBox) + 'static>(
475            this: *mut ffi::AdwWrapBox,
476            _param_spec: glib::ffi::gpointer,
477            f: glib::ffi::gpointer,
478        ) {
479            let f: &F = &*(f as *const F);
480            f(&from_glib_borrow(this))
481        }
482        unsafe {
483            let f: Box_<F> = Box_::new(f);
484            connect_raw(
485                self.as_ptr() as *mut _,
486                c"notify::line-spacing".as_ptr() as *const _,
487                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
488                    notify_line_spacing_trampoline::<F> as *const (),
489                )),
490                Box_::into_raw(f),
491            )
492        }
493    }
494
495    #[cfg(feature = "v1_7")]
496    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
497    #[doc(alias = "line-spacing-unit")]
498    pub fn connect_line_spacing_unit_notify<F: Fn(&Self) + 'static>(
499        &self,
500        f: F,
501    ) -> SignalHandlerId {
502        unsafe extern "C" fn notify_line_spacing_unit_trampoline<F: Fn(&WrapBox) + 'static>(
503            this: *mut ffi::AdwWrapBox,
504            _param_spec: glib::ffi::gpointer,
505            f: glib::ffi::gpointer,
506        ) {
507            let f: &F = &*(f as *const F);
508            f(&from_glib_borrow(this))
509        }
510        unsafe {
511            let f: Box_<F> = Box_::new(f);
512            connect_raw(
513                self.as_ptr() as *mut _,
514                c"notify::line-spacing-unit".as_ptr() as *const _,
515                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
516                    notify_line_spacing_unit_trampoline::<F> as *const (),
517                )),
518                Box_::into_raw(f),
519            )
520        }
521    }
522
523    #[cfg(feature = "v1_7")]
524    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
525    #[doc(alias = "natural-line-length")]
526    pub fn connect_natural_line_length_notify<F: Fn(&Self) + 'static>(
527        &self,
528        f: F,
529    ) -> SignalHandlerId {
530        unsafe extern "C" fn notify_natural_line_length_trampoline<F: Fn(&WrapBox) + 'static>(
531            this: *mut ffi::AdwWrapBox,
532            _param_spec: glib::ffi::gpointer,
533            f: glib::ffi::gpointer,
534        ) {
535            let f: &F = &*(f as *const F);
536            f(&from_glib_borrow(this))
537        }
538        unsafe {
539            let f: Box_<F> = Box_::new(f);
540            connect_raw(
541                self.as_ptr() as *mut _,
542                c"notify::natural-line-length".as_ptr() as *const _,
543                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
544                    notify_natural_line_length_trampoline::<F> as *const (),
545                )),
546                Box_::into_raw(f),
547            )
548        }
549    }
550
551    #[cfg(feature = "v1_7")]
552    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
553    #[doc(alias = "natural-line-length-unit")]
554    pub fn connect_natural_line_length_unit_notify<F: Fn(&Self) + 'static>(
555        &self,
556        f: F,
557    ) -> SignalHandlerId {
558        unsafe extern "C" fn notify_natural_line_length_unit_trampoline<
559            F: Fn(&WrapBox) + 'static,
560        >(
561            this: *mut ffi::AdwWrapBox,
562            _param_spec: glib::ffi::gpointer,
563            f: glib::ffi::gpointer,
564        ) {
565            let f: &F = &*(f as *const F);
566            f(&from_glib_borrow(this))
567        }
568        unsafe {
569            let f: Box_<F> = Box_::new(f);
570            connect_raw(
571                self.as_ptr() as *mut _,
572                c"notify::natural-line-length-unit".as_ptr() as *const _,
573                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
574                    notify_natural_line_length_unit_trampoline::<F> as *const (),
575                )),
576                Box_::into_raw(f),
577            )
578        }
579    }
580
581    #[cfg(feature = "v1_7")]
582    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
583    #[doc(alias = "pack-direction")]
584    pub fn connect_pack_direction_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
585        unsafe extern "C" fn notify_pack_direction_trampoline<F: Fn(&WrapBox) + 'static>(
586            this: *mut ffi::AdwWrapBox,
587            _param_spec: glib::ffi::gpointer,
588            f: glib::ffi::gpointer,
589        ) {
590            let f: &F = &*(f as *const F);
591            f(&from_glib_borrow(this))
592        }
593        unsafe {
594            let f: Box_<F> = Box_::new(f);
595            connect_raw(
596                self.as_ptr() as *mut _,
597                c"notify::pack-direction".as_ptr() as *const _,
598                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
599                    notify_pack_direction_trampoline::<F> as *const (),
600                )),
601                Box_::into_raw(f),
602            )
603        }
604    }
605
606    #[cfg(feature = "v1_7")]
607    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
608    #[doc(alias = "wrap-policy")]
609    pub fn connect_wrap_policy_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
610        unsafe extern "C" fn notify_wrap_policy_trampoline<F: Fn(&WrapBox) + 'static>(
611            this: *mut ffi::AdwWrapBox,
612            _param_spec: glib::ffi::gpointer,
613            f: glib::ffi::gpointer,
614        ) {
615            let f: &F = &*(f as *const F);
616            f(&from_glib_borrow(this))
617        }
618        unsafe {
619            let f: Box_<F> = Box_::new(f);
620            connect_raw(
621                self.as_ptr() as *mut _,
622                c"notify::wrap-policy".as_ptr() as *const _,
623                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
624                    notify_wrap_policy_trampoline::<F> as *const (),
625                )),
626                Box_::into_raw(f),
627            )
628        }
629    }
630
631    #[cfg(feature = "v1_7")]
632    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
633    #[doc(alias = "wrap-reverse")]
634    pub fn connect_wrap_reverse_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
635        unsafe extern "C" fn notify_wrap_reverse_trampoline<F: Fn(&WrapBox) + 'static>(
636            this: *mut ffi::AdwWrapBox,
637            _param_spec: glib::ffi::gpointer,
638            f: glib::ffi::gpointer,
639        ) {
640            let f: &F = &*(f as *const F);
641            f(&from_glib_borrow(this))
642        }
643        unsafe {
644            let f: Box_<F> = Box_::new(f);
645            connect_raw(
646                self.as_ptr() as *mut _,
647                c"notify::wrap-reverse".as_ptr() as *const _,
648                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
649                    notify_wrap_reverse_trampoline::<F> as *const (),
650                )),
651                Box_::into_raw(f),
652            )
653        }
654    }
655}
656
657#[cfg(feature = "v1_7")]
658#[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
659impl Default for WrapBox {
660    fn default() -> Self {
661        Self::new()
662    }
663}
664
665// rustdoc-stripper-ignore-next
666/// A [builder-pattern] type to construct [`WrapBox`] objects.
667///
668/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
669#[must_use = "The builder must be built to be used"]
670pub struct WrapBoxBuilder {
671    builder: glib::object::ObjectBuilder<'static, WrapBox>,
672}
673
674impl WrapBoxBuilder {
675    fn new() -> Self {
676        Self {
677            builder: glib::object::Object::builder(),
678        }
679    }
680
681    #[cfg(feature = "v1_7")]
682    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
683    pub fn align(self, align: f32) -> Self {
684        Self {
685            builder: self.builder.property("align", align),
686        }
687    }
688
689    #[cfg(feature = "v1_7")]
690    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
691    pub fn child_spacing(self, child_spacing: i32) -> Self {
692        Self {
693            builder: self.builder.property("child-spacing", child_spacing),
694        }
695    }
696
697    #[cfg(feature = "v1_7")]
698    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
699    pub fn child_spacing_unit(self, child_spacing_unit: LengthUnit) -> Self {
700        Self {
701            builder: self
702                .builder
703                .property("child-spacing-unit", child_spacing_unit),
704        }
705    }
706
707    #[cfg(feature = "v1_7")]
708    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
709    pub fn justify(self, justify: JustifyMode) -> Self {
710        Self {
711            builder: self.builder.property("justify", justify),
712        }
713    }
714
715    #[cfg(feature = "v1_7")]
716    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
717    pub fn justify_last_line(self, justify_last_line: bool) -> Self {
718        Self {
719            builder: self
720                .builder
721                .property("justify-last-line", justify_last_line),
722        }
723    }
724
725    #[cfg(feature = "v1_7")]
726    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
727    pub fn line_homogeneous(self, line_homogeneous: bool) -> Self {
728        Self {
729            builder: self.builder.property("line-homogeneous", line_homogeneous),
730        }
731    }
732
733    #[cfg(feature = "v1_7")]
734    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
735    pub fn line_spacing(self, line_spacing: i32) -> Self {
736        Self {
737            builder: self.builder.property("line-spacing", line_spacing),
738        }
739    }
740
741    #[cfg(feature = "v1_7")]
742    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
743    pub fn line_spacing_unit(self, line_spacing_unit: LengthUnit) -> Self {
744        Self {
745            builder: self
746                .builder
747                .property("line-spacing-unit", line_spacing_unit),
748        }
749    }
750
751    #[cfg(feature = "v1_7")]
752    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
753    pub fn natural_line_length(self, natural_line_length: i32) -> Self {
754        Self {
755            builder: self
756                .builder
757                .property("natural-line-length", natural_line_length),
758        }
759    }
760
761    #[cfg(feature = "v1_7")]
762    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
763    pub fn natural_line_length_unit(self, natural_line_length_unit: LengthUnit) -> Self {
764        Self {
765            builder: self
766                .builder
767                .property("natural-line-length-unit", natural_line_length_unit),
768        }
769    }
770
771    #[cfg(feature = "v1_7")]
772    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
773    pub fn pack_direction(self, pack_direction: PackDirection) -> Self {
774        Self {
775            builder: self.builder.property("pack-direction", pack_direction),
776        }
777    }
778
779    #[cfg(feature = "v1_7")]
780    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
781    pub fn wrap_policy(self, wrap_policy: WrapPolicy) -> Self {
782        Self {
783            builder: self.builder.property("wrap-policy", wrap_policy),
784        }
785    }
786
787    #[cfg(feature = "v1_7")]
788    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
789    pub fn wrap_reverse(self, wrap_reverse: bool) -> Self {
790        Self {
791            builder: self.builder.property("wrap-reverse", wrap_reverse),
792        }
793    }
794
795    pub fn can_focus(self, can_focus: bool) -> Self {
796        Self {
797            builder: self.builder.property("can-focus", can_focus),
798        }
799    }
800
801    pub fn can_target(self, can_target: bool) -> Self {
802        Self {
803            builder: self.builder.property("can-target", can_target),
804        }
805    }
806
807    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
808        Self {
809            builder: self.builder.property("css-classes", css_classes.into()),
810        }
811    }
812
813    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
814        Self {
815            builder: self.builder.property("css-name", css_name.into()),
816        }
817    }
818
819    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
820        Self {
821            builder: self.builder.property("cursor", cursor.clone()),
822        }
823    }
824
825    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
826        Self {
827            builder: self.builder.property("focus-on-click", focus_on_click),
828        }
829    }
830
831    pub fn focusable(self, focusable: bool) -> Self {
832        Self {
833            builder: self.builder.property("focusable", focusable),
834        }
835    }
836
837    pub fn halign(self, halign: gtk::Align) -> Self {
838        Self {
839            builder: self.builder.property("halign", halign),
840        }
841    }
842
843    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
844        Self {
845            builder: self.builder.property("has-tooltip", has_tooltip),
846        }
847    }
848
849    pub fn height_request(self, height_request: i32) -> Self {
850        Self {
851            builder: self.builder.property("height-request", height_request),
852        }
853    }
854
855    pub fn hexpand(self, hexpand: bool) -> Self {
856        Self {
857            builder: self.builder.property("hexpand", hexpand),
858        }
859    }
860
861    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
862        Self {
863            builder: self.builder.property("hexpand-set", hexpand_set),
864        }
865    }
866
867    pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
868        Self {
869            builder: self
870                .builder
871                .property("layout-manager", layout_manager.clone().upcast()),
872        }
873    }
874
875    #[cfg(feature = "gtk_v4_18")]
876    #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
877    pub fn limit_events(self, limit_events: bool) -> Self {
878        Self {
879            builder: self.builder.property("limit-events", limit_events),
880        }
881    }
882
883    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
884        Self {
885            builder: self.builder.property("margin-bottom", margin_bottom),
886        }
887    }
888
889    pub fn margin_end(self, margin_end: i32) -> Self {
890        Self {
891            builder: self.builder.property("margin-end", margin_end),
892        }
893    }
894
895    pub fn margin_start(self, margin_start: i32) -> Self {
896        Self {
897            builder: self.builder.property("margin-start", margin_start),
898        }
899    }
900
901    pub fn margin_top(self, margin_top: i32) -> Self {
902        Self {
903            builder: self.builder.property("margin-top", margin_top),
904        }
905    }
906
907    pub fn name(self, name: impl Into<glib::GString>) -> Self {
908        Self {
909            builder: self.builder.property("name", name.into()),
910        }
911    }
912
913    pub fn opacity(self, opacity: f64) -> Self {
914        Self {
915            builder: self.builder.property("opacity", opacity),
916        }
917    }
918
919    pub fn overflow(self, overflow: gtk::Overflow) -> Self {
920        Self {
921            builder: self.builder.property("overflow", overflow),
922        }
923    }
924
925    pub fn receives_default(self, receives_default: bool) -> Self {
926        Self {
927            builder: self.builder.property("receives-default", receives_default),
928        }
929    }
930
931    pub fn sensitive(self, sensitive: bool) -> Self {
932        Self {
933            builder: self.builder.property("sensitive", sensitive),
934        }
935    }
936
937    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
938        Self {
939            builder: self
940                .builder
941                .property("tooltip-markup", tooltip_markup.into()),
942        }
943    }
944
945    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
946        Self {
947            builder: self.builder.property("tooltip-text", tooltip_text.into()),
948        }
949    }
950
951    pub fn valign(self, valign: gtk::Align) -> Self {
952        Self {
953            builder: self.builder.property("valign", valign),
954        }
955    }
956
957    pub fn vexpand(self, vexpand: bool) -> Self {
958        Self {
959            builder: self.builder.property("vexpand", vexpand),
960        }
961    }
962
963    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
964        Self {
965            builder: self.builder.property("vexpand-set", vexpand_set),
966        }
967    }
968
969    pub fn visible(self, visible: bool) -> Self {
970        Self {
971            builder: self.builder.property("visible", visible),
972        }
973    }
974
975    pub fn width_request(self, width_request: i32) -> Self {
976        Self {
977            builder: self.builder.property("width-request", width_request),
978        }
979    }
980
981    pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
982        Self {
983            builder: self.builder.property("accessible-role", accessible_role),
984        }
985    }
986
987    pub fn orientation(self, orientation: gtk::Orientation) -> Self {
988        Self {
989            builder: self.builder.property("orientation", orientation),
990        }
991    }
992
993    // rustdoc-stripper-ignore-next
994    /// Build the [`WrapBox`].
995    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
996    pub fn build(self) -> WrapBox {
997        assert_initialized_main_thread!();
998        self.builder.build()
999    }
1000}