[go: up one dir, main page]

gtk4/auto/
flow_box.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{
6    ffi, Accessible, AccessibleRole, Adjustment, Align, Buildable, ConstraintTarget, FlowBoxChild,
7    LayoutManager, MovementStep, Orientable, Orientation, Overflow, SelectionMode, Widget,
8};
9use glib::{
10    object::ObjectType as _,
11    prelude::*,
12    signal::{connect_raw, SignalHandlerId},
13    translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18    #[doc(alias = "GtkFlowBox")]
19    pub struct FlowBox(Object<ffi::GtkFlowBox>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, Orientable;
20
21    match fn {
22        type_ => || ffi::gtk_flow_box_get_type(),
23    }
24}
25
26impl FlowBox {
27    #[doc(alias = "gtk_flow_box_new")]
28    pub fn new() -> FlowBox {
29        assert_initialized_main_thread!();
30        unsafe { Widget::from_glib_none(ffi::gtk_flow_box_new()).unsafe_cast() }
31    }
32
33    // rustdoc-stripper-ignore-next
34    /// Creates a new builder-pattern struct instance to construct [`FlowBox`] objects.
35    ///
36    /// This method returns an instance of [`FlowBoxBuilder`](crate::builders::FlowBoxBuilder) which can be used to create [`FlowBox`] objects.
37    pub fn builder() -> FlowBoxBuilder {
38        FlowBoxBuilder::new()
39    }
40
41    #[cfg(feature = "v4_6")]
42    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
43    #[doc(alias = "gtk_flow_box_append")]
44    pub fn append(&self, child: &impl IsA<Widget>) {
45        unsafe {
46            ffi::gtk_flow_box_append(self.to_glib_none().0, child.as_ref().to_glib_none().0);
47        }
48    }
49
50    #[doc(alias = "gtk_flow_box_bind_model")]
51    pub fn bind_model<P: Fn(&glib::Object) -> Widget + 'static>(
52        &self,
53        model: Option<&impl IsA<gio::ListModel>>,
54        create_widget_func: P,
55    ) {
56        let create_widget_func_data: Box_<P> = Box_::new(create_widget_func);
57        unsafe extern "C" fn create_widget_func_func<P: Fn(&glib::Object) -> Widget + 'static>(
58            item: *mut glib::gobject_ffi::GObject,
59            user_data: glib::ffi::gpointer,
60        ) -> *mut ffi::GtkWidget {
61            let item = from_glib_borrow(item);
62            let callback = &*(user_data as *mut P);
63            (*callback)(&item).to_glib_full()
64        }
65        let create_widget_func = Some(create_widget_func_func::<P> as _);
66        unsafe extern "C" fn user_data_free_func_func<P: Fn(&glib::Object) -> Widget + 'static>(
67            data: glib::ffi::gpointer,
68        ) {
69            let _callback = Box_::from_raw(data as *mut P);
70        }
71        let destroy_call4 = Some(user_data_free_func_func::<P> as _);
72        let super_callback0: Box_<P> = create_widget_func_data;
73        unsafe {
74            ffi::gtk_flow_box_bind_model(
75                self.to_glib_none().0,
76                model.map(|p| p.as_ref()).to_glib_none().0,
77                create_widget_func,
78                Box_::into_raw(super_callback0) as *mut _,
79                destroy_call4,
80            );
81        }
82    }
83
84    #[doc(alias = "gtk_flow_box_get_activate_on_single_click")]
85    #[doc(alias = "get_activate_on_single_click")]
86    #[doc(alias = "activate-on-single-click")]
87    pub fn activates_on_single_click(&self) -> bool {
88        unsafe {
89            from_glib(ffi::gtk_flow_box_get_activate_on_single_click(
90                self.to_glib_none().0,
91            ))
92        }
93    }
94
95    #[doc(alias = "gtk_flow_box_get_child_at_index")]
96    #[doc(alias = "get_child_at_index")]
97    pub fn child_at_index(&self, idx: i32) -> Option<FlowBoxChild> {
98        unsafe {
99            from_glib_none(ffi::gtk_flow_box_get_child_at_index(
100                self.to_glib_none().0,
101                idx,
102            ))
103        }
104    }
105
106    #[doc(alias = "gtk_flow_box_get_child_at_pos")]
107    #[doc(alias = "get_child_at_pos")]
108    pub fn child_at_pos(&self, x: i32, y: i32) -> Option<FlowBoxChild> {
109        unsafe {
110            from_glib_none(ffi::gtk_flow_box_get_child_at_pos(
111                self.to_glib_none().0,
112                x,
113                y,
114            ))
115        }
116    }
117
118    #[doc(alias = "gtk_flow_box_get_column_spacing")]
119    #[doc(alias = "get_column_spacing")]
120    #[doc(alias = "column-spacing")]
121    pub fn column_spacing(&self) -> u32 {
122        unsafe { ffi::gtk_flow_box_get_column_spacing(self.to_glib_none().0) }
123    }
124
125    #[doc(alias = "gtk_flow_box_get_homogeneous")]
126    #[doc(alias = "get_homogeneous")]
127    #[doc(alias = "homogeneous")]
128    pub fn is_homogeneous(&self) -> bool {
129        unsafe { from_glib(ffi::gtk_flow_box_get_homogeneous(self.to_glib_none().0)) }
130    }
131
132    #[doc(alias = "gtk_flow_box_get_max_children_per_line")]
133    #[doc(alias = "get_max_children_per_line")]
134    #[doc(alias = "max-children-per-line")]
135    pub fn max_children_per_line(&self) -> u32 {
136        unsafe { ffi::gtk_flow_box_get_max_children_per_line(self.to_glib_none().0) }
137    }
138
139    #[doc(alias = "gtk_flow_box_get_min_children_per_line")]
140    #[doc(alias = "get_min_children_per_line")]
141    #[doc(alias = "min-children-per-line")]
142    pub fn min_children_per_line(&self) -> u32 {
143        unsafe { ffi::gtk_flow_box_get_min_children_per_line(self.to_glib_none().0) }
144    }
145
146    #[doc(alias = "gtk_flow_box_get_row_spacing")]
147    #[doc(alias = "get_row_spacing")]
148    #[doc(alias = "row-spacing")]
149    pub fn row_spacing(&self) -> u32 {
150        unsafe { ffi::gtk_flow_box_get_row_spacing(self.to_glib_none().0) }
151    }
152
153    #[doc(alias = "gtk_flow_box_get_selected_children")]
154    #[doc(alias = "get_selected_children")]
155    pub fn selected_children(&self) -> Vec<FlowBoxChild> {
156        unsafe {
157            FromGlibPtrContainer::from_glib_container(ffi::gtk_flow_box_get_selected_children(
158                self.to_glib_none().0,
159            ))
160        }
161    }
162
163    #[doc(alias = "gtk_flow_box_get_selection_mode")]
164    #[doc(alias = "get_selection_mode")]
165    #[doc(alias = "selection-mode")]
166    pub fn selection_mode(&self) -> SelectionMode {
167        unsafe { from_glib(ffi::gtk_flow_box_get_selection_mode(self.to_glib_none().0)) }
168    }
169
170    #[doc(alias = "gtk_flow_box_insert")]
171    pub fn insert(&self, widget: &impl IsA<Widget>, position: i32) {
172        unsafe {
173            ffi::gtk_flow_box_insert(
174                self.to_glib_none().0,
175                widget.as_ref().to_glib_none().0,
176                position,
177            );
178        }
179    }
180
181    #[doc(alias = "gtk_flow_box_invalidate_filter")]
182    pub fn invalidate_filter(&self) {
183        unsafe {
184            ffi::gtk_flow_box_invalidate_filter(self.to_glib_none().0);
185        }
186    }
187
188    #[doc(alias = "gtk_flow_box_invalidate_sort")]
189    pub fn invalidate_sort(&self) {
190        unsafe {
191            ffi::gtk_flow_box_invalidate_sort(self.to_glib_none().0);
192        }
193    }
194
195    #[cfg(feature = "v4_6")]
196    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
197    #[doc(alias = "gtk_flow_box_prepend")]
198    pub fn prepend(&self, child: &impl IsA<Widget>) {
199        unsafe {
200            ffi::gtk_flow_box_prepend(self.to_glib_none().0, child.as_ref().to_glib_none().0);
201        }
202    }
203
204    #[doc(alias = "gtk_flow_box_remove")]
205    pub fn remove(&self, widget: &impl IsA<Widget>) {
206        unsafe {
207            ffi::gtk_flow_box_remove(self.to_glib_none().0, widget.as_ref().to_glib_none().0);
208        }
209    }
210
211    #[cfg(feature = "v4_12")]
212    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
213    #[doc(alias = "gtk_flow_box_remove_all")]
214    pub fn remove_all(&self) {
215        unsafe {
216            ffi::gtk_flow_box_remove_all(self.to_glib_none().0);
217        }
218    }
219
220    #[doc(alias = "gtk_flow_box_select_all")]
221    pub fn select_all(&self) {
222        unsafe {
223            ffi::gtk_flow_box_select_all(self.to_glib_none().0);
224        }
225    }
226
227    #[doc(alias = "gtk_flow_box_select_child")]
228    pub fn select_child(&self, child: &impl IsA<FlowBoxChild>) {
229        unsafe {
230            ffi::gtk_flow_box_select_child(self.to_glib_none().0, child.as_ref().to_glib_none().0);
231        }
232    }
233
234    #[doc(alias = "gtk_flow_box_selected_foreach")]
235    pub fn selected_foreach<P: FnMut(&FlowBox, &FlowBoxChild)>(&self, func: P) {
236        let mut func_data: P = func;
237        unsafe extern "C" fn func_func<P: FnMut(&FlowBox, &FlowBoxChild)>(
238            box_: *mut ffi::GtkFlowBox,
239            child: *mut ffi::GtkFlowBoxChild,
240            user_data: glib::ffi::gpointer,
241        ) {
242            let box_ = from_glib_borrow(box_);
243            let child = from_glib_borrow(child);
244            let callback = user_data as *mut P;
245            (*callback)(&box_, &child)
246        }
247        let func = Some(func_func::<P> as _);
248        let super_callback0: &mut P = &mut func_data;
249        unsafe {
250            ffi::gtk_flow_box_selected_foreach(
251                self.to_glib_none().0,
252                func,
253                super_callback0 as *mut _ as *mut _,
254            );
255        }
256    }
257
258    #[doc(alias = "gtk_flow_box_set_activate_on_single_click")]
259    #[doc(alias = "activate-on-single-click")]
260    pub fn set_activate_on_single_click(&self, single: bool) {
261        unsafe {
262            ffi::gtk_flow_box_set_activate_on_single_click(
263                self.to_glib_none().0,
264                single.into_glib(),
265            );
266        }
267    }
268
269    #[doc(alias = "gtk_flow_box_set_column_spacing")]
270    #[doc(alias = "column-spacing")]
271    pub fn set_column_spacing(&self, spacing: u32) {
272        unsafe {
273            ffi::gtk_flow_box_set_column_spacing(self.to_glib_none().0, spacing);
274        }
275    }
276
277    #[doc(alias = "gtk_flow_box_set_filter_func")]
278    pub fn set_filter_func<P: Fn(&FlowBoxChild) -> bool + 'static>(&self, filter_func: P) {
279        let filter_func_data: Box_<P> = Box_::new(filter_func);
280        unsafe extern "C" fn filter_func_func<P: Fn(&FlowBoxChild) -> bool + 'static>(
281            child: *mut ffi::GtkFlowBoxChild,
282            user_data: glib::ffi::gpointer,
283        ) -> glib::ffi::gboolean {
284            let child = from_glib_borrow(child);
285            let callback = &*(user_data as *mut P);
286            (*callback)(&child).into_glib()
287        }
288        let filter_func = Some(filter_func_func::<P> as _);
289        unsafe extern "C" fn destroy_func<P: Fn(&FlowBoxChild) -> bool + 'static>(
290            data: glib::ffi::gpointer,
291        ) {
292            let _callback = Box_::from_raw(data as *mut P);
293        }
294        let destroy_call3 = Some(destroy_func::<P> as _);
295        let super_callback0: Box_<P> = filter_func_data;
296        unsafe {
297            ffi::gtk_flow_box_set_filter_func(
298                self.to_glib_none().0,
299                filter_func,
300                Box_::into_raw(super_callback0) as *mut _,
301                destroy_call3,
302            );
303        }
304    }
305
306    #[doc(alias = "gtk_flow_box_set_hadjustment")]
307    pub fn set_hadjustment(&self, adjustment: &impl IsA<Adjustment>) {
308        unsafe {
309            ffi::gtk_flow_box_set_hadjustment(
310                self.to_glib_none().0,
311                adjustment.as_ref().to_glib_none().0,
312            );
313        }
314    }
315
316    #[doc(alias = "gtk_flow_box_set_homogeneous")]
317    #[doc(alias = "homogeneous")]
318    pub fn set_homogeneous(&self, homogeneous: bool) {
319        unsafe {
320            ffi::gtk_flow_box_set_homogeneous(self.to_glib_none().0, homogeneous.into_glib());
321        }
322    }
323
324    #[doc(alias = "gtk_flow_box_set_max_children_per_line")]
325    #[doc(alias = "max-children-per-line")]
326    pub fn set_max_children_per_line(&self, n_children: u32) {
327        unsafe {
328            ffi::gtk_flow_box_set_max_children_per_line(self.to_glib_none().0, n_children);
329        }
330    }
331
332    #[doc(alias = "gtk_flow_box_set_min_children_per_line")]
333    #[doc(alias = "min-children-per-line")]
334    pub fn set_min_children_per_line(&self, n_children: u32) {
335        unsafe {
336            ffi::gtk_flow_box_set_min_children_per_line(self.to_glib_none().0, n_children);
337        }
338    }
339
340    #[doc(alias = "gtk_flow_box_set_row_spacing")]
341    #[doc(alias = "row-spacing")]
342    pub fn set_row_spacing(&self, spacing: u32) {
343        unsafe {
344            ffi::gtk_flow_box_set_row_spacing(self.to_glib_none().0, spacing);
345        }
346    }
347
348    #[doc(alias = "gtk_flow_box_set_selection_mode")]
349    #[doc(alias = "selection-mode")]
350    pub fn set_selection_mode(&self, mode: SelectionMode) {
351        unsafe {
352            ffi::gtk_flow_box_set_selection_mode(self.to_glib_none().0, mode.into_glib());
353        }
354    }
355
356    #[doc(alias = "gtk_flow_box_set_vadjustment")]
357    pub fn set_vadjustment(&self, adjustment: &impl IsA<Adjustment>) {
358        unsafe {
359            ffi::gtk_flow_box_set_vadjustment(
360                self.to_glib_none().0,
361                adjustment.as_ref().to_glib_none().0,
362            );
363        }
364    }
365
366    #[doc(alias = "gtk_flow_box_unselect_all")]
367    pub fn unselect_all(&self) {
368        unsafe {
369            ffi::gtk_flow_box_unselect_all(self.to_glib_none().0);
370        }
371    }
372
373    #[doc(alias = "gtk_flow_box_unselect_child")]
374    pub fn unselect_child(&self, child: &impl IsA<FlowBoxChild>) {
375        unsafe {
376            ffi::gtk_flow_box_unselect_child(
377                self.to_glib_none().0,
378                child.as_ref().to_glib_none().0,
379            );
380        }
381    }
382
383    #[doc(alias = "accept-unpaired-release")]
384    pub fn accepts_unpaired_release(&self) -> bool {
385        ObjectExt::property(self, "accept-unpaired-release")
386    }
387
388    #[doc(alias = "accept-unpaired-release")]
389    pub fn set_accept_unpaired_release(&self, accept_unpaired_release: bool) {
390        ObjectExt::set_property(self, "accept-unpaired-release", accept_unpaired_release)
391    }
392
393    #[doc(alias = "activate-cursor-child")]
394    pub fn connect_activate_cursor_child<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
395        unsafe extern "C" fn activate_cursor_child_trampoline<F: Fn(&FlowBox) + 'static>(
396            this: *mut ffi::GtkFlowBox,
397            f: glib::ffi::gpointer,
398        ) {
399            let f: &F = &*(f as *const F);
400            f(&from_glib_borrow(this))
401        }
402        unsafe {
403            let f: Box_<F> = Box_::new(f);
404            connect_raw(
405                self.as_ptr() as *mut _,
406                c"activate-cursor-child".as_ptr() as *const _,
407                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
408                    activate_cursor_child_trampoline::<F> as *const (),
409                )),
410                Box_::into_raw(f),
411            )
412        }
413    }
414
415    pub fn emit_activate_cursor_child(&self) {
416        self.emit_by_name::<()>("activate-cursor-child", &[]);
417    }
418
419    #[doc(alias = "child-activated")]
420    pub fn connect_child_activated<F: Fn(&Self, &FlowBoxChild) + 'static>(
421        &self,
422        f: F,
423    ) -> SignalHandlerId {
424        unsafe extern "C" fn child_activated_trampoline<
425            F: Fn(&FlowBox, &FlowBoxChild) + 'static,
426        >(
427            this: *mut ffi::GtkFlowBox,
428            child: *mut ffi::GtkFlowBoxChild,
429            f: glib::ffi::gpointer,
430        ) {
431            let f: &F = &*(f as *const F);
432            f(&from_glib_borrow(this), &from_glib_borrow(child))
433        }
434        unsafe {
435            let f: Box_<F> = Box_::new(f);
436            connect_raw(
437                self.as_ptr() as *mut _,
438                c"child-activated".as_ptr() as *const _,
439                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
440                    child_activated_trampoline::<F> as *const (),
441                )),
442                Box_::into_raw(f),
443            )
444        }
445    }
446
447    #[doc(alias = "move-cursor")]
448    pub fn connect_move_cursor<F: Fn(&Self, MovementStep, i32, bool, bool) -> bool + 'static>(
449        &self,
450        f: F,
451    ) -> SignalHandlerId {
452        unsafe extern "C" fn move_cursor_trampoline<
453            F: Fn(&FlowBox, MovementStep, i32, bool, bool) -> bool + 'static,
454        >(
455            this: *mut ffi::GtkFlowBox,
456            step: ffi::GtkMovementStep,
457            count: std::ffi::c_int,
458            extend: glib::ffi::gboolean,
459            modify: glib::ffi::gboolean,
460            f: glib::ffi::gpointer,
461        ) -> glib::ffi::gboolean {
462            let f: &F = &*(f as *const F);
463            f(
464                &from_glib_borrow(this),
465                from_glib(step),
466                count,
467                from_glib(extend),
468                from_glib(modify),
469            )
470            .into_glib()
471        }
472        unsafe {
473            let f: Box_<F> = Box_::new(f);
474            connect_raw(
475                self.as_ptr() as *mut _,
476                c"move-cursor".as_ptr() as *const _,
477                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
478                    move_cursor_trampoline::<F> as *const (),
479                )),
480                Box_::into_raw(f),
481            )
482        }
483    }
484
485    pub fn emit_move_cursor(
486        &self,
487        step: MovementStep,
488        count: i32,
489        extend: bool,
490        modify: bool,
491    ) -> bool {
492        self.emit_by_name("move-cursor", &[&step, &count, &extend, &modify])
493    }
494
495    #[doc(alias = "select-all")]
496    pub fn connect_select_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
497        unsafe extern "C" fn select_all_trampoline<F: Fn(&FlowBox) + 'static>(
498            this: *mut ffi::GtkFlowBox,
499            f: glib::ffi::gpointer,
500        ) {
501            let f: &F = &*(f as *const F);
502            f(&from_glib_borrow(this))
503        }
504        unsafe {
505            let f: Box_<F> = Box_::new(f);
506            connect_raw(
507                self.as_ptr() as *mut _,
508                c"select-all".as_ptr() as *const _,
509                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
510                    select_all_trampoline::<F> as *const (),
511                )),
512                Box_::into_raw(f),
513            )
514        }
515    }
516
517    pub fn emit_select_all(&self) {
518        self.emit_by_name::<()>("select-all", &[]);
519    }
520
521    #[doc(alias = "selected-children-changed")]
522    pub fn connect_selected_children_changed<F: Fn(&Self) + 'static>(
523        &self,
524        f: F,
525    ) -> SignalHandlerId {
526        unsafe extern "C" fn selected_children_changed_trampoline<F: Fn(&FlowBox) + 'static>(
527            this: *mut ffi::GtkFlowBox,
528            f: glib::ffi::gpointer,
529        ) {
530            let f: &F = &*(f as *const F);
531            f(&from_glib_borrow(this))
532        }
533        unsafe {
534            let f: Box_<F> = Box_::new(f);
535            connect_raw(
536                self.as_ptr() as *mut _,
537                c"selected-children-changed".as_ptr() as *const _,
538                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
539                    selected_children_changed_trampoline::<F> as *const (),
540                )),
541                Box_::into_raw(f),
542            )
543        }
544    }
545
546    #[doc(alias = "toggle-cursor-child")]
547    pub fn connect_toggle_cursor_child<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
548        unsafe extern "C" fn toggle_cursor_child_trampoline<F: Fn(&FlowBox) + 'static>(
549            this: *mut ffi::GtkFlowBox,
550            f: glib::ffi::gpointer,
551        ) {
552            let f: &F = &*(f as *const F);
553            f(&from_glib_borrow(this))
554        }
555        unsafe {
556            let f: Box_<F> = Box_::new(f);
557            connect_raw(
558                self.as_ptr() as *mut _,
559                c"toggle-cursor-child".as_ptr() as *const _,
560                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
561                    toggle_cursor_child_trampoline::<F> as *const (),
562                )),
563                Box_::into_raw(f),
564            )
565        }
566    }
567
568    pub fn emit_toggle_cursor_child(&self) {
569        self.emit_by_name::<()>("toggle-cursor-child", &[]);
570    }
571
572    #[doc(alias = "unselect-all")]
573    pub fn connect_unselect_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
574        unsafe extern "C" fn unselect_all_trampoline<F: Fn(&FlowBox) + 'static>(
575            this: *mut ffi::GtkFlowBox,
576            f: glib::ffi::gpointer,
577        ) {
578            let f: &F = &*(f as *const F);
579            f(&from_glib_borrow(this))
580        }
581        unsafe {
582            let f: Box_<F> = Box_::new(f);
583            connect_raw(
584                self.as_ptr() as *mut _,
585                c"unselect-all".as_ptr() as *const _,
586                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
587                    unselect_all_trampoline::<F> as *const (),
588                )),
589                Box_::into_raw(f),
590            )
591        }
592    }
593
594    pub fn emit_unselect_all(&self) {
595        self.emit_by_name::<()>("unselect-all", &[]);
596    }
597
598    #[doc(alias = "accept-unpaired-release")]
599    pub fn connect_accept_unpaired_release_notify<F: Fn(&Self) + 'static>(
600        &self,
601        f: F,
602    ) -> SignalHandlerId {
603        unsafe extern "C" fn notify_accept_unpaired_release_trampoline<
604            F: Fn(&FlowBox) + 'static,
605        >(
606            this: *mut ffi::GtkFlowBox,
607            _param_spec: glib::ffi::gpointer,
608            f: glib::ffi::gpointer,
609        ) {
610            let f: &F = &*(f as *const F);
611            f(&from_glib_borrow(this))
612        }
613        unsafe {
614            let f: Box_<F> = Box_::new(f);
615            connect_raw(
616                self.as_ptr() as *mut _,
617                c"notify::accept-unpaired-release".as_ptr() as *const _,
618                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
619                    notify_accept_unpaired_release_trampoline::<F> as *const (),
620                )),
621                Box_::into_raw(f),
622            )
623        }
624    }
625
626    #[doc(alias = "activate-on-single-click")]
627    pub fn connect_activate_on_single_click_notify<F: Fn(&Self) + 'static>(
628        &self,
629        f: F,
630    ) -> SignalHandlerId {
631        unsafe extern "C" fn notify_activate_on_single_click_trampoline<
632            F: Fn(&FlowBox) + 'static,
633        >(
634            this: *mut ffi::GtkFlowBox,
635            _param_spec: glib::ffi::gpointer,
636            f: glib::ffi::gpointer,
637        ) {
638            let f: &F = &*(f as *const F);
639            f(&from_glib_borrow(this))
640        }
641        unsafe {
642            let f: Box_<F> = Box_::new(f);
643            connect_raw(
644                self.as_ptr() as *mut _,
645                c"notify::activate-on-single-click".as_ptr() as *const _,
646                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
647                    notify_activate_on_single_click_trampoline::<F> as *const (),
648                )),
649                Box_::into_raw(f),
650            )
651        }
652    }
653
654    #[doc(alias = "column-spacing")]
655    pub fn connect_column_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
656        unsafe extern "C" fn notify_column_spacing_trampoline<F: Fn(&FlowBox) + 'static>(
657            this: *mut ffi::GtkFlowBox,
658            _param_spec: glib::ffi::gpointer,
659            f: glib::ffi::gpointer,
660        ) {
661            let f: &F = &*(f as *const F);
662            f(&from_glib_borrow(this))
663        }
664        unsafe {
665            let f: Box_<F> = Box_::new(f);
666            connect_raw(
667                self.as_ptr() as *mut _,
668                c"notify::column-spacing".as_ptr() as *const _,
669                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
670                    notify_column_spacing_trampoline::<F> as *const (),
671                )),
672                Box_::into_raw(f),
673            )
674        }
675    }
676
677    #[doc(alias = "homogeneous")]
678    pub fn connect_homogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
679        unsafe extern "C" fn notify_homogeneous_trampoline<F: Fn(&FlowBox) + 'static>(
680            this: *mut ffi::GtkFlowBox,
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::homogeneous".as_ptr() as *const _,
692                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
693                    notify_homogeneous_trampoline::<F> as *const (),
694                )),
695                Box_::into_raw(f),
696            )
697        }
698    }
699
700    #[doc(alias = "max-children-per-line")]
701    pub fn connect_max_children_per_line_notify<F: Fn(&Self) + 'static>(
702        &self,
703        f: F,
704    ) -> SignalHandlerId {
705        unsafe extern "C" fn notify_max_children_per_line_trampoline<F: Fn(&FlowBox) + 'static>(
706            this: *mut ffi::GtkFlowBox,
707            _param_spec: glib::ffi::gpointer,
708            f: glib::ffi::gpointer,
709        ) {
710            let f: &F = &*(f as *const F);
711            f(&from_glib_borrow(this))
712        }
713        unsafe {
714            let f: Box_<F> = Box_::new(f);
715            connect_raw(
716                self.as_ptr() as *mut _,
717                c"notify::max-children-per-line".as_ptr() as *const _,
718                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
719                    notify_max_children_per_line_trampoline::<F> as *const (),
720                )),
721                Box_::into_raw(f),
722            )
723        }
724    }
725
726    #[doc(alias = "min-children-per-line")]
727    pub fn connect_min_children_per_line_notify<F: Fn(&Self) + 'static>(
728        &self,
729        f: F,
730    ) -> SignalHandlerId {
731        unsafe extern "C" fn notify_min_children_per_line_trampoline<F: Fn(&FlowBox) + 'static>(
732            this: *mut ffi::GtkFlowBox,
733            _param_spec: glib::ffi::gpointer,
734            f: glib::ffi::gpointer,
735        ) {
736            let f: &F = &*(f as *const F);
737            f(&from_glib_borrow(this))
738        }
739        unsafe {
740            let f: Box_<F> = Box_::new(f);
741            connect_raw(
742                self.as_ptr() as *mut _,
743                c"notify::min-children-per-line".as_ptr() as *const _,
744                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
745                    notify_min_children_per_line_trampoline::<F> as *const (),
746                )),
747                Box_::into_raw(f),
748            )
749        }
750    }
751
752    #[doc(alias = "row-spacing")]
753    pub fn connect_row_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
754        unsafe extern "C" fn notify_row_spacing_trampoline<F: Fn(&FlowBox) + 'static>(
755            this: *mut ffi::GtkFlowBox,
756            _param_spec: glib::ffi::gpointer,
757            f: glib::ffi::gpointer,
758        ) {
759            let f: &F = &*(f as *const F);
760            f(&from_glib_borrow(this))
761        }
762        unsafe {
763            let f: Box_<F> = Box_::new(f);
764            connect_raw(
765                self.as_ptr() as *mut _,
766                c"notify::row-spacing".as_ptr() as *const _,
767                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
768                    notify_row_spacing_trampoline::<F> as *const (),
769                )),
770                Box_::into_raw(f),
771            )
772        }
773    }
774
775    #[doc(alias = "selection-mode")]
776    pub fn connect_selection_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
777        unsafe extern "C" fn notify_selection_mode_trampoline<F: Fn(&FlowBox) + 'static>(
778            this: *mut ffi::GtkFlowBox,
779            _param_spec: glib::ffi::gpointer,
780            f: glib::ffi::gpointer,
781        ) {
782            let f: &F = &*(f as *const F);
783            f(&from_glib_borrow(this))
784        }
785        unsafe {
786            let f: Box_<F> = Box_::new(f);
787            connect_raw(
788                self.as_ptr() as *mut _,
789                c"notify::selection-mode".as_ptr() as *const _,
790                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
791                    notify_selection_mode_trampoline::<F> as *const (),
792                )),
793                Box_::into_raw(f),
794            )
795        }
796    }
797}
798
799impl Default for FlowBox {
800    fn default() -> Self {
801        Self::new()
802    }
803}
804
805// rustdoc-stripper-ignore-next
806/// A [builder-pattern] type to construct [`FlowBox`] objects.
807///
808/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
809#[must_use = "The builder must be built to be used"]
810pub struct FlowBoxBuilder {
811    builder: glib::object::ObjectBuilder<'static, FlowBox>,
812}
813
814impl FlowBoxBuilder {
815    fn new() -> Self {
816        Self {
817            builder: glib::object::Object::builder(),
818        }
819    }
820
821    pub fn accept_unpaired_release(self, accept_unpaired_release: bool) -> Self {
822        Self {
823            builder: self
824                .builder
825                .property("accept-unpaired-release", accept_unpaired_release),
826        }
827    }
828
829    pub fn activate_on_single_click(self, activate_on_single_click: bool) -> Self {
830        Self {
831            builder: self
832                .builder
833                .property("activate-on-single-click", activate_on_single_click),
834        }
835    }
836
837    pub fn column_spacing(self, column_spacing: u32) -> Self {
838        Self {
839            builder: self.builder.property("column-spacing", column_spacing),
840        }
841    }
842
843    pub fn homogeneous(self, homogeneous: bool) -> Self {
844        Self {
845            builder: self.builder.property("homogeneous", homogeneous),
846        }
847    }
848
849    pub fn max_children_per_line(self, max_children_per_line: u32) -> Self {
850        Self {
851            builder: self
852                .builder
853                .property("max-children-per-line", max_children_per_line),
854        }
855    }
856
857    pub fn min_children_per_line(self, min_children_per_line: u32) -> Self {
858        Self {
859            builder: self
860                .builder
861                .property("min-children-per-line", min_children_per_line),
862        }
863    }
864
865    pub fn row_spacing(self, row_spacing: u32) -> Self {
866        Self {
867            builder: self.builder.property("row-spacing", row_spacing),
868        }
869    }
870
871    pub fn selection_mode(self, selection_mode: SelectionMode) -> Self {
872        Self {
873            builder: self.builder.property("selection-mode", selection_mode),
874        }
875    }
876
877    pub fn can_focus(self, can_focus: bool) -> Self {
878        Self {
879            builder: self.builder.property("can-focus", can_focus),
880        }
881    }
882
883    pub fn can_target(self, can_target: bool) -> Self {
884        Self {
885            builder: self.builder.property("can-target", can_target),
886        }
887    }
888
889    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
890        Self {
891            builder: self.builder.property("css-classes", css_classes.into()),
892        }
893    }
894
895    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
896        Self {
897            builder: self.builder.property("css-name", css_name.into()),
898        }
899    }
900
901    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
902        Self {
903            builder: self.builder.property("cursor", cursor.clone()),
904        }
905    }
906
907    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
908        Self {
909            builder: self.builder.property("focus-on-click", focus_on_click),
910        }
911    }
912
913    pub fn focusable(self, focusable: bool) -> Self {
914        Self {
915            builder: self.builder.property("focusable", focusable),
916        }
917    }
918
919    pub fn halign(self, halign: Align) -> Self {
920        Self {
921            builder: self.builder.property("halign", halign),
922        }
923    }
924
925    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
926        Self {
927            builder: self.builder.property("has-tooltip", has_tooltip),
928        }
929    }
930
931    pub fn height_request(self, height_request: i32) -> Self {
932        Self {
933            builder: self.builder.property("height-request", height_request),
934        }
935    }
936
937    pub fn hexpand(self, hexpand: bool) -> Self {
938        Self {
939            builder: self.builder.property("hexpand", hexpand),
940        }
941    }
942
943    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
944        Self {
945            builder: self.builder.property("hexpand-set", hexpand_set),
946        }
947    }
948
949    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
950        Self {
951            builder: self
952                .builder
953                .property("layout-manager", layout_manager.clone().upcast()),
954        }
955    }
956
957    #[cfg(feature = "v4_18")]
958    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
959    pub fn limit_events(self, limit_events: bool) -> Self {
960        Self {
961            builder: self.builder.property("limit-events", limit_events),
962        }
963    }
964
965    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
966        Self {
967            builder: self.builder.property("margin-bottom", margin_bottom),
968        }
969    }
970
971    pub fn margin_end(self, margin_end: i32) -> Self {
972        Self {
973            builder: self.builder.property("margin-end", margin_end),
974        }
975    }
976
977    pub fn margin_start(self, margin_start: i32) -> Self {
978        Self {
979            builder: self.builder.property("margin-start", margin_start),
980        }
981    }
982
983    pub fn margin_top(self, margin_top: i32) -> Self {
984        Self {
985            builder: self.builder.property("margin-top", margin_top),
986        }
987    }
988
989    pub fn name(self, name: impl Into<glib::GString>) -> Self {
990        Self {
991            builder: self.builder.property("name", name.into()),
992        }
993    }
994
995    pub fn opacity(self, opacity: f64) -> Self {
996        Self {
997            builder: self.builder.property("opacity", opacity),
998        }
999    }
1000
1001    pub fn overflow(self, overflow: Overflow) -> Self {
1002        Self {
1003            builder: self.builder.property("overflow", overflow),
1004        }
1005    }
1006
1007    pub fn receives_default(self, receives_default: bool) -> Self {
1008        Self {
1009            builder: self.builder.property("receives-default", receives_default),
1010        }
1011    }
1012
1013    pub fn sensitive(self, sensitive: bool) -> Self {
1014        Self {
1015            builder: self.builder.property("sensitive", sensitive),
1016        }
1017    }
1018
1019    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1020        Self {
1021            builder: self
1022                .builder
1023                .property("tooltip-markup", tooltip_markup.into()),
1024        }
1025    }
1026
1027    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1028        Self {
1029            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1030        }
1031    }
1032
1033    pub fn valign(self, valign: Align) -> Self {
1034        Self {
1035            builder: self.builder.property("valign", valign),
1036        }
1037    }
1038
1039    pub fn vexpand(self, vexpand: bool) -> Self {
1040        Self {
1041            builder: self.builder.property("vexpand", vexpand),
1042        }
1043    }
1044
1045    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1046        Self {
1047            builder: self.builder.property("vexpand-set", vexpand_set),
1048        }
1049    }
1050
1051    pub fn visible(self, visible: bool) -> Self {
1052        Self {
1053            builder: self.builder.property("visible", visible),
1054        }
1055    }
1056
1057    pub fn width_request(self, width_request: i32) -> Self {
1058        Self {
1059            builder: self.builder.property("width-request", width_request),
1060        }
1061    }
1062
1063    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1064        Self {
1065            builder: self.builder.property("accessible-role", accessible_role),
1066        }
1067    }
1068
1069    pub fn orientation(self, orientation: Orientation) -> Self {
1070        Self {
1071            builder: self.builder.property("orientation", orientation),
1072        }
1073    }
1074
1075    // rustdoc-stripper-ignore-next
1076    /// Build the [`FlowBox`].
1077    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1078    pub fn build(self) -> FlowBox {
1079        assert_initialized_main_thread!();
1080        self.builder.build()
1081    }
1082}