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