gtk/auto/popover.rs
1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4
5use crate::{
6 Align, Bin, Buildable, Container, PopoverConstraint, PositionType, ResizeMode, Widget, ffi,
7};
8use glib::{
9 object::ObjectType as _,
10 prelude::*,
11 signal::{SignalHandlerId, connect_raw},
12 translate::*,
13};
14use std::boxed::Box as Box_;
15
16glib::wrapper! {
17 ///
18 /// ]|
19 ///
20 /// # CSS nodes
21 ///
22 /// GtkPopover has a single css node called popover. It always gets the
23 /// .background style class and it gets the .menu style class if it is
24 /// menu-like (e.g. [`PopoverMenu`][crate::PopoverMenu] or created using [`from_model()`][Self::from_model()].
25 ///
26 /// Particular uses of GtkPopover, such as touch selection popups
27 /// or magnifiers in [`Entry`][crate::Entry] or [`TextView`][crate::TextView] get style classes
28 /// like .touch-selection or .magnifier to differentiate from
29 /// plain popovers.
30 ///
31 /// ## Properties
32 ///
33 ///
34 /// #### `constrain-to`
35 /// Sets a constraint for the popover position.
36 ///
37 /// Readable | Writable
38 ///
39 ///
40 /// #### `modal`
41 /// Sets whether the popover is modal (so other elements in the window do not
42 /// receive input while the popover is visible).
43 ///
44 /// Readable | Writable
45 ///
46 ///
47 /// #### `pointing-to`
48 /// Marks a specific rectangle to be pointed.
49 ///
50 /// Readable | Writable
51 ///
52 ///
53 /// #### `position`
54 /// Sets the preferred position of the popover.
55 ///
56 /// Readable | Writable
57 ///
58 ///
59 /// #### `relative-to`
60 /// Sets the attached widget.
61 ///
62 /// Readable | Writable
63 ///
64 ///
65 /// #### `transitions-enabled`
66 /// Whether show/hide transitions are enabled for this popover.
67 ///
68 /// Readable | Writable
69 /// <details><summary><h4>Container</h4></summary>
70 ///
71 ///
72 /// #### `border-width`
73 /// Readable | Writable
74 ///
75 ///
76 /// #### `child`
77 /// Writable
78 ///
79 ///
80 /// #### `resize-mode`
81 /// Readable | Writable
82 /// </details>
83 /// <details><summary><h4>Widget</h4></summary>
84 ///
85 ///
86 /// #### `app-paintable`
87 /// Readable | Writable
88 ///
89 ///
90 /// #### `can-default`
91 /// Readable | Writable
92 ///
93 ///
94 /// #### `can-focus`
95 /// Readable | Writable
96 ///
97 ///
98 /// #### `composite-child`
99 /// Readable
100 ///
101 ///
102 /// #### `double-buffered`
103 /// Whether the widget is double buffered.
104 ///
105 /// Readable | Writable
106 ///
107 ///
108 /// #### `events`
109 /// Readable | Writable
110 ///
111 ///
112 /// #### `expand`
113 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
114 ///
115 /// Readable | Writable
116 ///
117 ///
118 /// #### `focus-on-click`
119 /// Whether the widget should grab focus when it is clicked with the mouse.
120 ///
121 /// This property is only relevant for widgets that can take focus.
122 ///
123 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
124 /// GtkComboBox) implemented this property individually.
125 ///
126 /// Readable | Writable
127 ///
128 ///
129 /// #### `halign`
130 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
131 ///
132 /// Readable | Writable
133 ///
134 ///
135 /// #### `has-default`
136 /// Readable | Writable
137 ///
138 ///
139 /// #### `has-focus`
140 /// Readable | Writable
141 ///
142 ///
143 /// #### `has-tooltip`
144 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
145 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
146 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
147 /// whether it will provide a tooltip or not.
148 ///
149 /// Note that setting this property to [`true`] for the first time will change
150 /// the event masks of the GdkWindows of this widget to include leave-notify
151 /// and motion-notify events. This cannot and will not be undone when the
152 /// property is set to [`false`] again.
153 ///
154 /// Readable | Writable
155 ///
156 ///
157 /// #### `height-request`
158 /// Readable | Writable
159 ///
160 ///
161 /// #### `hexpand`
162 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
163 ///
164 /// Readable | Writable
165 ///
166 ///
167 /// #### `hexpand-set`
168 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
169 ///
170 /// Readable | Writable
171 ///
172 ///
173 /// #### `is-focus`
174 /// Readable | Writable
175 ///
176 ///
177 /// #### `margin`
178 /// Sets all four sides' margin at once. If read, returns max
179 /// margin on any side.
180 ///
181 /// Readable | Writable
182 ///
183 ///
184 /// #### `margin-bottom`
185 /// Margin on bottom side of widget.
186 ///
187 /// This property adds margin outside of the widget's normal size
188 /// request, the margin will be added in addition to the size from
189 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
190 ///
191 /// Readable | Writable
192 ///
193 ///
194 /// #### `margin-end`
195 /// Margin on end of widget, horizontally. This property supports
196 /// left-to-right and right-to-left text directions.
197 ///
198 /// This property adds margin outside of the widget's normal size
199 /// request, the margin will be added in addition to the size from
200 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
201 ///
202 /// Readable | Writable
203 ///
204 ///
205 /// #### `margin-left`
206 /// Margin on left side of widget.
207 ///
208 /// This property adds margin outside of the widget's normal size
209 /// request, the margin will be added in addition to the size from
210 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
211 ///
212 /// Readable | Writable
213 ///
214 ///
215 /// #### `margin-right`
216 /// Margin on right side of widget.
217 ///
218 /// This property adds margin outside of the widget's normal size
219 /// request, the margin will be added in addition to the size from
220 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
221 ///
222 /// Readable | Writable
223 ///
224 ///
225 /// #### `margin-start`
226 /// Margin on start of widget, horizontally. This property supports
227 /// left-to-right and right-to-left text directions.
228 ///
229 /// This property adds margin outside of the widget's normal size
230 /// request, the margin will be added in addition to the size from
231 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
232 ///
233 /// Readable | Writable
234 ///
235 ///
236 /// #### `margin-top`
237 /// Margin on top side of widget.
238 ///
239 /// This property adds margin outside of the widget's normal size
240 /// request, the margin will be added in addition to the size from
241 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
242 ///
243 /// Readable | Writable
244 ///
245 ///
246 /// #### `name`
247 /// Readable | Writable
248 ///
249 ///
250 /// #### `no-show-all`
251 /// Readable | Writable
252 ///
253 ///
254 /// #### `opacity`
255 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
256 /// more details about window opacity.
257 ///
258 /// Before 3.8 this was only available in GtkWindow
259 ///
260 /// Readable | Writable
261 ///
262 ///
263 /// #### `parent`
264 /// Readable | Writable
265 ///
266 ///
267 /// #### `receives-default`
268 /// Readable | Writable
269 ///
270 ///
271 /// #### `scale-factor`
272 /// The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
273 /// more details about widget scaling.
274 ///
275 /// Readable
276 ///
277 ///
278 /// #### `sensitive`
279 /// Readable | Writable
280 ///
281 ///
282 /// #### `style`
283 /// The style of the widget, which contains information about how it will look (colors, etc).
284 ///
285 /// Readable | Writable
286 ///
287 ///
288 /// #### `tooltip-markup`
289 /// Sets the text of tooltip to be the given string, which is marked up
290 /// with the [Pango text markup language][PangoMarkupFormat].
291 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
292 ///
293 /// This is a convenience property which will take care of getting the
294 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
295 /// will automatically be set to [`true`] and there will be taken care of
296 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
297 ///
298 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
299 /// are set, the last one wins.
300 ///
301 /// Readable | Writable
302 ///
303 ///
304 /// #### `tooltip-text`
305 /// Sets the text of tooltip to be the given string.
306 ///
307 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
308 ///
309 /// This is a convenience property which will take care of getting the
310 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
311 /// will automatically be set to [`true`] and there will be taken care of
312 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
313 ///
314 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
315 /// are set, the last one wins.
316 ///
317 /// Readable | Writable
318 ///
319 ///
320 /// #### `valign`
321 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
322 ///
323 /// Readable | Writable
324 ///
325 ///
326 /// #### `vexpand`
327 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
328 ///
329 /// Readable | Writable
330 ///
331 ///
332 /// #### `vexpand-set`
333 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
334 ///
335 /// Readable | Writable
336 ///
337 ///
338 /// #### `visible`
339 /// Readable | Writable
340 ///
341 ///
342 /// #### `width-request`
343 /// Readable | Writable
344 ///
345 ///
346 /// #### `window`
347 /// The widget's window if it is realized, [`None`] otherwise.
348 ///
349 /// Readable
350 /// </details>
351 ///
352 /// ## Signals
353 ///
354 ///
355 /// #### `closed`
356 /// This signal is emitted when the popover is dismissed either through
357 /// API or user interaction.
358 ///
359 ///
360 /// <details><summary><h4>Container</h4></summary>
361 ///
362 ///
363 /// #### `add`
364 ///
365 ///
366 ///
367 /// #### `check-resize`
368 ///
369 ///
370 ///
371 /// #### `remove`
372 ///
373 ///
374 ///
375 /// #### `set-focus-child`
376 ///
377 /// </details>
378 /// <details><summary><h4>Widget</h4></summary>
379 ///
380 ///
381 /// #### `accel-closures-changed`
382 ///
383 ///
384 ///
385 /// #### `button-press-event`
386 /// The ::button-press-event signal will be emitted when a button
387 /// (typically from a mouse) is pressed.
388 ///
389 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
390 /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
391 ///
392 /// This signal will be sent to the grab widget if there is one.
393 ///
394 ///
395 ///
396 ///
397 /// #### `button-release-event`
398 /// The ::button-release-event signal will be emitted when a button
399 /// (typically from a mouse) is released.
400 ///
401 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
402 /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
403 ///
404 /// This signal will be sent to the grab widget if there is one.
405 ///
406 ///
407 ///
408 ///
409 /// #### `can-activate-accel`
410 /// Determines whether an accelerator that activates the signal
411 /// identified by `signal_id` can currently be activated.
412 /// This signal is present to allow applications and derived
413 /// widgets to override the default [`Widget`][crate::Widget] handling
414 /// for determining whether an accelerator can be activated.
415 ///
416 ///
417 ///
418 ///
419 /// #### `child-notify`
420 /// The ::child-notify signal is emitted for each
421 /// [child property][child-properties] that has
422 /// changed on an object. The signal's detail holds the property name.
423 ///
424 /// Detailed
425 ///
426 ///
427 /// #### `composited-changed`
428 /// The ::composited-changed signal is emitted when the composited
429 /// status of `widgets` screen changes.
430 /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
431 ///
432 /// Action
433 ///
434 ///
435 /// #### `configure-event`
436 /// The ::configure-event signal will be emitted when the size, position or
437 /// stacking of the `widget`'s window has changed.
438 ///
439 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
440 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
441 /// automatically for all new windows.
442 ///
443 ///
444 ///
445 ///
446 /// #### `damage-event`
447 /// Emitted when a redirected window belonging to `widget` gets drawn into.
448 /// The region/area members of the event shows what area of the redirected
449 /// drawable was drawn into.
450 ///
451 ///
452 ///
453 ///
454 /// #### `delete-event`
455 /// The ::delete-event signal is emitted if a user requests that
456 /// a toplevel window is closed. The default handler for this signal
457 /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
458 /// this signal will cause the window to be hidden instead, so that
459 /// it can later be shown again without reconstructing it.
460 ///
461 ///
462 ///
463 ///
464 /// #### `destroy`
465 /// Signals that all holders of a reference to the widget should release
466 /// the reference that they hold. May result in finalization of the widget
467 /// if all references are released.
468 ///
469 /// This signal is not suitable for saving widget state.
470 ///
471 ///
472 ///
473 ///
474 /// #### `destroy-event`
475 /// The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
476 /// You rarely get this signal, because most widgets disconnect themselves
477 /// from their window before they destroy it, so no widget owns the
478 /// window at destroy time.
479 ///
480 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
481 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
482 /// automatically for all new windows.
483 ///
484 ///
485 ///
486 ///
487 /// #### `direction-changed`
488 /// The ::direction-changed signal is emitted when the text direction
489 /// of a widget changes.
490 ///
491 ///
492 ///
493 ///
494 /// #### `drag-begin`
495 /// The ::drag-begin signal is emitted on the drag source when a drag is
496 /// started. A typical reason to connect to this signal is to set up a
497 /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
498 ///
499 /// Note that some widgets set up a drag icon in the default handler of
500 /// this signal, so you may have to use `g_signal_connect_after()` to
501 /// override what the default handler did.
502 ///
503 ///
504 ///
505 ///
506 /// #### `drag-data-delete`
507 /// The ::drag-data-delete signal is emitted on the drag source when a drag
508 /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
509 /// handler is responsible for deleting the data that has been dropped. What
510 /// "delete" means depends on the context of the drag operation.
511 ///
512 ///
513 ///
514 ///
515 /// #### `drag-data-get`
516 /// The ::drag-data-get signal is emitted on the drag source when the drop
517 /// site requests the data which is dragged. It is the responsibility of
518 /// the signal handler to fill `data` with the data in the format which
519 /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
520 /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
521 ///
522 ///
523 ///
524 ///
525 /// #### `drag-data-received`
526 /// format == 8))
527 /// {
528 /// GdkDragAction action;
529 ///
530 /// // handle data here
531 ///
532 /// action = gdk_drag_context_get_selected_action (context);
533 /// if (action == GDK_ACTION_ASK)
534 /// {
535 /// GtkWidget *dialog;
536 /// gint response;
537 ///
538 /// dialog = gtk_message_dialog_new (NULL,
539 /// GTK_DIALOG_MODAL |
540 /// GTK_DIALOG_DESTROY_WITH_PARENT,
541 /// GTK_MESSAGE_INFO,
542 /// GTK_BUTTONS_YES_NO,
543 /// "Move the data ?\n");
544 /// response = gtk_dialog_run (GTK_DIALOG (dialog));
545 /// gtk_widget_destroy (dialog);
546 ///
547 /// if (response == GTK_RESPONSE_YES)
548 /// action = GDK_ACTION_MOVE;
549 /// else
550 /// action = GDK_ACTION_COPY;
551 /// }
552 ///
553 /// gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
554 /// }
555 /// else
556 /// gtk_drag_finish (context, FALSE, FALSE, time);
557 /// }
558 /// ]|
559 ///
560 ///
561 ///
562 ///
563 /// #### `drag-drop`
564 /// The ::drag-drop signal is emitted on the drop site when the user drops
565 /// the data onto the widget. The signal handler must determine whether
566 /// the cursor position is in a drop zone or not. If it is not in a drop
567 /// zone, it returns [`false`] and no further processing is necessary.
568 /// Otherwise, the handler returns [`true`]. In this case, the handler must
569 /// ensure that `gtk_drag_finish()` is called to let the source know that
570 /// the drop is done. The call to `gtk_drag_finish()` can be done either
571 /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
572 /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
573 /// or more of the supported targets.
574 ///
575 ///
576 ///
577 ///
578 /// #### `drag-end`
579 /// The ::drag-end signal is emitted on the drag source when a drag is
580 /// finished. A typical reason to connect to this signal is to undo
581 /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
582 ///
583 ///
584 ///
585 ///
586 /// #### `drag-failed`
587 /// The ::drag-failed signal is emitted on the drag source when a drag has
588 /// failed. The signal handler may hook custom code to handle a failed DnD
589 /// operation based on the type of error, it returns [`true`] is the failure has
590 /// been already handled (not showing the default "drag operation failed"
591 /// animation), otherwise it returns [`false`].
592 ///
593 ///
594 ///
595 ///
596 /// #### `drag-leave`
597 /// The ::drag-leave signal is emitted on the drop site when the cursor
598 /// leaves the widget. A typical reason to connect to this signal is to
599 /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
600 /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
601 ///
602 ///
603 /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
604 /// ::drag-drop signal, for instance to allow cleaning up of a preview item
605 /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
606 ///
607 ///
608 ///
609 ///
610 /// #### `drag-motion`
611 /// suggested_action,
612 /// time);
613 /// }
614 /// else
615 /// {
616 /// // accept the drop
617 /// }
618 /// }
619 /// ]|
620 ///
621 ///
622 ///
623 ///
624 /// #### `draw`
625 /// This signal is emitted when a widget is supposed to render itself.
626 /// The `widget`'s top left corner must be painted at the origin of
627 /// the passed in context and be sized to the values returned by
628 /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
629 /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
630 ///
631 /// Signal handlers connected to this signal can modify the cairo
632 /// context passed as `cr` in any way they like and don't need to
633 /// restore it. The signal emission takes care of calling `cairo_save()`
634 /// before and `cairo_restore()` after invoking the handler.
635 ///
636 /// The signal handler will get a `cr` with a clip region already set to the
637 /// widget's dirty region, i.e. to the area that needs repainting. Complicated
638 /// widgets that want to avoid redrawing themselves completely can get the full
639 /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
640 /// get a finer-grained representation of the dirty region with
641 /// `cairo_copy_clip_rectangle_list()`.
642 ///
643 ///
644 ///
645 ///
646 /// #### `enter-notify-event`
647 /// The ::enter-notify-event will be emitted when the pointer enters
648 /// the `widget`'s window.
649 ///
650 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
651 /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
652 ///
653 /// This signal will be sent to the grab widget if there is one.
654 ///
655 ///
656 ///
657 ///
658 /// #### `event`
659 /// The GTK+ main loop will emit three signals for each GDK event delivered
660 /// to a widget: one generic ::event signal, another, more specific,
661 /// signal that matches the type of event delivered (e.g.
662 /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
663 /// [`event-after`][struct@crate::Widget#event-after] signal.
664 ///
665 ///
666 ///
667 ///
668 /// #### `event-after`
669 /// After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
670 /// the second more specific signal, ::event-after will be emitted
671 /// regardless of the previous two signals handlers return values.
672 ///
673 ///
674 ///
675 ///
676 /// #### `focus`
677 ///
678 ///
679 ///
680 /// #### `focus-in-event`
681 /// The ::focus-in-event signal will be emitted when the keyboard focus
682 /// enters the `widget`'s window.
683 ///
684 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
685 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
686 ///
687 ///
688 ///
689 ///
690 /// #### `focus-out-event`
691 /// The ::focus-out-event signal will be emitted when the keyboard focus
692 /// leaves the `widget`'s window.
693 ///
694 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
695 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
696 ///
697 ///
698 ///
699 ///
700 /// #### `grab-broken-event`
701 /// Emitted when a pointer or keyboard grab on a window belonging
702 /// to `widget` gets broken.
703 ///
704 /// On X11, this happens when the grab window becomes unviewable
705 /// (i.e. it or one of its ancestors is unmapped), or if the same
706 /// application grabs the pointer or keyboard again.
707 ///
708 ///
709 ///
710 ///
711 /// #### `grab-focus`
712 /// Action
713 ///
714 ///
715 /// #### `grab-notify`
716 /// The ::grab-notify signal is emitted when a widget becomes
717 /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
718 /// another widget, or when it becomes unshadowed due to a grab
719 /// being removed.
720 ///
721 /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
722 /// grab widget in the grab stack of its window group is not
723 /// its ancestor.
724 ///
725 ///
726 ///
727 ///
728 /// #### `hide`
729 /// The ::hide signal is emitted when `widget` is hidden, for example with
730 /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
731 ///
732 ///
733 ///
734 ///
735 /// #### `hierarchy-changed`
736 /// The ::hierarchy-changed signal is emitted when the
737 /// anchored state of a widget changes. A widget is
738 /// “anchored” when its toplevel
739 /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
740 /// a widget changes from un-anchored to anchored or vice-versa.
741 ///
742 ///
743 ///
744 ///
745 /// #### `key-press-event`
746 /// The ::key-press-event signal is emitted when a key is pressed. The signal
747 /// emission will reoccur at the key-repeat rate when the key is kept pressed.
748 ///
749 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
750 /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
751 ///
752 /// This signal will be sent to the grab widget if there is one.
753 ///
754 ///
755 ///
756 ///
757 /// #### `key-release-event`
758 /// The ::key-release-event signal is emitted when a key is released.
759 ///
760 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
761 /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
762 ///
763 /// This signal will be sent to the grab widget if there is one.
764 ///
765 ///
766 ///
767 ///
768 /// #### `keynav-failed`
769 /// Gets emitted if keyboard navigation fails.
770 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
771 ///
772 ///
773 ///
774 ///
775 /// #### `leave-notify-event`
776 /// The ::leave-notify-event will be emitted when the pointer leaves
777 /// the `widget`'s window.
778 ///
779 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
780 /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
781 ///
782 /// This signal will be sent to the grab widget if there is one.
783 ///
784 ///
785 ///
786 ///
787 /// #### `map`
788 /// The ::map signal is emitted when `widget` is going to be mapped, that is
789 /// when the widget is visible (which is controlled with
790 /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
791 /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
792 /// be emitted.
793 ///
794 /// The ::map signal can be used to determine whether a widget will be drawn,
795 /// for instance it can resume an animation that was stopped during the
796 /// emission of [`unmap`][struct@crate::Widget#unmap].
797 ///
798 ///
799 ///
800 ///
801 /// #### `map-event`
802 /// The ::map-event signal will be emitted when the `widget`'s window is
803 /// mapped. A window is mapped when it becomes visible on the screen.
804 ///
805 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
806 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
807 /// automatically for all new windows.
808 ///
809 ///
810 ///
811 ///
812 /// #### `mnemonic-activate`
813 /// The default handler for this signal activates `widget` if `group_cycling`
814 /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
815 ///
816 ///
817 ///
818 ///
819 /// #### `motion-notify-event`
820 /// The ::motion-notify-event signal is emitted when the pointer moves
821 /// over the widget's [`gdk::Window`][crate::gdk::Window].
822 ///
823 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
824 /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
825 ///
826 /// This signal will be sent to the grab widget if there is one.
827 ///
828 ///
829 ///
830 ///
831 /// #### `move-focus`
832 /// Action
833 ///
834 ///
835 /// #### `parent-set`
836 /// The ::parent-set signal is emitted when a new parent
837 /// has been set on a widget.
838 ///
839 ///
840 ///
841 ///
842 /// #### `popup-menu`
843 /// This signal gets emitted whenever a widget should pop up a context
844 /// menu. This usually happens through the standard key binding mechanism;
845 /// by pressing a certain key while a widget is focused, the user can cause
846 /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
847 /// a menu with clipboard commands. See the
848 /// [Popup Menu Migration Checklist][checklist-popup-menu]
849 /// for an example of how to use this signal.
850 ///
851 /// Action
852 ///
853 ///
854 /// #### `property-notify-event`
855 /// The ::property-notify-event signal will be emitted when a property on
856 /// the `widget`'s window has been changed or deleted.
857 ///
858 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
859 /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
860 ///
861 ///
862 ///
863 ///
864 /// #### `proximity-in-event`
865 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
866 /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
867 ///
868 /// This signal will be sent to the grab widget if there is one.
869 ///
870 ///
871 ///
872 ///
873 /// #### `proximity-out-event`
874 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
875 /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
876 ///
877 /// This signal will be sent to the grab widget if there is one.
878 ///
879 ///
880 ///
881 ///
882 /// #### `query-tooltip`
883 /// Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
884 /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
885 /// focus in keyboard mode.
886 ///
887 /// Using the given coordinates, the signal handler should determine
888 /// whether a tooltip should be shown for `widget`. If this is the case
889 /// [`true`] should be returned, [`false`] otherwise. Note that if
890 /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
891 /// should not be used.
892 ///
893 /// The signal handler is free to manipulate `tooltip` with the therefore
894 /// destined function calls.
895 ///
896 ///
897 ///
898 ///
899 /// #### `realize`
900 /// The ::realize signal is emitted when `widget` is associated with a
901 /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
902 /// widget has been mapped (that is, it is going to be drawn).
903 ///
904 ///
905 ///
906 ///
907 /// #### `screen-changed`
908 /// The ::screen-changed signal gets emitted when the
909 /// screen of a widget has changed.
910 ///
911 ///
912 ///
913 ///
914 /// #### `scroll-event`
915 /// The ::scroll-event signal is emitted when a button in the 4 to 7
916 /// range is pressed. Wheel mice are usually configured to generate
917 /// button press events for buttons 4 and 5 when the wheel is turned.
918 ///
919 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
920 /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
921 ///
922 /// This signal will be sent to the grab widget if there is one.
923 ///
924 ///
925 ///
926 ///
927 /// #### `selection-clear-event`
928 /// The ::selection-clear-event signal will be emitted when the
929 /// the `widget`'s window has lost ownership of a selection.
930 ///
931 ///
932 ///
933 ///
934 /// #### `selection-get`
935 ///
936 ///
937 ///
938 /// #### `selection-notify-event`
939 ///
940 ///
941 ///
942 /// #### `selection-received`
943 ///
944 ///
945 ///
946 /// #### `selection-request-event`
947 /// The ::selection-request-event signal will be emitted when
948 /// another client requests ownership of the selection owned by
949 /// the `widget`'s window.
950 ///
951 ///
952 ///
953 ///
954 /// #### `show`
955 /// The ::show signal is emitted when `widget` is shown, for example with
956 /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
957 ///
958 ///
959 ///
960 ///
961 /// #### `show-help`
962 /// Action
963 ///
964 ///
965 /// #### `size-allocate`
966 ///
967 ///
968 ///
969 /// #### `state-changed`
970 /// The ::state-changed signal is emitted when the widget state changes.
971 /// See `gtk_widget_get_state()`.
972 ///
973 ///
974 ///
975 ///
976 /// #### `state-flags-changed`
977 /// The ::state-flags-changed signal is emitted when the widget state
978 /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
979 ///
980 ///
981 ///
982 ///
983 /// #### `style-set`
984 /// The ::style-set signal is emitted when a new style has been set
985 /// on a widget. Note that style-modifying functions like
986 /// `gtk_widget_modify_base()` also cause this signal to be emitted.
987 ///
988 /// Note that this signal is emitted for changes to the deprecated
989 /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
990 /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
991 ///
992 ///
993 ///
994 ///
995 /// #### `style-updated`
996 /// The ::style-updated signal is a convenience signal that is emitted when the
997 /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
998 /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
999 ///
1000 /// Note that style-modifying functions like `gtk_widget_override_color()` also
1001 /// cause this signal to be emitted.
1002 ///
1003 ///
1004 ///
1005 ///
1006 /// #### `touch-event`
1007 ///
1008 ///
1009 ///
1010 /// #### `unmap`
1011 /// The ::unmap signal is emitted when `widget` is going to be unmapped, which
1012 /// means that either it or any of its parents up to the toplevel widget have
1013 /// been set as hidden.
1014 ///
1015 /// As ::unmap indicates that a widget will not be shown any longer, it can be
1016 /// used to, for example, stop an animation on the widget.
1017 ///
1018 ///
1019 ///
1020 ///
1021 /// #### `unmap-event`
1022 /// The ::unmap-event signal will be emitted when the `widget`'s window is
1023 /// unmapped. A window is unmapped when it becomes invisible on the screen.
1024 ///
1025 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1026 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1027 /// automatically for all new windows.
1028 ///
1029 ///
1030 ///
1031 ///
1032 /// #### `unrealize`
1033 /// The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1034 /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1035 /// called or the widget has been unmapped (that is, it is going to be
1036 /// hidden).
1037 ///
1038 ///
1039 ///
1040 ///
1041 /// #### `visibility-notify-event`
1042 /// The ::visibility-notify-event will be emitted when the `widget`'s
1043 /// window is obscured or unobscured.
1044 ///
1045 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1046 /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1047 ///
1048 ///
1049 ///
1050 ///
1051 /// #### `window-state-event`
1052 /// The ::window-state-event will be emitted when the state of the
1053 /// toplevel window associated to the `widget` changes.
1054 ///
1055 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1056 /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1057 /// this mask automatically for all new windows.
1058 ///
1059 ///
1060 /// </details>
1061 ///
1062 /// # Implements
1063 ///
1064 /// [`PopoverExt`][trait@crate::prelude::PopoverExt], [`BinExt`][trait@crate::prelude::BinExt], [`ContainerExt`][trait@crate::prelude::ContainerExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ContainerExtManual`][trait@crate::prelude::ContainerExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
1065 #[doc(alias = "GtkPopover")]
1066 pub struct Popover(Object<ffi::GtkPopover, ffi::GtkPopoverClass>) @extends Bin, Container, Widget, @implements Buildable;
1067
1068 match fn {
1069 type_ => || ffi::gtk_popover_get_type(),
1070 }
1071}
1072
1073impl Popover {
1074 pub const NONE: Option<&'static Popover> = None;
1075
1076 /// Creates a new popover to point to `relative_to`
1077 /// ## `relative_to`
1078 /// [`Widget`][crate::Widget] the popover is related to
1079 ///
1080 /// # Returns
1081 ///
1082 /// a new [`Popover`][crate::Popover]
1083 #[doc(alias = "gtk_popover_new")]
1084 pub fn new(relative_to: Option<&impl IsA<Widget>>) -> Popover {
1085 assert_initialized_main_thread!();
1086 unsafe {
1087 Widget::from_glib_none(ffi::gtk_popover_new(
1088 relative_to.map(|p| p.as_ref()).to_glib_none().0,
1089 ))
1090 .unsafe_cast()
1091 }
1092 }
1093
1094 /// Creates a [`Popover`][crate::Popover] and populates it according to
1095 /// `model`. The popover is pointed to the `relative_to` widget.
1096 ///
1097 /// The created buttons are connected to actions found in the
1098 /// [`ApplicationWindow`][crate::ApplicationWindow] to which the popover belongs - typically
1099 /// by means of being attached to a widget that is contained within
1100 /// the `GtkApplicationWindows` widget hierarchy.
1101 ///
1102 /// Actions can also be added using [`WidgetExt::insert_action_group()`][crate::prelude::WidgetExt::insert_action_group()]
1103 /// on the menus attach widget or on any of its parent widgets.
1104 /// ## `relative_to`
1105 /// [`Widget`][crate::Widget] the popover is related to
1106 /// ## `model`
1107 /// a [`gio::MenuModel`][crate::gio::MenuModel]
1108 ///
1109 /// # Returns
1110 ///
1111 /// the new [`Popover`][crate::Popover]
1112 #[doc(alias = "gtk_popover_new_from_model")]
1113 #[doc(alias = "new_from_model")]
1114 pub fn from_model(
1115 relative_to: Option<&impl IsA<Widget>>,
1116 model: &impl IsA<gio::MenuModel>,
1117 ) -> Popover {
1118 assert_initialized_main_thread!();
1119 unsafe {
1120 Widget::from_glib_none(ffi::gtk_popover_new_from_model(
1121 relative_to.map(|p| p.as_ref()).to_glib_none().0,
1122 model.as_ref().to_glib_none().0,
1123 ))
1124 .unsafe_cast()
1125 }
1126 }
1127
1128 // rustdoc-stripper-ignore-next
1129 /// Creates a new builder-pattern struct instance to construct [`Popover`] objects.
1130 ///
1131 /// This method returns an instance of [`PopoverBuilder`](crate::builders::PopoverBuilder) which can be used to create [`Popover`] objects.
1132 pub fn builder() -> PopoverBuilder {
1133 PopoverBuilder::new()
1134 }
1135}
1136
1137impl Default for Popover {
1138 fn default() -> Self {
1139 glib::object::Object::new::<Self>()
1140 }
1141}
1142
1143// rustdoc-stripper-ignore-next
1144/// A [builder-pattern] type to construct [`Popover`] objects.
1145///
1146/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1147#[must_use = "The builder must be built to be used"]
1148pub struct PopoverBuilder {
1149 builder: glib::object::ObjectBuilder<'static, Popover>,
1150}
1151
1152impl PopoverBuilder {
1153 fn new() -> Self {
1154 Self {
1155 builder: glib::object::Object::builder(),
1156 }
1157 }
1158
1159 /// Sets a constraint for the popover position.
1160 pub fn constrain_to(self, constrain_to: PopoverConstraint) -> Self {
1161 Self {
1162 builder: self.builder.property("constrain-to", constrain_to),
1163 }
1164 }
1165
1166 /// Sets whether the popover is modal (so other elements in the window do not
1167 /// receive input while the popover is visible).
1168 pub fn modal(self, modal: bool) -> Self {
1169 Self {
1170 builder: self.builder.property("modal", modal),
1171 }
1172 }
1173
1174 /// Marks a specific rectangle to be pointed.
1175 pub fn pointing_to(self, pointing_to: &gdk::Rectangle) -> Self {
1176 Self {
1177 builder: self.builder.property("pointing-to", pointing_to),
1178 }
1179 }
1180
1181 /// Sets the preferred position of the popover.
1182 pub fn position(self, position: PositionType) -> Self {
1183 Self {
1184 builder: self.builder.property("position", position),
1185 }
1186 }
1187
1188 /// Sets the attached widget.
1189 pub fn relative_to(self, relative_to: &impl IsA<Widget>) -> Self {
1190 Self {
1191 builder: self
1192 .builder
1193 .property("relative-to", relative_to.clone().upcast()),
1194 }
1195 }
1196
1197 pub fn border_width(self, border_width: u32) -> Self {
1198 Self {
1199 builder: self.builder.property("border-width", border_width),
1200 }
1201 }
1202
1203 pub fn child(self, child: &impl IsA<Widget>) -> Self {
1204 Self {
1205 builder: self.builder.property("child", child.clone().upcast()),
1206 }
1207 }
1208
1209 pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
1210 Self {
1211 builder: self.builder.property("resize-mode", resize_mode),
1212 }
1213 }
1214
1215 pub fn app_paintable(self, app_paintable: bool) -> Self {
1216 Self {
1217 builder: self.builder.property("app-paintable", app_paintable),
1218 }
1219 }
1220
1221 pub fn can_default(self, can_default: bool) -> Self {
1222 Self {
1223 builder: self.builder.property("can-default", can_default),
1224 }
1225 }
1226
1227 pub fn can_focus(self, can_focus: bool) -> Self {
1228 Self {
1229 builder: self.builder.property("can-focus", can_focus),
1230 }
1231 }
1232
1233 pub fn events(self, events: gdk::EventMask) -> Self {
1234 Self {
1235 builder: self.builder.property("events", events),
1236 }
1237 }
1238
1239 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1240 pub fn expand(self, expand: bool) -> Self {
1241 Self {
1242 builder: self.builder.property("expand", expand),
1243 }
1244 }
1245
1246 /// Whether the widget should grab focus when it is clicked with the mouse.
1247 ///
1248 /// This property is only relevant for widgets that can take focus.
1249 ///
1250 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1251 /// GtkComboBox) implemented this property individually.
1252 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1253 Self {
1254 builder: self.builder.property("focus-on-click", focus_on_click),
1255 }
1256 }
1257
1258 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1259 pub fn halign(self, halign: Align) -> Self {
1260 Self {
1261 builder: self.builder.property("halign", halign),
1262 }
1263 }
1264
1265 pub fn has_default(self, has_default: bool) -> Self {
1266 Self {
1267 builder: self.builder.property("has-default", has_default),
1268 }
1269 }
1270
1271 pub fn has_focus(self, has_focus: bool) -> Self {
1272 Self {
1273 builder: self.builder.property("has-focus", has_focus),
1274 }
1275 }
1276
1277 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1278 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1279 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1280 /// whether it will provide a tooltip or not.
1281 ///
1282 /// Note that setting this property to [`true`] for the first time will change
1283 /// the event masks of the GdkWindows of this widget to include leave-notify
1284 /// and motion-notify events. This cannot and will not be undone when the
1285 /// property is set to [`false`] again.
1286 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1287 Self {
1288 builder: self.builder.property("has-tooltip", has_tooltip),
1289 }
1290 }
1291
1292 pub fn height_request(self, height_request: i32) -> Self {
1293 Self {
1294 builder: self.builder.property("height-request", height_request),
1295 }
1296 }
1297
1298 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1299 pub fn hexpand(self, hexpand: bool) -> Self {
1300 Self {
1301 builder: self.builder.property("hexpand", hexpand),
1302 }
1303 }
1304
1305 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1306 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1307 Self {
1308 builder: self.builder.property("hexpand-set", hexpand_set),
1309 }
1310 }
1311
1312 pub fn is_focus(self, is_focus: bool) -> Self {
1313 Self {
1314 builder: self.builder.property("is-focus", is_focus),
1315 }
1316 }
1317
1318 /// Sets all four sides' margin at once. If read, returns max
1319 /// margin on any side.
1320 pub fn margin(self, margin: i32) -> Self {
1321 Self {
1322 builder: self.builder.property("margin", margin),
1323 }
1324 }
1325
1326 /// Margin on bottom side of widget.
1327 ///
1328 /// This property adds margin outside of the widget's normal size
1329 /// request, the margin will be added in addition to the size from
1330 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1331 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1332 Self {
1333 builder: self.builder.property("margin-bottom", margin_bottom),
1334 }
1335 }
1336
1337 /// Margin on end of widget, horizontally. This property supports
1338 /// left-to-right and right-to-left text directions.
1339 ///
1340 /// This property adds margin outside of the widget's normal size
1341 /// request, the margin will be added in addition to the size from
1342 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1343 pub fn margin_end(self, margin_end: i32) -> Self {
1344 Self {
1345 builder: self.builder.property("margin-end", margin_end),
1346 }
1347 }
1348
1349 /// Margin on start of widget, horizontally. This property supports
1350 /// left-to-right and right-to-left text directions.
1351 ///
1352 /// This property adds margin outside of the widget's normal size
1353 /// request, the margin will be added in addition to the size from
1354 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1355 pub fn margin_start(self, margin_start: i32) -> Self {
1356 Self {
1357 builder: self.builder.property("margin-start", margin_start),
1358 }
1359 }
1360
1361 /// Margin on top side of widget.
1362 ///
1363 /// This property adds margin outside of the widget's normal size
1364 /// request, the margin will be added in addition to the size from
1365 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1366 pub fn margin_top(self, margin_top: i32) -> Self {
1367 Self {
1368 builder: self.builder.property("margin-top", margin_top),
1369 }
1370 }
1371
1372 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1373 Self {
1374 builder: self.builder.property("name", name.into()),
1375 }
1376 }
1377
1378 pub fn no_show_all(self, no_show_all: bool) -> Self {
1379 Self {
1380 builder: self.builder.property("no-show-all", no_show_all),
1381 }
1382 }
1383
1384 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1385 /// more details about window opacity.
1386 ///
1387 /// Before 3.8 this was only available in GtkWindow
1388 pub fn opacity(self, opacity: f64) -> Self {
1389 Self {
1390 builder: self.builder.property("opacity", opacity),
1391 }
1392 }
1393
1394 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1395 Self {
1396 builder: self.builder.property("parent", parent.clone().upcast()),
1397 }
1398 }
1399
1400 pub fn receives_default(self, receives_default: bool) -> Self {
1401 Self {
1402 builder: self.builder.property("receives-default", receives_default),
1403 }
1404 }
1405
1406 pub fn sensitive(self, sensitive: bool) -> Self {
1407 Self {
1408 builder: self.builder.property("sensitive", sensitive),
1409 }
1410 }
1411
1412 /// Sets the text of tooltip to be the given string, which is marked up
1413 /// with the [Pango text markup language][PangoMarkupFormat].
1414 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1415 ///
1416 /// This is a convenience property which will take care of getting the
1417 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1418 /// will automatically be set to [`true`] and there will be taken care of
1419 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1420 ///
1421 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1422 /// are set, the last one wins.
1423 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1424 Self {
1425 builder: self
1426 .builder
1427 .property("tooltip-markup", tooltip_markup.into()),
1428 }
1429 }
1430
1431 /// Sets the text of tooltip to be the given string.
1432 ///
1433 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1434 ///
1435 /// This is a convenience property which will take care of getting the
1436 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1437 /// will automatically be set to [`true`] and there will be taken care of
1438 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1439 ///
1440 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1441 /// are set, the last one wins.
1442 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1443 Self {
1444 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1445 }
1446 }
1447
1448 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1449 pub fn valign(self, valign: Align) -> Self {
1450 Self {
1451 builder: self.builder.property("valign", valign),
1452 }
1453 }
1454
1455 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1456 pub fn vexpand(self, vexpand: bool) -> Self {
1457 Self {
1458 builder: self.builder.property("vexpand", vexpand),
1459 }
1460 }
1461
1462 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1463 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1464 Self {
1465 builder: self.builder.property("vexpand-set", vexpand_set),
1466 }
1467 }
1468
1469 pub fn visible(self, visible: bool) -> Self {
1470 Self {
1471 builder: self.builder.property("visible", visible),
1472 }
1473 }
1474
1475 pub fn width_request(self, width_request: i32) -> Self {
1476 Self {
1477 builder: self.builder.property("width-request", width_request),
1478 }
1479 }
1480
1481 // rustdoc-stripper-ignore-next
1482 /// Build the [`Popover`].
1483 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1484 pub fn build(self) -> Popover {
1485 assert_initialized_main_thread!();
1486 self.builder.build()
1487 }
1488}
1489
1490/// Trait containing all [`struct@Popover`] methods.
1491///
1492/// # Implementors
1493///
1494/// [`PopoverMenu`][struct@crate::PopoverMenu], [`Popover`][struct@crate::Popover]
1495pub trait PopoverExt: IsA<Popover> + 'static {
1496 /// Establishes a binding between a [`Popover`][crate::Popover] and a [`gio::MenuModel`][crate::gio::MenuModel].
1497 ///
1498 /// The contents of `self` are removed and then refilled with menu items
1499 /// according to `model`. When `model` changes, `self` is updated.
1500 /// Calling this function twice on `self` with different `model` will
1501 /// cause the first binding to be replaced with a binding to the new
1502 /// model. If `model` is [`None`] then any previous binding is undone and
1503 /// all children are removed.
1504 ///
1505 /// If `action_namespace` is non-[`None`] then the effect is as if all
1506 /// actions mentioned in the `model` have their names prefixed with the
1507 /// namespace, plus a dot. For example, if the action “quit” is
1508 /// mentioned and `action_namespace` is “app” then the effective action
1509 /// name is “app.quit”.
1510 ///
1511 /// This function uses [`Actionable`][crate::Actionable] to define the action name and
1512 /// target values on the created menu items. If you want to use an
1513 /// action group other than “app” and “win”, or if you want to use a
1514 /// [`MenuShell`][crate::MenuShell] outside of a [`ApplicationWindow`][crate::ApplicationWindow], then you will need
1515 /// to attach your own action group to the widget hierarchy using
1516 /// [`WidgetExt::insert_action_group()`][crate::prelude::WidgetExt::insert_action_group()]. As an example, if you created a
1517 /// group with a “quit” action and inserted it with the name “mygroup”
1518 /// then you would use the action name “mygroup.quit” in your
1519 /// [`gio::MenuModel`][crate::gio::MenuModel].
1520 /// ## `model`
1521 /// the [`gio::MenuModel`][crate::gio::MenuModel] to bind to or [`None`] to remove
1522 /// binding
1523 /// ## `action_namespace`
1524 /// the namespace for actions in `model`
1525 #[doc(alias = "gtk_popover_bind_model")]
1526 fn bind_model(&self, model: Option<&impl IsA<gio::MenuModel>>, action_namespace: Option<&str>) {
1527 unsafe {
1528 ffi::gtk_popover_bind_model(
1529 self.as_ref().to_glib_none().0,
1530 model.map(|p| p.as_ref()).to_glib_none().0,
1531 action_namespace.to_glib_none().0,
1532 );
1533 }
1534 }
1535
1536 /// Returns the constraint for placing this popover.
1537 /// See [`set_constrain_to()`][Self::set_constrain_to()].
1538 ///
1539 /// # Returns
1540 ///
1541 /// the constraint for placing this popover.
1542 #[doc(alias = "gtk_popover_get_constrain_to")]
1543 #[doc(alias = "get_constrain_to")]
1544 #[doc(alias = "constrain-to")]
1545 fn constrain_to(&self) -> PopoverConstraint {
1546 unsafe {
1547 from_glib(ffi::gtk_popover_get_constrain_to(
1548 self.as_ref().to_glib_none().0,
1549 ))
1550 }
1551 }
1552
1553 /// Gets the widget that should be set as the default while
1554 /// the popover is shown.
1555 ///
1556 /// # Returns
1557 ///
1558 /// the default widget,
1559 /// or [`None`] if there is none
1560 #[doc(alias = "gtk_popover_get_default_widget")]
1561 #[doc(alias = "get_default_widget")]
1562 fn default_widget(&self) -> Option<Widget> {
1563 unsafe {
1564 from_glib_none(ffi::gtk_popover_get_default_widget(
1565 self.as_ref().to_glib_none().0,
1566 ))
1567 }
1568 }
1569
1570 /// Returns whether the popover is modal, see gtk_popover_set_modal to
1571 /// see the implications of this.
1572 ///
1573 /// # Returns
1574 ///
1575 /// [`true`] if `self` is modal
1576 #[doc(alias = "gtk_popover_get_modal")]
1577 #[doc(alias = "get_modal")]
1578 #[doc(alias = "modal")]
1579 fn is_modal(&self) -> bool {
1580 unsafe { from_glib(ffi::gtk_popover_get_modal(self.as_ref().to_glib_none().0)) }
1581 }
1582
1583 /// If a rectangle to point to has been set, this function will
1584 /// return [`true`] and fill in `rect` with such rectangle, otherwise
1585 /// it will return [`false`] and fill in `rect` with the attached
1586 /// widget width and height if a widget exists, otherwise it will zero-out `rect`.
1587 ///
1588 /// # Returns
1589 ///
1590 /// [`true`] if a rectangle to point to was set.
1591 ///
1592 /// ## `rect`
1593 /// location to store the rectangle
1594 #[doc(alias = "gtk_popover_get_pointing_to")]
1595 #[doc(alias = "get_pointing_to")]
1596 #[doc(alias = "pointing-to")]
1597 fn pointing_to(&self) -> Option<gdk::Rectangle> {
1598 unsafe {
1599 let mut rect = gdk::Rectangle::uninitialized();
1600 let ret = from_glib(ffi::gtk_popover_get_pointing_to(
1601 self.as_ref().to_glib_none().0,
1602 rect.to_glib_none_mut().0,
1603 ));
1604 if ret { Some(rect) } else { None }
1605 }
1606 }
1607
1608 /// Returns the preferred position of `self`.
1609 ///
1610 /// # Returns
1611 ///
1612 /// The preferred position.
1613 #[doc(alias = "gtk_popover_get_position")]
1614 #[doc(alias = "get_position")]
1615 fn position(&self) -> PositionType {
1616 unsafe {
1617 from_glib(ffi::gtk_popover_get_position(
1618 self.as_ref().to_glib_none().0,
1619 ))
1620 }
1621 }
1622
1623 /// Returns the widget `self` is currently attached to
1624 ///
1625 /// # Returns
1626 ///
1627 /// a [`Widget`][crate::Widget]
1628 #[doc(alias = "gtk_popover_get_relative_to")]
1629 #[doc(alias = "get_relative_to")]
1630 #[doc(alias = "relative-to")]
1631 fn relative_to(&self) -> Option<Widget> {
1632 unsafe {
1633 from_glib_none(ffi::gtk_popover_get_relative_to(
1634 self.as_ref().to_glib_none().0,
1635 ))
1636 }
1637 }
1638
1639 /// Pops `self` down.This is different than a [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()] call
1640 /// in that it shows the popover with a transition. If you want to hide
1641 /// the popover without a transition, use [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
1642 #[doc(alias = "gtk_popover_popdown")]
1643 fn popdown(&self) {
1644 unsafe {
1645 ffi::gtk_popover_popdown(self.as_ref().to_glib_none().0);
1646 }
1647 }
1648
1649 /// Pops `self` up. This is different than a [`WidgetExt::show()`][crate::prelude::WidgetExt::show()] call
1650 /// in that it shows the popover with a transition. If you want to show
1651 /// the popover without a transition, use [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
1652 #[doc(alias = "gtk_popover_popup")]
1653 fn popup(&self) {
1654 unsafe {
1655 ffi::gtk_popover_popup(self.as_ref().to_glib_none().0);
1656 }
1657 }
1658
1659 /// Sets a constraint for positioning this popover.
1660 ///
1661 /// Note that not all platforms support placing popovers freely,
1662 /// and may already impose constraints.
1663 /// ## `constraint`
1664 /// the new constraint
1665 #[doc(alias = "gtk_popover_set_constrain_to")]
1666 #[doc(alias = "constrain-to")]
1667 fn set_constrain_to(&self, constraint: PopoverConstraint) {
1668 unsafe {
1669 ffi::gtk_popover_set_constrain_to(
1670 self.as_ref().to_glib_none().0,
1671 constraint.into_glib(),
1672 );
1673 }
1674 }
1675
1676 /// Sets the widget that should be set as default widget while
1677 /// the popover is shown (see [`GtkWindowExt::set_default()`][crate::prelude::GtkWindowExt::set_default()]). [`Popover`][crate::Popover]
1678 /// remembers the previous default widget and reestablishes it
1679 /// when the popover is dismissed.
1680 /// ## `widget`
1681 /// the new default widget, or [`None`]
1682 #[doc(alias = "gtk_popover_set_default_widget")]
1683 fn set_default_widget(&self, widget: Option<&impl IsA<Widget>>) {
1684 unsafe {
1685 ffi::gtk_popover_set_default_widget(
1686 self.as_ref().to_glib_none().0,
1687 widget.map(|p| p.as_ref()).to_glib_none().0,
1688 );
1689 }
1690 }
1691
1692 /// Sets whether `self` is modal, a modal popover will grab all input
1693 /// within the toplevel and grab the keyboard focus on it when being
1694 /// displayed. Clicking outside the popover area or pressing Esc will
1695 /// dismiss the popover and ungrab input.
1696 /// ## `modal`
1697 /// [`true`] to make popover claim all input within the toplevel
1698 #[doc(alias = "gtk_popover_set_modal")]
1699 #[doc(alias = "modal")]
1700 fn set_modal(&self, modal: bool) {
1701 unsafe {
1702 ffi::gtk_popover_set_modal(self.as_ref().to_glib_none().0, modal.into_glib());
1703 }
1704 }
1705
1706 /// Sets the rectangle that `self` will point to, in the
1707 /// coordinate space of the widget `self` is attached to,
1708 /// see [`set_relative_to()`][Self::set_relative_to()].
1709 /// ## `rect`
1710 /// rectangle to point to
1711 #[doc(alias = "gtk_popover_set_pointing_to")]
1712 #[doc(alias = "pointing-to")]
1713 fn set_pointing_to(&self, rect: &gdk::Rectangle) {
1714 unsafe {
1715 ffi::gtk_popover_set_pointing_to(self.as_ref().to_glib_none().0, rect.to_glib_none().0);
1716 }
1717 }
1718
1719 /// Sets the preferred position for `self` to appear. If the `self`
1720 /// is currently visible, it will be immediately updated.
1721 ///
1722 /// This preference will be respected where possible, although
1723 /// on lack of space (eg. if close to the window edges), the
1724 /// [`Popover`][crate::Popover] may choose to appear on the opposite side
1725 /// ## `position`
1726 /// preferred popover position
1727 #[doc(alias = "gtk_popover_set_position")]
1728 #[doc(alias = "position")]
1729 fn set_position(&self, position: PositionType) {
1730 unsafe {
1731 ffi::gtk_popover_set_position(self.as_ref().to_glib_none().0, position.into_glib());
1732 }
1733 }
1734
1735 /// Sets a new widget to be attached to `self`. If `self` is
1736 /// visible, the position will be updated.
1737 ///
1738 /// Note: the ownership of popovers is always given to their `relative_to`
1739 /// widget, so if `relative_to` is set to [`None`] on an attached `self`, it
1740 /// will be detached from its previous widget, and consequently destroyed
1741 /// unless extra references are kept.
1742 /// ## `relative_to`
1743 /// a [`Widget`][crate::Widget]
1744 #[doc(alias = "gtk_popover_set_relative_to")]
1745 #[doc(alias = "relative-to")]
1746 fn set_relative_to(&self, relative_to: Option<&impl IsA<Widget>>) {
1747 unsafe {
1748 ffi::gtk_popover_set_relative_to(
1749 self.as_ref().to_glib_none().0,
1750 relative_to.map(|p| p.as_ref()).to_glib_none().0,
1751 );
1752 }
1753 }
1754
1755 /// This signal is emitted when the popover is dismissed either through
1756 /// API or user interaction.
1757 #[doc(alias = "closed")]
1758 fn connect_closed<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1759 unsafe extern "C" fn closed_trampoline<P: IsA<Popover>, F: Fn(&P) + 'static>(
1760 this: *mut ffi::GtkPopover,
1761 f: glib::ffi::gpointer,
1762 ) {
1763 unsafe {
1764 let f: &F = &*(f as *const F);
1765 f(Popover::from_glib_borrow(this).unsafe_cast_ref())
1766 }
1767 }
1768 unsafe {
1769 let f: Box_<F> = Box_::new(f);
1770 connect_raw(
1771 self.as_ptr() as *mut _,
1772 c"closed".as_ptr(),
1773 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1774 closed_trampoline::<Self, F> as *const (),
1775 )),
1776 Box_::into_raw(f),
1777 )
1778 }
1779 }
1780
1781 #[doc(alias = "constrain-to")]
1782 fn connect_constrain_to_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1783 unsafe extern "C" fn notify_constrain_to_trampoline<
1784 P: IsA<Popover>,
1785 F: Fn(&P) + 'static,
1786 >(
1787 this: *mut ffi::GtkPopover,
1788 _param_spec: glib::ffi::gpointer,
1789 f: glib::ffi::gpointer,
1790 ) {
1791 unsafe {
1792 let f: &F = &*(f as *const F);
1793 f(Popover::from_glib_borrow(this).unsafe_cast_ref())
1794 }
1795 }
1796 unsafe {
1797 let f: Box_<F> = Box_::new(f);
1798 connect_raw(
1799 self.as_ptr() as *mut _,
1800 c"notify::constrain-to".as_ptr(),
1801 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1802 notify_constrain_to_trampoline::<Self, F> as *const (),
1803 )),
1804 Box_::into_raw(f),
1805 )
1806 }
1807 }
1808
1809 #[doc(alias = "modal")]
1810 fn connect_modal_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1811 unsafe extern "C" fn notify_modal_trampoline<P: IsA<Popover>, F: Fn(&P) + 'static>(
1812 this: *mut ffi::GtkPopover,
1813 _param_spec: glib::ffi::gpointer,
1814 f: glib::ffi::gpointer,
1815 ) {
1816 unsafe {
1817 let f: &F = &*(f as *const F);
1818 f(Popover::from_glib_borrow(this).unsafe_cast_ref())
1819 }
1820 }
1821 unsafe {
1822 let f: Box_<F> = Box_::new(f);
1823 connect_raw(
1824 self.as_ptr() as *mut _,
1825 c"notify::modal".as_ptr(),
1826 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1827 notify_modal_trampoline::<Self, F> as *const (),
1828 )),
1829 Box_::into_raw(f),
1830 )
1831 }
1832 }
1833
1834 #[doc(alias = "pointing-to")]
1835 fn connect_pointing_to_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1836 unsafe extern "C" fn notify_pointing_to_trampoline<P: IsA<Popover>, F: Fn(&P) + 'static>(
1837 this: *mut ffi::GtkPopover,
1838 _param_spec: glib::ffi::gpointer,
1839 f: glib::ffi::gpointer,
1840 ) {
1841 unsafe {
1842 let f: &F = &*(f as *const F);
1843 f(Popover::from_glib_borrow(this).unsafe_cast_ref())
1844 }
1845 }
1846 unsafe {
1847 let f: Box_<F> = Box_::new(f);
1848 connect_raw(
1849 self.as_ptr() as *mut _,
1850 c"notify::pointing-to".as_ptr(),
1851 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1852 notify_pointing_to_trampoline::<Self, F> as *const (),
1853 )),
1854 Box_::into_raw(f),
1855 )
1856 }
1857 }
1858
1859 #[doc(alias = "position")]
1860 fn connect_position_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1861 unsafe extern "C" fn notify_position_trampoline<P: IsA<Popover>, F: Fn(&P) + 'static>(
1862 this: *mut ffi::GtkPopover,
1863 _param_spec: glib::ffi::gpointer,
1864 f: glib::ffi::gpointer,
1865 ) {
1866 unsafe {
1867 let f: &F = &*(f as *const F);
1868 f(Popover::from_glib_borrow(this).unsafe_cast_ref())
1869 }
1870 }
1871 unsafe {
1872 let f: Box_<F> = Box_::new(f);
1873 connect_raw(
1874 self.as_ptr() as *mut _,
1875 c"notify::position".as_ptr(),
1876 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1877 notify_position_trampoline::<Self, F> as *const (),
1878 )),
1879 Box_::into_raw(f),
1880 )
1881 }
1882 }
1883
1884 #[doc(alias = "relative-to")]
1885 fn connect_relative_to_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1886 unsafe extern "C" fn notify_relative_to_trampoline<P: IsA<Popover>, F: Fn(&P) + 'static>(
1887 this: *mut ffi::GtkPopover,
1888 _param_spec: glib::ffi::gpointer,
1889 f: glib::ffi::gpointer,
1890 ) {
1891 unsafe {
1892 let f: &F = &*(f as *const F);
1893 f(Popover::from_glib_borrow(this).unsafe_cast_ref())
1894 }
1895 }
1896 unsafe {
1897 let f: Box_<F> = Box_::new(f);
1898 connect_raw(
1899 self.as_ptr() as *mut _,
1900 c"notify::relative-to".as_ptr(),
1901 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1902 notify_relative_to_trampoline::<Self, F> as *const (),
1903 )),
1904 Box_::into_raw(f),
1905 )
1906 }
1907 }
1908}
1909
1910impl<O: IsA<Popover>> PopoverExt for O {}