gtk4/auto/
flow_box.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{
6    ffi, Accessible, AccessibleRole, Adjustment, Align, Buildable, ConstraintTarget, FlowBoxChild,
7    LayoutManager, MovementStep, Orientable, Orientation, Overflow, SelectionMode, Widget,
8};
9use glib::{
10    object::ObjectType as _,
11    prelude::*,
12    signal::{connect_raw, SignalHandlerId},
13    translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18    /// 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            let item = from_glib_borrow(item);
732            let callback = &*(user_data as *mut P);
733            (*callback)(&item).to_glib_full()
734        }
735        let create_widget_func = Some(create_widget_func_func::<P> as _);
736        unsafe extern "C" fn user_data_free_func_func<P: Fn(&glib::Object) -> Widget + 'static>(
737            data: glib::ffi::gpointer,
738        ) {
739            let _callback = Box_::from_raw(data as *mut P);
740        }
741        let destroy_call4 = Some(user_data_free_func_func::<P> as _);
742        let super_callback0: Box_<P> = create_widget_func_data;
743        unsafe {
744            ffi::gtk_flow_box_bind_model(
745                self.to_glib_none().0,
746                model.map(|p| p.as_ref()).to_glib_none().0,
747                create_widget_func,
748                Box_::into_raw(super_callback0) as *mut _,
749                destroy_call4,
750            );
751        }
752    }
753
754    /// Returns whether children activate on single clicks.
755    ///
756    /// # Returns
757    ///
758    /// [`true`] if children are activated on single click,
759    ///   [`false`] otherwise
760    #[doc(alias = "gtk_flow_box_get_activate_on_single_click")]
761    #[doc(alias = "get_activate_on_single_click")]
762    #[doc(alias = "activate-on-single-click")]
763    pub fn activates_on_single_click(&self) -> bool {
764        unsafe {
765            from_glib(ffi::gtk_flow_box_get_activate_on_single_click(
766                self.to_glib_none().0,
767            ))
768        }
769    }
770
771    /// Gets the nth child in the @self.
772    /// ## `idx`
773    /// the position of the child
774    ///
775    /// # Returns
776    ///
777    /// the child widget, which will
778    ///   always be a [`FlowBoxChild`][crate::FlowBoxChild] or [`None`] in case no child widget
779    ///   with the given index exists.
780    #[doc(alias = "gtk_flow_box_get_child_at_index")]
781    #[doc(alias = "get_child_at_index")]
782    pub fn child_at_index(&self, idx: i32) -> Option<FlowBoxChild> {
783        unsafe {
784            from_glib_none(ffi::gtk_flow_box_get_child_at_index(
785                self.to_glib_none().0,
786                idx,
787            ))
788        }
789    }
790
791    /// Gets the child in the (@x, @y) position.
792    ///
793    /// Both @x and @y are assumed to be relative to the origin of @self.
794    /// ## `x`
795    /// the x coordinate of the child
796    /// ## `y`
797    /// the y coordinate of the child
798    ///
799    /// # Returns
800    ///
801    /// the child widget, which will
802    ///   always be a [`FlowBoxChild`][crate::FlowBoxChild] or [`None`] in case no child widget
803    ///   exists for the given x and y coordinates.
804    #[doc(alias = "gtk_flow_box_get_child_at_pos")]
805    #[doc(alias = "get_child_at_pos")]
806    pub fn child_at_pos(&self, x: i32, y: i32) -> Option<FlowBoxChild> {
807        unsafe {
808            from_glib_none(ffi::gtk_flow_box_get_child_at_pos(
809                self.to_glib_none().0,
810                x,
811                y,
812            ))
813        }
814    }
815
816    /// Gets the horizontal spacing.
817    ///
818    /// # Returns
819    ///
820    /// the horizontal spacing
821    #[doc(alias = "gtk_flow_box_get_column_spacing")]
822    #[doc(alias = "get_column_spacing")]
823    #[doc(alias = "column-spacing")]
824    pub fn column_spacing(&self) -> u32 {
825        unsafe { ffi::gtk_flow_box_get_column_spacing(self.to_glib_none().0) }
826    }
827
828    /// Returns whether the box is homogeneous.
829    ///
830    /// # Returns
831    ///
832    /// [`true`] if the box is homogeneous.
833    #[doc(alias = "gtk_flow_box_get_homogeneous")]
834    #[doc(alias = "get_homogeneous")]
835    #[doc(alias = "homogeneous")]
836    pub fn is_homogeneous(&self) -> bool {
837        unsafe { from_glib(ffi::gtk_flow_box_get_homogeneous(self.to_glib_none().0)) }
838    }
839
840    /// Gets the maximum number of children per line.
841    ///
842    /// # Returns
843    ///
844    /// the maximum number of children per line
845    #[doc(alias = "gtk_flow_box_get_max_children_per_line")]
846    #[doc(alias = "get_max_children_per_line")]
847    #[doc(alias = "max-children-per-line")]
848    pub fn max_children_per_line(&self) -> u32 {
849        unsafe { ffi::gtk_flow_box_get_max_children_per_line(self.to_glib_none().0) }
850    }
851
852    /// Gets the minimum number of children per line.
853    ///
854    /// # Returns
855    ///
856    /// the minimum number of children per line
857    #[doc(alias = "gtk_flow_box_get_min_children_per_line")]
858    #[doc(alias = "get_min_children_per_line")]
859    #[doc(alias = "min-children-per-line")]
860    pub fn min_children_per_line(&self) -> u32 {
861        unsafe { ffi::gtk_flow_box_get_min_children_per_line(self.to_glib_none().0) }
862    }
863
864    /// Gets the vertical spacing.
865    ///
866    /// # Returns
867    ///
868    /// the vertical spacing
869    #[doc(alias = "gtk_flow_box_get_row_spacing")]
870    #[doc(alias = "get_row_spacing")]
871    #[doc(alias = "row-spacing")]
872    pub fn row_spacing(&self) -> u32 {
873        unsafe { ffi::gtk_flow_box_get_row_spacing(self.to_glib_none().0) }
874    }
875
876    /// Creates a list of all selected children.
877    ///
878    /// # Returns
879    ///
880    ///
881    ///   A `GList` containing the [`Widget`][crate::Widget] for each selected child.
882    ///   Free with g_list_free() when done.
883    #[doc(alias = "gtk_flow_box_get_selected_children")]
884    #[doc(alias = "get_selected_children")]
885    pub fn selected_children(&self) -> Vec<FlowBoxChild> {
886        unsafe {
887            FromGlibPtrContainer::from_glib_container(ffi::gtk_flow_box_get_selected_children(
888                self.to_glib_none().0,
889            ))
890        }
891    }
892
893    /// Gets the selection mode of @self.
894    ///
895    /// # Returns
896    ///
897    /// the [`SelectionMode`][crate::SelectionMode]
898    #[doc(alias = "gtk_flow_box_get_selection_mode")]
899    #[doc(alias = "get_selection_mode")]
900    #[doc(alias = "selection-mode")]
901    pub fn selection_mode(&self) -> SelectionMode {
902        unsafe { from_glib(ffi::gtk_flow_box_get_selection_mode(self.to_glib_none().0)) }
903    }
904
905    /// Inserts the @widget into @self at @position.
906    ///
907    /// If a sort function is set, the widget will actually be inserted
908    /// at the calculated position.
909    ///
910    /// If @position is -1, or larger than the total number of children
911    /// in the @self, then the @widget will be appended to the end.
912    /// ## `widget`
913    /// the [`Widget`][crate::Widget] to add
914    /// ## `position`
915    /// the position to insert @child in
916    #[doc(alias = "gtk_flow_box_insert")]
917    pub fn insert(&self, widget: &impl IsA<Widget>, position: i32) {
918        unsafe {
919            ffi::gtk_flow_box_insert(
920                self.to_glib_none().0,
921                widget.as_ref().to_glib_none().0,
922                position,
923            );
924        }
925    }
926
927    /// Updates the filtering for all children.
928    ///
929    /// Call this function when the result of the filter
930    /// function on the @self is changed due to an external
931    /// factor. For instance, this would be used if the
932    /// filter function just looked for a specific search
933    /// term, and the entry with the string has changed.
934    #[doc(alias = "gtk_flow_box_invalidate_filter")]
935    pub fn invalidate_filter(&self) {
936        unsafe {
937            ffi::gtk_flow_box_invalidate_filter(self.to_glib_none().0);
938        }
939    }
940
941    /// Updates the sorting for all children.
942    ///
943    /// Call this when the result of the sort function on
944    /// @self is changed due to an external factor.
945    #[doc(alias = "gtk_flow_box_invalidate_sort")]
946    pub fn invalidate_sort(&self) {
947        unsafe {
948            ffi::gtk_flow_box_invalidate_sort(self.to_glib_none().0);
949        }
950    }
951
952    /// Adds @child to the start of @self.
953    ///
954    /// If a sort function is set, the widget will
955    /// actually be inserted at the calculated position.
956    ///
957    /// See also: [`insert()`][Self::insert()].
958    /// ## `child`
959    /// the [`Widget`][crate::Widget] to add
960    #[cfg(feature = "v4_6")]
961    #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
962    #[doc(alias = "gtk_flow_box_prepend")]
963    pub fn prepend(&self, child: &impl IsA<Widget>) {
964        unsafe {
965            ffi::gtk_flow_box_prepend(self.to_glib_none().0, child.as_ref().to_glib_none().0);
966        }
967    }
968
969    /// Removes a child from @self.
970    /// ## `widget`
971    /// the child widget to remove
972    #[doc(alias = "gtk_flow_box_remove")]
973    pub fn remove(&self, widget: &impl IsA<Widget>) {
974        unsafe {
975            ffi::gtk_flow_box_remove(self.to_glib_none().0, widget.as_ref().to_glib_none().0);
976        }
977    }
978
979    /// Removes all children from @self.
980    ///
981    /// This function does nothing if @self is backed by a model.
982    #[cfg(feature = "v4_12")]
983    #[cfg_attr(docsrs, doc(cfg(feature = "v4_12")))]
984    #[doc(alias = "gtk_flow_box_remove_all")]
985    pub fn remove_all(&self) {
986        unsafe {
987            ffi::gtk_flow_box_remove_all(self.to_glib_none().0);
988        }
989    }
990
991    /// Select all children of @self, if the selection
992    /// mode allows it.
993    #[doc(alias = "gtk_flow_box_select_all")]
994    pub fn select_all(&self) {
995        unsafe {
996            ffi::gtk_flow_box_select_all(self.to_glib_none().0);
997        }
998    }
999
1000    /// Selects a single child of @self, if the selection
1001    /// mode allows it.
1002    /// ## `child`
1003    /// a child of @self
1004    #[doc(alias = "gtk_flow_box_select_child")]
1005    pub fn select_child(&self, child: &impl IsA<FlowBoxChild>) {
1006        unsafe {
1007            ffi::gtk_flow_box_select_child(self.to_glib_none().0, child.as_ref().to_glib_none().0);
1008        }
1009    }
1010
1011    /// Calls a function for each selected child.
1012    ///
1013    /// Note that the selection cannot be modified from within
1014    /// this function.
1015    /// ## `func`
1016    /// the function to call for each selected child
1017    #[doc(alias = "gtk_flow_box_selected_foreach")]
1018    pub fn selected_foreach<P: FnMut(&FlowBox, &FlowBoxChild)>(&self, func: P) {
1019        let mut func_data: P = func;
1020        unsafe extern "C" fn func_func<P: FnMut(&FlowBox, &FlowBoxChild)>(
1021            box_: *mut ffi::GtkFlowBox,
1022            child: *mut ffi::GtkFlowBoxChild,
1023            user_data: glib::ffi::gpointer,
1024        ) {
1025            let box_ = from_glib_borrow(box_);
1026            let child = from_glib_borrow(child);
1027            let callback = user_data as *mut P;
1028            (*callback)(&box_, &child)
1029        }
1030        let func = Some(func_func::<P> as _);
1031        let super_callback0: &mut P = &mut func_data;
1032        unsafe {
1033            ffi::gtk_flow_box_selected_foreach(
1034                self.to_glib_none().0,
1035                func,
1036                super_callback0 as *mut _ as *mut _,
1037            );
1038        }
1039    }
1040
1041    /// If @single is [`true`], children will be activated when you click
1042    /// on them, otherwise you need to double-click.
1043    /// ## `single`
1044    /// [`true`] to emit child-activated on a single click
1045    #[doc(alias = "gtk_flow_box_set_activate_on_single_click")]
1046    #[doc(alias = "activate-on-single-click")]
1047    pub fn set_activate_on_single_click(&self, single: bool) {
1048        unsafe {
1049            ffi::gtk_flow_box_set_activate_on_single_click(
1050                self.to_glib_none().0,
1051                single.into_glib(),
1052            );
1053        }
1054    }
1055
1056    /// Sets the horizontal space to add between children.
1057    /// ## `spacing`
1058    /// the spacing to use
1059    #[doc(alias = "gtk_flow_box_set_column_spacing")]
1060    #[doc(alias = "column-spacing")]
1061    pub fn set_column_spacing(&self, spacing: u32) {
1062        unsafe {
1063            ffi::gtk_flow_box_set_column_spacing(self.to_glib_none().0, spacing);
1064        }
1065    }
1066
1067    /// By setting a filter function on the @self one can decide dynamically
1068    /// which of the children to show.
1069    ///
1070    /// For instance, to implement a search function that only shows the
1071    /// children matching the search terms.
1072    ///
1073    /// The @filter_func will be called for each child after the call, and
1074    /// it will continue to be called each time a child changes (via
1075    /// [`FlowBoxChildExt::changed()`][crate::prelude::FlowBoxChildExt::changed()]) or when
1076    /// [`invalidate_filter()`][Self::invalidate_filter()] is called.
1077    ///
1078    /// Note that using a filter function is incompatible with using a model
1079    /// (see [`bind_model()`][Self::bind_model()]).
1080    /// ## `filter_func`
1081    /// callback
1082    ///   that lets you filter which children to show
1083    #[doc(alias = "gtk_flow_box_set_filter_func")]
1084    pub fn set_filter_func<P: Fn(&FlowBoxChild) -> bool + 'static>(&self, filter_func: P) {
1085        let filter_func_data: Box_<P> = Box_::new(filter_func);
1086        unsafe extern "C" fn filter_func_func<P: Fn(&FlowBoxChild) -> bool + 'static>(
1087            child: *mut ffi::GtkFlowBoxChild,
1088            user_data: glib::ffi::gpointer,
1089        ) -> glib::ffi::gboolean {
1090            let child = from_glib_borrow(child);
1091            let callback = &*(user_data as *mut P);
1092            (*callback)(&child).into_glib()
1093        }
1094        let filter_func = Some(filter_func_func::<P> as _);
1095        unsafe extern "C" fn destroy_func<P: Fn(&FlowBoxChild) -> bool + 'static>(
1096            data: glib::ffi::gpointer,
1097        ) {
1098            let _callback = Box_::from_raw(data as *mut P);
1099        }
1100        let destroy_call3 = Some(destroy_func::<P> as _);
1101        let super_callback0: Box_<P> = filter_func_data;
1102        unsafe {
1103            ffi::gtk_flow_box_set_filter_func(
1104                self.to_glib_none().0,
1105                filter_func,
1106                Box_::into_raw(super_callback0) as *mut _,
1107                destroy_call3,
1108            );
1109        }
1110    }
1111
1112    /// Hooks up an adjustment to focus handling in @self.
1113    ///
1114    /// The adjustment is also used for autoscrolling during
1115    /// rubberband selection. See [`ScrolledWindow::hadjustment()`][crate::ScrolledWindow::hadjustment()]
1116    /// for a typical way of obtaining the adjustment, and
1117    /// [`set_vadjustment()`][Self::set_vadjustment()] for setting the vertical
1118    /// adjustment.
1119    ///
1120    /// The adjustments have to be in pixel units and in the same
1121    /// coordinate system as the allocation for immediate children
1122    /// of the box.
1123    /// ## `adjustment`
1124    /// an adjustment which should be adjusted
1125    ///    when the focus is moved among the descendents of @container
1126    #[doc(alias = "gtk_flow_box_set_hadjustment")]
1127    pub fn set_hadjustment(&self, adjustment: &impl IsA<Adjustment>) {
1128        unsafe {
1129            ffi::gtk_flow_box_set_hadjustment(
1130                self.to_glib_none().0,
1131                adjustment.as_ref().to_glib_none().0,
1132            );
1133        }
1134    }
1135
1136    /// Sets whether or not all children of @self are given
1137    /// equal space in the box.
1138    /// ## `homogeneous`
1139    /// [`true`] to create equal allotments,
1140    ///   [`false`] for variable allotments
1141    #[doc(alias = "gtk_flow_box_set_homogeneous")]
1142    #[doc(alias = "homogeneous")]
1143    pub fn set_homogeneous(&self, homogeneous: bool) {
1144        unsafe {
1145            ffi::gtk_flow_box_set_homogeneous(self.to_glib_none().0, homogeneous.into_glib());
1146        }
1147    }
1148
1149    /// Sets the maximum number of children to request and
1150    /// allocate space for in @self’s orientation.
1151    ///
1152    /// Setting the maximum number of children per line
1153    /// limits the overall natural size request to be no more
1154    /// than @n_children children long in the given orientation.
1155    /// ## `n_children`
1156    /// the maximum number of children per line
1157    #[doc(alias = "gtk_flow_box_set_max_children_per_line")]
1158    #[doc(alias = "max-children-per-line")]
1159    pub fn set_max_children_per_line(&self, n_children: u32) {
1160        unsafe {
1161            ffi::gtk_flow_box_set_max_children_per_line(self.to_glib_none().0, n_children);
1162        }
1163    }
1164
1165    /// Sets the minimum number of children to line up
1166    /// in @self’s orientation before flowing.
1167    /// ## `n_children`
1168    /// the minimum number of children per line
1169    #[doc(alias = "gtk_flow_box_set_min_children_per_line")]
1170    #[doc(alias = "min-children-per-line")]
1171    pub fn set_min_children_per_line(&self, n_children: u32) {
1172        unsafe {
1173            ffi::gtk_flow_box_set_min_children_per_line(self.to_glib_none().0, n_children);
1174        }
1175    }
1176
1177    /// Sets the vertical space to add between children.
1178    /// ## `spacing`
1179    /// the spacing to use
1180    #[doc(alias = "gtk_flow_box_set_row_spacing")]
1181    #[doc(alias = "row-spacing")]
1182    pub fn set_row_spacing(&self, spacing: u32) {
1183        unsafe {
1184            ffi::gtk_flow_box_set_row_spacing(self.to_glib_none().0, spacing);
1185        }
1186    }
1187
1188    /// Sets how selection works in @self.
1189    /// ## `mode`
1190    /// the new selection mode
1191    #[doc(alias = "gtk_flow_box_set_selection_mode")]
1192    #[doc(alias = "selection-mode")]
1193    pub fn set_selection_mode(&self, mode: SelectionMode) {
1194        unsafe {
1195            ffi::gtk_flow_box_set_selection_mode(self.to_glib_none().0, mode.into_glib());
1196        }
1197    }
1198
1199    /// Hooks up an adjustment to focus handling in @self.
1200    ///
1201    /// The adjustment is also used for autoscrolling during
1202    /// rubberband selection. See [`ScrolledWindow::vadjustment()`][crate::ScrolledWindow::vadjustment()]
1203    /// for a typical way of obtaining the adjustment, and
1204    /// [`set_hadjustment()`][Self::set_hadjustment()] for setting the horizontal
1205    /// adjustment.
1206    ///
1207    /// The adjustments have to be in pixel units and in the same
1208    /// coordinate system as the allocation for immediate children
1209    /// of the box.
1210    /// ## `adjustment`
1211    /// an adjustment which should be adjusted
1212    ///    when the focus is moved among the descendents of @container
1213    #[doc(alias = "gtk_flow_box_set_vadjustment")]
1214    pub fn set_vadjustment(&self, adjustment: &impl IsA<Adjustment>) {
1215        unsafe {
1216            ffi::gtk_flow_box_set_vadjustment(
1217                self.to_glib_none().0,
1218                adjustment.as_ref().to_glib_none().0,
1219            );
1220        }
1221    }
1222
1223    /// Unselect all children of @self, if the selection
1224    /// mode allows it.
1225    #[doc(alias = "gtk_flow_box_unselect_all")]
1226    pub fn unselect_all(&self) {
1227        unsafe {
1228            ffi::gtk_flow_box_unselect_all(self.to_glib_none().0);
1229        }
1230    }
1231
1232    /// Unselects a single child of @self, if the selection
1233    /// mode allows it.
1234    /// ## `child`
1235    /// a child of @self
1236    #[doc(alias = "gtk_flow_box_unselect_child")]
1237    pub fn unselect_child(&self, child: &impl IsA<FlowBoxChild>) {
1238        unsafe {
1239            ffi::gtk_flow_box_unselect_child(
1240                self.to_glib_none().0,
1241                child.as_ref().to_glib_none().0,
1242            );
1243        }
1244    }
1245
1246    /// Whether to accept unpaired release events.
1247    #[doc(alias = "accept-unpaired-release")]
1248    pub fn accepts_unpaired_release(&self) -> bool {
1249        ObjectExt::property(self, "accept-unpaired-release")
1250    }
1251
1252    /// Whether to accept unpaired release events.
1253    #[doc(alias = "accept-unpaired-release")]
1254    pub fn set_accept_unpaired_release(&self, accept_unpaired_release: bool) {
1255        ObjectExt::set_property(self, "accept-unpaired-release", accept_unpaired_release)
1256    }
1257
1258    /// Emitted when the user activates the @box_.
1259    ///
1260    /// This is a [keybinding signal](class.SignalAction.html).
1261    #[doc(alias = "activate-cursor-child")]
1262    pub fn connect_activate_cursor_child<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1263        unsafe extern "C" fn activate_cursor_child_trampoline<F: Fn(&FlowBox) + 'static>(
1264            this: *mut ffi::GtkFlowBox,
1265            f: glib::ffi::gpointer,
1266        ) {
1267            let f: &F = &*(f as *const F);
1268            f(&from_glib_borrow(this))
1269        }
1270        unsafe {
1271            let f: Box_<F> = Box_::new(f);
1272            connect_raw(
1273                self.as_ptr() as *mut _,
1274                c"activate-cursor-child".as_ptr() as *const _,
1275                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1276                    activate_cursor_child_trampoline::<F> as *const (),
1277                )),
1278                Box_::into_raw(f),
1279            )
1280        }
1281    }
1282
1283    pub fn emit_activate_cursor_child(&self) {
1284        self.emit_by_name::<()>("activate-cursor-child", &[]);
1285    }
1286
1287    /// Emitted when a child has been activated by the user.
1288    /// ## `child`
1289    /// the child that is activated
1290    #[doc(alias = "child-activated")]
1291    pub fn connect_child_activated<F: Fn(&Self, &FlowBoxChild) + 'static>(
1292        &self,
1293        f: F,
1294    ) -> SignalHandlerId {
1295        unsafe extern "C" fn child_activated_trampoline<
1296            F: Fn(&FlowBox, &FlowBoxChild) + 'static,
1297        >(
1298            this: *mut ffi::GtkFlowBox,
1299            child: *mut ffi::GtkFlowBoxChild,
1300            f: glib::ffi::gpointer,
1301        ) {
1302            let f: &F = &*(f as *const F);
1303            f(&from_glib_borrow(this), &from_glib_borrow(child))
1304        }
1305        unsafe {
1306            let f: Box_<F> = Box_::new(f);
1307            connect_raw(
1308                self.as_ptr() as *mut _,
1309                c"child-activated".as_ptr() as *const _,
1310                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1311                    child_activated_trampoline::<F> as *const (),
1312                )),
1313                Box_::into_raw(f),
1314            )
1315        }
1316    }
1317
1318    /// Emitted when the user initiates a cursor movement.
1319    ///
1320    /// This is a [keybinding signal](class.SignalAction.html).
1321    /// Applications should not connect to it, but may emit it with
1322    /// g_signal_emit_by_name() if they need to control the cursor
1323    /// programmatically.
1324    ///
1325    /// The default bindings for this signal come in two variants,
1326    /// the variant with the Shift modifier extends the selection,
1327    /// the variant without the Shift modifier does not.
1328    /// There are too many key combinations to list them all here.
1329    ///
1330    /// - <kbd>←</kbd>, <kbd>→</kbd>, <kbd>↑</kbd>, <kbd>↓</kbd>
1331    ///   move by individual children
1332    /// - <kbd>Home</kbd>, <kbd>End</kbd> move to the ends of the box
1333    /// - <kbd>PgUp</kbd>, <kbd>PgDn</kbd> move vertically by pages
1334    /// ## `step`
1335    /// the granularity of the move, as a [`MovementStep`][crate::MovementStep]
1336    /// ## `count`
1337    /// the number of @step units to move
1338    /// ## `extend`
1339    /// whether to extend the selection
1340    /// ## `modify`
1341    /// whether to modify the selection
1342    ///
1343    /// # Returns
1344    ///
1345    /// [`true`] to stop other handlers from being invoked for the event.
1346    ///   [`false`] to propagate the event further.
1347    #[doc(alias = "move-cursor")]
1348    pub fn connect_move_cursor<F: Fn(&Self, MovementStep, i32, bool, bool) -> bool + 'static>(
1349        &self,
1350        f: F,
1351    ) -> SignalHandlerId {
1352        unsafe extern "C" fn move_cursor_trampoline<
1353            F: Fn(&FlowBox, MovementStep, i32, bool, bool) -> bool + 'static,
1354        >(
1355            this: *mut ffi::GtkFlowBox,
1356            step: ffi::GtkMovementStep,
1357            count: std::ffi::c_int,
1358            extend: glib::ffi::gboolean,
1359            modify: glib::ffi::gboolean,
1360            f: glib::ffi::gpointer,
1361        ) -> glib::ffi::gboolean {
1362            let f: &F = &*(f as *const F);
1363            f(
1364                &from_glib_borrow(this),
1365                from_glib(step),
1366                count,
1367                from_glib(extend),
1368                from_glib(modify),
1369            )
1370            .into_glib()
1371        }
1372        unsafe {
1373            let f: Box_<F> = Box_::new(f);
1374            connect_raw(
1375                self.as_ptr() as *mut _,
1376                c"move-cursor".as_ptr() as *const _,
1377                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1378                    move_cursor_trampoline::<F> as *const (),
1379                )),
1380                Box_::into_raw(f),
1381            )
1382        }
1383    }
1384
1385    pub fn emit_move_cursor(
1386        &self,
1387        step: MovementStep,
1388        count: i32,
1389        extend: bool,
1390        modify: bool,
1391    ) -> bool {
1392        self.emit_by_name("move-cursor", &[&step, &count, &extend, &modify])
1393    }
1394
1395    /// Emitted to select all children of the box,
1396    /// if the selection mode permits it.
1397    ///
1398    /// This is a [keybinding signal](class.SignalAction.html).
1399    ///
1400    /// The default bindings for this signal is <kbd>Ctrl</kbd>-<kbd>a</kbd>.
1401    #[doc(alias = "select-all")]
1402    pub fn connect_select_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1403        unsafe extern "C" fn select_all_trampoline<F: Fn(&FlowBox) + 'static>(
1404            this: *mut ffi::GtkFlowBox,
1405            f: glib::ffi::gpointer,
1406        ) {
1407            let f: &F = &*(f as *const F);
1408            f(&from_glib_borrow(this))
1409        }
1410        unsafe {
1411            let f: Box_<F> = Box_::new(f);
1412            connect_raw(
1413                self.as_ptr() as *mut _,
1414                c"select-all".as_ptr() as *const _,
1415                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1416                    select_all_trampoline::<F> as *const (),
1417                )),
1418                Box_::into_raw(f),
1419            )
1420        }
1421    }
1422
1423    pub fn emit_select_all(&self) {
1424        self.emit_by_name::<()>("select-all", &[]);
1425    }
1426
1427    /// Emitted when the set of selected children changes.
1428    ///
1429    /// Use [`selected_foreach()`][Self::selected_foreach()] or
1430    /// [`selected_children()`][Self::selected_children()] to obtain the
1431    /// selected children.
1432    #[doc(alias = "selected-children-changed")]
1433    pub fn connect_selected_children_changed<F: Fn(&Self) + 'static>(
1434        &self,
1435        f: F,
1436    ) -> SignalHandlerId {
1437        unsafe extern "C" fn selected_children_changed_trampoline<F: Fn(&FlowBox) + 'static>(
1438            this: *mut ffi::GtkFlowBox,
1439            f: glib::ffi::gpointer,
1440        ) {
1441            let f: &F = &*(f as *const F);
1442            f(&from_glib_borrow(this))
1443        }
1444        unsafe {
1445            let f: Box_<F> = Box_::new(f);
1446            connect_raw(
1447                self.as_ptr() as *mut _,
1448                c"selected-children-changed".as_ptr() as *const _,
1449                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1450                    selected_children_changed_trampoline::<F> as *const (),
1451                )),
1452                Box_::into_raw(f),
1453            )
1454        }
1455    }
1456
1457    /// Emitted to toggle the selection of the child that has the focus.
1458    ///
1459    /// This is a [keybinding signal](class.SignalAction.html).
1460    ///
1461    /// The default binding for this signal is <kbd>Ctrl</kbd>-<kbd>Space</kbd>.
1462    #[doc(alias = "toggle-cursor-child")]
1463    pub fn connect_toggle_cursor_child<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1464        unsafe extern "C" fn toggle_cursor_child_trampoline<F: Fn(&FlowBox) + 'static>(
1465            this: *mut ffi::GtkFlowBox,
1466            f: glib::ffi::gpointer,
1467        ) {
1468            let f: &F = &*(f as *const F);
1469            f(&from_glib_borrow(this))
1470        }
1471        unsafe {
1472            let f: Box_<F> = Box_::new(f);
1473            connect_raw(
1474                self.as_ptr() as *mut _,
1475                c"toggle-cursor-child".as_ptr() as *const _,
1476                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1477                    toggle_cursor_child_trampoline::<F> as *const (),
1478                )),
1479                Box_::into_raw(f),
1480            )
1481        }
1482    }
1483
1484    pub fn emit_toggle_cursor_child(&self) {
1485        self.emit_by_name::<()>("toggle-cursor-child", &[]);
1486    }
1487
1488    /// Emitted to unselect all children of the box,
1489    /// if the selection mode permits it.
1490    ///
1491    /// This is a [keybinding signal](class.SignalAction.html).
1492    ///
1493    /// The default bindings for this signal is <kbd>Ctrl</kbd>-<kbd>Shift</kbd>-<kbd>a</kbd>.
1494    #[doc(alias = "unselect-all")]
1495    pub fn connect_unselect_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1496        unsafe extern "C" fn unselect_all_trampoline<F: Fn(&FlowBox) + 'static>(
1497            this: *mut ffi::GtkFlowBox,
1498            f: glib::ffi::gpointer,
1499        ) {
1500            let f: &F = &*(f as *const F);
1501            f(&from_glib_borrow(this))
1502        }
1503        unsafe {
1504            let f: Box_<F> = Box_::new(f);
1505            connect_raw(
1506                self.as_ptr() as *mut _,
1507                c"unselect-all".as_ptr() as *const _,
1508                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1509                    unselect_all_trampoline::<F> as *const (),
1510                )),
1511                Box_::into_raw(f),
1512            )
1513        }
1514    }
1515
1516    pub fn emit_unselect_all(&self) {
1517        self.emit_by_name::<()>("unselect-all", &[]);
1518    }
1519
1520    #[doc(alias = "accept-unpaired-release")]
1521    pub fn connect_accept_unpaired_release_notify<F: Fn(&Self) + 'static>(
1522        &self,
1523        f: F,
1524    ) -> SignalHandlerId {
1525        unsafe extern "C" fn notify_accept_unpaired_release_trampoline<
1526            F: Fn(&FlowBox) + 'static,
1527        >(
1528            this: *mut ffi::GtkFlowBox,
1529            _param_spec: glib::ffi::gpointer,
1530            f: glib::ffi::gpointer,
1531        ) {
1532            let f: &F = &*(f as *const F);
1533            f(&from_glib_borrow(this))
1534        }
1535        unsafe {
1536            let f: Box_<F> = Box_::new(f);
1537            connect_raw(
1538                self.as_ptr() as *mut _,
1539                c"notify::accept-unpaired-release".as_ptr() as *const _,
1540                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1541                    notify_accept_unpaired_release_trampoline::<F> as *const (),
1542                )),
1543                Box_::into_raw(f),
1544            )
1545        }
1546    }
1547
1548    #[doc(alias = "activate-on-single-click")]
1549    pub fn connect_activate_on_single_click_notify<F: Fn(&Self) + 'static>(
1550        &self,
1551        f: F,
1552    ) -> SignalHandlerId {
1553        unsafe extern "C" fn notify_activate_on_single_click_trampoline<
1554            F: Fn(&FlowBox) + 'static,
1555        >(
1556            this: *mut ffi::GtkFlowBox,
1557            _param_spec: glib::ffi::gpointer,
1558            f: glib::ffi::gpointer,
1559        ) {
1560            let f: &F = &*(f as *const F);
1561            f(&from_glib_borrow(this))
1562        }
1563        unsafe {
1564            let f: Box_<F> = Box_::new(f);
1565            connect_raw(
1566                self.as_ptr() as *mut _,
1567                c"notify::activate-on-single-click".as_ptr() as *const _,
1568                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1569                    notify_activate_on_single_click_trampoline::<F> as *const (),
1570                )),
1571                Box_::into_raw(f),
1572            )
1573        }
1574    }
1575
1576    #[doc(alias = "column-spacing")]
1577    pub fn connect_column_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1578        unsafe extern "C" fn notify_column_spacing_trampoline<F: Fn(&FlowBox) + 'static>(
1579            this: *mut ffi::GtkFlowBox,
1580            _param_spec: glib::ffi::gpointer,
1581            f: glib::ffi::gpointer,
1582        ) {
1583            let f: &F = &*(f as *const F);
1584            f(&from_glib_borrow(this))
1585        }
1586        unsafe {
1587            let f: Box_<F> = Box_::new(f);
1588            connect_raw(
1589                self.as_ptr() as *mut _,
1590                c"notify::column-spacing".as_ptr() as *const _,
1591                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1592                    notify_column_spacing_trampoline::<F> as *const (),
1593                )),
1594                Box_::into_raw(f),
1595            )
1596        }
1597    }
1598
1599    #[doc(alias = "homogeneous")]
1600    pub fn connect_homogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1601        unsafe extern "C" fn notify_homogeneous_trampoline<F: Fn(&FlowBox) + 'static>(
1602            this: *mut ffi::GtkFlowBox,
1603            _param_spec: glib::ffi::gpointer,
1604            f: glib::ffi::gpointer,
1605        ) {
1606            let f: &F = &*(f as *const F);
1607            f(&from_glib_borrow(this))
1608        }
1609        unsafe {
1610            let f: Box_<F> = Box_::new(f);
1611            connect_raw(
1612                self.as_ptr() as *mut _,
1613                c"notify::homogeneous".as_ptr() as *const _,
1614                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1615                    notify_homogeneous_trampoline::<F> as *const (),
1616                )),
1617                Box_::into_raw(f),
1618            )
1619        }
1620    }
1621
1622    #[doc(alias = "max-children-per-line")]
1623    pub fn connect_max_children_per_line_notify<F: Fn(&Self) + 'static>(
1624        &self,
1625        f: F,
1626    ) -> SignalHandlerId {
1627        unsafe extern "C" fn notify_max_children_per_line_trampoline<F: Fn(&FlowBox) + 'static>(
1628            this: *mut ffi::GtkFlowBox,
1629            _param_spec: glib::ffi::gpointer,
1630            f: glib::ffi::gpointer,
1631        ) {
1632            let f: &F = &*(f as *const F);
1633            f(&from_glib_borrow(this))
1634        }
1635        unsafe {
1636            let f: Box_<F> = Box_::new(f);
1637            connect_raw(
1638                self.as_ptr() as *mut _,
1639                c"notify::max-children-per-line".as_ptr() as *const _,
1640                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1641                    notify_max_children_per_line_trampoline::<F> as *const (),
1642                )),
1643                Box_::into_raw(f),
1644            )
1645        }
1646    }
1647
1648    #[doc(alias = "min-children-per-line")]
1649    pub fn connect_min_children_per_line_notify<F: Fn(&Self) + 'static>(
1650        &self,
1651        f: F,
1652    ) -> SignalHandlerId {
1653        unsafe extern "C" fn notify_min_children_per_line_trampoline<F: Fn(&FlowBox) + 'static>(
1654            this: *mut ffi::GtkFlowBox,
1655            _param_spec: glib::ffi::gpointer,
1656            f: glib::ffi::gpointer,
1657        ) {
1658            let f: &F = &*(f as *const F);
1659            f(&from_glib_borrow(this))
1660        }
1661        unsafe {
1662            let f: Box_<F> = Box_::new(f);
1663            connect_raw(
1664                self.as_ptr() as *mut _,
1665                c"notify::min-children-per-line".as_ptr() as *const _,
1666                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1667                    notify_min_children_per_line_trampoline::<F> as *const (),
1668                )),
1669                Box_::into_raw(f),
1670            )
1671        }
1672    }
1673
1674    #[doc(alias = "row-spacing")]
1675    pub fn connect_row_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1676        unsafe extern "C" fn notify_row_spacing_trampoline<F: Fn(&FlowBox) + 'static>(
1677            this: *mut ffi::GtkFlowBox,
1678            _param_spec: glib::ffi::gpointer,
1679            f: glib::ffi::gpointer,
1680        ) {
1681            let f: &F = &*(f as *const F);
1682            f(&from_glib_borrow(this))
1683        }
1684        unsafe {
1685            let f: Box_<F> = Box_::new(f);
1686            connect_raw(
1687                self.as_ptr() as *mut _,
1688                c"notify::row-spacing".as_ptr() as *const _,
1689                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1690                    notify_row_spacing_trampoline::<F> as *const (),
1691                )),
1692                Box_::into_raw(f),
1693            )
1694        }
1695    }
1696
1697    #[doc(alias = "selection-mode")]
1698    pub fn connect_selection_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1699        unsafe extern "C" fn notify_selection_mode_trampoline<F: Fn(&FlowBox) + 'static>(
1700            this: *mut ffi::GtkFlowBox,
1701            _param_spec: glib::ffi::gpointer,
1702            f: glib::ffi::gpointer,
1703        ) {
1704            let f: &F = &*(f as *const F);
1705            f(&from_glib_borrow(this))
1706        }
1707        unsafe {
1708            let f: Box_<F> = Box_::new(f);
1709            connect_raw(
1710                self.as_ptr() as *mut _,
1711                c"notify::selection-mode".as_ptr() as *const _,
1712                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1713                    notify_selection_mode_trampoline::<F> as *const (),
1714                )),
1715                Box_::into_raw(f),
1716            )
1717        }
1718    }
1719}
1720
1721impl Default for FlowBox {
1722    fn default() -> Self {
1723        Self::new()
1724    }
1725}
1726
1727// rustdoc-stripper-ignore-next
1728/// A [builder-pattern] type to construct [`FlowBox`] objects.
1729///
1730/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1731#[must_use = "The builder must be built to be used"]
1732pub struct FlowBoxBuilder {
1733    builder: glib::object::ObjectBuilder<'static, FlowBox>,
1734}
1735
1736impl FlowBoxBuilder {
1737    fn new() -> Self {
1738        Self {
1739            builder: glib::object::Object::builder(),
1740        }
1741    }
1742
1743    /// Whether to accept unpaired release events.
1744    pub fn accept_unpaired_release(self, accept_unpaired_release: bool) -> Self {
1745        Self {
1746            builder: self
1747                .builder
1748                .property("accept-unpaired-release", accept_unpaired_release),
1749        }
1750    }
1751
1752    /// Determines whether children can be activated with a single
1753    /// click, or require a double-click.
1754    pub fn activate_on_single_click(self, activate_on_single_click: bool) -> Self {
1755        Self {
1756            builder: self
1757                .builder
1758                .property("activate-on-single-click", activate_on_single_click),
1759        }
1760    }
1761
1762    /// The amount of horizontal space between two children.
1763    pub fn column_spacing(self, column_spacing: u32) -> Self {
1764        Self {
1765            builder: self.builder.property("column-spacing", column_spacing),
1766        }
1767    }
1768
1769    /// Determines whether all children should be allocated the
1770    /// same size.
1771    pub fn homogeneous(self, homogeneous: bool) -> Self {
1772        Self {
1773            builder: self.builder.property("homogeneous", homogeneous),
1774        }
1775    }
1776
1777    /// The maximum amount of children to request space for consecutively
1778    /// in the given orientation.
1779    pub fn max_children_per_line(self, max_children_per_line: u32) -> Self {
1780        Self {
1781            builder: self
1782                .builder
1783                .property("max-children-per-line", max_children_per_line),
1784        }
1785    }
1786
1787    /// The minimum number of children to allocate consecutively
1788    /// in the given orientation.
1789    ///
1790    /// Setting the minimum children per line ensures
1791    /// that a reasonably small height will be requested
1792    /// for the overall minimum width of the box.
1793    pub fn min_children_per_line(self, min_children_per_line: u32) -> Self {
1794        Self {
1795            builder: self
1796                .builder
1797                .property("min-children-per-line", min_children_per_line),
1798        }
1799    }
1800
1801    /// The amount of vertical space between two children.
1802    pub fn row_spacing(self, row_spacing: u32) -> Self {
1803        Self {
1804            builder: self.builder.property("row-spacing", row_spacing),
1805        }
1806    }
1807
1808    /// The selection mode used by the flow box.
1809    pub fn selection_mode(self, selection_mode: SelectionMode) -> Self {
1810        Self {
1811            builder: self.builder.property("selection-mode", selection_mode),
1812        }
1813    }
1814
1815    /// Whether the widget or any of its descendents can accept
1816    /// the input focus.
1817    ///
1818    /// This property is meant to be set by widget implementations,
1819    /// typically in their instance init function.
1820    pub fn can_focus(self, can_focus: bool) -> Self {
1821        Self {
1822            builder: self.builder.property("can-focus", can_focus),
1823        }
1824    }
1825
1826    /// Whether the widget can receive pointer events.
1827    pub fn can_target(self, can_target: bool) -> Self {
1828        Self {
1829            builder: self.builder.property("can-target", can_target),
1830        }
1831    }
1832
1833    /// A list of css classes applied to this widget.
1834    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1835        Self {
1836            builder: self.builder.property("css-classes", css_classes.into()),
1837        }
1838    }
1839
1840    /// The name of this widget in the CSS tree.
1841    ///
1842    /// This property is meant to be set by widget implementations,
1843    /// typically in their instance init function.
1844    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1845        Self {
1846            builder: self.builder.property("css-name", css_name.into()),
1847        }
1848    }
1849
1850    /// The cursor used by @widget.
1851    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1852        Self {
1853            builder: self.builder.property("cursor", cursor.clone()),
1854        }
1855    }
1856
1857    /// Whether the widget should grab focus when it is clicked with the mouse.
1858    ///
1859    /// This property is only relevant for widgets that can take focus.
1860    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1861        Self {
1862            builder: self.builder.property("focus-on-click", focus_on_click),
1863        }
1864    }
1865
1866    /// Whether this widget itself will accept the input focus.
1867    pub fn focusable(self, focusable: bool) -> Self {
1868        Self {
1869            builder: self.builder.property("focusable", focusable),
1870        }
1871    }
1872
1873    /// How to distribute horizontal space if widget gets extra space.
1874    pub fn halign(self, halign: Align) -> Self {
1875        Self {
1876            builder: self.builder.property("halign", halign),
1877        }
1878    }
1879
1880    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1881    /// signal on @widget.
1882    ///
1883    /// A true value indicates that @widget can have a tooltip, in this case
1884    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1885    /// determine whether it will provide a tooltip or not.
1886    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1887        Self {
1888            builder: self.builder.property("has-tooltip", has_tooltip),
1889        }
1890    }
1891
1892    /// Overrides for height request of the widget.
1893    ///
1894    /// If this is -1, the natural request will be used.
1895    pub fn height_request(self, height_request: i32) -> Self {
1896        Self {
1897            builder: self.builder.property("height-request", height_request),
1898        }
1899    }
1900
1901    /// Whether to expand horizontally.
1902    pub fn hexpand(self, hexpand: bool) -> Self {
1903        Self {
1904            builder: self.builder.property("hexpand", hexpand),
1905        }
1906    }
1907
1908    /// Whether to use the `hexpand` property.
1909    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1910        Self {
1911            builder: self.builder.property("hexpand-set", hexpand_set),
1912        }
1913    }
1914
1915    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1916    /// the preferred size of the widget, and allocate its children.
1917    ///
1918    /// This property is meant to be set by widget implementations,
1919    /// typically in their instance init function.
1920    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1921        Self {
1922            builder: self
1923                .builder
1924                .property("layout-manager", layout_manager.clone().upcast()),
1925        }
1926    }
1927
1928    /// Makes this widget act like a modal dialog, with respect to
1929    /// event delivery.
1930    ///
1931    /// Global event controllers will not handle events with targets
1932    /// inside the widget, unless they are set up to ignore propagation
1933    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1934    #[cfg(feature = "v4_18")]
1935    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1936    pub fn limit_events(self, limit_events: bool) -> Self {
1937        Self {
1938            builder: self.builder.property("limit-events", limit_events),
1939        }
1940    }
1941
1942    /// Margin on bottom side of widget.
1943    ///
1944    /// This property adds margin outside of the widget's normal size
1945    /// request, the margin will be added in addition to the size from
1946    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1947    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1948        Self {
1949            builder: self.builder.property("margin-bottom", margin_bottom),
1950        }
1951    }
1952
1953    /// Margin on end of widget, horizontally.
1954    ///
1955    /// This property supports left-to-right and right-to-left text
1956    /// directions.
1957    ///
1958    /// This property adds margin outside of the widget's normal size
1959    /// request, the margin will be added in addition to the size from
1960    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1961    pub fn margin_end(self, margin_end: i32) -> Self {
1962        Self {
1963            builder: self.builder.property("margin-end", margin_end),
1964        }
1965    }
1966
1967    /// Margin on start of widget, horizontally.
1968    ///
1969    /// This property supports left-to-right and right-to-left text
1970    /// directions.
1971    ///
1972    /// This property adds margin outside of the widget's normal size
1973    /// request, the margin will be added in addition to the size from
1974    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1975    pub fn margin_start(self, margin_start: i32) -> Self {
1976        Self {
1977            builder: self.builder.property("margin-start", margin_start),
1978        }
1979    }
1980
1981    /// Margin on top side of widget.
1982    ///
1983    /// This property adds margin outside of the widget's normal size
1984    /// request, the margin will be added in addition to the size from
1985    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1986    pub fn margin_top(self, margin_top: i32) -> Self {
1987        Self {
1988            builder: self.builder.property("margin-top", margin_top),
1989        }
1990    }
1991
1992    /// The name of the widget.
1993    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1994        Self {
1995            builder: self.builder.property("name", name.into()),
1996        }
1997    }
1998
1999    /// The requested opacity of the widget.
2000    pub fn opacity(self, opacity: f64) -> Self {
2001        Self {
2002            builder: self.builder.property("opacity", opacity),
2003        }
2004    }
2005
2006    /// How content outside the widget's content area is treated.
2007    ///
2008    /// This property is meant to be set by widget implementations,
2009    /// typically in their instance init function.
2010    pub fn overflow(self, overflow: Overflow) -> Self {
2011        Self {
2012            builder: self.builder.property("overflow", overflow),
2013        }
2014    }
2015
2016    /// Whether the widget will receive the default action when it is focused.
2017    pub fn receives_default(self, receives_default: bool) -> Self {
2018        Self {
2019            builder: self.builder.property("receives-default", receives_default),
2020        }
2021    }
2022
2023    /// Whether the widget responds to input.
2024    pub fn sensitive(self, sensitive: bool) -> Self {
2025        Self {
2026            builder: self.builder.property("sensitive", sensitive),
2027        }
2028    }
2029
2030    /// Sets the text of tooltip to be the given string, which is marked up
2031    /// with Pango markup.
2032    ///
2033    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
2034    ///
2035    /// This is a convenience property which will take care of getting the
2036    /// tooltip shown if the given string is not `NULL`:
2037    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
2038    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
2039    /// the default signal handler.
2040    ///
2041    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
2042    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
2043    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
2044        Self {
2045            builder: self
2046                .builder
2047                .property("tooltip-markup", tooltip_markup.into()),
2048        }
2049    }
2050
2051    /// Sets the text of tooltip to be the given string.
2052    ///
2053    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
2054    ///
2055    /// This is a convenience property which will take care of getting the
2056    /// tooltip shown if the given string is not `NULL`:
2057    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
2058    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
2059    /// the default signal handler.
2060    ///
2061    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
2062    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
2063    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
2064        Self {
2065            builder: self.builder.property("tooltip-text", tooltip_text.into()),
2066        }
2067    }
2068
2069    /// How to distribute vertical space if widget gets extra space.
2070    pub fn valign(self, valign: Align) -> Self {
2071        Self {
2072            builder: self.builder.property("valign", valign),
2073        }
2074    }
2075
2076    /// Whether to expand vertically.
2077    pub fn vexpand(self, vexpand: bool) -> Self {
2078        Self {
2079            builder: self.builder.property("vexpand", vexpand),
2080        }
2081    }
2082
2083    /// Whether to use the `vexpand` property.
2084    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
2085        Self {
2086            builder: self.builder.property("vexpand-set", vexpand_set),
2087        }
2088    }
2089
2090    /// Whether the widget is visible.
2091    pub fn visible(self, visible: bool) -> Self {
2092        Self {
2093            builder: self.builder.property("visible", visible),
2094        }
2095    }
2096
2097    /// Overrides for width request of the widget.
2098    ///
2099    /// If this is -1, the natural request will be used.
2100    pub fn width_request(self, width_request: i32) -> Self {
2101        Self {
2102            builder: self.builder.property("width-request", width_request),
2103        }
2104    }
2105
2106    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
2107    ///
2108    /// The accessible role cannot be changed once set.
2109    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
2110        Self {
2111            builder: self.builder.property("accessible-role", accessible_role),
2112        }
2113    }
2114
2115    /// The orientation of the orientable.
2116    pub fn orientation(self, orientation: Orientation) -> Self {
2117        Self {
2118            builder: self.builder.property("orientation", orientation),
2119        }
2120    }
2121
2122    // rustdoc-stripper-ignore-next
2123    /// Build the [`FlowBox`].
2124    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
2125    pub fn build(self) -> FlowBox {
2126        assert_initialized_main_thread!();
2127        self.builder.build()
2128    }
2129}