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