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