Skip to main content

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