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