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