Skip to main content

gtk4/auto/
flow_box.rs

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