gtk/auto/flow_box_child.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::{Align, Bin, Buildable, Container, ResizeMode, Widget, ffi};
6use glib::{
7 object::ObjectType as _,
8 prelude::*,
9 signal::{SignalHandlerId, connect_raw},
10 translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15 ///
16 ///
17 /// ## Signals
18 ///
19 ///
20 /// #### `activate`
21 /// The ::activate signal is emitted when the user activates
22 /// a child widget in a [`FlowBox`][crate::FlowBox], either by clicking or
23 /// double-clicking, or by using the Space or Enter key.
24 ///
25 /// While this signal is used as a
26 /// [keybinding signal][GtkBindingSignal],
27 /// it can be used by applications for their own purposes.
28 ///
29 /// Action
30 /// <details><summary><h4>Container</h4></summary>
31 ///
32 ///
33 /// #### `add`
34 ///
35 ///
36 ///
37 /// #### `check-resize`
38 ///
39 ///
40 ///
41 /// #### `remove`
42 ///
43 ///
44 ///
45 /// #### `set-focus-child`
46 ///
47 /// </details>
48 /// <details><summary><h4>Widget</h4></summary>
49 ///
50 ///
51 /// #### `accel-closures-changed`
52 ///
53 ///
54 ///
55 /// #### `button-press-event`
56 /// The ::button-press-event signal will be emitted when a button
57 /// (typically from a mouse) is pressed.
58 ///
59 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
60 /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
61 ///
62 /// This signal will be sent to the grab widget if there is one.
63 ///
64 ///
65 ///
66 ///
67 /// #### `button-release-event`
68 /// The ::button-release-event signal will be emitted when a button
69 /// (typically from a mouse) is released.
70 ///
71 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
72 /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
73 ///
74 /// This signal will be sent to the grab widget if there is one.
75 ///
76 ///
77 ///
78 ///
79 /// #### `can-activate-accel`
80 /// Determines whether an accelerator that activates the signal
81 /// identified by `signal_id` can currently be activated.
82 /// This signal is present to allow applications and derived
83 /// widgets to override the default [`Widget`][crate::Widget] handling
84 /// for determining whether an accelerator can be activated.
85 ///
86 ///
87 ///
88 ///
89 /// #### `child-notify`
90 /// The ::child-notify signal is emitted for each
91 /// [child property][child-properties] that has
92 /// changed on an object. The signal's detail holds the property name.
93 ///
94 /// Detailed
95 ///
96 ///
97 /// #### `composited-changed`
98 /// The ::composited-changed signal is emitted when the composited
99 /// status of `widgets` screen changes.
100 /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
101 ///
102 /// Action
103 ///
104 ///
105 /// #### `configure-event`
106 /// The ::configure-event signal will be emitted when the size, position or
107 /// stacking of the `widget`'s window has changed.
108 ///
109 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
110 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
111 /// automatically for all new windows.
112 ///
113 ///
114 ///
115 ///
116 /// #### `damage-event`
117 /// Emitted when a redirected window belonging to `widget` gets drawn into.
118 /// The region/area members of the event shows what area of the redirected
119 /// drawable was drawn into.
120 ///
121 ///
122 ///
123 ///
124 /// #### `delete-event`
125 /// The ::delete-event signal is emitted if a user requests that
126 /// a toplevel window is closed. The default handler for this signal
127 /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
128 /// this signal will cause the window to be hidden instead, so that
129 /// it can later be shown again without reconstructing it.
130 ///
131 ///
132 ///
133 ///
134 /// #### `destroy`
135 /// Signals that all holders of a reference to the widget should release
136 /// the reference that they hold. May result in finalization of the widget
137 /// if all references are released.
138 ///
139 /// This signal is not suitable for saving widget state.
140 ///
141 ///
142 ///
143 ///
144 /// #### `destroy-event`
145 /// The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
146 /// You rarely get this signal, because most widgets disconnect themselves
147 /// from their window before they destroy it, so no widget owns the
148 /// window at destroy time.
149 ///
150 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
151 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
152 /// automatically for all new windows.
153 ///
154 ///
155 ///
156 ///
157 /// #### `direction-changed`
158 /// The ::direction-changed signal is emitted when the text direction
159 /// of a widget changes.
160 ///
161 ///
162 ///
163 ///
164 /// #### `drag-begin`
165 /// The ::drag-begin signal is emitted on the drag source when a drag is
166 /// started. A typical reason to connect to this signal is to set up a
167 /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
168 ///
169 /// Note that some widgets set up a drag icon in the default handler of
170 /// this signal, so you may have to use `g_signal_connect_after()` to
171 /// override what the default handler did.
172 ///
173 ///
174 ///
175 ///
176 /// #### `drag-data-delete`
177 /// The ::drag-data-delete signal is emitted on the drag source when a drag
178 /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
179 /// handler is responsible for deleting the data that has been dropped. What
180 /// "delete" means depends on the context of the drag operation.
181 ///
182 ///
183 ///
184 ///
185 /// #### `drag-data-get`
186 /// The ::drag-data-get signal is emitted on the drag source when the drop
187 /// site requests the data which is dragged. It is the responsibility of
188 /// the signal handler to fill `data` with the data in the format which
189 /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
190 /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
191 ///
192 ///
193 ///
194 ///
195 /// #### `drag-data-received`
196 /// format == 8))
197 /// {
198 /// GdkDragAction action;
199 ///
200 /// // handle data here
201 ///
202 /// action = gdk_drag_context_get_selected_action (context);
203 /// if (action == GDK_ACTION_ASK)
204 /// {
205 /// GtkWidget *dialog;
206 /// gint response;
207 ///
208 /// dialog = gtk_message_dialog_new (NULL,
209 /// GTK_DIALOG_MODAL |
210 /// GTK_DIALOG_DESTROY_WITH_PARENT,
211 /// GTK_MESSAGE_INFO,
212 /// GTK_BUTTONS_YES_NO,
213 /// "Move the data ?\n");
214 /// response = gtk_dialog_run (GTK_DIALOG (dialog));
215 /// gtk_widget_destroy (dialog);
216 ///
217 /// if (response == GTK_RESPONSE_YES)
218 /// action = GDK_ACTION_MOVE;
219 /// else
220 /// action = GDK_ACTION_COPY;
221 /// }
222 ///
223 /// gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
224 /// }
225 /// else
226 /// gtk_drag_finish (context, FALSE, FALSE, time);
227 /// }
228 /// ]|
229 ///
230 ///
231 ///
232 ///
233 /// #### `drag-drop`
234 /// The ::drag-drop signal is emitted on the drop site when the user drops
235 /// the data onto the widget. The signal handler must determine whether
236 /// the cursor position is in a drop zone or not. If it is not in a drop
237 /// zone, it returns [`false`] and no further processing is necessary.
238 /// Otherwise, the handler returns [`true`]. In this case, the handler must
239 /// ensure that `gtk_drag_finish()` is called to let the source know that
240 /// the drop is done. The call to `gtk_drag_finish()` can be done either
241 /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
242 /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
243 /// or more of the supported targets.
244 ///
245 ///
246 ///
247 ///
248 /// #### `drag-end`
249 /// The ::drag-end signal is emitted on the drag source when a drag is
250 /// finished. A typical reason to connect to this signal is to undo
251 /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
252 ///
253 ///
254 ///
255 ///
256 /// #### `drag-failed`
257 /// The ::drag-failed signal is emitted on the drag source when a drag has
258 /// failed. The signal handler may hook custom code to handle a failed DnD
259 /// operation based on the type of error, it returns [`true`] is the failure has
260 /// been already handled (not showing the default "drag operation failed"
261 /// animation), otherwise it returns [`false`].
262 ///
263 ///
264 ///
265 ///
266 /// #### `drag-leave`
267 /// The ::drag-leave signal is emitted on the drop site when the cursor
268 /// leaves the widget. A typical reason to connect to this signal is to
269 /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
270 /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
271 ///
272 ///
273 /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
274 /// ::drag-drop signal, for instance to allow cleaning up of a preview item
275 /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
276 ///
277 ///
278 ///
279 ///
280 /// #### `drag-motion`
281 /// suggested_action,
282 /// time);
283 /// }
284 /// else
285 /// {
286 /// // accept the drop
287 /// }
288 /// }
289 /// ]|
290 ///
291 ///
292 ///
293 ///
294 /// #### `draw`
295 /// This signal is emitted when a widget is supposed to render itself.
296 /// The `widget`'s top left corner must be painted at the origin of
297 /// the passed in context and be sized to the values returned by
298 /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
299 /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
300 ///
301 /// Signal handlers connected to this signal can modify the cairo
302 /// context passed as `cr` in any way they like and don't need to
303 /// restore it. The signal emission takes care of calling `cairo_save()`
304 /// before and `cairo_restore()` after invoking the handler.
305 ///
306 /// The signal handler will get a `cr` with a clip region already set to the
307 /// widget's dirty region, i.e. to the area that needs repainting. Complicated
308 /// widgets that want to avoid redrawing themselves completely can get the full
309 /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
310 /// get a finer-grained representation of the dirty region with
311 /// `cairo_copy_clip_rectangle_list()`.
312 ///
313 ///
314 ///
315 ///
316 /// #### `enter-notify-event`
317 /// The ::enter-notify-event will be emitted when the pointer enters
318 /// the `widget`'s window.
319 ///
320 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
321 /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
322 ///
323 /// This signal will be sent to the grab widget if there is one.
324 ///
325 ///
326 ///
327 ///
328 /// #### `event`
329 /// The GTK+ main loop will emit three signals for each GDK event delivered
330 /// to a widget: one generic ::event signal, another, more specific,
331 /// signal that matches the type of event delivered (e.g.
332 /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
333 /// [`event-after`][struct@crate::Widget#event-after] signal.
334 ///
335 ///
336 ///
337 ///
338 /// #### `event-after`
339 /// After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
340 /// the second more specific signal, ::event-after will be emitted
341 /// regardless of the previous two signals handlers return values.
342 ///
343 ///
344 ///
345 ///
346 /// #### `focus`
347 ///
348 ///
349 ///
350 /// #### `focus-in-event`
351 /// The ::focus-in-event signal will be emitted when the keyboard focus
352 /// enters the `widget`'s window.
353 ///
354 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
355 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
356 ///
357 ///
358 ///
359 ///
360 /// #### `focus-out-event`
361 /// The ::focus-out-event signal will be emitted when the keyboard focus
362 /// leaves the `widget`'s window.
363 ///
364 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
365 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
366 ///
367 ///
368 ///
369 ///
370 /// #### `grab-broken-event`
371 /// Emitted when a pointer or keyboard grab on a window belonging
372 /// to `widget` gets broken.
373 ///
374 /// On X11, this happens when the grab window becomes unviewable
375 /// (i.e. it or one of its ancestors is unmapped), or if the same
376 /// application grabs the pointer or keyboard again.
377 ///
378 ///
379 ///
380 ///
381 /// #### `grab-focus`
382 /// Action
383 ///
384 ///
385 /// #### `grab-notify`
386 /// The ::grab-notify signal is emitted when a widget becomes
387 /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
388 /// another widget, or when it becomes unshadowed due to a grab
389 /// being removed.
390 ///
391 /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
392 /// grab widget in the grab stack of its window group is not
393 /// its ancestor.
394 ///
395 ///
396 ///
397 ///
398 /// #### `hide`
399 /// The ::hide signal is emitted when `widget` is hidden, for example with
400 /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
401 ///
402 ///
403 ///
404 ///
405 /// #### `hierarchy-changed`
406 /// The ::hierarchy-changed signal is emitted when the
407 /// anchored state of a widget changes. A widget is
408 /// “anchored” when its toplevel
409 /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
410 /// a widget changes from un-anchored to anchored or vice-versa.
411 ///
412 ///
413 ///
414 ///
415 /// #### `key-press-event`
416 /// The ::key-press-event signal is emitted when a key is pressed. The signal
417 /// emission will reoccur at the key-repeat rate when the key is kept pressed.
418 ///
419 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
420 /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
421 ///
422 /// This signal will be sent to the grab widget if there is one.
423 ///
424 ///
425 ///
426 ///
427 /// #### `key-release-event`
428 /// The ::key-release-event signal is emitted when a key is released.
429 ///
430 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
431 /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
432 ///
433 /// This signal will be sent to the grab widget if there is one.
434 ///
435 ///
436 ///
437 ///
438 /// #### `keynav-failed`
439 /// Gets emitted if keyboard navigation fails.
440 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
441 ///
442 ///
443 ///
444 ///
445 /// #### `leave-notify-event`
446 /// The ::leave-notify-event will be emitted when the pointer leaves
447 /// the `widget`'s window.
448 ///
449 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
450 /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
451 ///
452 /// This signal will be sent to the grab widget if there is one.
453 ///
454 ///
455 ///
456 ///
457 /// #### `map`
458 /// The ::map signal is emitted when `widget` is going to be mapped, that is
459 /// when the widget is visible (which is controlled with
460 /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
461 /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
462 /// be emitted.
463 ///
464 /// The ::map signal can be used to determine whether a widget will be drawn,
465 /// for instance it can resume an animation that was stopped during the
466 /// emission of [`unmap`][struct@crate::Widget#unmap].
467 ///
468 ///
469 ///
470 ///
471 /// #### `map-event`
472 /// The ::map-event signal will be emitted when the `widget`'s window is
473 /// mapped. A window is mapped when it becomes visible on the screen.
474 ///
475 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
476 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
477 /// automatically for all new windows.
478 ///
479 ///
480 ///
481 ///
482 /// #### `mnemonic-activate`
483 /// The default handler for this signal activates `widget` if `group_cycling`
484 /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
485 ///
486 ///
487 ///
488 ///
489 /// #### `motion-notify-event`
490 /// The ::motion-notify-event signal is emitted when the pointer moves
491 /// over the widget's [`gdk::Window`][crate::gdk::Window].
492 ///
493 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
494 /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
495 ///
496 /// This signal will be sent to the grab widget if there is one.
497 ///
498 ///
499 ///
500 ///
501 /// #### `move-focus`
502 /// Action
503 ///
504 ///
505 /// #### `parent-set`
506 /// The ::parent-set signal is emitted when a new parent
507 /// has been set on a widget.
508 ///
509 ///
510 ///
511 ///
512 /// #### `popup-menu`
513 /// This signal gets emitted whenever a widget should pop up a context
514 /// menu. This usually happens through the standard key binding mechanism;
515 /// by pressing a certain key while a widget is focused, the user can cause
516 /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
517 /// a menu with clipboard commands. See the
518 /// [Popup Menu Migration Checklist][checklist-popup-menu]
519 /// for an example of how to use this signal.
520 ///
521 /// Action
522 ///
523 ///
524 /// #### `property-notify-event`
525 /// The ::property-notify-event signal will be emitted when a property on
526 /// the `widget`'s window has been changed or deleted.
527 ///
528 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
529 /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
530 ///
531 ///
532 ///
533 ///
534 /// #### `proximity-in-event`
535 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
536 /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
537 ///
538 /// This signal will be sent to the grab widget if there is one.
539 ///
540 ///
541 ///
542 ///
543 /// #### `proximity-out-event`
544 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
545 /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
546 ///
547 /// This signal will be sent to the grab widget if there is one.
548 ///
549 ///
550 ///
551 ///
552 /// #### `query-tooltip`
553 /// Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
554 /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
555 /// focus in keyboard mode.
556 ///
557 /// Using the given coordinates, the signal handler should determine
558 /// whether a tooltip should be shown for `widget`. If this is the case
559 /// [`true`] should be returned, [`false`] otherwise. Note that if
560 /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
561 /// should not be used.
562 ///
563 /// The signal handler is free to manipulate `tooltip` with the therefore
564 /// destined function calls.
565 ///
566 ///
567 ///
568 ///
569 /// #### `realize`
570 /// The ::realize signal is emitted when `widget` is associated with a
571 /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
572 /// widget has been mapped (that is, it is going to be drawn).
573 ///
574 ///
575 ///
576 ///
577 /// #### `screen-changed`
578 /// The ::screen-changed signal gets emitted when the
579 /// screen of a widget has changed.
580 ///
581 ///
582 ///
583 ///
584 /// #### `scroll-event`
585 /// The ::scroll-event signal is emitted when a button in the 4 to 7
586 /// range is pressed. Wheel mice are usually configured to generate
587 /// button press events for buttons 4 and 5 when the wheel is turned.
588 ///
589 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
590 /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
591 ///
592 /// This signal will be sent to the grab widget if there is one.
593 ///
594 ///
595 ///
596 ///
597 /// #### `selection-clear-event`
598 /// The ::selection-clear-event signal will be emitted when the
599 /// the `widget`'s window has lost ownership of a selection.
600 ///
601 ///
602 ///
603 ///
604 /// #### `selection-get`
605 ///
606 ///
607 ///
608 /// #### `selection-notify-event`
609 ///
610 ///
611 ///
612 /// #### `selection-received`
613 ///
614 ///
615 ///
616 /// #### `selection-request-event`
617 /// The ::selection-request-event signal will be emitted when
618 /// another client requests ownership of the selection owned by
619 /// the `widget`'s window.
620 ///
621 ///
622 ///
623 ///
624 /// #### `show`
625 /// The ::show signal is emitted when `widget` is shown, for example with
626 /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
627 ///
628 ///
629 ///
630 ///
631 /// #### `show-help`
632 /// Action
633 ///
634 ///
635 /// #### `size-allocate`
636 ///
637 ///
638 ///
639 /// #### `state-changed`
640 /// The ::state-changed signal is emitted when the widget state changes.
641 /// See `gtk_widget_get_state()`.
642 ///
643 ///
644 ///
645 ///
646 /// #### `state-flags-changed`
647 /// The ::state-flags-changed signal is emitted when the widget state
648 /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
649 ///
650 ///
651 ///
652 ///
653 /// #### `style-set`
654 /// The ::style-set signal is emitted when a new style has been set
655 /// on a widget. Note that style-modifying functions like
656 /// `gtk_widget_modify_base()` also cause this signal to be emitted.
657 ///
658 /// Note that this signal is emitted for changes to the deprecated
659 /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
660 /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
661 ///
662 ///
663 ///
664 ///
665 /// #### `style-updated`
666 /// The ::style-updated signal is a convenience signal that is emitted when the
667 /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
668 /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
669 ///
670 /// Note that style-modifying functions like `gtk_widget_override_color()` also
671 /// cause this signal to be emitted.
672 ///
673 ///
674 ///
675 ///
676 /// #### `touch-event`
677 ///
678 ///
679 ///
680 /// #### `unmap`
681 /// The ::unmap signal is emitted when `widget` is going to be unmapped, which
682 /// means that either it or any of its parents up to the toplevel widget have
683 /// been set as hidden.
684 ///
685 /// As ::unmap indicates that a widget will not be shown any longer, it can be
686 /// used to, for example, stop an animation on the widget.
687 ///
688 ///
689 ///
690 ///
691 /// #### `unmap-event`
692 /// The ::unmap-event signal will be emitted when the `widget`'s window is
693 /// unmapped. A window is unmapped when it becomes invisible on the screen.
694 ///
695 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
696 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
697 /// automatically for all new windows.
698 ///
699 ///
700 ///
701 ///
702 /// #### `unrealize`
703 /// The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
704 /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
705 /// called or the widget has been unmapped (that is, it is going to be
706 /// hidden).
707 ///
708 ///
709 ///
710 ///
711 /// #### `visibility-notify-event`
712 /// The ::visibility-notify-event will be emitted when the `widget`'s
713 /// window is obscured or unobscured.
714 ///
715 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
716 /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
717 ///
718 ///
719 ///
720 ///
721 /// #### `window-state-event`
722 /// The ::window-state-event will be emitted when the state of the
723 /// toplevel window associated to the `widget` changes.
724 ///
725 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
726 /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
727 /// this mask automatically for all new windows.
728 ///
729 ///
730 /// </details>
731 ///
732 /// # Implements
733 ///
734 /// [`FlowBoxChildExt`][trait@crate::prelude::FlowBoxChildExt], [`BinExt`][trait@crate::prelude::BinExt], [`ContainerExt`][trait@crate::prelude::ContainerExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ContainerExtManual`][trait@crate::prelude::ContainerExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
735 #[doc(alias = "GtkFlowBoxChild")]
736 pub struct FlowBoxChild(Object<ffi::GtkFlowBoxChild, ffi::GtkFlowBoxChildClass>) @extends Bin, Container, Widget, @implements Buildable;
737
738 match fn {
739 type_ => || ffi::gtk_flow_box_child_get_type(),
740 }
741}
742
743impl FlowBoxChild {
744 pub const NONE: Option<&'static FlowBoxChild> = None;
745
746 /// Creates a new [`FlowBoxChild`][crate::FlowBoxChild], to be used as a child
747 /// of a [`FlowBox`][crate::FlowBox].
748 ///
749 /// # Returns
750 ///
751 /// a new [`FlowBoxChild`][crate::FlowBoxChild]
752 #[doc(alias = "gtk_flow_box_child_new")]
753 pub fn new() -> FlowBoxChild {
754 assert_initialized_main_thread!();
755 unsafe { Widget::from_glib_none(ffi::gtk_flow_box_child_new()).unsafe_cast() }
756 }
757
758 // rustdoc-stripper-ignore-next
759 /// Creates a new builder-pattern struct instance to construct [`FlowBoxChild`] objects.
760 ///
761 /// This method returns an instance of [`FlowBoxChildBuilder`](crate::builders::FlowBoxChildBuilder) which can be used to create [`FlowBoxChild`] objects.
762 pub fn builder() -> FlowBoxChildBuilder {
763 FlowBoxChildBuilder::new()
764 }
765}
766
767impl Default for FlowBoxChild {
768 fn default() -> Self {
769 Self::new()
770 }
771}
772
773// rustdoc-stripper-ignore-next
774/// A [builder-pattern] type to construct [`FlowBoxChild`] objects.
775///
776/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
777#[must_use = "The builder must be built to be used"]
778pub struct FlowBoxChildBuilder {
779 builder: glib::object::ObjectBuilder<'static, FlowBoxChild>,
780}
781
782impl FlowBoxChildBuilder {
783 fn new() -> Self {
784 Self {
785 builder: glib::object::Object::builder(),
786 }
787 }
788
789 pub fn border_width(self, border_width: u32) -> Self {
790 Self {
791 builder: self.builder.property("border-width", border_width),
792 }
793 }
794
795 pub fn child(self, child: &impl IsA<Widget>) -> Self {
796 Self {
797 builder: self.builder.property("child", child.clone().upcast()),
798 }
799 }
800
801 pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
802 Self {
803 builder: self.builder.property("resize-mode", resize_mode),
804 }
805 }
806
807 pub fn app_paintable(self, app_paintable: bool) -> Self {
808 Self {
809 builder: self.builder.property("app-paintable", app_paintable),
810 }
811 }
812
813 pub fn can_default(self, can_default: bool) -> Self {
814 Self {
815 builder: self.builder.property("can-default", can_default),
816 }
817 }
818
819 pub fn can_focus(self, can_focus: bool) -> Self {
820 Self {
821 builder: self.builder.property("can-focus", can_focus),
822 }
823 }
824
825 pub fn events(self, events: gdk::EventMask) -> Self {
826 Self {
827 builder: self.builder.property("events", events),
828 }
829 }
830
831 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
832 pub fn expand(self, expand: bool) -> Self {
833 Self {
834 builder: self.builder.property("expand", expand),
835 }
836 }
837
838 /// Whether the widget should grab focus when it is clicked with the mouse.
839 ///
840 /// This property is only relevant for widgets that can take focus.
841 ///
842 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
843 /// GtkComboBox) implemented this property individually.
844 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
845 Self {
846 builder: self.builder.property("focus-on-click", focus_on_click),
847 }
848 }
849
850 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
851 pub fn halign(self, halign: Align) -> Self {
852 Self {
853 builder: self.builder.property("halign", halign),
854 }
855 }
856
857 pub fn has_default(self, has_default: bool) -> Self {
858 Self {
859 builder: self.builder.property("has-default", has_default),
860 }
861 }
862
863 pub fn has_focus(self, has_focus: bool) -> Self {
864 Self {
865 builder: self.builder.property("has-focus", has_focus),
866 }
867 }
868
869 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
870 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
871 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
872 /// whether it will provide a tooltip or not.
873 ///
874 /// Note that setting this property to [`true`] for the first time will change
875 /// the event masks of the GdkWindows of this widget to include leave-notify
876 /// and motion-notify events. This cannot and will not be undone when the
877 /// property is set to [`false`] again.
878 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
879 Self {
880 builder: self.builder.property("has-tooltip", has_tooltip),
881 }
882 }
883
884 pub fn height_request(self, height_request: i32) -> Self {
885 Self {
886 builder: self.builder.property("height-request", height_request),
887 }
888 }
889
890 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
891 pub fn hexpand(self, hexpand: bool) -> Self {
892 Self {
893 builder: self.builder.property("hexpand", hexpand),
894 }
895 }
896
897 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
898 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
899 Self {
900 builder: self.builder.property("hexpand-set", hexpand_set),
901 }
902 }
903
904 pub fn is_focus(self, is_focus: bool) -> Self {
905 Self {
906 builder: self.builder.property("is-focus", is_focus),
907 }
908 }
909
910 /// Sets all four sides' margin at once. If read, returns max
911 /// margin on any side.
912 pub fn margin(self, margin: i32) -> Self {
913 Self {
914 builder: self.builder.property("margin", margin),
915 }
916 }
917
918 /// Margin on bottom side of widget.
919 ///
920 /// This property adds margin outside of the widget's normal size
921 /// request, the margin will be added in addition to the size from
922 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
923 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
924 Self {
925 builder: self.builder.property("margin-bottom", margin_bottom),
926 }
927 }
928
929 /// Margin on end of widget, horizontally. This property supports
930 /// left-to-right and right-to-left text directions.
931 ///
932 /// This property adds margin outside of the widget's normal size
933 /// request, the margin will be added in addition to the size from
934 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
935 pub fn margin_end(self, margin_end: i32) -> Self {
936 Self {
937 builder: self.builder.property("margin-end", margin_end),
938 }
939 }
940
941 /// Margin on start of widget, horizontally. This property supports
942 /// left-to-right and right-to-left text directions.
943 ///
944 /// This property adds margin outside of the widget's normal size
945 /// request, the margin will be added in addition to the size from
946 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
947 pub fn margin_start(self, margin_start: i32) -> Self {
948 Self {
949 builder: self.builder.property("margin-start", margin_start),
950 }
951 }
952
953 /// Margin on top side of widget.
954 ///
955 /// This property adds margin outside of the widget's normal size
956 /// request, the margin will be added in addition to the size from
957 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
958 pub fn margin_top(self, margin_top: i32) -> Self {
959 Self {
960 builder: self.builder.property("margin-top", margin_top),
961 }
962 }
963
964 pub fn name(self, name: impl Into<glib::GString>) -> Self {
965 Self {
966 builder: self.builder.property("name", name.into()),
967 }
968 }
969
970 pub fn no_show_all(self, no_show_all: bool) -> Self {
971 Self {
972 builder: self.builder.property("no-show-all", no_show_all),
973 }
974 }
975
976 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
977 /// more details about window opacity.
978 ///
979 /// Before 3.8 this was only available in GtkWindow
980 pub fn opacity(self, opacity: f64) -> Self {
981 Self {
982 builder: self.builder.property("opacity", opacity),
983 }
984 }
985
986 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
987 Self {
988 builder: self.builder.property("parent", parent.clone().upcast()),
989 }
990 }
991
992 pub fn receives_default(self, receives_default: bool) -> Self {
993 Self {
994 builder: self.builder.property("receives-default", receives_default),
995 }
996 }
997
998 pub fn sensitive(self, sensitive: bool) -> Self {
999 Self {
1000 builder: self.builder.property("sensitive", sensitive),
1001 }
1002 }
1003
1004 /// Sets the text of tooltip to be the given string, which is marked up
1005 /// with the [Pango text markup language][PangoMarkupFormat].
1006 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1007 ///
1008 /// This is a convenience property which will take care of getting the
1009 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1010 /// will automatically be set to [`true`] and there will be taken care of
1011 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1012 ///
1013 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1014 /// are set, the last one wins.
1015 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1016 Self {
1017 builder: self
1018 .builder
1019 .property("tooltip-markup", tooltip_markup.into()),
1020 }
1021 }
1022
1023 /// Sets the text of tooltip to be the given string.
1024 ///
1025 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1026 ///
1027 /// This is a convenience property which will take care of getting the
1028 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1029 /// will automatically be set to [`true`] and there will be taken care of
1030 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1031 ///
1032 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1033 /// are set, the last one wins.
1034 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1035 Self {
1036 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1037 }
1038 }
1039
1040 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1041 pub fn valign(self, valign: Align) -> Self {
1042 Self {
1043 builder: self.builder.property("valign", valign),
1044 }
1045 }
1046
1047 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1048 pub fn vexpand(self, vexpand: bool) -> Self {
1049 Self {
1050 builder: self.builder.property("vexpand", vexpand),
1051 }
1052 }
1053
1054 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1055 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1056 Self {
1057 builder: self.builder.property("vexpand-set", vexpand_set),
1058 }
1059 }
1060
1061 pub fn visible(self, visible: bool) -> Self {
1062 Self {
1063 builder: self.builder.property("visible", visible),
1064 }
1065 }
1066
1067 pub fn width_request(self, width_request: i32) -> Self {
1068 Self {
1069 builder: self.builder.property("width-request", width_request),
1070 }
1071 }
1072
1073 // rustdoc-stripper-ignore-next
1074 /// Build the [`FlowBoxChild`].
1075 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1076 pub fn build(self) -> FlowBoxChild {
1077 assert_initialized_main_thread!();
1078 self.builder.build()
1079 }
1080}
1081
1082/// Trait containing all [`struct@FlowBoxChild`] methods.
1083///
1084/// # Implementors
1085///
1086/// [`FlowBoxChild`][struct@crate::FlowBoxChild]
1087pub trait FlowBoxChildExt: IsA<FlowBoxChild> + 'static {
1088 /// Marks `self` as changed, causing any state that depends on this
1089 /// to be updated. This affects sorting and filtering.
1090 ///
1091 /// Note that calls to this method must be in sync with the data
1092 /// used for the sorting and filtering functions. For instance, if
1093 /// the list is mirroring some external data set, and *two* children
1094 /// changed in the external data set when you call
1095 /// [`changed()`][Self::changed()] on the first child, the sort function
1096 /// must only read the new data for the first of the two changed
1097 /// children, otherwise the resorting of the children will be wrong.
1098 ///
1099 /// This generally means that if you don’t fully control the data
1100 /// model, you have to duplicate the data that affects the sorting
1101 /// and filtering functions into the widgets themselves. Another
1102 /// alternative is to call [`FlowBoxExt::invalidate_sort()`][crate::prelude::FlowBoxExt::invalidate_sort()] on any
1103 /// model change, but that is more expensive.
1104 #[doc(alias = "gtk_flow_box_child_changed")]
1105 fn changed(&self) {
1106 unsafe {
1107 ffi::gtk_flow_box_child_changed(self.as_ref().to_glib_none().0);
1108 }
1109 }
1110
1111 /// Gets the current index of the `self` in its [`FlowBox`][crate::FlowBox] container.
1112 ///
1113 /// # Returns
1114 ///
1115 /// the index of the `self`, or -1 if the `self` is not
1116 /// in a flow box.
1117 #[doc(alias = "gtk_flow_box_child_get_index")]
1118 #[doc(alias = "get_index")]
1119 fn index(&self) -> i32 {
1120 unsafe { ffi::gtk_flow_box_child_get_index(self.as_ref().to_glib_none().0) }
1121 }
1122
1123 /// Returns whether the `self` is currently selected in its
1124 /// [`FlowBox`][crate::FlowBox] container.
1125 ///
1126 /// # Returns
1127 ///
1128 /// [`true`] if `self` is selected
1129 #[doc(alias = "gtk_flow_box_child_is_selected")]
1130 fn is_selected(&self) -> bool {
1131 unsafe {
1132 from_glib(ffi::gtk_flow_box_child_is_selected(
1133 self.as_ref().to_glib_none().0,
1134 ))
1135 }
1136 }
1137
1138 /// The ::activate signal is emitted when the user activates
1139 /// a child widget in a [`FlowBox`][crate::FlowBox], either by clicking or
1140 /// double-clicking, or by using the Space or Enter key.
1141 ///
1142 /// While this signal is used as a
1143 /// [keybinding signal][GtkBindingSignal],
1144 /// it can be used by applications for their own purposes.
1145 #[doc(alias = "activate")]
1146 fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1147 unsafe extern "C" fn activate_trampoline<P: IsA<FlowBoxChild>, F: Fn(&P) + 'static>(
1148 this: *mut ffi::GtkFlowBoxChild,
1149 f: glib::ffi::gpointer,
1150 ) {
1151 unsafe {
1152 let f: &F = &*(f as *const F);
1153 f(FlowBoxChild::from_glib_borrow(this).unsafe_cast_ref())
1154 }
1155 }
1156 unsafe {
1157 let f: Box_<F> = Box_::new(f);
1158 connect_raw(
1159 self.as_ptr() as *mut _,
1160 c"activate".as_ptr(),
1161 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1162 activate_trampoline::<Self, F> as *const (),
1163 )),
1164 Box_::into_raw(f),
1165 )
1166 }
1167 }
1168
1169 fn emit_activate(&self) {
1170 self.emit_by_name::<()>("activate", &[]);
1171 }
1172}
1173
1174impl<O: IsA<FlowBoxChild>> FlowBoxChildExt for O {}