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