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