gtk/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 Adjustment, Align, Buildable, Container, FlowBoxChild, MovementStep, Orientable, Orientation,
7 ResizeMode, SelectionMode, Widget, ffi,
8};
9use glib::{
10 object::ObjectType as _,
11 prelude::*,
12 signal::{SignalHandlerId, connect_raw},
13 translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18 ///
19 /// ┊
20 /// ╰── [rubberband]
21 /// ]|
22 ///
23 /// GtkFlowBox uses a single CSS node with name flowbox. GtkFlowBoxChild
24 /// uses a single CSS node with name flowboxchild.
25 /// For rubberband selection, a subnode with name rubberband is used.
26 ///
27 /// ## Properties
28 ///
29 ///
30 /// #### `activate-on-single-click`
31 /// Determines whether children can be activated with a single
32 /// click, or require a double-click.
33 ///
34 /// Readable | Writable
35 ///
36 ///
37 /// #### `column-spacing`
38 /// The amount of horizontal space between two children.
39 ///
40 /// Readable | Writable
41 ///
42 ///
43 /// #### `homogeneous`
44 /// Determines whether all children should be allocated the
45 /// same size.
46 ///
47 /// Readable | Writable
48 ///
49 ///
50 /// #### `max-children-per-line`
51 /// The maximum amount of children to request space for consecutively
52 /// in the given orientation.
53 ///
54 /// Readable | Writable
55 ///
56 ///
57 /// #### `min-children-per-line`
58 /// The minimum number of children to allocate consecutively
59 /// in the given orientation.
60 ///
61 /// Setting the minimum children per line ensures
62 /// that a reasonably small height will be requested
63 /// for the overall minimum width of the box.
64 ///
65 /// Readable | Writable
66 ///
67 ///
68 /// #### `row-spacing`
69 /// The amount of vertical space between two children.
70 ///
71 /// Readable | Writable
72 ///
73 ///
74 /// #### `selection-mode`
75 /// The selection mode used by the flow box.
76 ///
77 /// Readable | Writable
78 /// <details><summary><h4>Container</h4></summary>
79 ///
80 ///
81 /// #### `border-width`
82 /// Readable | Writable
83 ///
84 ///
85 /// #### `child`
86 /// Writable
87 ///
88 ///
89 /// #### `resize-mode`
90 /// Readable | Writable
91 /// </details>
92 /// <details><summary><h4>Widget</h4></summary>
93 ///
94 ///
95 /// #### `app-paintable`
96 /// Readable | Writable
97 ///
98 ///
99 /// #### `can-default`
100 /// Readable | Writable
101 ///
102 ///
103 /// #### `can-focus`
104 /// Readable | Writable
105 ///
106 ///
107 /// #### `composite-child`
108 /// Readable
109 ///
110 ///
111 /// #### `double-buffered`
112 /// Whether the widget is double buffered.
113 ///
114 /// Readable | Writable
115 ///
116 ///
117 /// #### `events`
118 /// Readable | Writable
119 ///
120 ///
121 /// #### `expand`
122 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
123 ///
124 /// Readable | Writable
125 ///
126 ///
127 /// #### `focus-on-click`
128 /// Whether the widget should grab focus when it is clicked with the mouse.
129 ///
130 /// This property is only relevant for widgets that can take focus.
131 ///
132 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
133 /// GtkComboBox) implemented this property individually.
134 ///
135 /// Readable | Writable
136 ///
137 ///
138 /// #### `halign`
139 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
140 ///
141 /// Readable | Writable
142 ///
143 ///
144 /// #### `has-default`
145 /// Readable | Writable
146 ///
147 ///
148 /// #### `has-focus`
149 /// Readable | Writable
150 ///
151 ///
152 /// #### `has-tooltip`
153 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
154 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
155 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
156 /// whether it will provide a tooltip or not.
157 ///
158 /// Note that setting this property to [`true`] for the first time will change
159 /// the event masks of the GdkWindows of this widget to include leave-notify
160 /// and motion-notify events. This cannot and will not be undone when the
161 /// property is set to [`false`] again.
162 ///
163 /// Readable | Writable
164 ///
165 ///
166 /// #### `height-request`
167 /// Readable | Writable
168 ///
169 ///
170 /// #### `hexpand`
171 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
172 ///
173 /// Readable | Writable
174 ///
175 ///
176 /// #### `hexpand-set`
177 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
178 ///
179 /// Readable | Writable
180 ///
181 ///
182 /// #### `is-focus`
183 /// Readable | Writable
184 ///
185 ///
186 /// #### `margin`
187 /// Sets all four sides' margin at once. If read, returns max
188 /// margin on any side.
189 ///
190 /// Readable | Writable
191 ///
192 ///
193 /// #### `margin-bottom`
194 /// Margin on bottom side of widget.
195 ///
196 /// This property adds margin outside of the widget's normal size
197 /// request, the margin will be added in addition to the size from
198 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
199 ///
200 /// Readable | Writable
201 ///
202 ///
203 /// #### `margin-end`
204 /// Margin on end of widget, horizontally. This property supports
205 /// left-to-right and right-to-left text directions.
206 ///
207 /// This property adds margin outside of the widget's normal size
208 /// request, the margin will be added in addition to the size from
209 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
210 ///
211 /// Readable | Writable
212 ///
213 ///
214 /// #### `margin-left`
215 /// Margin on left side of widget.
216 ///
217 /// This property adds margin outside of the widget's normal size
218 /// request, the margin will be added in addition to the size from
219 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
220 ///
221 /// Readable | Writable
222 ///
223 ///
224 /// #### `margin-right`
225 /// Margin on right side of widget.
226 ///
227 /// This property adds margin outside of the widget's normal size
228 /// request, the margin will be added in addition to the size from
229 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
230 ///
231 /// Readable | Writable
232 ///
233 ///
234 /// #### `margin-start`
235 /// Margin on start of widget, horizontally. This property supports
236 /// left-to-right and right-to-left text directions.
237 ///
238 /// This property adds margin outside of the widget's normal size
239 /// request, the margin will be added in addition to the size from
240 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
241 ///
242 /// Readable | Writable
243 ///
244 ///
245 /// #### `margin-top`
246 /// Margin on top side of widget.
247 ///
248 /// This property adds margin outside of the widget's normal size
249 /// request, the margin will be added in addition to the size from
250 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
251 ///
252 /// Readable | Writable
253 ///
254 ///
255 /// #### `name`
256 /// Readable | Writable
257 ///
258 ///
259 /// #### `no-show-all`
260 /// Readable | Writable
261 ///
262 ///
263 /// #### `opacity`
264 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
265 /// more details about window opacity.
266 ///
267 /// Before 3.8 this was only available in GtkWindow
268 ///
269 /// Readable | Writable
270 ///
271 ///
272 /// #### `parent`
273 /// Readable | Writable
274 ///
275 ///
276 /// #### `receives-default`
277 /// Readable | Writable
278 ///
279 ///
280 /// #### `scale-factor`
281 /// The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
282 /// more details about widget scaling.
283 ///
284 /// Readable
285 ///
286 ///
287 /// #### `sensitive`
288 /// Readable | Writable
289 ///
290 ///
291 /// #### `style`
292 /// The style of the widget, which contains information about how it will look (colors, etc).
293 ///
294 /// Readable | Writable
295 ///
296 ///
297 /// #### `tooltip-markup`
298 /// Sets the text of tooltip to be the given string, which is marked up
299 /// with the [Pango text markup language][PangoMarkupFormat].
300 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
301 ///
302 /// This is a convenience property which will take care of getting the
303 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
304 /// will automatically be set to [`true`] and there will be taken care of
305 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
306 ///
307 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
308 /// are set, the last one wins.
309 ///
310 /// Readable | Writable
311 ///
312 ///
313 /// #### `tooltip-text`
314 /// Sets the text of tooltip to be the given string.
315 ///
316 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
317 ///
318 /// This is a convenience property which will take care of getting the
319 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
320 /// will automatically be set to [`true`] and there will be taken care of
321 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
322 ///
323 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
324 /// are set, the last one wins.
325 ///
326 /// Readable | Writable
327 ///
328 ///
329 /// #### `valign`
330 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
331 ///
332 /// Readable | Writable
333 ///
334 ///
335 /// #### `vexpand`
336 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
337 ///
338 /// Readable | Writable
339 ///
340 ///
341 /// #### `vexpand-set`
342 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
343 ///
344 /// Readable | Writable
345 ///
346 ///
347 /// #### `visible`
348 /// Readable | Writable
349 ///
350 ///
351 /// #### `width-request`
352 /// Readable | Writable
353 ///
354 ///
355 /// #### `window`
356 /// The widget's window if it is realized, [`None`] otherwise.
357 ///
358 /// Readable
359 /// </details>
360 /// <details><summary><h4>Orientable</h4></summary>
361 ///
362 ///
363 /// #### `orientation`
364 /// The orientation of the orientable.
365 ///
366 /// Readable | Writable
367 /// </details>
368 ///
369 /// ## Signals
370 ///
371 ///
372 /// #### `activate-cursor-child`
373 /// The ::activate-cursor-child signal is a
374 /// [keybinding signal][GtkBindingSignal]
375 /// which gets emitted when the user activates the `box_`.
376 ///
377 /// Action
378 ///
379 ///
380 /// #### `child-activated`
381 /// The ::child-activated signal is emitted when a child has been
382 /// activated by the user.
383 ///
384 ///
385 ///
386 ///
387 /// #### `move-cursor`
388 /// The ::move-cursor signal is a
389 /// [keybinding signal][GtkBindingSignal]
390 /// which gets emitted when the user initiates a cursor movement.
391 ///
392 /// Applications should not connect to it, but may emit it with
393 /// `g_signal_emit_by_name()` if they need to control the cursor
394 /// programmatically.
395 ///
396 /// The default bindings for this signal come in two variants,
397 /// the variant with the Shift modifier extends the selection,
398 /// the variant without the Shift modifer does not.
399 /// There are too many key combinations to list them all here.
400 /// - Arrow keys move by individual children
401 /// - Home/End keys move to the ends of the box
402 /// - PageUp/PageDown keys move vertically by pages
403 ///
404 /// Action
405 ///
406 ///
407 /// #### `select-all`
408 /// The ::select-all signal is a
409 /// [keybinding signal][GtkBindingSignal]
410 /// which gets emitted to select all children of the box, if
411 /// the selection mode permits it.
412 ///
413 /// The default bindings for this signal is Ctrl-a.
414 ///
415 /// Action
416 ///
417 ///
418 /// #### `selected-children-changed`
419 /// The ::selected-children-changed signal is emitted when the
420 /// set of selected children changes.
421 ///
422 /// Use [`FlowBoxExt::selected_foreach()`][crate::prelude::FlowBoxExt::selected_foreach()] or
423 /// [`FlowBoxExt::selected_children()`][crate::prelude::FlowBoxExt::selected_children()] to obtain the
424 /// selected children.
425 ///
426 ///
427 ///
428 ///
429 /// #### `toggle-cursor-child`
430 /// The ::toggle-cursor-child signal is a
431 /// [keybinding signal][GtkBindingSignal]
432 /// which toggles the selection of the child that has the focus.
433 ///
434 /// The default binding for this signal is Ctrl-Space.
435 ///
436 /// Action
437 ///
438 ///
439 /// #### `unselect-all`
440 /// The ::unselect-all signal is a
441 /// [keybinding signal][GtkBindingSignal]
442 /// which gets emitted to unselect all children of the box, if
443 /// the selection mode permits it.
444 ///
445 /// The default bindings for this signal is Ctrl-Shift-a.
446 ///
447 /// Action
448 /// <details><summary><h4>Container</h4></summary>
449 ///
450 ///
451 /// #### `add`
452 ///
453 ///
454 ///
455 /// #### `check-resize`
456 ///
457 ///
458 ///
459 /// #### `remove`
460 ///
461 ///
462 ///
463 /// #### `set-focus-child`
464 ///
465 /// </details>
466 /// <details><summary><h4>Widget</h4></summary>
467 ///
468 ///
469 /// #### `accel-closures-changed`
470 ///
471 ///
472 ///
473 /// #### `button-press-event`
474 /// The ::button-press-event signal will be emitted when a button
475 /// (typically from a mouse) is pressed.
476 ///
477 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
478 /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
479 ///
480 /// This signal will be sent to the grab widget if there is one.
481 ///
482 ///
483 ///
484 ///
485 /// #### `button-release-event`
486 /// The ::button-release-event signal will be emitted when a button
487 /// (typically from a mouse) is released.
488 ///
489 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
490 /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
491 ///
492 /// This signal will be sent to the grab widget if there is one.
493 ///
494 ///
495 ///
496 ///
497 /// #### `can-activate-accel`
498 /// Determines whether an accelerator that activates the signal
499 /// identified by `signal_id` can currently be activated.
500 /// This signal is present to allow applications and derived
501 /// widgets to override the default [`Widget`][crate::Widget] handling
502 /// for determining whether an accelerator can be activated.
503 ///
504 ///
505 ///
506 ///
507 /// #### `child-notify`
508 /// The ::child-notify signal is emitted for each
509 /// [child property][child-properties] that has
510 /// changed on an object. The signal's detail holds the property name.
511 ///
512 /// Detailed
513 ///
514 ///
515 /// #### `composited-changed`
516 /// The ::composited-changed signal is emitted when the composited
517 /// status of `widgets` screen changes.
518 /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
519 ///
520 /// Action
521 ///
522 ///
523 /// #### `configure-event`
524 /// The ::configure-event signal will be emitted when the size, position or
525 /// stacking of the `widget`'s window has changed.
526 ///
527 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
528 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
529 /// automatically for all new windows.
530 ///
531 ///
532 ///
533 ///
534 /// #### `damage-event`
535 /// Emitted when a redirected window belonging to `widget` gets drawn into.
536 /// The region/area members of the event shows what area of the redirected
537 /// drawable was drawn into.
538 ///
539 ///
540 ///
541 ///
542 /// #### `delete-event`
543 /// The ::delete-event signal is emitted if a user requests that
544 /// a toplevel window is closed. The default handler for this signal
545 /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
546 /// this signal will cause the window to be hidden instead, so that
547 /// it can later be shown again without reconstructing it.
548 ///
549 ///
550 ///
551 ///
552 /// #### `destroy`
553 /// Signals that all holders of a reference to the widget should release
554 /// the reference that they hold. May result in finalization of the widget
555 /// if all references are released.
556 ///
557 /// This signal is not suitable for saving widget state.
558 ///
559 ///
560 ///
561 ///
562 /// #### `destroy-event`
563 /// The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
564 /// You rarely get this signal, because most widgets disconnect themselves
565 /// from their window before they destroy it, so no widget owns the
566 /// window at destroy time.
567 ///
568 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
569 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
570 /// automatically for all new windows.
571 ///
572 ///
573 ///
574 ///
575 /// #### `direction-changed`
576 /// The ::direction-changed signal is emitted when the text direction
577 /// of a widget changes.
578 ///
579 ///
580 ///
581 ///
582 /// #### `drag-begin`
583 /// The ::drag-begin signal is emitted on the drag source when a drag is
584 /// started. A typical reason to connect to this signal is to set up a
585 /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
586 ///
587 /// Note that some widgets set up a drag icon in the default handler of
588 /// this signal, so you may have to use `g_signal_connect_after()` to
589 /// override what the default handler did.
590 ///
591 ///
592 ///
593 ///
594 /// #### `drag-data-delete`
595 /// The ::drag-data-delete signal is emitted on the drag source when a drag
596 /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
597 /// handler is responsible for deleting the data that has been dropped. What
598 /// "delete" means depends on the context of the drag operation.
599 ///
600 ///
601 ///
602 ///
603 /// #### `drag-data-get`
604 /// The ::drag-data-get signal is emitted on the drag source when the drop
605 /// site requests the data which is dragged. It is the responsibility of
606 /// the signal handler to fill `data` with the data in the format which
607 /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
608 /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
609 ///
610 ///
611 ///
612 ///
613 /// #### `drag-data-received`
614 /// format == 8))
615 /// {
616 /// GdkDragAction action;
617 ///
618 /// // handle data here
619 ///
620 /// action = gdk_drag_context_get_selected_action (context);
621 /// if (action == GDK_ACTION_ASK)
622 /// {
623 /// GtkWidget *dialog;
624 /// gint response;
625 ///
626 /// dialog = gtk_message_dialog_new (NULL,
627 /// GTK_DIALOG_MODAL |
628 /// GTK_DIALOG_DESTROY_WITH_PARENT,
629 /// GTK_MESSAGE_INFO,
630 /// GTK_BUTTONS_YES_NO,
631 /// "Move the data ?\n");
632 /// response = gtk_dialog_run (GTK_DIALOG (dialog));
633 /// gtk_widget_destroy (dialog);
634 ///
635 /// if (response == GTK_RESPONSE_YES)
636 /// action = GDK_ACTION_MOVE;
637 /// else
638 /// action = GDK_ACTION_COPY;
639 /// }
640 ///
641 /// gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
642 /// }
643 /// else
644 /// gtk_drag_finish (context, FALSE, FALSE, time);
645 /// }
646 /// ]|
647 ///
648 ///
649 ///
650 ///
651 /// #### `drag-drop`
652 /// The ::drag-drop signal is emitted on the drop site when the user drops
653 /// the data onto the widget. The signal handler must determine whether
654 /// the cursor position is in a drop zone or not. If it is not in a drop
655 /// zone, it returns [`false`] and no further processing is necessary.
656 /// Otherwise, the handler returns [`true`]. In this case, the handler must
657 /// ensure that `gtk_drag_finish()` is called to let the source know that
658 /// the drop is done. The call to `gtk_drag_finish()` can be done either
659 /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
660 /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
661 /// or more of the supported targets.
662 ///
663 ///
664 ///
665 ///
666 /// #### `drag-end`
667 /// The ::drag-end signal is emitted on the drag source when a drag is
668 /// finished. A typical reason to connect to this signal is to undo
669 /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
670 ///
671 ///
672 ///
673 ///
674 /// #### `drag-failed`
675 /// The ::drag-failed signal is emitted on the drag source when a drag has
676 /// failed. The signal handler may hook custom code to handle a failed DnD
677 /// operation based on the type of error, it returns [`true`] is the failure has
678 /// been already handled (not showing the default "drag operation failed"
679 /// animation), otherwise it returns [`false`].
680 ///
681 ///
682 ///
683 ///
684 /// #### `drag-leave`
685 /// The ::drag-leave signal is emitted on the drop site when the cursor
686 /// leaves the widget. A typical reason to connect to this signal is to
687 /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
688 /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
689 ///
690 ///
691 /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
692 /// ::drag-drop signal, for instance to allow cleaning up of a preview item
693 /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
694 ///
695 ///
696 ///
697 ///
698 /// #### `drag-motion`
699 /// suggested_action,
700 /// time);
701 /// }
702 /// else
703 /// {
704 /// // accept the drop
705 /// }
706 /// }
707 /// ]|
708 ///
709 ///
710 ///
711 ///
712 /// #### `draw`
713 /// This signal is emitted when a widget is supposed to render itself.
714 /// The `widget`'s top left corner must be painted at the origin of
715 /// the passed in context and be sized to the values returned by
716 /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
717 /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
718 ///
719 /// Signal handlers connected to this signal can modify the cairo
720 /// context passed as `cr` in any way they like and don't need to
721 /// restore it. The signal emission takes care of calling `cairo_save()`
722 /// before and `cairo_restore()` after invoking the handler.
723 ///
724 /// The signal handler will get a `cr` with a clip region already set to the
725 /// widget's dirty region, i.e. to the area that needs repainting. Complicated
726 /// widgets that want to avoid redrawing themselves completely can get the full
727 /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
728 /// get a finer-grained representation of the dirty region with
729 /// `cairo_copy_clip_rectangle_list()`.
730 ///
731 ///
732 ///
733 ///
734 /// #### `enter-notify-event`
735 /// The ::enter-notify-event will be emitted when the pointer enters
736 /// the `widget`'s window.
737 ///
738 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
739 /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
740 ///
741 /// This signal will be sent to the grab widget if there is one.
742 ///
743 ///
744 ///
745 ///
746 /// #### `event`
747 /// The GTK+ main loop will emit three signals for each GDK event delivered
748 /// to a widget: one generic ::event signal, another, more specific,
749 /// signal that matches the type of event delivered (e.g.
750 /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
751 /// [`event-after`][struct@crate::Widget#event-after] signal.
752 ///
753 ///
754 ///
755 ///
756 /// #### `event-after`
757 /// After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
758 /// the second more specific signal, ::event-after will be emitted
759 /// regardless of the previous two signals handlers return values.
760 ///
761 ///
762 ///
763 ///
764 /// #### `focus`
765 ///
766 ///
767 ///
768 /// #### `focus-in-event`
769 /// The ::focus-in-event signal will be emitted when the keyboard focus
770 /// enters the `widget`'s window.
771 ///
772 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
773 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
774 ///
775 ///
776 ///
777 ///
778 /// #### `focus-out-event`
779 /// The ::focus-out-event signal will be emitted when the keyboard focus
780 /// leaves the `widget`'s window.
781 ///
782 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
783 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
784 ///
785 ///
786 ///
787 ///
788 /// #### `grab-broken-event`
789 /// Emitted when a pointer or keyboard grab on a window belonging
790 /// to `widget` gets broken.
791 ///
792 /// On X11, this happens when the grab window becomes unviewable
793 /// (i.e. it or one of its ancestors is unmapped), or if the same
794 /// application grabs the pointer or keyboard again.
795 ///
796 ///
797 ///
798 ///
799 /// #### `grab-focus`
800 /// Action
801 ///
802 ///
803 /// #### `grab-notify`
804 /// The ::grab-notify signal is emitted when a widget becomes
805 /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
806 /// another widget, or when it becomes unshadowed due to a grab
807 /// being removed.
808 ///
809 /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
810 /// grab widget in the grab stack of its window group is not
811 /// its ancestor.
812 ///
813 ///
814 ///
815 ///
816 /// #### `hide`
817 /// The ::hide signal is emitted when `widget` is hidden, for example with
818 /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
819 ///
820 ///
821 ///
822 ///
823 /// #### `hierarchy-changed`
824 /// The ::hierarchy-changed signal is emitted when the
825 /// anchored state of a widget changes. A widget is
826 /// “anchored” when its toplevel
827 /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
828 /// a widget changes from un-anchored to anchored or vice-versa.
829 ///
830 ///
831 ///
832 ///
833 /// #### `key-press-event`
834 /// The ::key-press-event signal is emitted when a key is pressed. The signal
835 /// emission will reoccur at the key-repeat rate when the key is kept pressed.
836 ///
837 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
838 /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
839 ///
840 /// This signal will be sent to the grab widget if there is one.
841 ///
842 ///
843 ///
844 ///
845 /// #### `key-release-event`
846 /// The ::key-release-event signal is emitted when a key is released.
847 ///
848 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
849 /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
850 ///
851 /// This signal will be sent to the grab widget if there is one.
852 ///
853 ///
854 ///
855 ///
856 /// #### `keynav-failed`
857 /// Gets emitted if keyboard navigation fails.
858 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
859 ///
860 ///
861 ///
862 ///
863 /// #### `leave-notify-event`
864 /// The ::leave-notify-event will be emitted when the pointer leaves
865 /// the `widget`'s window.
866 ///
867 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
868 /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
869 ///
870 /// This signal will be sent to the grab widget if there is one.
871 ///
872 ///
873 ///
874 ///
875 /// #### `map`
876 /// The ::map signal is emitted when `widget` is going to be mapped, that is
877 /// when the widget is visible (which is controlled with
878 /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
879 /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
880 /// be emitted.
881 ///
882 /// The ::map signal can be used to determine whether a widget will be drawn,
883 /// for instance it can resume an animation that was stopped during the
884 /// emission of [`unmap`][struct@crate::Widget#unmap].
885 ///
886 ///
887 ///
888 ///
889 /// #### `map-event`
890 /// The ::map-event signal will be emitted when the `widget`'s window is
891 /// mapped. A window is mapped when it becomes visible on the screen.
892 ///
893 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
894 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
895 /// automatically for all new windows.
896 ///
897 ///
898 ///
899 ///
900 /// #### `mnemonic-activate`
901 /// The default handler for this signal activates `widget` if `group_cycling`
902 /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
903 ///
904 ///
905 ///
906 ///
907 /// #### `motion-notify-event`
908 /// The ::motion-notify-event signal is emitted when the pointer moves
909 /// over the widget's [`gdk::Window`][crate::gdk::Window].
910 ///
911 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
912 /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
913 ///
914 /// This signal will be sent to the grab widget if there is one.
915 ///
916 ///
917 ///
918 ///
919 /// #### `move-focus`
920 /// Action
921 ///
922 ///
923 /// #### `parent-set`
924 /// The ::parent-set signal is emitted when a new parent
925 /// has been set on a widget.
926 ///
927 ///
928 ///
929 ///
930 /// #### `popup-menu`
931 /// This signal gets emitted whenever a widget should pop up a context
932 /// menu. This usually happens through the standard key binding mechanism;
933 /// by pressing a certain key while a widget is focused, the user can cause
934 /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
935 /// a menu with clipboard commands. See the
936 /// [Popup Menu Migration Checklist][checklist-popup-menu]
937 /// for an example of how to use this signal.
938 ///
939 /// Action
940 ///
941 ///
942 /// #### `property-notify-event`
943 /// The ::property-notify-event signal will be emitted when a property on
944 /// the `widget`'s window has been changed or deleted.
945 ///
946 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
947 /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
948 ///
949 ///
950 ///
951 ///
952 /// #### `proximity-in-event`
953 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
954 /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
955 ///
956 /// This signal will be sent to the grab widget if there is one.
957 ///
958 ///
959 ///
960 ///
961 /// #### `proximity-out-event`
962 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
963 /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
964 ///
965 /// This signal will be sent to the grab widget if there is one.
966 ///
967 ///
968 ///
969 ///
970 /// #### `query-tooltip`
971 /// Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
972 /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
973 /// focus in keyboard mode.
974 ///
975 /// Using the given coordinates, the signal handler should determine
976 /// whether a tooltip should be shown for `widget`. If this is the case
977 /// [`true`] should be returned, [`false`] otherwise. Note that if
978 /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
979 /// should not be used.
980 ///
981 /// The signal handler is free to manipulate `tooltip` with the therefore
982 /// destined function calls.
983 ///
984 ///
985 ///
986 ///
987 /// #### `realize`
988 /// The ::realize signal is emitted when `widget` is associated with a
989 /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
990 /// widget has been mapped (that is, it is going to be drawn).
991 ///
992 ///
993 ///
994 ///
995 /// #### `screen-changed`
996 /// The ::screen-changed signal gets emitted when the
997 /// screen of a widget has changed.
998 ///
999 ///
1000 ///
1001 ///
1002 /// #### `scroll-event`
1003 /// The ::scroll-event signal is emitted when a button in the 4 to 7
1004 /// range is pressed. Wheel mice are usually configured to generate
1005 /// button press events for buttons 4 and 5 when the wheel is turned.
1006 ///
1007 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1008 /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
1009 ///
1010 /// This signal will be sent to the grab widget if there is one.
1011 ///
1012 ///
1013 ///
1014 ///
1015 /// #### `selection-clear-event`
1016 /// The ::selection-clear-event signal will be emitted when the
1017 /// the `widget`'s window has lost ownership of a selection.
1018 ///
1019 ///
1020 ///
1021 ///
1022 /// #### `selection-get`
1023 ///
1024 ///
1025 ///
1026 /// #### `selection-notify-event`
1027 ///
1028 ///
1029 ///
1030 /// #### `selection-received`
1031 ///
1032 ///
1033 ///
1034 /// #### `selection-request-event`
1035 /// The ::selection-request-event signal will be emitted when
1036 /// another client requests ownership of the selection owned by
1037 /// the `widget`'s window.
1038 ///
1039 ///
1040 ///
1041 ///
1042 /// #### `show`
1043 /// The ::show signal is emitted when `widget` is shown, for example with
1044 /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
1045 ///
1046 ///
1047 ///
1048 ///
1049 /// #### `show-help`
1050 /// Action
1051 ///
1052 ///
1053 /// #### `size-allocate`
1054 ///
1055 ///
1056 ///
1057 /// #### `state-changed`
1058 /// The ::state-changed signal is emitted when the widget state changes.
1059 /// See `gtk_widget_get_state()`.
1060 ///
1061 ///
1062 ///
1063 ///
1064 /// #### `state-flags-changed`
1065 /// The ::state-flags-changed signal is emitted when the widget state
1066 /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
1067 ///
1068 ///
1069 ///
1070 ///
1071 /// #### `style-set`
1072 /// The ::style-set signal is emitted when a new style has been set
1073 /// on a widget. Note that style-modifying functions like
1074 /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1075 ///
1076 /// Note that this signal is emitted for changes to the deprecated
1077 /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1078 /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1079 ///
1080 ///
1081 ///
1082 ///
1083 /// #### `style-updated`
1084 /// The ::style-updated signal is a convenience signal that is emitted when the
1085 /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1086 /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1087 ///
1088 /// Note that style-modifying functions like `gtk_widget_override_color()` also
1089 /// cause this signal to be emitted.
1090 ///
1091 ///
1092 ///
1093 ///
1094 /// #### `touch-event`
1095 ///
1096 ///
1097 ///
1098 /// #### `unmap`
1099 /// The ::unmap signal is emitted when `widget` is going to be unmapped, which
1100 /// means that either it or any of its parents up to the toplevel widget have
1101 /// been set as hidden.
1102 ///
1103 /// As ::unmap indicates that a widget will not be shown any longer, it can be
1104 /// used to, for example, stop an animation on the widget.
1105 ///
1106 ///
1107 ///
1108 ///
1109 /// #### `unmap-event`
1110 /// The ::unmap-event signal will be emitted when the `widget`'s window is
1111 /// unmapped. A window is unmapped when it becomes invisible on the screen.
1112 ///
1113 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1114 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1115 /// automatically for all new windows.
1116 ///
1117 ///
1118 ///
1119 ///
1120 /// #### `unrealize`
1121 /// The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1122 /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1123 /// called or the widget has been unmapped (that is, it is going to be
1124 /// hidden).
1125 ///
1126 ///
1127 ///
1128 ///
1129 /// #### `visibility-notify-event`
1130 /// The ::visibility-notify-event will be emitted when the `widget`'s
1131 /// window is obscured or unobscured.
1132 ///
1133 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1134 /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1135 ///
1136 ///
1137 ///
1138 ///
1139 /// #### `window-state-event`
1140 /// The ::window-state-event will be emitted when the state of the
1141 /// toplevel window associated to the `widget` changes.
1142 ///
1143 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1144 /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1145 /// this mask automatically for all new windows.
1146 ///
1147 ///
1148 /// </details>
1149 ///
1150 /// # Implements
1151 ///
1152 /// [`FlowBoxExt`][trait@crate::prelude::FlowBoxExt], [`ContainerExt`][trait@crate::prelude::ContainerExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`OrientableExt`][trait@crate::prelude::OrientableExt], [`FlowBoxExtManual`][trait@crate::prelude::FlowBoxExtManual], [`ContainerExtManual`][trait@crate::prelude::ContainerExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
1153 #[doc(alias = "GtkFlowBox")]
1154 pub struct FlowBox(Object<ffi::GtkFlowBox, ffi::GtkFlowBoxClass>) @extends Container, Widget, @implements Buildable, Orientable;
1155
1156 match fn {
1157 type_ => || ffi::gtk_flow_box_get_type(),
1158 }
1159}
1160
1161impl FlowBox {
1162 pub const NONE: Option<&'static FlowBox> = None;
1163
1164 /// Creates a GtkFlowBox.
1165 ///
1166 /// # Returns
1167 ///
1168 /// a new [`FlowBox`][crate::FlowBox] container
1169 #[doc(alias = "gtk_flow_box_new")]
1170 pub fn new() -> FlowBox {
1171 assert_initialized_main_thread!();
1172 unsafe { Widget::from_glib_none(ffi::gtk_flow_box_new()).unsafe_cast() }
1173 }
1174
1175 // rustdoc-stripper-ignore-next
1176 /// Creates a new builder-pattern struct instance to construct [`FlowBox`] objects.
1177 ///
1178 /// This method returns an instance of [`FlowBoxBuilder`](crate::builders::FlowBoxBuilder) which can be used to create [`FlowBox`] objects.
1179 pub fn builder() -> FlowBoxBuilder {
1180 FlowBoxBuilder::new()
1181 }
1182}
1183
1184impl Default for FlowBox {
1185 fn default() -> Self {
1186 Self::new()
1187 }
1188}
1189
1190// rustdoc-stripper-ignore-next
1191/// A [builder-pattern] type to construct [`FlowBox`] objects.
1192///
1193/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1194#[must_use = "The builder must be built to be used"]
1195pub struct FlowBoxBuilder {
1196 builder: glib::object::ObjectBuilder<'static, FlowBox>,
1197}
1198
1199impl FlowBoxBuilder {
1200 fn new() -> Self {
1201 Self {
1202 builder: glib::object::Object::builder(),
1203 }
1204 }
1205
1206 /// Determines whether children can be activated with a single
1207 /// click, or require a double-click.
1208 pub fn activate_on_single_click(self, activate_on_single_click: bool) -> Self {
1209 Self {
1210 builder: self
1211 .builder
1212 .property("activate-on-single-click", activate_on_single_click),
1213 }
1214 }
1215
1216 /// The amount of horizontal space between two children.
1217 pub fn column_spacing(self, column_spacing: u32) -> Self {
1218 Self {
1219 builder: self.builder.property("column-spacing", column_spacing),
1220 }
1221 }
1222
1223 /// Determines whether all children should be allocated the
1224 /// same size.
1225 pub fn homogeneous(self, homogeneous: bool) -> Self {
1226 Self {
1227 builder: self.builder.property("homogeneous", homogeneous),
1228 }
1229 }
1230
1231 /// The maximum amount of children to request space for consecutively
1232 /// in the given orientation.
1233 pub fn max_children_per_line(self, max_children_per_line: u32) -> Self {
1234 Self {
1235 builder: self
1236 .builder
1237 .property("max-children-per-line", max_children_per_line),
1238 }
1239 }
1240
1241 /// The minimum number of children to allocate consecutively
1242 /// in the given orientation.
1243 ///
1244 /// Setting the minimum children per line ensures
1245 /// that a reasonably small height will be requested
1246 /// for the overall minimum width of the box.
1247 pub fn min_children_per_line(self, min_children_per_line: u32) -> Self {
1248 Self {
1249 builder: self
1250 .builder
1251 .property("min-children-per-line", min_children_per_line),
1252 }
1253 }
1254
1255 /// The amount of vertical space between two children.
1256 pub fn row_spacing(self, row_spacing: u32) -> Self {
1257 Self {
1258 builder: self.builder.property("row-spacing", row_spacing),
1259 }
1260 }
1261
1262 /// The selection mode used by the flow box.
1263 pub fn selection_mode(self, selection_mode: SelectionMode) -> Self {
1264 Self {
1265 builder: self.builder.property("selection-mode", selection_mode),
1266 }
1267 }
1268
1269 pub fn border_width(self, border_width: u32) -> Self {
1270 Self {
1271 builder: self.builder.property("border-width", border_width),
1272 }
1273 }
1274
1275 pub fn child(self, child: &impl IsA<Widget>) -> Self {
1276 Self {
1277 builder: self.builder.property("child", child.clone().upcast()),
1278 }
1279 }
1280
1281 pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
1282 Self {
1283 builder: self.builder.property("resize-mode", resize_mode),
1284 }
1285 }
1286
1287 pub fn app_paintable(self, app_paintable: bool) -> Self {
1288 Self {
1289 builder: self.builder.property("app-paintable", app_paintable),
1290 }
1291 }
1292
1293 pub fn can_default(self, can_default: bool) -> Self {
1294 Self {
1295 builder: self.builder.property("can-default", can_default),
1296 }
1297 }
1298
1299 pub fn can_focus(self, can_focus: bool) -> Self {
1300 Self {
1301 builder: self.builder.property("can-focus", can_focus),
1302 }
1303 }
1304
1305 pub fn events(self, events: gdk::EventMask) -> Self {
1306 Self {
1307 builder: self.builder.property("events", events),
1308 }
1309 }
1310
1311 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1312 pub fn expand(self, expand: bool) -> Self {
1313 Self {
1314 builder: self.builder.property("expand", expand),
1315 }
1316 }
1317
1318 /// Whether the widget should grab focus when it is clicked with the mouse.
1319 ///
1320 /// This property is only relevant for widgets that can take focus.
1321 ///
1322 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1323 /// GtkComboBox) implemented this property individually.
1324 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1325 Self {
1326 builder: self.builder.property("focus-on-click", focus_on_click),
1327 }
1328 }
1329
1330 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1331 pub fn halign(self, halign: Align) -> Self {
1332 Self {
1333 builder: self.builder.property("halign", halign),
1334 }
1335 }
1336
1337 pub fn has_default(self, has_default: bool) -> Self {
1338 Self {
1339 builder: self.builder.property("has-default", has_default),
1340 }
1341 }
1342
1343 pub fn has_focus(self, has_focus: bool) -> Self {
1344 Self {
1345 builder: self.builder.property("has-focus", has_focus),
1346 }
1347 }
1348
1349 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1350 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1351 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1352 /// whether it will provide a tooltip or not.
1353 ///
1354 /// Note that setting this property to [`true`] for the first time will change
1355 /// the event masks of the GdkWindows of this widget to include leave-notify
1356 /// and motion-notify events. This cannot and will not be undone when the
1357 /// property is set to [`false`] again.
1358 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1359 Self {
1360 builder: self.builder.property("has-tooltip", has_tooltip),
1361 }
1362 }
1363
1364 pub fn height_request(self, height_request: i32) -> Self {
1365 Self {
1366 builder: self.builder.property("height-request", height_request),
1367 }
1368 }
1369
1370 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1371 pub fn hexpand(self, hexpand: bool) -> Self {
1372 Self {
1373 builder: self.builder.property("hexpand", hexpand),
1374 }
1375 }
1376
1377 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1378 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1379 Self {
1380 builder: self.builder.property("hexpand-set", hexpand_set),
1381 }
1382 }
1383
1384 pub fn is_focus(self, is_focus: bool) -> Self {
1385 Self {
1386 builder: self.builder.property("is-focus", is_focus),
1387 }
1388 }
1389
1390 /// Sets all four sides' margin at once. If read, returns max
1391 /// margin on any side.
1392 pub fn margin(self, margin: i32) -> Self {
1393 Self {
1394 builder: self.builder.property("margin", margin),
1395 }
1396 }
1397
1398 /// Margin on bottom side of widget.
1399 ///
1400 /// This property adds margin outside of the widget's normal size
1401 /// request, the margin will be added in addition to the size from
1402 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1403 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1404 Self {
1405 builder: self.builder.property("margin-bottom", margin_bottom),
1406 }
1407 }
1408
1409 /// Margin on end of widget, horizontally. This property supports
1410 /// left-to-right and right-to-left text directions.
1411 ///
1412 /// This property adds margin outside of the widget's normal size
1413 /// request, the margin will be added in addition to the size from
1414 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1415 pub fn margin_end(self, margin_end: i32) -> Self {
1416 Self {
1417 builder: self.builder.property("margin-end", margin_end),
1418 }
1419 }
1420
1421 /// Margin on start of widget, horizontally. This property supports
1422 /// left-to-right and right-to-left text directions.
1423 ///
1424 /// This property adds margin outside of the widget's normal size
1425 /// request, the margin will be added in addition to the size from
1426 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1427 pub fn margin_start(self, margin_start: i32) -> Self {
1428 Self {
1429 builder: self.builder.property("margin-start", margin_start),
1430 }
1431 }
1432
1433 /// Margin on top side of widget.
1434 ///
1435 /// This property adds margin outside of the widget's normal size
1436 /// request, the margin will be added in addition to the size from
1437 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1438 pub fn margin_top(self, margin_top: i32) -> Self {
1439 Self {
1440 builder: self.builder.property("margin-top", margin_top),
1441 }
1442 }
1443
1444 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1445 Self {
1446 builder: self.builder.property("name", name.into()),
1447 }
1448 }
1449
1450 pub fn no_show_all(self, no_show_all: bool) -> Self {
1451 Self {
1452 builder: self.builder.property("no-show-all", no_show_all),
1453 }
1454 }
1455
1456 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1457 /// more details about window opacity.
1458 ///
1459 /// Before 3.8 this was only available in GtkWindow
1460 pub fn opacity(self, opacity: f64) -> Self {
1461 Self {
1462 builder: self.builder.property("opacity", opacity),
1463 }
1464 }
1465
1466 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1467 Self {
1468 builder: self.builder.property("parent", parent.clone().upcast()),
1469 }
1470 }
1471
1472 pub fn receives_default(self, receives_default: bool) -> Self {
1473 Self {
1474 builder: self.builder.property("receives-default", receives_default),
1475 }
1476 }
1477
1478 pub fn sensitive(self, sensitive: bool) -> Self {
1479 Self {
1480 builder: self.builder.property("sensitive", sensitive),
1481 }
1482 }
1483
1484 /// Sets the text of tooltip to be the given string, which is marked up
1485 /// with the [Pango text markup language][PangoMarkupFormat].
1486 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1487 ///
1488 /// This is a convenience property which will take care of getting the
1489 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1490 /// will automatically be set to [`true`] and there will be taken care of
1491 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1492 ///
1493 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1494 /// are set, the last one wins.
1495 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1496 Self {
1497 builder: self
1498 .builder
1499 .property("tooltip-markup", tooltip_markup.into()),
1500 }
1501 }
1502
1503 /// Sets the text of tooltip to be the given string.
1504 ///
1505 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1506 ///
1507 /// This is a convenience property which will take care of getting the
1508 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1509 /// will automatically be set to [`true`] and there will be taken care of
1510 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1511 ///
1512 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1513 /// are set, the last one wins.
1514 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1515 Self {
1516 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1517 }
1518 }
1519
1520 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1521 pub fn valign(self, valign: Align) -> Self {
1522 Self {
1523 builder: self.builder.property("valign", valign),
1524 }
1525 }
1526
1527 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1528 pub fn vexpand(self, vexpand: bool) -> Self {
1529 Self {
1530 builder: self.builder.property("vexpand", vexpand),
1531 }
1532 }
1533
1534 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1535 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1536 Self {
1537 builder: self.builder.property("vexpand-set", vexpand_set),
1538 }
1539 }
1540
1541 pub fn visible(self, visible: bool) -> Self {
1542 Self {
1543 builder: self.builder.property("visible", visible),
1544 }
1545 }
1546
1547 pub fn width_request(self, width_request: i32) -> Self {
1548 Self {
1549 builder: self.builder.property("width-request", width_request),
1550 }
1551 }
1552
1553 /// The orientation of the orientable.
1554 pub fn orientation(self, orientation: Orientation) -> Self {
1555 Self {
1556 builder: self.builder.property("orientation", orientation),
1557 }
1558 }
1559
1560 // rustdoc-stripper-ignore-next
1561 /// Build the [`FlowBox`].
1562 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1563 pub fn build(self) -> FlowBox {
1564 assert_initialized_main_thread!();
1565 self.builder.build()
1566 }
1567}
1568
1569/// Trait containing all [`struct@FlowBox`] methods.
1570///
1571/// # Implementors
1572///
1573/// [`FlowBox`][struct@crate::FlowBox]
1574pub trait FlowBoxExt: IsA<FlowBox> + 'static {
1575 /// Binds `model` to `self`.
1576 ///
1577 /// If `self` was already bound to a model, that previous binding is
1578 /// destroyed.
1579 ///
1580 /// The contents of `self` are cleared and then filled with widgets that
1581 /// represent items from `model`. `self` is updated whenever `model` changes.
1582 /// If `model` is [`None`], `self` is left empty.
1583 ///
1584 /// It is undefined to add or remove widgets directly (for example, with
1585 /// [`insert()`][Self::insert()] or [`ContainerExt::add()`][crate::prelude::ContainerExt::add()]) while `self` is bound to a
1586 /// model.
1587 ///
1588 /// Note that using a model is incompatible with the filtering and sorting
1589 /// functionality in GtkFlowBox. When using a model, filtering and sorting
1590 /// should be implemented by the model.
1591 /// ## `model`
1592 /// the [`gio::ListModel`][crate::gio::ListModel] to be bound to `self`
1593 /// ## `create_widget_func`
1594 /// a function that creates widgets for items
1595 #[doc(alias = "gtk_flow_box_bind_model")]
1596 fn bind_model<P: Fn(&glib::Object) -> Widget + 'static>(
1597 &self,
1598 model: Option<&impl IsA<gio::ListModel>>,
1599 create_widget_func: P,
1600 ) {
1601 let create_widget_func_data: Box_<P> = Box_::new(create_widget_func);
1602 unsafe extern "C" fn create_widget_func_func<P: Fn(&glib::Object) -> Widget + 'static>(
1603 item: *mut glib::gobject_ffi::GObject,
1604 user_data: glib::ffi::gpointer,
1605 ) -> *mut ffi::GtkWidget {
1606 unsafe {
1607 let item = from_glib_borrow(item);
1608 let callback = &*(user_data as *mut P);
1609 (*callback)(&item).to_glib_full()
1610 }
1611 }
1612 let create_widget_func = Some(create_widget_func_func::<P> as _);
1613 unsafe extern "C" fn user_data_free_func_func<P: Fn(&glib::Object) -> Widget + 'static>(
1614 data: glib::ffi::gpointer,
1615 ) {
1616 unsafe {
1617 let _callback = Box_::from_raw(data as *mut P);
1618 }
1619 }
1620 let destroy_call4 = Some(user_data_free_func_func::<P> as _);
1621 let super_callback0: Box_<P> = create_widget_func_data;
1622 unsafe {
1623 ffi::gtk_flow_box_bind_model(
1624 self.as_ref().to_glib_none().0,
1625 model.map(|p| p.as_ref()).to_glib_none().0,
1626 create_widget_func,
1627 Box_::into_raw(super_callback0) as *mut _,
1628 destroy_call4,
1629 );
1630 }
1631 }
1632
1633 /// Returns whether children activate on single clicks.
1634 ///
1635 /// # Returns
1636 ///
1637 /// [`true`] if children are activated on single click,
1638 /// [`false`] otherwise
1639 #[doc(alias = "gtk_flow_box_get_activate_on_single_click")]
1640 #[doc(alias = "get_activate_on_single_click")]
1641 #[doc(alias = "activate-on-single-click")]
1642 fn activates_on_single_click(&self) -> bool {
1643 unsafe {
1644 from_glib(ffi::gtk_flow_box_get_activate_on_single_click(
1645 self.as_ref().to_glib_none().0,
1646 ))
1647 }
1648 }
1649
1650 /// Gets the nth child in the `self`.
1651 /// ## `idx`
1652 /// the position of the child
1653 ///
1654 /// # Returns
1655 ///
1656 /// the child widget, which will
1657 /// always be a [`FlowBoxChild`][crate::FlowBoxChild] or [`None`] in case no child widget
1658 /// with the given index exists.
1659 #[doc(alias = "gtk_flow_box_get_child_at_index")]
1660 #[doc(alias = "get_child_at_index")]
1661 fn child_at_index(&self, idx: i32) -> Option<FlowBoxChild> {
1662 unsafe {
1663 from_glib_none(ffi::gtk_flow_box_get_child_at_index(
1664 self.as_ref().to_glib_none().0,
1665 idx,
1666 ))
1667 }
1668 }
1669
1670 /// Gets the child in the (`x`, `y`) position.
1671 /// ## `x`
1672 /// the x coordinate of the child
1673 /// ## `y`
1674 /// the y coordinate of the child
1675 ///
1676 /// # Returns
1677 ///
1678 /// the child widget, which will
1679 /// always be a [`FlowBoxChild`][crate::FlowBoxChild] or [`None`] in case no child widget
1680 /// exists for the given x and y coordinates.
1681 #[doc(alias = "gtk_flow_box_get_child_at_pos")]
1682 #[doc(alias = "get_child_at_pos")]
1683 fn child_at_pos(&self, x: i32, y: i32) -> Option<FlowBoxChild> {
1684 unsafe {
1685 from_glib_none(ffi::gtk_flow_box_get_child_at_pos(
1686 self.as_ref().to_glib_none().0,
1687 x,
1688 y,
1689 ))
1690 }
1691 }
1692
1693 /// Gets the horizontal spacing.
1694 ///
1695 /// # Returns
1696 ///
1697 /// the horizontal spacing
1698 #[doc(alias = "gtk_flow_box_get_column_spacing")]
1699 #[doc(alias = "get_column_spacing")]
1700 #[doc(alias = "column-spacing")]
1701 fn column_spacing(&self) -> u32 {
1702 unsafe { ffi::gtk_flow_box_get_column_spacing(self.as_ref().to_glib_none().0) }
1703 }
1704
1705 /// Returns whether the box is homogeneous (all children are the
1706 /// same size). See [`BoxExt::set_homogeneous()`][crate::prelude::BoxExt::set_homogeneous()].
1707 ///
1708 /// # Returns
1709 ///
1710 /// [`true`] if the box is homogeneous.
1711 #[doc(alias = "gtk_flow_box_get_homogeneous")]
1712 #[doc(alias = "get_homogeneous")]
1713 #[doc(alias = "homogeneous")]
1714 fn is_homogeneous(&self) -> bool {
1715 unsafe {
1716 from_glib(ffi::gtk_flow_box_get_homogeneous(
1717 self.as_ref().to_glib_none().0,
1718 ))
1719 }
1720 }
1721
1722 /// Gets the maximum number of children per line.
1723 ///
1724 /// # Returns
1725 ///
1726 /// the maximum number of children per line
1727 #[doc(alias = "gtk_flow_box_get_max_children_per_line")]
1728 #[doc(alias = "get_max_children_per_line")]
1729 #[doc(alias = "max-children-per-line")]
1730 fn max_children_per_line(&self) -> u32 {
1731 unsafe { ffi::gtk_flow_box_get_max_children_per_line(self.as_ref().to_glib_none().0) }
1732 }
1733
1734 /// Gets the minimum number of children per line.
1735 ///
1736 /// # Returns
1737 ///
1738 /// the minimum number of children per line
1739 #[doc(alias = "gtk_flow_box_get_min_children_per_line")]
1740 #[doc(alias = "get_min_children_per_line")]
1741 #[doc(alias = "min-children-per-line")]
1742 fn min_children_per_line(&self) -> u32 {
1743 unsafe { ffi::gtk_flow_box_get_min_children_per_line(self.as_ref().to_glib_none().0) }
1744 }
1745
1746 /// Gets the vertical spacing.
1747 ///
1748 /// # Returns
1749 ///
1750 /// the vertical spacing
1751 #[doc(alias = "gtk_flow_box_get_row_spacing")]
1752 #[doc(alias = "get_row_spacing")]
1753 #[doc(alias = "row-spacing")]
1754 fn row_spacing(&self) -> u32 {
1755 unsafe { ffi::gtk_flow_box_get_row_spacing(self.as_ref().to_glib_none().0) }
1756 }
1757
1758 /// Creates a list of all selected children.
1759 ///
1760 /// # Returns
1761 ///
1762 ///
1763 /// A `GList` containing the [`Widget`][crate::Widget] for each selected child.
1764 /// Free with `g_list_free()` when done.
1765 #[doc(alias = "gtk_flow_box_get_selected_children")]
1766 #[doc(alias = "get_selected_children")]
1767 fn selected_children(&self) -> Vec<FlowBoxChild> {
1768 unsafe {
1769 FromGlibPtrContainer::from_glib_container(ffi::gtk_flow_box_get_selected_children(
1770 self.as_ref().to_glib_none().0,
1771 ))
1772 }
1773 }
1774
1775 /// Gets the selection mode of `self`.
1776 ///
1777 /// # Returns
1778 ///
1779 /// the [`SelectionMode`][crate::SelectionMode]
1780 #[doc(alias = "gtk_flow_box_get_selection_mode")]
1781 #[doc(alias = "get_selection_mode")]
1782 #[doc(alias = "selection-mode")]
1783 fn selection_mode(&self) -> SelectionMode {
1784 unsafe {
1785 from_glib(ffi::gtk_flow_box_get_selection_mode(
1786 self.as_ref().to_glib_none().0,
1787 ))
1788 }
1789 }
1790
1791 /// Inserts the `widget` into `self` at `position`.
1792 ///
1793 /// If a sort function is set, the widget will actually be inserted
1794 /// at the calculated position and this function has the same effect
1795 /// as [`ContainerExt::add()`][crate::prelude::ContainerExt::add()].
1796 ///
1797 /// If `position` is -1, or larger than the total number of children
1798 /// in the `self`, then the `widget` will be appended to the end.
1799 /// ## `widget`
1800 /// the [`Widget`][crate::Widget] to add
1801 /// ## `position`
1802 /// the position to insert `child` in
1803 #[doc(alias = "gtk_flow_box_insert")]
1804 fn insert(&self, widget: &impl IsA<Widget>, position: i32) {
1805 unsafe {
1806 ffi::gtk_flow_box_insert(
1807 self.as_ref().to_glib_none().0,
1808 widget.as_ref().to_glib_none().0,
1809 position,
1810 );
1811 }
1812 }
1813
1814 /// Updates the filtering for all children.
1815 ///
1816 /// Call this function when the result of the filter
1817 /// function on the `self` is changed due ot an external
1818 /// factor. For instance, this would be used if the
1819 /// filter function just looked for a specific search
1820 /// term, and the entry with the string has changed.
1821 #[doc(alias = "gtk_flow_box_invalidate_filter")]
1822 fn invalidate_filter(&self) {
1823 unsafe {
1824 ffi::gtk_flow_box_invalidate_filter(self.as_ref().to_glib_none().0);
1825 }
1826 }
1827
1828 /// Updates the sorting for all children.
1829 ///
1830 /// Call this when the result of the sort function on
1831 /// `self` is changed due to an external factor.
1832 #[doc(alias = "gtk_flow_box_invalidate_sort")]
1833 fn invalidate_sort(&self) {
1834 unsafe {
1835 ffi::gtk_flow_box_invalidate_sort(self.as_ref().to_glib_none().0);
1836 }
1837 }
1838
1839 /// Select all children of `self`, if the selection
1840 /// mode allows it.
1841 #[doc(alias = "gtk_flow_box_select_all")]
1842 fn select_all(&self) {
1843 unsafe {
1844 ffi::gtk_flow_box_select_all(self.as_ref().to_glib_none().0);
1845 }
1846 }
1847
1848 /// Selects a single child of `self`, if the selection
1849 /// mode allows it.
1850 /// ## `child`
1851 /// a child of `self`
1852 #[doc(alias = "gtk_flow_box_select_child")]
1853 fn select_child(&self, child: &impl IsA<FlowBoxChild>) {
1854 unsafe {
1855 ffi::gtk_flow_box_select_child(
1856 self.as_ref().to_glib_none().0,
1857 child.as_ref().to_glib_none().0,
1858 );
1859 }
1860 }
1861
1862 /// Calls a function for each selected child.
1863 ///
1864 /// Note that the selection cannot be modified from within
1865 /// this function.
1866 /// ## `func`
1867 /// the function to call for each selected child
1868 #[doc(alias = "gtk_flow_box_selected_foreach")]
1869 fn selected_foreach<P: FnMut(&FlowBox, &FlowBoxChild)>(&self, func: P) {
1870 let mut func_data: P = func;
1871 unsafe extern "C" fn func_func<P: FnMut(&FlowBox, &FlowBoxChild)>(
1872 box_: *mut ffi::GtkFlowBox,
1873 child: *mut ffi::GtkFlowBoxChild,
1874 user_data: glib::ffi::gpointer,
1875 ) {
1876 unsafe {
1877 let box_ = from_glib_borrow(box_);
1878 let child = from_glib_borrow(child);
1879 let callback = user_data as *mut P;
1880 (*callback)(&box_, &child)
1881 }
1882 }
1883 let func = Some(func_func::<P> as _);
1884 let super_callback0: &mut P = &mut func_data;
1885 unsafe {
1886 ffi::gtk_flow_box_selected_foreach(
1887 self.as_ref().to_glib_none().0,
1888 func,
1889 super_callback0 as *mut _ as *mut _,
1890 );
1891 }
1892 }
1893
1894 /// If `single` is [`true`], children will be activated when you click
1895 /// on them, otherwise you need to double-click.
1896 /// ## `single`
1897 /// [`true`] to emit child-activated on a single click
1898 #[doc(alias = "gtk_flow_box_set_activate_on_single_click")]
1899 #[doc(alias = "activate-on-single-click")]
1900 fn set_activate_on_single_click(&self, single: bool) {
1901 unsafe {
1902 ffi::gtk_flow_box_set_activate_on_single_click(
1903 self.as_ref().to_glib_none().0,
1904 single.into_glib(),
1905 );
1906 }
1907 }
1908
1909 /// Sets the horizontal space to add between children.
1910 /// See the [`column-spacing`][struct@crate::FlowBox#column-spacing] property.
1911 /// ## `spacing`
1912 /// the spacing to use
1913 #[doc(alias = "gtk_flow_box_set_column_spacing")]
1914 #[doc(alias = "column-spacing")]
1915 fn set_column_spacing(&self, spacing: u32) {
1916 unsafe {
1917 ffi::gtk_flow_box_set_column_spacing(self.as_ref().to_glib_none().0, spacing);
1918 }
1919 }
1920
1921 /// By setting a filter function on the `self` one can decide dynamically
1922 /// which of the children to show. For instance, to implement a search
1923 /// function that only shows the children matching the search terms.
1924 ///
1925 /// The `filter_func` will be called for each child after the call, and
1926 /// it will continue to be called each time a child changes (via
1927 /// [`FlowBoxChildExt::changed()`][crate::prelude::FlowBoxChildExt::changed()]) or when [`invalidate_filter()`][Self::invalidate_filter()]
1928 /// is called.
1929 ///
1930 /// Note that using a filter function is incompatible with using a model
1931 /// (see [`bind_model()`][Self::bind_model()]).
1932 /// ## `filter_func`
1933 /// callback that
1934 /// lets you filter which children to show
1935 #[doc(alias = "gtk_flow_box_set_filter_func")]
1936 fn set_filter_func(&self, filter_func: Option<Box_<dyn Fn(&FlowBoxChild) -> bool + 'static>>) {
1937 let filter_func_data: Box_<Option<Box_<dyn Fn(&FlowBoxChild) -> bool + 'static>>> =
1938 Box_::new(filter_func);
1939 unsafe extern "C" fn filter_func_func(
1940 child: *mut ffi::GtkFlowBoxChild,
1941 user_data: glib::ffi::gpointer,
1942 ) -> glib::ffi::gboolean {
1943 unsafe {
1944 let child = from_glib_borrow(child);
1945 let callback =
1946 &*(user_data as *mut Option<Box_<dyn Fn(&FlowBoxChild) -> bool + 'static>>);
1947 if let Some(ref callback) = *callback {
1948 callback(&child)
1949 } else {
1950 panic!("cannot get closure...")
1951 }
1952 .into_glib()
1953 }
1954 }
1955 let filter_func = if filter_func_data.is_some() {
1956 Some(filter_func_func as _)
1957 } else {
1958 None
1959 };
1960 unsafe extern "C" fn destroy_func(data: glib::ffi::gpointer) {
1961 unsafe {
1962 let _callback = Box_::from_raw(
1963 data as *mut Option<Box_<dyn Fn(&FlowBoxChild) -> bool + 'static>>,
1964 );
1965 }
1966 }
1967 let destroy_call3 = Some(destroy_func as _);
1968 let super_callback0: Box_<Option<Box_<dyn Fn(&FlowBoxChild) -> bool + 'static>>> =
1969 filter_func_data;
1970 unsafe {
1971 ffi::gtk_flow_box_set_filter_func(
1972 self.as_ref().to_glib_none().0,
1973 filter_func,
1974 Box_::into_raw(super_callback0) as *mut _,
1975 destroy_call3,
1976 );
1977 }
1978 }
1979
1980 /// Hooks up an adjustment to focus handling in `self`.
1981 /// The adjustment is also used for autoscrolling during
1982 /// rubberband selection. See [`ScrolledWindowExt::hadjustment()`][crate::prelude::ScrolledWindowExt::hadjustment()]
1983 /// for a typical way of obtaining the adjustment, and
1984 /// [`set_vadjustment()`][Self::set_vadjustment()]for setting the vertical
1985 /// adjustment.
1986 ///
1987 /// The adjustments have to be in pixel units and in the same
1988 /// coordinate system as the allocation for immediate children
1989 /// of the box.
1990 /// ## `adjustment`
1991 /// an adjustment which should be adjusted
1992 /// when the focus is moved among the descendents of `container`
1993 #[doc(alias = "gtk_flow_box_set_hadjustment")]
1994 fn set_hadjustment(&self, adjustment: &impl IsA<Adjustment>) {
1995 unsafe {
1996 ffi::gtk_flow_box_set_hadjustment(
1997 self.as_ref().to_glib_none().0,
1998 adjustment.as_ref().to_glib_none().0,
1999 );
2000 }
2001 }
2002
2003 /// Sets the [`homogeneous`][struct@crate::FlowBox#homogeneous] property of `self`, controlling
2004 /// whether or not all children of `self` are given equal space
2005 /// in the box.
2006 /// ## `homogeneous`
2007 /// [`true`] to create equal allotments,
2008 /// [`false`] for variable allotments
2009 #[doc(alias = "gtk_flow_box_set_homogeneous")]
2010 #[doc(alias = "homogeneous")]
2011 fn set_homogeneous(&self, homogeneous: bool) {
2012 unsafe {
2013 ffi::gtk_flow_box_set_homogeneous(
2014 self.as_ref().to_glib_none().0,
2015 homogeneous.into_glib(),
2016 );
2017 }
2018 }
2019
2020 /// Sets the maximum number of children to request and
2021 /// allocate space for in `self`’s orientation.
2022 ///
2023 /// Setting the maximum number of children per line
2024 /// limits the overall natural size request to be no more
2025 /// than `n_children` children long in the given orientation.
2026 /// ## `n_children`
2027 /// the maximum number of children per line
2028 #[doc(alias = "gtk_flow_box_set_max_children_per_line")]
2029 #[doc(alias = "max-children-per-line")]
2030 fn set_max_children_per_line(&self, n_children: u32) {
2031 unsafe {
2032 ffi::gtk_flow_box_set_max_children_per_line(self.as_ref().to_glib_none().0, n_children);
2033 }
2034 }
2035
2036 /// Sets the minimum number of children to line up
2037 /// in `self`’s orientation before flowing.
2038 /// ## `n_children`
2039 /// the minimum number of children per line
2040 #[doc(alias = "gtk_flow_box_set_min_children_per_line")]
2041 #[doc(alias = "min-children-per-line")]
2042 fn set_min_children_per_line(&self, n_children: u32) {
2043 unsafe {
2044 ffi::gtk_flow_box_set_min_children_per_line(self.as_ref().to_glib_none().0, n_children);
2045 }
2046 }
2047
2048 /// Sets the vertical space to add between children.
2049 /// See the [`row-spacing`][struct@crate::FlowBox#row-spacing] property.
2050 /// ## `spacing`
2051 /// the spacing to use
2052 #[doc(alias = "gtk_flow_box_set_row_spacing")]
2053 #[doc(alias = "row-spacing")]
2054 fn set_row_spacing(&self, spacing: u32) {
2055 unsafe {
2056 ffi::gtk_flow_box_set_row_spacing(self.as_ref().to_glib_none().0, spacing);
2057 }
2058 }
2059
2060 /// Sets how selection works in `self`.
2061 /// See [`SelectionMode`][crate::SelectionMode] for details.
2062 /// ## `mode`
2063 /// the new selection mode
2064 #[doc(alias = "gtk_flow_box_set_selection_mode")]
2065 #[doc(alias = "selection-mode")]
2066 fn set_selection_mode(&self, mode: SelectionMode) {
2067 unsafe {
2068 ffi::gtk_flow_box_set_selection_mode(self.as_ref().to_glib_none().0, mode.into_glib());
2069 }
2070 }
2071
2072 /// By setting a sort function on the `self`, one can dynamically
2073 /// reorder the children of the box, based on the contents of
2074 /// the children.
2075 ///
2076 /// The `sort_func` will be called for each child after the call,
2077 /// and will continue to be called each time a child changes (via
2078 /// [`FlowBoxChildExt::changed()`][crate::prelude::FlowBoxChildExt::changed()]) and when [`invalidate_sort()`][Self::invalidate_sort()]
2079 /// is called.
2080 ///
2081 /// Note that using a sort function is incompatible with using a model
2082 /// (see [`bind_model()`][Self::bind_model()]).
2083 /// ## `sort_func`
2084 /// the sort function
2085 #[doc(alias = "gtk_flow_box_set_sort_func")]
2086 fn set_sort_func(
2087 &self,
2088 sort_func: Option<Box_<dyn Fn(&FlowBoxChild, &FlowBoxChild) -> i32 + 'static>>,
2089 ) {
2090 let sort_func_data: Box_<
2091 Option<Box_<dyn Fn(&FlowBoxChild, &FlowBoxChild) -> i32 + 'static>>,
2092 > = Box_::new(sort_func);
2093 unsafe extern "C" fn sort_func_func(
2094 child1: *mut ffi::GtkFlowBoxChild,
2095 child2: *mut ffi::GtkFlowBoxChild,
2096 user_data: glib::ffi::gpointer,
2097 ) -> std::ffi::c_int {
2098 unsafe {
2099 let child1 = from_glib_borrow(child1);
2100 let child2 = from_glib_borrow(child2);
2101 let callback = &*(user_data
2102 as *mut Option<Box_<dyn Fn(&FlowBoxChild, &FlowBoxChild) -> i32 + 'static>>);
2103 if let Some(ref callback) = *callback {
2104 callback(&child1, &child2)
2105 } else {
2106 panic!("cannot get closure...")
2107 }
2108 }
2109 }
2110 let sort_func = if sort_func_data.is_some() {
2111 Some(sort_func_func as _)
2112 } else {
2113 None
2114 };
2115 unsafe extern "C" fn destroy_func(data: glib::ffi::gpointer) {
2116 unsafe {
2117 let _callback = Box_::from_raw(
2118 data as *mut Option<
2119 Box_<dyn Fn(&FlowBoxChild, &FlowBoxChild) -> i32 + 'static>,
2120 >,
2121 );
2122 }
2123 }
2124 let destroy_call3 = Some(destroy_func as _);
2125 let super_callback0: Box_<
2126 Option<Box_<dyn Fn(&FlowBoxChild, &FlowBoxChild) -> i32 + 'static>>,
2127 > = sort_func_data;
2128 unsafe {
2129 ffi::gtk_flow_box_set_sort_func(
2130 self.as_ref().to_glib_none().0,
2131 sort_func,
2132 Box_::into_raw(super_callback0) as *mut _,
2133 destroy_call3,
2134 );
2135 }
2136 }
2137
2138 /// Hooks up an adjustment to focus handling in `self`.
2139 /// The adjustment is also used for autoscrolling during
2140 /// rubberband selection. See [`ScrolledWindowExt::vadjustment()`][crate::prelude::ScrolledWindowExt::vadjustment()]
2141 /// for a typical way of obtaining the adjustment, and
2142 /// [`set_hadjustment()`][Self::set_hadjustment()]for setting the horizontal
2143 /// adjustment.
2144 ///
2145 /// The adjustments have to be in pixel units and in the same
2146 /// coordinate system as the allocation for immediate children
2147 /// of the box.
2148 /// ## `adjustment`
2149 /// an adjustment which should be adjusted
2150 /// when the focus is moved among the descendents of `container`
2151 #[doc(alias = "gtk_flow_box_set_vadjustment")]
2152 fn set_vadjustment(&self, adjustment: &impl IsA<Adjustment>) {
2153 unsafe {
2154 ffi::gtk_flow_box_set_vadjustment(
2155 self.as_ref().to_glib_none().0,
2156 adjustment.as_ref().to_glib_none().0,
2157 );
2158 }
2159 }
2160
2161 /// Unselect all children of `self`, if the selection
2162 /// mode allows it.
2163 #[doc(alias = "gtk_flow_box_unselect_all")]
2164 fn unselect_all(&self) {
2165 unsafe {
2166 ffi::gtk_flow_box_unselect_all(self.as_ref().to_glib_none().0);
2167 }
2168 }
2169
2170 /// Unselects a single child of `self`, if the selection
2171 /// mode allows it.
2172 /// ## `child`
2173 /// a child of `self`
2174 #[doc(alias = "gtk_flow_box_unselect_child")]
2175 fn unselect_child(&self, child: &impl IsA<FlowBoxChild>) {
2176 unsafe {
2177 ffi::gtk_flow_box_unselect_child(
2178 self.as_ref().to_glib_none().0,
2179 child.as_ref().to_glib_none().0,
2180 );
2181 }
2182 }
2183
2184 /// The ::activate-cursor-child signal is a
2185 /// [keybinding signal][GtkBindingSignal]
2186 /// which gets emitted when the user activates the `box_`.
2187 #[doc(alias = "activate-cursor-child")]
2188 fn connect_activate_cursor_child<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2189 unsafe extern "C" fn activate_cursor_child_trampoline<
2190 P: IsA<FlowBox>,
2191 F: Fn(&P) + 'static,
2192 >(
2193 this: *mut ffi::GtkFlowBox,
2194 f: glib::ffi::gpointer,
2195 ) {
2196 unsafe {
2197 let f: &F = &*(f as *const F);
2198 f(FlowBox::from_glib_borrow(this).unsafe_cast_ref())
2199 }
2200 }
2201 unsafe {
2202 let f: Box_<F> = Box_::new(f);
2203 connect_raw(
2204 self.as_ptr() as *mut _,
2205 c"activate-cursor-child".as_ptr(),
2206 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2207 activate_cursor_child_trampoline::<Self, F> as *const (),
2208 )),
2209 Box_::into_raw(f),
2210 )
2211 }
2212 }
2213
2214 fn emit_activate_cursor_child(&self) {
2215 self.emit_by_name::<()>("activate-cursor-child", &[]);
2216 }
2217
2218 /// The ::child-activated signal is emitted when a child has been
2219 /// activated by the user.
2220 /// ## `child`
2221 /// the child that is activated
2222 #[doc(alias = "child-activated")]
2223 fn connect_child_activated<F: Fn(&Self, &FlowBoxChild) + 'static>(
2224 &self,
2225 f: F,
2226 ) -> SignalHandlerId {
2227 unsafe extern "C" fn child_activated_trampoline<
2228 P: IsA<FlowBox>,
2229 F: Fn(&P, &FlowBoxChild) + 'static,
2230 >(
2231 this: *mut ffi::GtkFlowBox,
2232 child: *mut ffi::GtkFlowBoxChild,
2233 f: glib::ffi::gpointer,
2234 ) {
2235 unsafe {
2236 let f: &F = &*(f as *const F);
2237 f(
2238 FlowBox::from_glib_borrow(this).unsafe_cast_ref(),
2239 &from_glib_borrow(child),
2240 )
2241 }
2242 }
2243 unsafe {
2244 let f: Box_<F> = Box_::new(f);
2245 connect_raw(
2246 self.as_ptr() as *mut _,
2247 c"child-activated".as_ptr(),
2248 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2249 child_activated_trampoline::<Self, F> as *const (),
2250 )),
2251 Box_::into_raw(f),
2252 )
2253 }
2254 }
2255
2256 /// The ::move-cursor signal is a
2257 /// [keybinding signal][GtkBindingSignal]
2258 /// which gets emitted when the user initiates a cursor movement.
2259 ///
2260 /// Applications should not connect to it, but may emit it with
2261 /// `g_signal_emit_by_name()` if they need to control the cursor
2262 /// programmatically.
2263 ///
2264 /// The default bindings for this signal come in two variants,
2265 /// the variant with the Shift modifier extends the selection,
2266 /// the variant without the Shift modifer does not.
2267 /// There are too many key combinations to list them all here.
2268 /// - Arrow keys move by individual children
2269 /// - Home/End keys move to the ends of the box
2270 /// - PageUp/PageDown keys move vertically by pages
2271 /// ## `step`
2272 /// the granularity fo the move, as a [`MovementStep`][crate::MovementStep]
2273 /// ## `count`
2274 /// the number of `step` units to move
2275 ///
2276 /// # Returns
2277 ///
2278 /// [`true`] to stop other handlers from being invoked for the event.
2279 /// [`false`] to propagate the event further.
2280 #[doc(alias = "move-cursor")]
2281 fn connect_move_cursor<F: Fn(&Self, MovementStep, i32) -> bool + 'static>(
2282 &self,
2283 f: F,
2284 ) -> SignalHandlerId {
2285 unsafe extern "C" fn move_cursor_trampoline<
2286 P: IsA<FlowBox>,
2287 F: Fn(&P, MovementStep, i32) -> bool + 'static,
2288 >(
2289 this: *mut ffi::GtkFlowBox,
2290 step: ffi::GtkMovementStep,
2291 count: std::ffi::c_int,
2292 f: glib::ffi::gpointer,
2293 ) -> glib::ffi::gboolean {
2294 unsafe {
2295 let f: &F = &*(f as *const F);
2296 f(
2297 FlowBox::from_glib_borrow(this).unsafe_cast_ref(),
2298 from_glib(step),
2299 count,
2300 )
2301 .into_glib()
2302 }
2303 }
2304 unsafe {
2305 let f: Box_<F> = Box_::new(f);
2306 connect_raw(
2307 self.as_ptr() as *mut _,
2308 c"move-cursor".as_ptr(),
2309 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2310 move_cursor_trampoline::<Self, F> as *const (),
2311 )),
2312 Box_::into_raw(f),
2313 )
2314 }
2315 }
2316
2317 fn emit_move_cursor(&self, step: MovementStep, count: i32) -> bool {
2318 self.emit_by_name("move-cursor", &[&step, &count])
2319 }
2320
2321 /// The ::select-all signal is a
2322 /// [keybinding signal][GtkBindingSignal]
2323 /// which gets emitted to select all children of the box, if
2324 /// the selection mode permits it.
2325 ///
2326 /// The default bindings for this signal is Ctrl-a.
2327 #[doc(alias = "select-all")]
2328 fn connect_select_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2329 unsafe extern "C" fn select_all_trampoline<P: IsA<FlowBox>, F: Fn(&P) + 'static>(
2330 this: *mut ffi::GtkFlowBox,
2331 f: glib::ffi::gpointer,
2332 ) {
2333 unsafe {
2334 let f: &F = &*(f as *const F);
2335 f(FlowBox::from_glib_borrow(this).unsafe_cast_ref())
2336 }
2337 }
2338 unsafe {
2339 let f: Box_<F> = Box_::new(f);
2340 connect_raw(
2341 self.as_ptr() as *mut _,
2342 c"select-all".as_ptr(),
2343 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2344 select_all_trampoline::<Self, F> as *const (),
2345 )),
2346 Box_::into_raw(f),
2347 )
2348 }
2349 }
2350
2351 fn emit_select_all(&self) {
2352 self.emit_by_name::<()>("select-all", &[]);
2353 }
2354
2355 /// The ::selected-children-changed signal is emitted when the
2356 /// set of selected children changes.
2357 ///
2358 /// Use [`selected_foreach()`][Self::selected_foreach()] or
2359 /// [`selected_children()`][Self::selected_children()] to obtain the
2360 /// selected children.
2361 #[doc(alias = "selected-children-changed")]
2362 fn connect_selected_children_changed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2363 unsafe extern "C" fn selected_children_changed_trampoline<
2364 P: IsA<FlowBox>,
2365 F: Fn(&P) + 'static,
2366 >(
2367 this: *mut ffi::GtkFlowBox,
2368 f: glib::ffi::gpointer,
2369 ) {
2370 unsafe {
2371 let f: &F = &*(f as *const F);
2372 f(FlowBox::from_glib_borrow(this).unsafe_cast_ref())
2373 }
2374 }
2375 unsafe {
2376 let f: Box_<F> = Box_::new(f);
2377 connect_raw(
2378 self.as_ptr() as *mut _,
2379 c"selected-children-changed".as_ptr(),
2380 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2381 selected_children_changed_trampoline::<Self, F> as *const (),
2382 )),
2383 Box_::into_raw(f),
2384 )
2385 }
2386 }
2387
2388 /// The ::toggle-cursor-child signal is a
2389 /// [keybinding signal][GtkBindingSignal]
2390 /// which toggles the selection of the child that has the focus.
2391 ///
2392 /// The default binding for this signal is Ctrl-Space.
2393 #[doc(alias = "toggle-cursor-child")]
2394 fn connect_toggle_cursor_child<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2395 unsafe extern "C" fn toggle_cursor_child_trampoline<
2396 P: IsA<FlowBox>,
2397 F: Fn(&P) + 'static,
2398 >(
2399 this: *mut ffi::GtkFlowBox,
2400 f: glib::ffi::gpointer,
2401 ) {
2402 unsafe {
2403 let f: &F = &*(f as *const F);
2404 f(FlowBox::from_glib_borrow(this).unsafe_cast_ref())
2405 }
2406 }
2407 unsafe {
2408 let f: Box_<F> = Box_::new(f);
2409 connect_raw(
2410 self.as_ptr() as *mut _,
2411 c"toggle-cursor-child".as_ptr(),
2412 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2413 toggle_cursor_child_trampoline::<Self, F> as *const (),
2414 )),
2415 Box_::into_raw(f),
2416 )
2417 }
2418 }
2419
2420 fn emit_toggle_cursor_child(&self) {
2421 self.emit_by_name::<()>("toggle-cursor-child", &[]);
2422 }
2423
2424 /// The ::unselect-all signal is a
2425 /// [keybinding signal][GtkBindingSignal]
2426 /// which gets emitted to unselect all children of the box, if
2427 /// the selection mode permits it.
2428 ///
2429 /// The default bindings for this signal is Ctrl-Shift-a.
2430 #[doc(alias = "unselect-all")]
2431 fn connect_unselect_all<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2432 unsafe extern "C" fn unselect_all_trampoline<P: IsA<FlowBox>, F: Fn(&P) + 'static>(
2433 this: *mut ffi::GtkFlowBox,
2434 f: glib::ffi::gpointer,
2435 ) {
2436 unsafe {
2437 let f: &F = &*(f as *const F);
2438 f(FlowBox::from_glib_borrow(this).unsafe_cast_ref())
2439 }
2440 }
2441 unsafe {
2442 let f: Box_<F> = Box_::new(f);
2443 connect_raw(
2444 self.as_ptr() as *mut _,
2445 c"unselect-all".as_ptr(),
2446 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2447 unselect_all_trampoline::<Self, F> as *const (),
2448 )),
2449 Box_::into_raw(f),
2450 )
2451 }
2452 }
2453
2454 fn emit_unselect_all(&self) {
2455 self.emit_by_name::<()>("unselect-all", &[]);
2456 }
2457
2458 #[doc(alias = "activate-on-single-click")]
2459 fn connect_activate_on_single_click_notify<F: Fn(&Self) + 'static>(
2460 &self,
2461 f: F,
2462 ) -> SignalHandlerId {
2463 unsafe extern "C" fn notify_activate_on_single_click_trampoline<
2464 P: IsA<FlowBox>,
2465 F: Fn(&P) + 'static,
2466 >(
2467 this: *mut ffi::GtkFlowBox,
2468 _param_spec: glib::ffi::gpointer,
2469 f: glib::ffi::gpointer,
2470 ) {
2471 unsafe {
2472 let f: &F = &*(f as *const F);
2473 f(FlowBox::from_glib_borrow(this).unsafe_cast_ref())
2474 }
2475 }
2476 unsafe {
2477 let f: Box_<F> = Box_::new(f);
2478 connect_raw(
2479 self.as_ptr() as *mut _,
2480 c"notify::activate-on-single-click".as_ptr(),
2481 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2482 notify_activate_on_single_click_trampoline::<Self, F> as *const (),
2483 )),
2484 Box_::into_raw(f),
2485 )
2486 }
2487 }
2488
2489 #[doc(alias = "column-spacing")]
2490 fn connect_column_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2491 unsafe extern "C" fn notify_column_spacing_trampoline<
2492 P: IsA<FlowBox>,
2493 F: Fn(&P) + 'static,
2494 >(
2495 this: *mut ffi::GtkFlowBox,
2496 _param_spec: glib::ffi::gpointer,
2497 f: glib::ffi::gpointer,
2498 ) {
2499 unsafe {
2500 let f: &F = &*(f as *const F);
2501 f(FlowBox::from_glib_borrow(this).unsafe_cast_ref())
2502 }
2503 }
2504 unsafe {
2505 let f: Box_<F> = Box_::new(f);
2506 connect_raw(
2507 self.as_ptr() as *mut _,
2508 c"notify::column-spacing".as_ptr(),
2509 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2510 notify_column_spacing_trampoline::<Self, F> as *const (),
2511 )),
2512 Box_::into_raw(f),
2513 )
2514 }
2515 }
2516
2517 #[doc(alias = "homogeneous")]
2518 fn connect_homogeneous_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2519 unsafe extern "C" fn notify_homogeneous_trampoline<P: IsA<FlowBox>, F: Fn(&P) + 'static>(
2520 this: *mut ffi::GtkFlowBox,
2521 _param_spec: glib::ffi::gpointer,
2522 f: glib::ffi::gpointer,
2523 ) {
2524 unsafe {
2525 let f: &F = &*(f as *const F);
2526 f(FlowBox::from_glib_borrow(this).unsafe_cast_ref())
2527 }
2528 }
2529 unsafe {
2530 let f: Box_<F> = Box_::new(f);
2531 connect_raw(
2532 self.as_ptr() as *mut _,
2533 c"notify::homogeneous".as_ptr(),
2534 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2535 notify_homogeneous_trampoline::<Self, F> as *const (),
2536 )),
2537 Box_::into_raw(f),
2538 )
2539 }
2540 }
2541
2542 #[doc(alias = "max-children-per-line")]
2543 fn connect_max_children_per_line_notify<F: Fn(&Self) + 'static>(
2544 &self,
2545 f: F,
2546 ) -> SignalHandlerId {
2547 unsafe extern "C" fn notify_max_children_per_line_trampoline<
2548 P: IsA<FlowBox>,
2549 F: Fn(&P) + 'static,
2550 >(
2551 this: *mut ffi::GtkFlowBox,
2552 _param_spec: glib::ffi::gpointer,
2553 f: glib::ffi::gpointer,
2554 ) {
2555 unsafe {
2556 let f: &F = &*(f as *const F);
2557 f(FlowBox::from_glib_borrow(this).unsafe_cast_ref())
2558 }
2559 }
2560 unsafe {
2561 let f: Box_<F> = Box_::new(f);
2562 connect_raw(
2563 self.as_ptr() as *mut _,
2564 c"notify::max-children-per-line".as_ptr(),
2565 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2566 notify_max_children_per_line_trampoline::<Self, F> as *const (),
2567 )),
2568 Box_::into_raw(f),
2569 )
2570 }
2571 }
2572
2573 #[doc(alias = "min-children-per-line")]
2574 fn connect_min_children_per_line_notify<F: Fn(&Self) + 'static>(
2575 &self,
2576 f: F,
2577 ) -> SignalHandlerId {
2578 unsafe extern "C" fn notify_min_children_per_line_trampoline<
2579 P: IsA<FlowBox>,
2580 F: Fn(&P) + 'static,
2581 >(
2582 this: *mut ffi::GtkFlowBox,
2583 _param_spec: glib::ffi::gpointer,
2584 f: glib::ffi::gpointer,
2585 ) {
2586 unsafe {
2587 let f: &F = &*(f as *const F);
2588 f(FlowBox::from_glib_borrow(this).unsafe_cast_ref())
2589 }
2590 }
2591 unsafe {
2592 let f: Box_<F> = Box_::new(f);
2593 connect_raw(
2594 self.as_ptr() as *mut _,
2595 c"notify::min-children-per-line".as_ptr(),
2596 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2597 notify_min_children_per_line_trampoline::<Self, F> as *const (),
2598 )),
2599 Box_::into_raw(f),
2600 )
2601 }
2602 }
2603
2604 #[doc(alias = "row-spacing")]
2605 fn connect_row_spacing_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2606 unsafe extern "C" fn notify_row_spacing_trampoline<P: IsA<FlowBox>, F: Fn(&P) + 'static>(
2607 this: *mut ffi::GtkFlowBox,
2608 _param_spec: glib::ffi::gpointer,
2609 f: glib::ffi::gpointer,
2610 ) {
2611 unsafe {
2612 let f: &F = &*(f as *const F);
2613 f(FlowBox::from_glib_borrow(this).unsafe_cast_ref())
2614 }
2615 }
2616 unsafe {
2617 let f: Box_<F> = Box_::new(f);
2618 connect_raw(
2619 self.as_ptr() as *mut _,
2620 c"notify::row-spacing".as_ptr(),
2621 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2622 notify_row_spacing_trampoline::<Self, F> as *const (),
2623 )),
2624 Box_::into_raw(f),
2625 )
2626 }
2627 }
2628
2629 #[doc(alias = "selection-mode")]
2630 fn connect_selection_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2631 unsafe extern "C" fn notify_selection_mode_trampoline<
2632 P: IsA<FlowBox>,
2633 F: Fn(&P) + 'static,
2634 >(
2635 this: *mut ffi::GtkFlowBox,
2636 _param_spec: glib::ffi::gpointer,
2637 f: glib::ffi::gpointer,
2638 ) {
2639 unsafe {
2640 let f: &F = &*(f as *const F);
2641 f(FlowBox::from_glib_borrow(this).unsafe_cast_ref())
2642 }
2643 }
2644 unsafe {
2645 let f: Box_<F> = Box_::new(f);
2646 connect_raw(
2647 self.as_ptr() as *mut _,
2648 c"notify::selection-mode".as_ptr(),
2649 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2650 notify_selection_mode_trampoline::<Self, F> as *const (),
2651 )),
2652 Box_::into_raw(f),
2653 )
2654 }
2655 }
2656}
2657
2658impl<O: IsA<FlowBox>> FlowBoxExt for O {}