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