Skip to main content

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
5#[cfg(feature = "v4_10")]
6#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
7use crate::Accessible;
8use crate::{
9    AccessibleRole, Adjustment, Align, Buildable, ConstraintTarget, FlowBoxChild, LayoutManager,
10    MovementStep, Orientable, Orientation, Overflow, SelectionMode, Widget, ffi,
11};
12use glib::{
13    object::ObjectType as _,
14    prelude::*,
15    signal::{SignalHandlerId, connect_raw},
16    translate::*,
17};
18use std::boxed::Box as Box_;
19
20#[cfg(feature = "v4_10")]
21#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
22glib::wrapper! {
23    ///  [rubberband]
24    /// ```text
25    ///
26    /// [`FlowBox`][crate::FlowBox] uses a single CSS node with name flowbox. [`FlowBoxChild`][crate::FlowBoxChild]
27    /// uses a single CSS node with name flowboxchild. For rubberband selection,
28    /// a subnode with name rubberband is used.
29    ///
30    /// # Accessibility
31    ///
32    /// [`FlowBox`][crate::FlowBox] uses the [enum@Gtk.AccessibleRole.grid] role, and [`FlowBoxChild`][crate::FlowBoxChild]
33    /// uses the [enum@Gtk.AccessibleRole.grid_cell] role.
34    ///
35    /// ## Properties
36    ///
37    ///
38    /// #### `accept-unpaired-release`
39    ///  Whether to accept unpaired release events.
40    ///
41    /// Readable | Writable
42    ///
43    ///
44    /// #### `activate-on-single-click`
45    ///  Determines whether children can be activated with a single
46    /// click, or require a double-click.
47    ///
48    /// Readable | Writable
49    ///
50    ///
51    /// #### `column-spacing`
52    ///  The amount of horizontal space between two children.
53    ///
54    /// Readable | Writable
55    ///
56    ///
57    /// #### `homogeneous`
58    ///  Determines whether all children should be allocated the
59    /// same size.
60    ///
61    /// Readable | Writable
62    ///
63    ///
64    /// #### `max-children-per-line`
65    ///  The maximum amount of children to request space for consecutively
66    /// in the given orientation.
67    ///
68    /// Readable | Writable
69    ///
70    ///
71    /// #### `min-children-per-line`
72    ///  The minimum number of children to allocate consecutively
73    /// in the given orientation.
74    ///
75    /// Setting the minimum children per line ensures
76    /// that a reasonably small height will be requested
77    /// for the overall minimum width of the box.
78    ///
79    /// Readable | Writable
80    ///
81    ///
82    /// #### `row-spacing`
83    ///  The amount of vertical space between two children.
84    ///
85    /// Readable | Writable
86    ///
87    ///
88    /// #### `selection-mode`
89    ///  The selection mode used by the flow box.
90    ///
91    /// Readable | Writable
92    /// <details><summary><h4>Widget</h4></summary>
93    ///
94    ///
95    /// #### `can-focus`
96    ///  Whether the widget or any of its descendents can accept
97    /// the input focus.
98    ///
99    /// This property is meant to be set by widget implementations,
100    /// typically in their instance init function.
101    ///
102    /// Readable | Writable
103    ///
104    ///
105    /// #### `can-target`
106    ///  Whether the widget can receive pointer events.
107    ///
108    /// Readable | Writable
109    ///
110    ///
111    /// #### `css-classes`
112    ///  A list of css classes applied to this widget.
113    ///
114    /// Readable | Writable
115    ///
116    ///
117    /// #### `css-name`
118    ///  The name of this widget in the CSS tree.
119    ///
120    /// This property is meant to be set by widget implementations,
121    /// typically in their instance init function.
122    ///
123    /// Readable | Writable | Construct Only
124    ///
125    ///
126    /// #### `cursor`
127    ///  The cursor used by @widget.
128    ///
129    /// Readable | Writable
130    ///
131    ///
132    /// #### `focus-on-click`
133    ///  Whether the widget should grab focus when it is clicked with the mouse.
134    ///
135    /// This property is only relevant for widgets that can take focus.
136    ///
137    /// Readable | Writable
138    ///
139    ///
140    /// #### `focusable`
141    ///  Whether this widget itself will accept the input focus.
142    ///
143    /// Readable | Writable
144    ///
145    ///
146    /// #### `halign`
147    ///  How to distribute horizontal space if widget gets extra space.
148    ///
149    /// Readable | Writable
150    ///
151    ///
152    /// #### `has-default`
153    ///  Whether the widget is the default widget.
154    ///
155    /// Readable
156    ///
157    ///
158    /// #### `has-focus`
159    ///  Whether the widget has the input focus.
160    ///
161    /// Readable
162    ///
163    ///
164    /// #### `has-tooltip`
165    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
166    /// signal on @widget.
167    ///
168    /// A true value indicates that @widget can have a tooltip, in this case
169    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
170    /// determine whether it will provide a tooltip or not.
171    ///
172    /// Readable | Writable
173    ///
174    ///
175    /// #### `height-request`
176    ///  Overrides for height request of the widget.
177    ///
178    /// If this is -1, the natural request will be used.
179    ///
180    /// Readable | Writable
181    ///
182    ///
183    /// #### `hexpand`
184    ///  Whether to expand horizontally.
185    ///
186    /// Readable | Writable
187    ///
188    ///
189    /// #### `hexpand-set`
190    ///  Whether to use the `hexpand` property.
191    ///
192    /// Readable | Writable
193    ///
194    ///
195    /// #### `layout-manager`
196    ///  The [`LayoutManager`][crate::LayoutManager] instance to use to compute
197    /// the preferred size of the widget, and allocate its children.
198    ///
199    /// This property is meant to be set by widget implementations,
200    /// typically in their instance init function.
201    ///
202    /// Readable | Writable
203    ///
204    ///
205    /// #### `limit-events`
206    ///  Makes this widget act like a modal dialog, with respect to
207    /// event delivery.
208    ///
209    /// Global event controllers will not handle events with targets
210    /// inside the widget, unless they are set up to ignore propagation
211    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
212    ///
213    /// Readable | Writable
214    ///
215    ///
216    /// #### `margin-bottom`
217    ///  Margin on bottom side of widget.
218    ///
219    /// This property adds margin outside of the widget's normal size
220    /// request, the margin will be added in addition to the size from
221    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
222    ///
223    /// Readable | Writable
224    ///
225    ///
226    /// #### `margin-end`
227    ///  Margin on end of widget, horizontally.
228    ///
229    /// This property supports left-to-right and right-to-left text
230    /// directions.
231    ///
232    /// This property adds margin outside of the widget's normal size
233    /// request, the margin will be added in addition to the size from
234    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
235    ///
236    /// Readable | Writable
237    ///
238    ///
239    /// #### `margin-start`
240    ///  Margin on start of widget, horizontally.
241    ///
242    /// This property supports left-to-right and right-to-left text
243    /// directions.
244    ///
245    /// This property adds margin outside of the widget's normal size
246    /// request, the margin will be added in addition to the size from
247    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
248    ///
249    /// Readable | Writable
250    ///
251    ///
252    /// #### `margin-top`
253    ///  Margin on top side of widget.
254    ///
255    /// This property adds margin outside of the widget's normal size
256    /// request, the margin will be added in addition to the size from
257    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
258    ///
259    /// Readable | Writable
260    ///
261    ///
262    /// #### `name`
263    ///  The name of the widget.
264    ///
265    /// Readable | Writable
266    ///
267    ///
268    /// #### `opacity`
269    ///  The requested opacity of the widget.
270    ///
271    /// Readable | Writable
272    ///
273    ///
274    /// #### `overflow`
275    ///  How content outside the widget's content area is treated.
276    ///
277    /// This property is meant to be set by widget implementations,
278    /// typically in their instance init function.
279    ///
280    /// Readable | Writable
281    ///
282    ///
283    /// #### `parent`
284    ///  The parent widget of this widget.
285    ///
286    /// Readable
287    ///
288    ///
289    /// #### `receives-default`
290    ///  Whether the widget will receive the default action when it is focused.
291    ///
292    /// Readable | Writable
293    ///
294    ///
295    /// #### `root`
296    ///  The [`Root`][crate::Root] widget of the widget tree containing this widget.
297    ///
298    /// This will be `NULL` if the widget is not contained in a root widget.
299    ///
300    /// Readable
301    ///
302    ///
303    /// #### `scale-factor`
304    ///  The scale factor of the widget.
305    ///
306    /// Readable
307    ///
308    ///
309    /// #### `sensitive`
310    ///  Whether the widget responds to input.
311    ///
312    /// Readable | Writable
313    ///
314    ///
315    /// #### `tooltip-markup`
316    ///  Sets the text of tooltip to be the given string, which is marked up
317    /// with Pango markup.
318    ///
319    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
320    ///
321    /// This is a convenience property which will take care of getting the
322    /// tooltip shown if the given string is not `NULL`:
323    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
324    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
325    /// the default signal handler.
326    ///
327    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
328    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
329    ///
330    /// Readable | Writable
331    ///
332    ///
333    /// #### `tooltip-text`
334    ///  Sets the text of tooltip to be the given string.
335    ///
336    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
337    ///
338    /// This is a convenience property which will take care of getting the
339    /// tooltip shown if the given string is not `NULL`:
340    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
341    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
342    /// the default signal handler.
343    ///
344    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
345    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
346    ///
347    /// Readable | Writable
348    ///
349    ///
350    /// #### `valign`
351    ///  How to distribute vertical space if widget gets extra space.
352    ///
353    /// Readable | Writable
354    ///
355    ///
356    /// #### `vexpand`
357    ///  Whether to expand vertically.
358    ///
359    /// Readable | Writable
360    ///
361    ///
362    /// #### `vexpand-set`
363    ///  Whether to use the `vexpand` property.
364    ///
365    /// Readable | Writable
366    ///
367    ///
368    /// #### `visible`
369    ///  Whether the widget is visible.
370    ///
371    /// Readable | Writable
372    ///
373    ///
374    /// #### `width-request`
375    ///  Overrides for width request of the widget.
376    ///
377    /// If this is -1, the natural request will be used.
378    ///
379    /// Readable | Writable
380    /// </details>
381    /// <details><summary><h4>Accessible</h4></summary>
382    ///
383    ///
384    /// #### `accessible-role`
385    ///  The accessible role of the given [`Accessible`][crate::Accessible] implementation.
386    ///
387    /// The accessible role cannot be changed once set.
388    ///
389    /// Readable | Writable
390    /// </details>
391    /// <details><summary><h4>Orientable</h4></summary>
392    ///
393    ///
394    /// #### `orientation`
395    ///  The orientation of the orientable.
396    ///
397    /// Readable | Writable
398    /// </details>
399    ///
400    /// ## Signals
401    ///
402    ///
403    /// #### `activate-cursor-child`
404    ///  Emitted when the user activates the @box_.
405    ///
406    /// This is a [keybinding signal](class.SignalAction.html).
407    ///
408    /// Action
409    ///
410    ///
411    /// #### `child-activated`
412    ///  Emitted when a child has been activated by the user.
413    ///
414    ///
415    ///
416    ///
417    /// #### `move-cursor`
418    ///   move vertically by pages
419    ///
420    /// Action
421    ///
422    ///
423    /// #### `select-all`
424    ///  .
425    ///
426    /// Action
427    ///
428    ///
429    /// #### `selected-children-changed`
430    ///  Emitted when the set of selected children changes.
431    ///
432    /// Use [`FlowBox::selected_foreach()`][crate::FlowBox::selected_foreach()] or
433    /// [`FlowBox::selected_children()`][crate::FlowBox::selected_children()] to obtain the
434    /// selected children.
435    ///
436    ///
437    ///
438    ///
439    /// #### `toggle-cursor-child`
440    ///  .
441    ///
442    /// Action
443    ///
444    ///
445    /// #### `unselect-all`
446    ///  .
447    ///
448    /// Action
449    /// <details><summary><h4>Widget</h4></summary>
450    ///
451    ///
452    /// #### `destroy`
453    ///  Signals that all holders of a reference to the widget should release
454    /// the reference that they hold.
455    ///
456    /// May result in finalization of the widget if all references are released.
457    ///
458    /// This signal is not suitable for saving widget state.
459    ///
460    ///
461    ///
462    ///
463    /// #### `direction-changed`
464    ///  Emitted when the text direction of a widget changes.
465    ///
466    ///
467    ///
468    ///
469    /// #### `hide`
470    ///  Emitted when @widget is hidden.
471    ///
472    ///
473    ///
474    ///
475    /// #### `keynav-failed`
476    ///  Emitted if keyboard navigation fails.
477    ///
478    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
479    ///
480    ///
481    ///
482    ///
483    /// #### `map`
484    ///  Emitted when @widget is going to be mapped.
485    ///
486    /// A widget is mapped when the widget is visible (which is controlled with
487    /// [`visible`][struct@crate::Widget#visible]) and all its parents up to the toplevel widget
488    /// are also visible.
489    ///
490    /// The `::map` signal can be used to determine whether a widget will be drawn,
491    /// for instance it can resume an animation that was stopped during the
492    /// emission of [`unmap`][struct@crate::Widget#unmap].
493    ///
494    ///
495    ///
496    ///
497    /// #### `mnemonic-activate`
498    ///  Emitted when a widget is activated via a mnemonic.
499    ///
500    /// The default handler for this signal activates @widget if @group_cycling
501    /// is false, or just makes @widget grab focus if @group_cycling is true.
502    ///
503    ///
504    ///
505    ///
506    /// #### `move-focus`
507    ///   to move backward.
508    ///
509    /// Action
510    ///
511    ///
512    /// #### `query-tooltip`
513    ///  s tooltip is about to be shown.
514    ///
515    /// This happens when the [`has-tooltip`][struct@crate::Widget#has-tooltip] property
516    /// is true and the hover timeout has expired with the cursor hovering
517    /// above @widget; or emitted when @widget got focus in keyboard mode.
518    ///
519    /// Using the given coordinates, the signal handler should determine
520    /// whether a tooltip should be shown for @widget. If this is the case
521    /// true should be returned, false otherwise. Note that if @keyboard_mode
522    /// is true, the values of @x and @y are undefined and should not be used.
523    ///
524    /// The signal handler is free to manipulate @tooltip with the therefore
525    /// destined function calls.
526    ///
527    ///
528    ///
529    ///
530    /// #### `realize`
531    ///  Emitted when @widget is associated with a [`gdk::Surface`][crate::gdk::Surface].
532    ///
533    /// This means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called
534    /// or the widget has been mapped (that is, it is going to be drawn).
535    ///
536    ///
537    ///
538    ///
539    /// #### `show`
540    ///  Emitted when @widget is shown.
541    ///
542    ///
543    ///
544    ///
545    /// #### `state-flags-changed`
546    ///  Emitted when the widget state changes.
547    ///
548    /// See [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
549    ///
550    ///
551    ///
552    ///
553    /// #### `unmap`
554    ///  Emitted when @widget is going to be unmapped.
555    ///
556    /// A widget is unmapped when either it or any of its parents up to the
557    /// toplevel widget have been set as hidden.
558    ///
559    /// As `::unmap` indicates that a widget will not be shown any longer,
560    /// it can be used to, for example, stop an animation on the widget.
561    ///
562    ///
563    ///
564    ///
565    /// #### `unrealize`
566    ///  Emitted when the [`gdk::Surface`][crate::gdk::Surface] associated with @widget is destroyed.
567    ///
568    /// This means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been called
569    /// or the widget has been unmapped (that is, it is going to be hidden).
570    ///
571    ///
572    /// </details>
573    ///
574    /// # Implements
575    ///
576    /// [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`OrientableExt`][trait@crate::prelude::OrientableExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual]
577    #[doc(alias = "GtkFlowBox")]
578    pub struct FlowBox(Object<ffi::GtkFlowBox>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, Orientable;
579
580    match fn {
581        type_ => || ffi::gtk_flow_box_get_type(),
582    }
583}
584
585#[cfg(not(feature = "v4_10"))]
586glib::wrapper! {
587    #[doc(alias = "GtkFlowBox")]
588    pub struct FlowBox(Object<ffi::GtkFlowBox>) @extends Widget, @implements Buildable, ConstraintTarget, Orientable;
589
590    match fn {
591        type_ => || ffi::gtk_flow_box_get_type(),
592    }
593}
594
595impl FlowBox {
596    /// Creates a [`FlowBox`][crate::FlowBox].
597    ///
598    /// # Returns
599    ///
600    /// a new [`FlowBox`][crate::FlowBox]
601    #[doc(alias = "gtk_flow_box_new")]
602    pub fn new() -> FlowBox {
603        assert_initialized_main_thread!();
604        unsafe { Widget::from_glib_none(ffi::gtk_flow_box_new()).unsafe_cast() }
605    }
606
607    // rustdoc-stripper-ignore-next
608    /// Creates a new builder-pattern struct instance to construct [`FlowBox`] objects.
609    ///
610    /// This method returns an instance of [`FlowBoxBuilder`](crate::builders::FlowBoxBuilder) which can be used to create [`FlowBox`] objects.
611    pub fn builder() -> FlowBoxBuilder {
612        FlowBoxBuilder::new()
613    }
614
615    /// Adds @child to the end of @self.
616    ///
617    /// If a sort function is set, the widget will
618    /// actually be inserted at the calculated position.
619    ///
620    /// See also: [`insert()`][Self::insert()].
621    /// ## `child`
622    /// the [`Widget`][crate::Widget] to add
623    #[cfg(feature = "v4_6")]
624    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
625    #[doc(alias = "gtk_flow_box_append")]
626    pub fn append(&self, child: &impl IsA<Widget>) {
627        unsafe {
628            ffi::gtk_flow_box_append(self.to_glib_none().0, child.as_ref().to_glib_none().0);
629        }
630    }
631
632    /// Binds @model to @self.
633    ///
634    /// If @self was already bound to a model, that previous binding is
635    /// destroyed.
636    ///
637    /// The contents of @self are cleared and then filled with widgets that
638    /// represent items from @model. @self is updated whenever @model changes.
639    /// If @model is [`None`], @self is left empty.
640    ///
641    /// It is undefined to add or remove widgets directly (for example, with
642    /// [`insert()`][Self::insert()]) while @self is bound to a model.
643    ///
644    /// Note that using a model is incompatible with the filtering and sorting
645    /// functionality in [`FlowBox`][crate::FlowBox]. When using a model, filtering and sorting
646    /// should be implemented by the model.
647    /// ## `model`
648    /// the `GListModel` to be bound to @self
649    /// ## `create_widget_func`
650    /// a function
651    ///   that creates widgets for items
652    #[doc(alias = "gtk_flow_box_bind_model")]
653    pub fn bind_model<P: Fn(&glib::Object) -> Widget + 'static>(
654        &self,
655        model: Option<&impl IsA<gio::ListModel>>,
656        create_widget_func: P,
657    ) {
658        let create_widget_func_data: Box_<P> = Box_::new(create_widget_func);
659        unsafe extern "C" fn create_widget_func_func<P: Fn(&glib::Object) -> Widget + 'static>(
660            item: *mut glib::gobject_ffi::GObject,
661            user_data: glib::ffi::gpointer,
662        ) -> *mut ffi::GtkWidget {
663            unsafe {
664                let item = from_glib_borrow(item);
665                let callback = &*(user_data as *mut P);
666                (*callback)(&item).to_glib_full()
667            }
668        }
669        let create_widget_func = Some(create_widget_func_func::<P> as _);
670        unsafe extern "C" fn user_data_free_func_func<P: Fn(&glib::Object) -> Widget + 'static>(
671            data: glib::ffi::gpointer,
672        ) {
673            unsafe {
674                let _callback = Box_::from_raw(data as *mut P);
675            }
676        }
677        let destroy_call4 = Some(user_data_free_func_func::<P> as _);
678        let super_callback0: Box_<P> = create_widget_func_data;
679        unsafe {
680            ffi::gtk_flow_box_bind_model(
681                self.to_glib_none().0,
682                model.map(|p| p.as_ref()).to_glib_none().0,
683                create_widget_func,
684                Box_::into_raw(super_callback0) as *mut _,
685                destroy_call4,
686            );
687        }
688    }
689
690    /// Returns whether children activate on single clicks.
691    ///
692    /// # Returns
693    ///
694    /// [`true`] if children are activated on single click,
695    ///   [`false`] otherwise
696    #[doc(alias = "gtk_flow_box_get_activate_on_single_click")]
697    #[doc(alias = "get_activate_on_single_click")]
698    #[doc(alias = "activate-on-single-click")]
699    pub fn activates_on_single_click(&self) -> bool {
700        unsafe {
701            from_glib(ffi::gtk_flow_box_get_activate_on_single_click(
702                self.to_glib_none().0,
703            ))
704        }
705    }
706
707    /// Gets the nth child in the @self.
708    /// ## `idx`
709    /// the position of the child
710    ///
711    /// # Returns
712    ///
713    /// the child widget, which will
714    ///   always be a [`FlowBoxChild`][crate::FlowBoxChild] or [`None`] in case no child widget
715    ///   with the given index exists.
716    #[doc(alias = "gtk_flow_box_get_child_at_index")]
717    #[doc(alias = "get_child_at_index")]
718    pub fn child_at_index(&self, idx: i32) -> Option<FlowBoxChild> {
719        unsafe {
720            from_glib_none(ffi::gtk_flow_box_get_child_at_index(
721                self.to_glib_none().0,
722                idx,
723            ))
724        }
725    }
726
727    /// Gets the child in the (@x, @y) position.
728    ///
729    /// Both @x and @y are assumed to be relative to the origin of @self.
730    /// ## `x`
731    /// the x coordinate of the child
732    /// ## `y`
733    /// the y coordinate of the child
734    ///
735    /// # Returns
736    ///
737    /// the child widget, which will
738    ///   always be a [`FlowBoxChild`][crate::FlowBoxChild] or [`None`] in case no child widget
739    ///   exists for the given x and y coordinates.
740    #[doc(alias = "gtk_flow_box_get_child_at_pos")]
741    #[doc(alias = "get_child_at_pos")]
742    pub fn child_at_pos(&self, x: i32, y: i32) -> Option<FlowBoxChild> {
743        unsafe {
744            from_glib_none(ffi::gtk_flow_box_get_child_at_pos(
745                self.to_glib_none().0,
746                x,
747                y,
748            ))
749        }
750    }
751
752    /// Gets the horizontal spacing.
753    ///
754    /// # Returns
755    ///
756    /// the horizontal spacing
757    #[doc(alias = "gtk_flow_box_get_column_spacing")]
758    #[doc(alias = "get_column_spacing")]
759    #[doc(alias = "column-spacing")]
760    pub fn column_spacing(&self) -> u32 {
761        unsafe { ffi::gtk_flow_box_get_column_spacing(self.to_glib_none().0) }
762    }
763
764    /// Returns whether the box is homogeneous.
765    ///
766    /// # Returns
767    ///
768    /// [`true`] if the box is homogeneous.
769    #[doc(alias = "gtk_flow_box_get_homogeneous")]
770    #[doc(alias = "get_homogeneous")]
771    #[doc(alias = "homogeneous")]
772    pub fn is_homogeneous(&self) -> bool {
773        unsafe { from_glib(ffi::gtk_flow_box_get_homogeneous(self.to_glib_none().0)) }
774    }
775
776    /// Gets the maximum number of children per line.
777    ///
778    /// # Returns
779    ///
780    /// the maximum number of children per line
781    #[doc(alias = "gtk_flow_box_get_max_children_per_line")]
782    #[doc(alias = "get_max_children_per_line")]
783    #[doc(alias = "max-children-per-line")]
784    pub fn max_children_per_line(&self) -> u32 {
785        unsafe { ffi::gtk_flow_box_get_max_children_per_line(self.to_glib_none().0) }
786    }
787
788    /// Gets the minimum number of children per line.
789    ///
790    /// # Returns
791    ///
792    /// the minimum number of children per line
793    #[doc(alias = "gtk_flow_box_get_min_children_per_line")]
794    #[doc(alias = "get_min_children_per_line")]
795    #[doc(alias = "min-children-per-line")]
796    pub fn min_children_per_line(&self) -> u32 {
797        unsafe { ffi::gtk_flow_box_get_min_children_per_line(self.to_glib_none().0) }
798    }
799
800    /// Gets the vertical spacing.
801    ///
802    /// # Returns
803    ///
804    /// the vertical spacing
805    #[doc(alias = "gtk_flow_box_get_row_spacing")]
806    #[doc(alias = "get_row_spacing")]
807    #[doc(alias = "row-spacing")]
808    pub fn row_spacing(&self) -> u32 {
809        unsafe { ffi::gtk_flow_box_get_row_spacing(self.to_glib_none().0) }
810    }
811
812    /// Creates a list of all selected children.
813    ///
814    /// # Returns
815    ///
816    ///
817    ///   A `GList` containing the [`Widget`][crate::Widget] for each selected child.
818    ///   Free with g_list_free() when done.
819    #[doc(alias = "gtk_flow_box_get_selected_children")]
820    #[doc(alias = "get_selected_children")]
821    pub fn selected_children(&self) -> Vec<FlowBoxChild> {
822        unsafe {
823            FromGlibPtrContainer::from_glib_container(ffi::gtk_flow_box_get_selected_children(
824                self.to_glib_none().0,
825            ))
826        }
827    }
828
829    /// Gets the selection mode of @self.
830    ///
831    /// # Returns
832    ///
833    /// the [`SelectionMode`][crate::SelectionMode]
834    #[doc(alias = "gtk_flow_box_get_selection_mode")]
835    #[doc(alias = "get_selection_mode")]
836    #[doc(alias = "selection-mode")]
837    pub fn selection_mode(&self) -> SelectionMode {
838        unsafe { from_glib(ffi::gtk_flow_box_get_selection_mode(self.to_glib_none().0)) }
839    }
840
841    /// Inserts the @widget into @self at @position.
842    ///
843    /// If a sort function is set, the widget will actually be inserted
844    /// at the calculated position.
845    ///
846    /// If @position is -1, or larger than the total number of children
847    /// in the @self, then the @widget will be appended to the end.
848    /// ## `widget`
849    /// the [`Widget`][crate::Widget] to add
850    /// ## `position`
851    /// the position to insert @child in
852    #[doc(alias = "gtk_flow_box_insert")]
853    pub fn insert(&self, widget: &impl IsA<Widget>, position: i32) {
854        unsafe {
855            ffi::gtk_flow_box_insert(
856                self.to_glib_none().0,
857                widget.as_ref().to_glib_none().0,
858                position,
859            );
860        }
861    }
862
863    /// Updates the filtering for all children.
864    ///
865    /// Call this function when the result of the filter
866    /// function on the @self is changed due to an external
867    /// factor. For instance, this would be used if the
868    /// filter function just looked for a specific search
869    /// term, and the entry with the string has changed.
870    #[doc(alias = "gtk_flow_box_invalidate_filter")]
871    pub fn invalidate_filter(&self) {
872        unsafe {
873            ffi::gtk_flow_box_invalidate_filter(self.to_glib_none().0);
874        }
875    }
876
877    /// Updates the sorting for all children.
878    ///
879    /// Call this when the result of the sort function on
880    /// @self is changed due to an external factor.
881    #[doc(alias = "gtk_flow_box_invalidate_sort")]
882    pub fn invalidate_sort(&self) {
883        unsafe {
884            ffi::gtk_flow_box_invalidate_sort(self.to_glib_none().0);
885        }
886    }
887
888    /// Adds @child to the start of @self.
889    ///
890    /// If a sort function is set, the widget will
891    /// actually be inserted at the calculated position.
892    ///
893    /// See also: [`insert()`][Self::insert()].
894    /// ## `child`
895    /// the [`Widget`][crate::Widget] to add
896    #[cfg(feature = "v4_6")]
897    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
898    #[doc(alias = "gtk_flow_box_prepend")]
899    pub fn prepend(&self, child: &impl IsA<Widget>) {
900        unsafe {
901            ffi::gtk_flow_box_prepend(self.to_glib_none().0, child.as_ref().to_glib_none().0);
902        }
903    }
904
905    /// Removes a child from @self.
906    /// ## `widget`
907    /// the child widget to remove
908    #[doc(alias = "gtk_flow_box_remove")]
909    pub fn remove(&self, widget: &impl IsA<Widget>) {
910        unsafe {
911            ffi::gtk_flow_box_remove(self.to_glib_none().0, widget.as_ref().to_glib_none().0);
912        }
913    }
914
915    /// Removes all children from @self.
916    ///
917    /// This function does nothing if @self is backed by a model.
918    #[cfg(feature = "v4_12")]
919    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
920    #[doc(alias = "gtk_flow_box_remove_all")]
921    pub fn remove_all(&self) {
922        unsafe {
923            ffi::gtk_flow_box_remove_all(self.to_glib_none().0);
924        }
925    }
926
927    /// Select all children of @self, if the selection
928    /// mode allows it.
929    #[doc(alias = "gtk_flow_box_select_all")]
930    pub fn select_all(&self) {
931        unsafe {
932            ffi::gtk_flow_box_select_all(self.to_glib_none().0);
933        }
934    }
935
936    /// Selects a single child of @self, if the selection
937    /// mode allows it.
938    /// ## `child`
939    /// a child of @self
940    #[doc(alias = "gtk_flow_box_select_child")]
941    pub fn select_child(&self, child: &impl IsA<FlowBoxChild>) {
942        unsafe {
943            ffi::gtk_flow_box_select_child(self.to_glib_none().0, child.as_ref().to_glib_none().0);
944        }
945    }
946
947    /// Calls a function for each selected child.
948    ///
949    /// Note that the selection cannot be modified from within
950    /// this function.
951    /// ## `func`
952    /// the function to call for each selected child
953    #[doc(alias = "gtk_flow_box_selected_foreach")]
954    pub fn selected_foreach<P: FnMut(&FlowBox, &FlowBoxChild)>(&self, func: P) {
955        let mut func_data: P = func;
956        unsafe extern "C" fn func_func<P: FnMut(&FlowBox, &FlowBoxChild)>(
957            box_: *mut ffi::GtkFlowBox,
958            child: *mut ffi::GtkFlowBoxChild,
959            user_data: glib::ffi::gpointer,
960        ) {
961            unsafe {
962                let box_ = from_glib_borrow(box_);
963                let child = from_glib_borrow(child);
964                let callback = user_data as *mut P;
965                (*callback)(&box_, &child)
966            }
967        }
968        let func = Some(func_func::<P> as _);
969        let super_callback0: &mut P = &mut func_data;
970        unsafe {
971            ffi::gtk_flow_box_selected_foreach(
972                self.to_glib_none().0,
973                func,
974                super_callback0 as *mut _ as *mut _,
975            );
976        }
977    }
978
979    /// If @single is [`true`], children will be activated when you click
980    /// on them, otherwise you need to double-click.
981    /// ## `single`
982    /// [`true`] to emit child-activated on a single click
983    #[doc(alias = "gtk_flow_box_set_activate_on_single_click")]
984    #[doc(alias = "activate-on-single-click")]
985    pub fn set_activate_on_single_click(&self, single: bool) {
986        unsafe {
987            ffi::gtk_flow_box_set_activate_on_single_click(
988                self.to_glib_none().0,
989                single.into_glib(),
990            );
991        }
992    }
993
994    /// Sets the horizontal space to add between children.
995    /// ## `spacing`
996    /// the spacing to use
997    #[doc(alias = "gtk_flow_box_set_column_spacing")]
998    #[doc(alias = "column-spacing")]
999    pub fn set_column_spacing(&self, spacing: u32) {
1000        unsafe {
1001            ffi::gtk_flow_box_set_column_spacing(self.to_glib_none().0, spacing);
1002        }
1003    }
1004
1005    /// By setting a filter function on the @self one can decide dynamically
1006    /// which of the children to show.
1007    ///
1008    /// For instance, to implement a search function that only shows the
1009    /// children matching the search terms.
1010    ///
1011    /// The @filter_func will be called for each child after the call, and
1012    /// it will continue to be called each time a child changes (via
1013    /// [`FlowBoxChildExt::changed()`][crate::prelude::FlowBoxChildExt::changed()]) or when
1014    /// [`invalidate_filter()`][Self::invalidate_filter()] is called.
1015    ///
1016    /// Note that using a filter function is incompatible with using a model
1017    /// (see [`bind_model()`][Self::bind_model()]).
1018    /// ## `filter_func`
1019    /// callback
1020    ///   that lets you filter which children to show
1021    #[doc(alias = "gtk_flow_box_set_filter_func")]
1022    pub fn set_filter_func<P: Fn(&FlowBoxChild) -> bool + 'static>(&self, filter_func: P) {
1023        let filter_func_data: Box_<P> = Box_::new(filter_func);
1024        unsafe extern "C" fn filter_func_func<P: Fn(&FlowBoxChild) -> bool + 'static>(
1025            child: *mut ffi::GtkFlowBoxChild,
1026            user_data: glib::ffi::gpointer,
1027        ) -> glib::ffi::gboolean {
1028            unsafe {
1029                let child = from_glib_borrow(child);
1030                let callback = &*(user_data as *mut P);
1031                (*callback)(&child).into_glib()
1032            }
1033        }
1034        let filter_func = Some(filter_func_func::<P> as _);
1035        unsafe extern "C" fn destroy_func<P: Fn(&FlowBoxChild) -> bool + 'static>(
1036            data: glib::ffi::gpointer,
1037        ) {
1038            unsafe {
1039                let _callback = Box_::from_raw(data as *mut P);
1040            }
1041        }
1042        let destroy_call3 = Some(destroy_func::<P> as _);
1043        let super_callback0: Box_<P> = filter_func_data;
1044        unsafe {
1045            ffi::gtk_flow_box_set_filter_func(
1046                self.to_glib_none().0,
1047                filter_func,
1048                Box_::into_raw(super_callback0) as *mut _,
1049                destroy_call3,
1050            );
1051        }
1052    }
1053
1054    /// Hooks up an adjustment to focus handling in @self.
1055    ///
1056    /// The adjustment is also used for autoscrolling during
1057    /// rubberband selection. See [`ScrolledWindow::hadjustment()`][crate::ScrolledWindow::hadjustment()]
1058    /// for a typical way of obtaining the adjustment, and
1059    /// [`set_vadjustment()`][Self::set_vadjustment()] for setting the vertical
1060    /// adjustment.
1061    ///
1062    /// The adjustments have to be in pixel units and in the same
1063    /// coordinate system as the allocation for immediate children
1064    /// of the box.
1065    /// ## `adjustment`
1066    /// an adjustment which should be adjusted
1067    ///    when the focus is moved among the descendents of @container
1068    #[doc(alias = "gtk_flow_box_set_hadjustment")]
1069    pub fn set_hadjustment(&self, adjustment: &impl IsA<Adjustment>) {
1070        unsafe {
1071            ffi::gtk_flow_box_set_hadjustment(
1072                self.to_glib_none().0,
1073                adjustment.as_ref().to_glib_none().0,
1074            );
1075        }
1076    }
1077
1078    /// Sets whether or not all children of @self are given
1079    /// equal space in the box.
1080    /// ## `homogeneous`
1081    /// [`true`] to create equal allotments,
1082    ///   [`false`] for variable allotments
1083    #[doc(alias = "gtk_flow_box_set_homogeneous")]
1084    #[doc(alias = "homogeneous")]
1085    pub fn set_homogeneous(&self, homogeneous: bool) {
1086        unsafe {
1087            ffi::gtk_flow_box_set_homogeneous(self.to_glib_none().0, homogeneous.into_glib());
1088        }
1089    }
1090
1091    /// s orientation.
1092    ///
1093    /// Setting the maximum number of children per line
1094    /// limits the overall natural size request to be no more
1095    /// than @n_children children long in the given orientation.
1096    /// ## `n_children`
1097    /// the maximum number of children per line
1098    #[doc(alias = "gtk_flow_box_set_max_children_per_line")]
1099    #[doc(alias = "max-children-per-line")]
1100    pub fn set_max_children_per_line(&self, n_children: u32) {
1101        unsafe {
1102            ffi::gtk_flow_box_set_max_children_per_line(self.to_glib_none().0, n_children);
1103        }
1104    }
1105
1106    /// s orientation before flowing.
1107    /// ## `n_children`
1108    /// the minimum number of children per line
1109    #[doc(alias = "gtk_flow_box_set_min_children_per_line")]
1110    #[doc(alias = "min-children-per-line")]
1111    pub fn set_min_children_per_line(&self, n_children: u32) {
1112        unsafe {
1113            ffi::gtk_flow_box_set_min_children_per_line(self.to_glib_none().0, n_children);
1114        }
1115    }
1116
1117    /// Sets the vertical space to add between children.
1118    /// ## `spacing`
1119    /// the spacing to use
1120    #[doc(alias = "gtk_flow_box_set_row_spacing")]
1121    #[doc(alias = "row-spacing")]
1122    pub fn set_row_spacing(&self, spacing: u32) {
1123        unsafe {
1124            ffi::gtk_flow_box_set_row_spacing(self.to_glib_none().0, spacing);
1125        }
1126    }
1127
1128    /// Sets how selection works in @self.
1129    /// ## `mode`
1130    /// the new selection mode
1131    #[doc(alias = "gtk_flow_box_set_selection_mode")]
1132    #[doc(alias = "selection-mode")]
1133    pub fn set_selection_mode(&self, mode: SelectionMode) {
1134        unsafe {
1135            ffi::gtk_flow_box_set_selection_mode(self.to_glib_none().0, mode.into_glib());
1136        }
1137    }
1138
1139    /// Hooks up an adjustment to focus handling in @self.
1140    ///
1141    /// The adjustment is also used for autoscrolling during
1142    /// rubberband selection. See [`ScrolledWindow::vadjustment()`][crate::ScrolledWindow::vadjustment()]
1143    /// for a typical way of obtaining the adjustment, and
1144    /// [`set_hadjustment()`][Self::set_hadjustment()] for setting the horizontal
1145    /// adjustment.
1146    ///
1147    /// The adjustments have to be in pixel units and in the same
1148    /// coordinate system as the allocation for immediate children
1149    /// of the box.
1150    /// ## `adjustment`
1151    /// an adjustment which should be adjusted
1152    ///    when the focus is moved among the descendents of @container
1153    #[doc(alias = "gtk_flow_box_set_vadjustment")]
1154    pub fn set_vadjustment(&self, adjustment: &impl IsA<Adjustment>) {
1155        unsafe {
1156            ffi::gtk_flow_box_set_vadjustment(
1157                self.to_glib_none().0,
1158                adjustment.as_ref().to_glib_none().0,
1159            );
1160        }
1161    }
1162
1163    /// Unselect all children of @self, if the selection
1164    /// mode allows it.
1165    #[doc(alias = "gtk_flow_box_unselect_all")]
1166    pub fn unselect_all(&self) {
1167        unsafe {
1168            ffi::gtk_flow_box_unselect_all(self.to_glib_none().0);
1169        }
1170    }
1171
1172    /// Unselects a single child of @self, if the selection
1173    /// mode allows it.
1174    /// ## `child`
1175    /// a child of @self
1176    #[doc(alias = "gtk_flow_box_unselect_child")]
1177    pub fn unselect_child(&self, child: &impl IsA<FlowBoxChild>) {
1178        unsafe {
1179            ffi::gtk_flow_box_unselect_child(
1180                self.to_glib_none().0,
1181                child.as_ref().to_glib_none().0,
1182            );
1183        }
1184    }
1185
1186    /// Whether to accept unpaired release events.
1187    #[doc(alias = "accept-unpaired-release")]
1188    pub fn accepts_unpaired_release(&self) -> bool {
1189        ObjectExt::property(self, "accept-unpaired-release")
1190    }
1191
1192    /// Whether to accept unpaired release events.
1193    #[doc(alias = "accept-unpaired-release")]
1194    pub fn set_accept_unpaired_release(&self, accept_unpaired_release: bool) {
1195        ObjectExt::set_property(self, "accept-unpaired-release", accept_unpaired_release)
1196    }
1197
1198    /// Emitted when the user activates the @box_.
1199    ///
1200    /// This is a [keybinding signal](class.SignalAction.html).
1201    #[doc(alias = "activate-cursor-child")]
1202    pub fn connect_activate_cursor_child<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1203        unsafe extern "C" fn activate_cursor_child_trampoline<F: Fn(&FlowBox) + 'static>(
1204            this: *mut ffi::GtkFlowBox,
1205            f: glib::ffi::gpointer,
1206        ) {
1207            unsafe {
1208                let f: &F = &*(f as *const F);
1209                f(&from_glib_borrow(this))
1210            }
1211        }
1212        unsafe {
1213            let f: Box_<F> = Box_::new(f);
1214            connect_raw(
1215                self.as_ptr() as *mut _,
1216                c"activate-cursor-child".as_ptr(),
1217                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1218                    activate_cursor_child_trampoline::<F> as *const (),
1219                )),
1220                Box_::into_raw(f),
1221            )
1222        }
1223    }
1224
1225    pub fn emit_activate_cursor_child(&self) {
1226        self.emit_by_name::<()>("activate-cursor-child", &[]);
1227    }
1228
1229    /// Emitted when a child has been activated by the user.
1230    /// ## `child`
1231    /// the child that is activated
1232    #[doc(alias = "child-activated")]
1233    pub fn connect_child_activated<F: Fn(&Self, &FlowBoxChild) + 'static>(
1234        &self,
1235        f: F,
1236    ) -> SignalHandlerId {
1237        unsafe extern "C" fn child_activated_trampoline<
1238            F: Fn(&FlowBox, &FlowBoxChild) + 'static,
1239        >(
1240            this: *mut ffi::GtkFlowBox,
1241            child: *mut ffi::GtkFlowBoxChild,
1242            f: glib::ffi::gpointer,
1243        ) {
1244            unsafe {
1245                let f: &F = &*(f as *const F);
1246                f(&from_glib_borrow(this), &from_glib_borrow(child))
1247            }
1248        }
1249        unsafe {
1250            let f: Box_<F> = Box_::new(f);
1251            connect_raw(
1252                self.as_ptr() as *mut _,
1253                c"child-activated".as_ptr(),
1254                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1255                    child_activated_trampoline::<F> as *const (),
1256                )),
1257                Box_::into_raw(f),
1258            )
1259        }
1260    }
1261
1262    ///  move vertically by pages
1263    /// ## `step`
1264    /// the granularity of the move, as a [`MovementStep`][crate::MovementStep]
1265    /// ## `count`
1266    /// the number of @step units to move
1267    /// ## `extend`
1268    /// whether to extend the selection
1269    /// ## `modify`
1270    /// whether to modify the selection
1271    ///
1272    /// # Returns
1273    ///
1274    /// [`true`] to stop other handlers from being invoked for the event.
1275    ///   [`false`] to propagate the event further.
1276    #[doc(alias = "move-cursor")]
1277    pub fn connect_move_cursor<F: Fn(&Self, MovementStep, i32, bool, bool) -> bool + 'static>(
1278        &self,
1279        f: F,
1280    ) -> SignalHandlerId {
1281        unsafe extern "C" fn move_cursor_trampoline<
1282            F: Fn(&FlowBox, MovementStep, i32, bool, bool) -> bool + 'static,
1283        >(
1284            this: *mut ffi::GtkFlowBox,
1285            step: ffi::GtkMovementStep,
1286            count: std::ffi::c_int,
1287            extend: glib::ffi::gboolean,
1288            modify: glib::ffi::gboolean,
1289            f: glib::ffi::gpointer,
1290        ) -> glib::ffi::gboolean {
1291            unsafe {
1292                let f: &F = &*(f as *const F);
1293                f(
1294                    &from_glib_borrow(this),
1295                    from_glib(step),
1296                    count,
1297                    from_glib(extend),
1298                    from_glib(modify),
1299                )
1300                .into_glib()
1301            }
1302        }
1303        unsafe {
1304            let f: Box_<F> = Box_::new(f);
1305            connect_raw(
1306                self.as_ptr() as *mut _,
1307                c"move-cursor".as_ptr(),
1308                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1309                    move_cursor_trampoline::<F> as *const (),
1310                )),
1311                Box_::into_raw(f),
1312            )
1313        }
1314    }
1315
1316    pub fn emit_move_cursor(
1317        &self,
1318        step: MovementStep,
1319        count: i32,
1320        extend: bool,
1321        modify: bool,
1322    ) -> bool {
1323        self.emit_by_name("move-cursor", &[&step, &count, &extend, &modify])
1324    }
1325
1326    /// .
1327    #[doc(alias = "select-all")]
1328    pub fn connect_select_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1329        unsafe extern "C" fn select_all_trampoline<F: Fn(&FlowBox) + 'static>(
1330            this: *mut ffi::GtkFlowBox,
1331            f: glib::ffi::gpointer,
1332        ) {
1333            unsafe {
1334                let f: &F = &*(f as *const F);
1335                f(&from_glib_borrow(this))
1336            }
1337        }
1338        unsafe {
1339            let f: Box_<F> = Box_::new(f);
1340            connect_raw(
1341                self.as_ptr() as *mut _,
1342                c"select-all".as_ptr(),
1343                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1344                    select_all_trampoline::<F> as *const (),
1345                )),
1346                Box_::into_raw(f),
1347            )
1348        }
1349    }
1350
1351    pub fn emit_select_all(&self) {
1352        self.emit_by_name::<()>("select-all", &[]);
1353    }
1354
1355    /// Emitted when the set of selected children changes.
1356    ///
1357    /// Use [`selected_foreach()`][Self::selected_foreach()] or
1358    /// [`selected_children()`][Self::selected_children()] to obtain the
1359    /// selected children.
1360    #[doc(alias = "selected-children-changed")]
1361    pub fn connect_selected_children_changed<F: Fn(&Self) + 'static>(
1362        &self,
1363        f: F,
1364    ) -> SignalHandlerId {
1365        unsafe extern "C" fn selected_children_changed_trampoline<F: Fn(&FlowBox) + 'static>(
1366            this: *mut ffi::GtkFlowBox,
1367            f: glib::ffi::gpointer,
1368        ) {
1369            unsafe {
1370                let f: &F = &*(f as *const F);
1371                f(&from_glib_borrow(this))
1372            }
1373        }
1374        unsafe {
1375            let f: Box_<F> = Box_::new(f);
1376            connect_raw(
1377                self.as_ptr() as *mut _,
1378                c"selected-children-changed".as_ptr(),
1379                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1380                    selected_children_changed_trampoline::<F> as *const (),
1381                )),
1382                Box_::into_raw(f),
1383            )
1384        }
1385    }
1386
1387    /// .
1388    #[doc(alias = "toggle-cursor-child")]
1389    pub fn connect_toggle_cursor_child<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1390        unsafe extern "C" fn toggle_cursor_child_trampoline<F: Fn(&FlowBox) + 'static>(
1391            this: *mut ffi::GtkFlowBox,
1392            f: glib::ffi::gpointer,
1393        ) {
1394            unsafe {
1395                let f: &F = &*(f as *const F);
1396                f(&from_glib_borrow(this))
1397            }
1398        }
1399        unsafe {
1400            let f: Box_<F> = Box_::new(f);
1401            connect_raw(
1402                self.as_ptr() as *mut _,
1403                c"toggle-cursor-child".as_ptr(),
1404                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1405                    toggle_cursor_child_trampoline::<F> as *const (),
1406                )),
1407                Box_::into_raw(f),
1408            )
1409        }
1410    }
1411
1412    pub fn emit_toggle_cursor_child(&self) {
1413        self.emit_by_name::<()>("toggle-cursor-child", &[]);
1414    }
1415
1416    /// .
1417    #[doc(alias = "unselect-all")]
1418    pub fn connect_unselect_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1419        unsafe extern "C" fn unselect_all_trampoline<F: Fn(&FlowBox) + 'static>(
1420            this: *mut ffi::GtkFlowBox,
1421            f: glib::ffi::gpointer,
1422        ) {
1423            unsafe {
1424                let f: &F = &*(f as *const F);
1425                f(&from_glib_borrow(this))
1426            }
1427        }
1428        unsafe {
1429            let f: Box_<F> = Box_::new(f);
1430            connect_raw(
1431                self.as_ptr() as *mut _,
1432                c"unselect-all".as_ptr(),
1433                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1434                    unselect_all_trampoline::<F> as *const (),
1435                )),
1436                Box_::into_raw(f),
1437            )
1438        }
1439    }
1440
1441    pub fn emit_unselect_all(&self) {
1442        self.emit_by_name::<()>("unselect-all", &[]);
1443    }
1444
1445    #[doc(alias = "accept-unpaired-release")]
1446    pub fn connect_accept_unpaired_release_notify<F: Fn(&Self) + 'static>(
1447        &self,
1448        f: F,
1449    ) -> SignalHandlerId {
1450        unsafe extern "C" fn notify_accept_unpaired_release_trampoline<
1451            F: Fn(&FlowBox) + 'static,
1452        >(
1453            this: *mut ffi::GtkFlowBox,
1454            _param_spec: glib::ffi::gpointer,
1455            f: glib::ffi::gpointer,
1456        ) {
1457            unsafe {
1458                let f: &F = &*(f as *const F);
1459                f(&from_glib_borrow(this))
1460            }
1461        }
1462        unsafe {
1463            let f: Box_<F> = Box_::new(f);
1464            connect_raw(
1465                self.as_ptr() as *mut _,
1466                c"notify::accept-unpaired-release".as_ptr(),
1467                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1468                    notify_accept_unpaired_release_trampoline::<F> as *const (),
1469                )),
1470                Box_::into_raw(f),
1471            )
1472        }
1473    }
1474
1475    #[doc(alias = "activate-on-single-click")]
1476    pub fn connect_activate_on_single_click_notify<F: Fn(&Self) + 'static>(
1477        &self,
1478        f: F,
1479    ) -> SignalHandlerId {
1480        unsafe extern "C" fn notify_activate_on_single_click_trampoline<
1481            F: Fn(&FlowBox) + 'static,
1482        >(
1483            this: *mut ffi::GtkFlowBox,
1484            _param_spec: glib::ffi::gpointer,
1485            f: glib::ffi::gpointer,
1486        ) {
1487            unsafe {
1488                let f: &F = &*(f as *const F);
1489                f(&from_glib_borrow(this))
1490            }
1491        }
1492        unsafe {
1493            let f: Box_<F> = Box_::new(f);
1494            connect_raw(
1495                self.as_ptr() as *mut _,
1496                c"notify::activate-on-single-click".as_ptr(),
1497                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1498                    notify_activate_on_single_click_trampoline::<F> as *const (),
1499                )),
1500                Box_::into_raw(f),
1501            )
1502        }
1503    }
1504
1505    #[doc(alias = "column-spacing")]
1506    pub fn connect_column_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1507        unsafe extern "C" fn notify_column_spacing_trampoline<F: Fn(&FlowBox) + 'static>(
1508            this: *mut ffi::GtkFlowBox,
1509            _param_spec: glib::ffi::gpointer,
1510            f: glib::ffi::gpointer,
1511        ) {
1512            unsafe {
1513                let f: &F = &*(f as *const F);
1514                f(&from_glib_borrow(this))
1515            }
1516        }
1517        unsafe {
1518            let f: Box_<F> = Box_::new(f);
1519            connect_raw(
1520                self.as_ptr() as *mut _,
1521                c"notify::column-spacing".as_ptr(),
1522                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1523                    notify_column_spacing_trampoline::<F> as *const (),
1524                )),
1525                Box_::into_raw(f),
1526            )
1527        }
1528    }
1529
1530    #[doc(alias = "homogeneous")]
1531    pub fn connect_homogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1532        unsafe extern "C" fn notify_homogeneous_trampoline<F: Fn(&FlowBox) + 'static>(
1533            this: *mut ffi::GtkFlowBox,
1534            _param_spec: glib::ffi::gpointer,
1535            f: glib::ffi::gpointer,
1536        ) {
1537            unsafe {
1538                let f: &F = &*(f as *const F);
1539                f(&from_glib_borrow(this))
1540            }
1541        }
1542        unsafe {
1543            let f: Box_<F> = Box_::new(f);
1544            connect_raw(
1545                self.as_ptr() as *mut _,
1546                c"notify::homogeneous".as_ptr(),
1547                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1548                    notify_homogeneous_trampoline::<F> as *const (),
1549                )),
1550                Box_::into_raw(f),
1551            )
1552        }
1553    }
1554
1555    #[doc(alias = "max-children-per-line")]
1556    pub fn connect_max_children_per_line_notify<F: Fn(&Self) + 'static>(
1557        &self,
1558        f: F,
1559    ) -> SignalHandlerId {
1560        unsafe extern "C" fn notify_max_children_per_line_trampoline<F: Fn(&FlowBox) + 'static>(
1561            this: *mut ffi::GtkFlowBox,
1562            _param_spec: glib::ffi::gpointer,
1563            f: glib::ffi::gpointer,
1564        ) {
1565            unsafe {
1566                let f: &F = &*(f as *const F);
1567                f(&from_glib_borrow(this))
1568            }
1569        }
1570        unsafe {
1571            let f: Box_<F> = Box_::new(f);
1572            connect_raw(
1573                self.as_ptr() as *mut _,
1574                c"notify::max-children-per-line".as_ptr(),
1575                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1576                    notify_max_children_per_line_trampoline::<F> as *const (),
1577                )),
1578                Box_::into_raw(f),
1579            )
1580        }
1581    }
1582
1583    #[doc(alias = "min-children-per-line")]
1584    pub fn connect_min_children_per_line_notify<F: Fn(&Self) + 'static>(
1585        &self,
1586        f: F,
1587    ) -> SignalHandlerId {
1588        unsafe extern "C" fn notify_min_children_per_line_trampoline<F: Fn(&FlowBox) + 'static>(
1589            this: *mut ffi::GtkFlowBox,
1590            _param_spec: glib::ffi::gpointer,
1591            f: glib::ffi::gpointer,
1592        ) {
1593            unsafe {
1594                let f: &F = &*(f as *const F);
1595                f(&from_glib_borrow(this))
1596            }
1597        }
1598        unsafe {
1599            let f: Box_<F> = Box_::new(f);
1600            connect_raw(
1601                self.as_ptr() as *mut _,
1602                c"notify::min-children-per-line".as_ptr(),
1603                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1604                    notify_min_children_per_line_trampoline::<F> as *const (),
1605                )),
1606                Box_::into_raw(f),
1607            )
1608        }
1609    }
1610
1611    #[doc(alias = "row-spacing")]
1612    pub fn connect_row_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1613        unsafe extern "C" fn notify_row_spacing_trampoline<F: Fn(&FlowBox) + 'static>(
1614            this: *mut ffi::GtkFlowBox,
1615            _param_spec: glib::ffi::gpointer,
1616            f: glib::ffi::gpointer,
1617        ) {
1618            unsafe {
1619                let f: &F = &*(f as *const F);
1620                f(&from_glib_borrow(this))
1621            }
1622        }
1623        unsafe {
1624            let f: Box_<F> = Box_::new(f);
1625            connect_raw(
1626                self.as_ptr() as *mut _,
1627                c"notify::row-spacing".as_ptr(),
1628                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1629                    notify_row_spacing_trampoline::<F> as *const (),
1630                )),
1631                Box_::into_raw(f),
1632            )
1633        }
1634    }
1635
1636    #[doc(alias = "selection-mode")]
1637    pub fn connect_selection_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1638        unsafe extern "C" fn notify_selection_mode_trampoline<F: Fn(&FlowBox) + 'static>(
1639            this: *mut ffi::GtkFlowBox,
1640            _param_spec: glib::ffi::gpointer,
1641            f: glib::ffi::gpointer,
1642        ) {
1643            unsafe {
1644                let f: &F = &*(f as *const F);
1645                f(&from_glib_borrow(this))
1646            }
1647        }
1648        unsafe {
1649            let f: Box_<F> = Box_::new(f);
1650            connect_raw(
1651                self.as_ptr() as *mut _,
1652                c"notify::selection-mode".as_ptr(),
1653                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1654                    notify_selection_mode_trampoline::<F> as *const (),
1655                )),
1656                Box_::into_raw(f),
1657            )
1658        }
1659    }
1660}
1661
1662impl Default for FlowBox {
1663    fn default() -> Self {
1664        Self::new()
1665    }
1666}
1667
1668// rustdoc-stripper-ignore-next
1669/// A [builder-pattern] type to construct [`FlowBox`] objects.
1670///
1671/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1672#[must_use = "The builder must be built to be used"]
1673pub struct FlowBoxBuilder {
1674    builder: glib::object::ObjectBuilder<'static, FlowBox>,
1675}
1676
1677impl FlowBoxBuilder {
1678    fn new() -> Self {
1679        Self {
1680            builder: glib::object::Object::builder(),
1681        }
1682    }
1683
1684    /// Whether to accept unpaired release events.
1685    pub fn accept_unpaired_release(self, accept_unpaired_release: bool) -> Self {
1686        Self {
1687            builder: self
1688                .builder
1689                .property("accept-unpaired-release", accept_unpaired_release),
1690        }
1691    }
1692
1693    /// Determines whether children can be activated with a single
1694    /// click, or require a double-click.
1695    pub fn activate_on_single_click(self, activate_on_single_click: bool) -> Self {
1696        Self {
1697            builder: self
1698                .builder
1699                .property("activate-on-single-click", activate_on_single_click),
1700        }
1701    }
1702
1703    /// The amount of horizontal space between two children.
1704    pub fn column_spacing(self, column_spacing: u32) -> Self {
1705        Self {
1706            builder: self.builder.property("column-spacing", column_spacing),
1707        }
1708    }
1709
1710    /// Determines whether all children should be allocated the
1711    /// same size.
1712    pub fn homogeneous(self, homogeneous: bool) -> Self {
1713        Self {
1714            builder: self.builder.property("homogeneous", homogeneous),
1715        }
1716    }
1717
1718    /// The maximum amount of children to request space for consecutively
1719    /// in the given orientation.
1720    pub fn max_children_per_line(self, max_children_per_line: u32) -> Self {
1721        Self {
1722            builder: self
1723                .builder
1724                .property("max-children-per-line", max_children_per_line),
1725        }
1726    }
1727
1728    /// The minimum number of children to allocate consecutively
1729    /// in the given orientation.
1730    ///
1731    /// Setting the minimum children per line ensures
1732    /// that a reasonably small height will be requested
1733    /// for the overall minimum width of the box.
1734    pub fn min_children_per_line(self, min_children_per_line: u32) -> Self {
1735        Self {
1736            builder: self
1737                .builder
1738                .property("min-children-per-line", min_children_per_line),
1739        }
1740    }
1741
1742    /// The amount of vertical space between two children.
1743    pub fn row_spacing(self, row_spacing: u32) -> Self {
1744        Self {
1745            builder: self.builder.property("row-spacing", row_spacing),
1746        }
1747    }
1748
1749    /// The selection mode used by the flow box.
1750    pub fn selection_mode(self, selection_mode: SelectionMode) -> Self {
1751        Self {
1752            builder: self.builder.property("selection-mode", selection_mode),
1753        }
1754    }
1755
1756    /// Whether the widget or any of its descendents can accept
1757    /// the input focus.
1758    ///
1759    /// This property is meant to be set by widget implementations,
1760    /// typically in their instance init function.
1761    pub fn can_focus(self, can_focus: bool) -> Self {
1762        Self {
1763            builder: self.builder.property("can-focus", can_focus),
1764        }
1765    }
1766
1767    /// Whether the widget can receive pointer events.
1768    pub fn can_target(self, can_target: bool) -> Self {
1769        Self {
1770            builder: self.builder.property("can-target", can_target),
1771        }
1772    }
1773
1774    /// A list of css classes applied to this widget.
1775    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1776        Self {
1777            builder: self.builder.property("css-classes", css_classes.into()),
1778        }
1779    }
1780
1781    /// The name of this widget in the CSS tree.
1782    ///
1783    /// This property is meant to be set by widget implementations,
1784    /// typically in their instance init function.
1785    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1786        Self {
1787            builder: self.builder.property("css-name", css_name.into()),
1788        }
1789    }
1790
1791    /// The cursor used by @widget.
1792    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1793        Self {
1794            builder: self.builder.property("cursor", cursor.clone()),
1795        }
1796    }
1797
1798    /// Whether the widget should grab focus when it is clicked with the mouse.
1799    ///
1800    /// This property is only relevant for widgets that can take focus.
1801    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1802        Self {
1803            builder: self.builder.property("focus-on-click", focus_on_click),
1804        }
1805    }
1806
1807    /// Whether this widget itself will accept the input focus.
1808    pub fn focusable(self, focusable: bool) -> Self {
1809        Self {
1810            builder: self.builder.property("focusable", focusable),
1811        }
1812    }
1813
1814    /// How to distribute horizontal space if widget gets extra space.
1815    pub fn halign(self, halign: Align) -> Self {
1816        Self {
1817            builder: self.builder.property("halign", halign),
1818        }
1819    }
1820
1821    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1822    /// signal on @widget.
1823    ///
1824    /// A true value indicates that @widget can have a tooltip, in this case
1825    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1826    /// determine whether it will provide a tooltip or not.
1827    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1828        Self {
1829            builder: self.builder.property("has-tooltip", has_tooltip),
1830        }
1831    }
1832
1833    /// Overrides for height request of the widget.
1834    ///
1835    /// If this is -1, the natural request will be used.
1836    pub fn height_request(self, height_request: i32) -> Self {
1837        Self {
1838            builder: self.builder.property("height-request", height_request),
1839        }
1840    }
1841
1842    /// Whether to expand horizontally.
1843    pub fn hexpand(self, hexpand: bool) -> Self {
1844        Self {
1845            builder: self.builder.property("hexpand", hexpand),
1846        }
1847    }
1848
1849    /// Whether to use the `hexpand` property.
1850    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1851        Self {
1852            builder: self.builder.property("hexpand-set", hexpand_set),
1853        }
1854    }
1855
1856    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1857    /// the preferred size of the widget, and allocate its children.
1858    ///
1859    /// This property is meant to be set by widget implementations,
1860    /// typically in their instance init function.
1861    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1862        Self {
1863            builder: self
1864                .builder
1865                .property("layout-manager", layout_manager.clone().upcast()),
1866        }
1867    }
1868
1869    /// Makes this widget act like a modal dialog, with respect to
1870    /// event delivery.
1871    ///
1872    /// Global event controllers will not handle events with targets
1873    /// inside the widget, unless they are set up to ignore propagation
1874    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1875    #[cfg(feature = "v4_18")]
1876    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1877    pub fn limit_events(self, limit_events: bool) -> Self {
1878        Self {
1879            builder: self.builder.property("limit-events", limit_events),
1880        }
1881    }
1882
1883    /// Margin on bottom side of widget.
1884    ///
1885    /// This property adds margin outside of the widget's normal size
1886    /// request, the margin will be added in addition to the size from
1887    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1888    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1889        Self {
1890            builder: self.builder.property("margin-bottom", margin_bottom),
1891        }
1892    }
1893
1894    /// Margin on end of widget, horizontally.
1895    ///
1896    /// This property supports left-to-right and right-to-left text
1897    /// directions.
1898    ///
1899    /// This property adds margin outside of the widget's normal size
1900    /// request, the margin will be added in addition to the size from
1901    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1902    pub fn margin_end(self, margin_end: i32) -> Self {
1903        Self {
1904            builder: self.builder.property("margin-end", margin_end),
1905        }
1906    }
1907
1908    /// Margin on start of widget, horizontally.
1909    ///
1910    /// This property supports left-to-right and right-to-left text
1911    /// directions.
1912    ///
1913    /// This property adds margin outside of the widget's normal size
1914    /// request, the margin will be added in addition to the size from
1915    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1916    pub fn margin_start(self, margin_start: i32) -> Self {
1917        Self {
1918            builder: self.builder.property("margin-start", margin_start),
1919        }
1920    }
1921
1922    /// Margin on top side of widget.
1923    ///
1924    /// This property adds margin outside of the widget's normal size
1925    /// request, the margin will be added in addition to the size from
1926    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1927    pub fn margin_top(self, margin_top: i32) -> Self {
1928        Self {
1929            builder: self.builder.property("margin-top", margin_top),
1930        }
1931    }
1932
1933    /// The name of the widget.
1934    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1935        Self {
1936            builder: self.builder.property("name", name.into()),
1937        }
1938    }
1939
1940    /// The requested opacity of the widget.
1941    pub fn opacity(self, opacity: f64) -> Self {
1942        Self {
1943            builder: self.builder.property("opacity", opacity),
1944        }
1945    }
1946
1947    /// How content outside the widget's content area is treated.
1948    ///
1949    /// This property is meant to be set by widget implementations,
1950    /// typically in their instance init function.
1951    pub fn overflow(self, overflow: Overflow) -> Self {
1952        Self {
1953            builder: self.builder.property("overflow", overflow),
1954        }
1955    }
1956
1957    /// Whether the widget will receive the default action when it is focused.
1958    pub fn receives_default(self, receives_default: bool) -> Self {
1959        Self {
1960            builder: self.builder.property("receives-default", receives_default),
1961        }
1962    }
1963
1964    /// Whether the widget responds to input.
1965    pub fn sensitive(self, sensitive: bool) -> Self {
1966        Self {
1967            builder: self.builder.property("sensitive", sensitive),
1968        }
1969    }
1970
1971    /// Sets the text of tooltip to be the given string, which is marked up
1972    /// with Pango markup.
1973    ///
1974    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1975    ///
1976    /// This is a convenience property which will take care of getting the
1977    /// tooltip shown if the given string is not `NULL`:
1978    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1979    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1980    /// the default signal handler.
1981    ///
1982    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1983    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1984    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1985        Self {
1986            builder: self
1987                .builder
1988                .property("tooltip-markup", tooltip_markup.into()),
1989        }
1990    }
1991
1992    /// Sets the text of tooltip to be the given string.
1993    ///
1994    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1995    ///
1996    /// This is a convenience property which will take care of getting the
1997    /// tooltip shown if the given string is not `NULL`:
1998    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1999    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
2000    /// the default signal handler.
2001    ///
2002    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
2003    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
2004    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
2005        Self {
2006            builder: self.builder.property("tooltip-text", tooltip_text.into()),
2007        }
2008    }
2009
2010    /// How to distribute vertical space if widget gets extra space.
2011    pub fn valign(self, valign: Align) -> Self {
2012        Self {
2013            builder: self.builder.property("valign", valign),
2014        }
2015    }
2016
2017    /// Whether to expand vertically.
2018    pub fn vexpand(self, vexpand: bool) -> Self {
2019        Self {
2020            builder: self.builder.property("vexpand", vexpand),
2021        }
2022    }
2023
2024    /// Whether to use the `vexpand` property.
2025    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
2026        Self {
2027            builder: self.builder.property("vexpand-set", vexpand_set),
2028        }
2029    }
2030
2031    /// Whether the widget is visible.
2032    pub fn visible(self, visible: bool) -> Self {
2033        Self {
2034            builder: self.builder.property("visible", visible),
2035        }
2036    }
2037
2038    /// Overrides for width request of the widget.
2039    ///
2040    /// If this is -1, the natural request will be used.
2041    pub fn width_request(self, width_request: i32) -> Self {
2042        Self {
2043            builder: self.builder.property("width-request", width_request),
2044        }
2045    }
2046
2047    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
2048    ///
2049    /// The accessible role cannot be changed once set.
2050    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
2051        Self {
2052            builder: self.builder.property("accessible-role", accessible_role),
2053        }
2054    }
2055
2056    /// The orientation of the orientable.
2057    pub fn orientation(self, orientation: Orientation) -> Self {
2058        Self {
2059            builder: self.builder.property("orientation", orientation),
2060        }
2061    }
2062
2063    // rustdoc-stripper-ignore-next
2064    /// Build the [`FlowBox`].
2065    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
2066    pub fn build(self) -> FlowBox {
2067        assert_initialized_main_thread!();
2068        self.builder.build()
2069    }
2070}