Skip to main content

gtk/auto/
menu.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    AccelGroup, Align, Buildable, Container, MenuItem, MenuShell, ResizeMode, ScrollType, Widget,
7    ffi,
8};
9use glib::{
10    object::ObjectType as _,
11    prelude::*,
12    signal::{SignalHandlerId, connect_raw},
13    translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18    /// A [`Menu`][crate::Menu] is a [`MenuShell`][crate::MenuShell] that implements a drop down menu
19    /// consisting of a list of [`MenuItem`][crate::MenuItem] objects which can be navigated
20    /// and activated by the user to perform application functions.
21    ///
22    /// A [`Menu`][crate::Menu] is most commonly dropped down by activating a
23    /// [`MenuItem`][crate::MenuItem] in a [`MenuBar`][crate::MenuBar] or popped up by activating a
24    /// [`MenuItem`][crate::MenuItem] in another [`Menu`][crate::Menu].
25    ///
26    /// A [`Menu`][crate::Menu] can also be popped up by activating a [`ComboBox`][crate::ComboBox].
27    /// Other composite widgets such as the [`Notebook`][crate::Notebook] can pop up a
28    /// [`Menu`][crate::Menu] as well.
29    ///
30    /// Applications can display a [`Menu`][crate::Menu] as a popup menu by calling the
31    /// `gtk_menu_popup()` function. The example below shows how an application
32    /// can pop up a menu when the 3rd mouse button is pressed.
33    ///
34    /// ## Connecting the popup signal handler.
35    ///
36    ///
37    ///
38    /// **⚠️ The following code is in C ⚠️**
39    ///
40    /// ```C
41    ///   // connect our handler which will popup the menu
42    ///   g_signal_connect_swapped (window, "button_press_event",
43    /// G_CALLBACK (my_popup_handler), menu);
44    /// ```
45    ///
46    /// ## Signal handler which displays a popup menu.
47    ///
48    ///
49    ///
50    /// **⚠️ The following code is in C ⚠️**
51    ///
52    /// ```C
53    /// static gint
54    /// my_popup_handler (GtkWidget *widget, GdkEvent *event)
55    /// {
56    ///   GtkMenu *menu;
57    ///   GdkEventButton *event_button;
58    ///
59    ///   g_return_val_if_fail (widget != NULL, FALSE);
60    ///   g_return_val_if_fail (GTK_IS_MENU (widget), FALSE);
61    ///   g_return_val_if_fail (event != NULL, FALSE);
62    ///
63    ///   // The "widget" is the menu that was supplied when
64    ///   // g_signal_connect_swapped() was called.
65    ///   menu = GTK_MENU (widget);
66    ///
67    ///   if (event->type == GDK_BUTTON_PRESS)
68    ///     {
69    ///       event_button = (GdkEventButton *) event;
70    ///       if (event_button->button == GDK_BUTTON_SECONDARY)
71    ///         {
72    ///           gtk_menu_popup (menu, NULL, NULL, NULL, NULL,
73    ///                           event_button->button, event_button->time);
74    ///           return TRUE;
75    ///         }
76    ///     }
77    ///
78    ///   return FALSE;
79    /// }
80    /// ```
81    ///
82    /// # CSS nodes
83    ///
84    ///
85    ///
86    /// **⚠️ The following code is in plain ⚠️**
87    ///
88    /// ```plain
89    /// menu
90    /// ├── arrow.top
91    /// ├── <child>
92    /// ┊
93    /// ├── <child>
94    /// ╰── arrow.bottom
95    /// ```
96    ///
97    /// The main CSS node of GtkMenu has name menu, and there are two subnodes
98    /// with name arrow, for scrolling menu arrows. These subnodes get the
99    /// .top and .bottom style classes.
100    ///
101    /// ## Properties
102    ///
103    ///
104    /// #### `accel-group`
105    ///  The accel group holding accelerators for the menu.
106    ///
107    /// Readable | Writable
108    ///
109    ///
110    /// #### `accel-path`
111    ///  An accel path used to conveniently construct accel paths of child items.
112    ///
113    /// Readable | Writable
114    ///
115    ///
116    /// #### `active`
117    ///  The index of the currently selected menu item, or -1 if no
118    /// menu item is selected.
119    ///
120    /// Readable | Writable
121    ///
122    ///
123    /// #### `anchor-hints`
124    ///  Positioning hints for aligning the menu relative to a rectangle.
125    ///
126    /// These hints determine how the menu should be positioned in the case that
127    /// the menu would fall off-screen if placed in its ideal position.
128    ///
129    /// ![](popup-flip.png)
130    ///
131    /// For example, [`gdk::AnchorHints::FLIP_Y`][crate::gdk::AnchorHints::FLIP_Y] will replace [`gdk::Gravity::NorthWest`][crate::gdk::Gravity::NorthWest] with
132    /// [`gdk::Gravity::SouthWest`][crate::gdk::Gravity::SouthWest] and vice versa if the menu extends beyond the
133    /// bottom edge of the monitor.
134    ///
135    /// See gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (),
136    /// gtk_menu_popup_at_pointer (), [`rect-anchor-dx`][struct@crate::Menu#rect-anchor-dx],
137    /// [`rect-anchor-dy`][struct@crate::Menu#rect-anchor-dy], [`menu-type-hint`][struct@crate::Menu#menu-type-hint], and [`popped-up`][struct@crate::Menu#popped-up].
138    ///
139    /// Readable | Writable | Construct
140    ///
141    ///
142    /// #### `attach-widget`
143    ///  The widget the menu is attached to. Setting this property attaches
144    /// the menu without a `GtkMenuDetachFunc`. If you need to use a detacher,
145    /// use `gtk_menu_attach_to_widget()` directly.
146    ///
147    /// Readable | Writable
148    ///
149    ///
150    /// #### `menu-type-hint`
151    ///  The [`gdk::WindowTypeHint`][crate::gdk::WindowTypeHint] to use for the menu's [`gdk::Window`][crate::gdk::Window].
152    ///
153    /// See gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (),
154    /// gtk_menu_popup_at_pointer (), [`anchor-hints`][struct@crate::Menu#anchor-hints],
155    /// [`rect-anchor-dx`][struct@crate::Menu#rect-anchor-dx], [`rect-anchor-dy`][struct@crate::Menu#rect-anchor-dy], and [`popped-up`][struct@crate::Menu#popped-up].
156    ///
157    /// Readable | Writable | Construct
158    ///
159    ///
160    /// #### `monitor`
161    ///  The monitor the menu will be popped up on.
162    ///
163    /// Readable | Writable
164    ///
165    ///
166    /// #### `rect-anchor-dx`
167    ///  Horizontal offset to apply to the menu, i.e. the rectangle or widget
168    /// anchor.
169    ///
170    /// See gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (),
171    /// gtk_menu_popup_at_pointer (), [`anchor-hints`][struct@crate::Menu#anchor-hints],
172    /// [`rect-anchor-dy`][struct@crate::Menu#rect-anchor-dy], [`menu-type-hint`][struct@crate::Menu#menu-type-hint], and [`popped-up`][struct@crate::Menu#popped-up].
173    ///
174    /// Readable | Writable | Construct
175    ///
176    ///
177    /// #### `rect-anchor-dy`
178    ///  Vertical offset to apply to the menu, i.e. the rectangle or widget anchor.
179    ///
180    /// See gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (),
181    /// gtk_menu_popup_at_pointer (), [`anchor-hints`][struct@crate::Menu#anchor-hints],
182    /// [`rect-anchor-dx`][struct@crate::Menu#rect-anchor-dx], [`menu-type-hint`][struct@crate::Menu#menu-type-hint], and [`popped-up`][struct@crate::Menu#popped-up].
183    ///
184    /// Readable | Writable | Construct
185    ///
186    ///
187    /// #### `reserve-toggle-size`
188    ///  A boolean that indicates whether the menu reserves space for
189    /// toggles and icons, regardless of their actual presence.
190    ///
191    /// This property should only be changed from its default value
192    /// for special-purposes such as tabular menus. Regular menus that
193    /// are connected to a menu bar or context menus should reserve
194    /// toggle space for consistency.
195    ///
196    /// Readable | Writable
197    ///
198    ///
199    /// #### `tearoff-state`
200    ///  A boolean that indicates whether the menu is torn-off.
201    ///
202    /// Readable | Writable
203    ///
204    ///
205    /// #### `tearoff-title`
206    ///  A title that may be displayed by the window manager when this
207    /// menu is torn-off.
208    ///
209    /// Readable | Writable
210    /// <details><summary><h4>MenuShell</h4></summary>
211    ///
212    ///
213    /// #### `take-focus`
214    ///  A boolean that determines whether the menu and its submenus grab the
215    /// keyboard focus. See [`MenuShellExt::set_take_focus()`][crate::prelude::MenuShellExt::set_take_focus()] and
216    /// [`MenuShellExt::takes_focus()`][crate::prelude::MenuShellExt::takes_focus()].
217    ///
218    /// Readable | Writable
219    /// </details>
220    /// <details><summary><h4>Container</h4></summary>
221    ///
222    ///
223    /// #### `border-width`
224    ///  Readable | Writable
225    ///
226    ///
227    /// #### `child`
228    ///  Writable
229    ///
230    ///
231    /// #### `resize-mode`
232    ///  Readable | Writable
233    /// </details>
234    /// <details><summary><h4>Widget</h4></summary>
235    ///
236    ///
237    /// #### `app-paintable`
238    ///  Readable | Writable
239    ///
240    ///
241    /// #### `can-default`
242    ///  Readable | Writable
243    ///
244    ///
245    /// #### `can-focus`
246    ///  Readable | Writable
247    ///
248    ///
249    /// #### `composite-child`
250    ///  Readable
251    ///
252    ///
253    /// #### `double-buffered`
254    ///  Whether the widget is double buffered.
255    ///
256    /// Readable | Writable
257    ///
258    ///
259    /// #### `events`
260    ///  Readable | Writable
261    ///
262    ///
263    /// #### `expand`
264    ///  Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
265    ///
266    /// Readable | Writable
267    ///
268    ///
269    /// #### `focus-on-click`
270    ///  Whether the widget should grab focus when it is clicked with the mouse.
271    ///
272    /// This property is only relevant for widgets that can take focus.
273    ///
274    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
275    /// GtkComboBox) implemented this property individually.
276    ///
277    /// Readable | Writable
278    ///
279    ///
280    /// #### `halign`
281    ///  How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
282    ///
283    /// Readable | Writable
284    ///
285    ///
286    /// #### `has-default`
287    ///  Readable | Writable
288    ///
289    ///
290    /// #### `has-focus`
291    ///  Readable | Writable
292    ///
293    ///
294    /// #### `has-tooltip`
295    ///  Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
296    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
297    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
298    /// whether it will provide a tooltip or not.
299    ///
300    /// Note that setting this property to [`true`] for the first time will change
301    /// the event masks of the GdkWindows of this widget to include leave-notify
302    /// and motion-notify events. This cannot and will not be undone when the
303    /// property is set to [`false`] again.
304    ///
305    /// Readable | Writable
306    ///
307    ///
308    /// #### `height-request`
309    ///  Readable | Writable
310    ///
311    ///
312    /// #### `hexpand`
313    ///  Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
314    ///
315    /// Readable | Writable
316    ///
317    ///
318    /// #### `hexpand-set`
319    ///  Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
320    ///
321    /// Readable | Writable
322    ///
323    ///
324    /// #### `is-focus`
325    ///  Readable | Writable
326    ///
327    ///
328    /// #### `margin`
329    ///  Sets all four sides' margin at once. If read, returns max
330    /// margin on any side.
331    ///
332    /// Readable | Writable
333    ///
334    ///
335    /// #### `margin-bottom`
336    ///  Margin on bottom side of widget.
337    ///
338    /// This property adds margin outside of the widget's normal size
339    /// request, the margin will be added in addition to the size from
340    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
341    ///
342    /// Readable | Writable
343    ///
344    ///
345    /// #### `margin-end`
346    ///  Margin on end of widget, horizontally. This property supports
347    /// left-to-right and right-to-left text directions.
348    ///
349    /// This property adds margin outside of the widget's normal size
350    /// request, the margin will be added in addition to the size from
351    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
352    ///
353    /// Readable | Writable
354    ///
355    ///
356    /// #### `margin-left`
357    ///  Margin on left side of widget.
358    ///
359    /// This property adds margin outside of the widget's normal size
360    /// request, the margin will be added in addition to the size from
361    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
362    ///
363    /// Readable | Writable
364    ///
365    ///
366    /// #### `margin-right`
367    ///  Margin on right side of widget.
368    ///
369    /// This property adds margin outside of the widget's normal size
370    /// request, the margin will be added in addition to the size from
371    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
372    ///
373    /// Readable | Writable
374    ///
375    ///
376    /// #### `margin-start`
377    ///  Margin on start of widget, horizontally. This property supports
378    /// left-to-right and right-to-left text directions.
379    ///
380    /// This property adds margin outside of the widget's normal size
381    /// request, the margin will be added in addition to the size from
382    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
383    ///
384    /// Readable | Writable
385    ///
386    ///
387    /// #### `margin-top`
388    ///  Margin on top side of widget.
389    ///
390    /// This property adds margin outside of the widget's normal size
391    /// request, the margin will be added in addition to the size from
392    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
393    ///
394    /// Readable | Writable
395    ///
396    ///
397    /// #### `name`
398    ///  Readable | Writable
399    ///
400    ///
401    /// #### `no-show-all`
402    ///  Readable | Writable
403    ///
404    ///
405    /// #### `opacity`
406    ///  The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
407    /// more details about window opacity.
408    ///
409    /// Before 3.8 this was only available in GtkWindow
410    ///
411    /// Readable | Writable
412    ///
413    ///
414    /// #### `parent`
415    ///  Readable | Writable
416    ///
417    ///
418    /// #### `receives-default`
419    ///  Readable | Writable
420    ///
421    ///
422    /// #### `scale-factor`
423    ///  The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
424    /// more details about widget scaling.
425    ///
426    /// Readable
427    ///
428    ///
429    /// #### `sensitive`
430    ///  Readable | Writable
431    ///
432    ///
433    /// #### `style`
434    ///  The style of the widget, which contains information about how it will look (colors, etc).
435    ///
436    /// Readable | Writable
437    ///
438    ///
439    /// #### `tooltip-markup`
440    ///  Sets the text of tooltip to be the given string, which is marked up
441    /// with the [Pango text markup language][PangoMarkupFormat].
442    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
443    ///
444    /// This is a convenience property which will take care of getting the
445    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
446    /// will automatically be set to [`true`] and there will be taken care of
447    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
448    ///
449    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
450    /// are set, the last one wins.
451    ///
452    /// Readable | Writable
453    ///
454    ///
455    /// #### `tooltip-text`
456    ///  Sets the text of tooltip to be the given string.
457    ///
458    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
459    ///
460    /// This is a convenience property which will take care of getting the
461    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
462    /// will automatically be set to [`true`] and there will be taken care of
463    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
464    ///
465    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
466    /// are set, the last one wins.
467    ///
468    /// Readable | Writable
469    ///
470    ///
471    /// #### `valign`
472    ///  How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
473    ///
474    /// Readable | Writable
475    ///
476    ///
477    /// #### `vexpand`
478    ///  Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
479    ///
480    /// Readable | Writable
481    ///
482    ///
483    /// #### `vexpand-set`
484    ///  Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
485    ///
486    /// Readable | Writable
487    ///
488    ///
489    /// #### `visible`
490    ///  Readable | Writable
491    ///
492    ///
493    /// #### `width-request`
494    ///  Readable | Writable
495    ///
496    ///
497    /// #### `window`
498    ///  The widget's window if it is realized, [`None`] otherwise.
499    ///
500    /// Readable
501    /// </details>
502    ///
503    /// ## Signals
504    ///
505    ///
506    /// #### `move-scroll`
507    ///  Action
508    ///
509    ///
510    /// #### `popped-up`
511    ///  Emitted when the position of `menu` is finalized after being popped up
512    /// using gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (), or
513    /// gtk_menu_popup_at_pointer ().
514    ///
515    /// `menu` might be flipped over the anchor rectangle in order to keep it
516    /// on-screen, in which case `flipped_x` and `flipped_y` will be set to [`true`]
517    /// accordingly.
518    ///
519    /// `flipped_rect` is the ideal position of `menu` after any possible flipping,
520    /// but before any possible sliding. `final_rect` is `flipped_rect`, but possibly
521    /// translated in the case that flipping is still ineffective in keeping `menu`
522    /// on-screen.
523    ///
524    /// ![](popup-slide.png)
525    ///
526    /// The blue menu is `menu`'s ideal position, the green menu is `flipped_rect`,
527    /// and the red menu is `final_rect`.
528    ///
529    /// See gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (),
530    /// gtk_menu_popup_at_pointer (), [`anchor-hints`][struct@crate::Menu#anchor-hints],
531    /// [`rect-anchor-dx`][struct@crate::Menu#rect-anchor-dx], [`rect-anchor-dy`][struct@crate::Menu#rect-anchor-dy], and
532    /// [`menu-type-hint`][struct@crate::Menu#menu-type-hint].
533    ///
534    ///
535    /// <details><summary><h4>MenuShell</h4></summary>
536    ///
537    ///
538    /// #### `activate-current`
539    ///  An action signal that activates the current menu item within
540    /// the menu shell.
541    ///
542    /// Action
543    ///
544    ///
545    /// #### `cancel`
546    ///  An action signal which cancels the selection within the menu shell.
547    /// Causes the [`selection-done`][struct@crate::MenuShell#selection-done] signal to be emitted.
548    ///
549    /// Action
550    ///
551    ///
552    /// #### `cycle-focus`
553    ///  A keybinding signal which moves the focus in the
554    /// given `direction`.
555    ///
556    /// Action
557    ///
558    ///
559    /// #### `deactivate`
560    ///  This signal is emitted when a menu shell is deactivated.
561    ///
562    ///
563    ///
564    ///
565    /// #### `insert`
566    ///  The ::insert signal is emitted when a new [`MenuItem`][crate::MenuItem] is added to
567    /// a [`MenuShell`][crate::MenuShell]. A separate signal is used instead of
568    /// GtkContainer::add because of the need for an additional position
569    /// parameter.
570    ///
571    /// The inverse of this signal is the GtkContainer::removed signal.
572    ///
573    ///
574    ///
575    ///
576    /// #### `move-current`
577    ///  An keybinding signal which moves the current menu item
578    /// in the direction specified by `direction`.
579    ///
580    /// Action
581    ///
582    ///
583    /// #### `move-selected`
584    ///  The ::move-selected signal is emitted to move the selection to
585    /// another item.
586    ///
587    ///
588    ///
589    ///
590    /// #### `selection-done`
591    ///  This signal is emitted when a selection has been
592    /// completed within a menu shell.
593    ///
594    ///
595    /// </details>
596    /// <details><summary><h4>Container</h4></summary>
597    ///
598    ///
599    /// #### `add`
600    ///
601    ///
602    ///
603    /// #### `check-resize`
604    ///
605    ///
606    ///
607    /// #### `remove`
608    ///
609    ///
610    ///
611    /// #### `set-focus-child`
612    ///
613    /// </details>
614    /// <details><summary><h4>Widget</h4></summary>
615    ///
616    ///
617    /// #### `accel-closures-changed`
618    ///
619    ///
620    ///
621    /// #### `button-press-event`
622    ///  The ::button-press-event signal will be emitted when a button
623    /// (typically from a mouse) is pressed.
624    ///
625    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
626    /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
627    ///
628    /// This signal will be sent to the grab widget if there is one.
629    ///
630    ///
631    ///
632    ///
633    /// #### `button-release-event`
634    ///  The ::button-release-event signal will be emitted when a button
635    /// (typically from a mouse) is released.
636    ///
637    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
638    /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
639    ///
640    /// This signal will be sent to the grab widget if there is one.
641    ///
642    ///
643    ///
644    ///
645    /// #### `can-activate-accel`
646    ///  Determines whether an accelerator that activates the signal
647    /// identified by `signal_id` can currently be activated.
648    /// This signal is present to allow applications and derived
649    /// widgets to override the default [`Widget`][crate::Widget] handling
650    /// for determining whether an accelerator can be activated.
651    ///
652    ///
653    ///
654    ///
655    /// #### `child-notify`
656    ///  The ::child-notify signal is emitted for each
657    /// [child property][child-properties] that has
658    /// changed on an object. The signal's detail holds the property name.
659    ///
660    /// Detailed
661    ///
662    ///
663    /// #### `composited-changed`
664    ///  The ::composited-changed signal is emitted when the composited
665    /// status of `widgets` screen changes.
666    /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
667    ///
668    /// Action
669    ///
670    ///
671    /// #### `configure-event`
672    ///  The ::configure-event signal will be emitted when the size, position or
673    /// stacking of the `widget`'s window has changed.
674    ///
675    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
676    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
677    /// automatically for all new windows.
678    ///
679    ///
680    ///
681    ///
682    /// #### `damage-event`
683    ///  Emitted when a redirected window belonging to `widget` gets drawn into.
684    /// The region/area members of the event shows what area of the redirected
685    /// drawable was drawn into.
686    ///
687    ///
688    ///
689    ///
690    /// #### `delete-event`
691    ///  The ::delete-event signal is emitted if a user requests that
692    /// a toplevel window is closed. The default handler for this signal
693    /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
694    /// this signal will cause the window to be hidden instead, so that
695    /// it can later be shown again without reconstructing it.
696    ///
697    ///
698    ///
699    ///
700    /// #### `destroy`
701    ///  Signals that all holders of a reference to the widget should release
702    /// the reference that they hold. May result in finalization of the widget
703    /// if all references are released.
704    ///
705    /// This signal is not suitable for saving widget state.
706    ///
707    ///
708    ///
709    ///
710    /// #### `destroy-event`
711    ///  The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
712    /// You rarely get this signal, because most widgets disconnect themselves
713    /// from their window before they destroy it, so no widget owns the
714    /// window at destroy time.
715    ///
716    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
717    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
718    /// automatically for all new windows.
719    ///
720    ///
721    ///
722    ///
723    /// #### `direction-changed`
724    ///  The ::direction-changed signal is emitted when the text direction
725    /// of a widget changes.
726    ///
727    ///
728    ///
729    ///
730    /// #### `drag-begin`
731    ///  The ::drag-begin signal is emitted on the drag source when a drag is
732    /// started. A typical reason to connect to this signal is to set up a
733    /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
734    ///
735    /// Note that some widgets set up a drag icon in the default handler of
736    /// this signal, so you may have to use `g_signal_connect_after()` to
737    /// override what the default handler did.
738    ///
739    ///
740    ///
741    ///
742    /// #### `drag-data-delete`
743    ///  The ::drag-data-delete signal is emitted on the drag source when a drag
744    /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
745    /// handler is responsible for deleting the data that has been dropped. What
746    /// "delete" means depends on the context of the drag operation.
747    ///
748    ///
749    ///
750    ///
751    /// #### `drag-data-get`
752    ///  The ::drag-data-get signal is emitted on the drag source when the drop
753    /// site requests the data which is dragged. It is the responsibility of
754    /// the signal handler to fill `data` with the data in the format which
755    /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
756    /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
757    ///
758    ///
759    ///
760    ///
761    /// #### `drag-data-received`
762    ///  The ::drag-data-received signal is emitted on the drop site when the
763    /// dragged data has been received. If the data was received in order to
764    /// determine whether the drop will be accepted, the handler is expected
765    /// to call `gdk_drag_status()` and not finish the drag.
766    /// If the data was received in response to a [`drag-drop`][struct@crate::Widget#drag-drop] signal
767    /// (and this is the last target to be received), the handler for this
768    /// signal is expected to process the received data and then call
769    /// `gtk_drag_finish()`, setting the `success` parameter depending on
770    /// whether the data was processed successfully.
771    ///
772    /// Applications must create some means to determine why the signal was emitted
773    /// and therefore whether to call `gdk_drag_status()` or `gtk_drag_finish()`.
774    ///
775    /// The handler may inspect the selected action with
776    /// [`DragContext::selected_action()`][crate::gdk::DragContext::selected_action()] before calling
777    /// `gtk_drag_finish()`, e.g. to implement [`gdk::DragAction::ASK`][crate::gdk::DragAction::ASK] as
778    /// shown in the following example:
779    ///
780    ///
781    /// **⚠️ The following code is in C ⚠️**
782    ///
783    /// ```C
784    /// void
785    /// drag_data_received (GtkWidget          *widget,
786    ///                     GdkDragContext     *context,
787    ///                     gint                x,
788    ///                     gint                y,
789    ///                     GtkSelectionData   *data,
790    ///                     guint               info,
791    ///                     guint               time)
792    /// {
793    ///   if ((data->length >= 0) && (data->format == 8))
794    ///     {
795    ///       GdkDragAction action;
796    ///
797    ///       // handle data here
798    ///
799    ///       action = gdk_drag_context_get_selected_action (context);
800    ///       if (action == GDK_ACTION_ASK)
801    ///         {
802    ///           GtkWidget *dialog;
803    ///           gint response;
804    ///
805    ///           dialog = gtk_message_dialog_new (NULL,
806    ///                                            GTK_DIALOG_MODAL |
807    ///                                            GTK_DIALOG_DESTROY_WITH_PARENT,
808    ///                                            GTK_MESSAGE_INFO,
809    ///                                            GTK_BUTTONS_YES_NO,
810    ///                                            "Move the data ?\n");
811    ///           response = gtk_dialog_run (GTK_DIALOG (dialog));
812    ///           gtk_widget_destroy (dialog);
813    ///
814    ///           if (response == GTK_RESPONSE_YES)
815    ///             action = GDK_ACTION_MOVE;
816    ///           else
817    ///             action = GDK_ACTION_COPY;
818    ///          }
819    ///
820    ///       gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
821    ///     }
822    ///   else
823    ///     gtk_drag_finish (context, FALSE, FALSE, time);
824    ///  }
825    /// ```
826    ///
827    ///
828    ///
829    ///
830    /// #### `drag-drop`
831    ///  The ::drag-drop signal is emitted on the drop site when the user drops
832    /// the data onto the widget. The signal handler must determine whether
833    /// the cursor position is in a drop zone or not. If it is not in a drop
834    /// zone, it returns [`false`] and no further processing is necessary.
835    /// Otherwise, the handler returns [`true`]. In this case, the handler must
836    /// ensure that `gtk_drag_finish()` is called to let the source know that
837    /// the drop is done. The call to `gtk_drag_finish()` can be done either
838    /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
839    /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
840    /// or more of the supported targets.
841    ///
842    ///
843    ///
844    ///
845    /// #### `drag-end`
846    ///  The ::drag-end signal is emitted on the drag source when a drag is
847    /// finished. A typical reason to connect to this signal is to undo
848    /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
849    ///
850    ///
851    ///
852    ///
853    /// #### `drag-failed`
854    ///  The ::drag-failed signal is emitted on the drag source when a drag has
855    /// failed. The signal handler may hook custom code to handle a failed DnD
856    /// operation based on the type of error, it returns [`true`] is the failure has
857    /// been already handled (not showing the default "drag operation failed"
858    /// animation), otherwise it returns [`false`].
859    ///
860    ///
861    ///
862    ///
863    /// #### `drag-leave`
864    ///  The ::drag-leave signal is emitted on the drop site when the cursor
865    /// leaves the widget. A typical reason to connect to this signal is to
866    /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
867    /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
868    ///
869    ///
870    /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
871    /// ::drag-drop signal, for instance to allow cleaning up of a preview item
872    /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
873    ///
874    ///
875    ///
876    ///
877    /// #### `drag-motion`
878    ///  The ::drag-motion signal is emitted on the drop site when the user
879    /// moves the cursor over the widget during a drag. The signal handler
880    /// must determine whether the cursor position is in a drop zone or not.
881    /// If it is not in a drop zone, it returns [`false`] and no further processing
882    /// is necessary. Otherwise, the handler returns [`true`]. In this case, the
883    /// handler is responsible for providing the necessary information for
884    /// displaying feedback to the user, by calling `gdk_drag_status()`.
885    ///
886    /// If the decision whether the drop will be accepted or rejected can't be
887    /// made based solely on the cursor position and the type of the data, the
888    /// handler may inspect the dragged data by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] and
889    /// defer the `gdk_drag_status()` call to the [`drag-data-received`][struct@crate::Widget#drag-data-received]
890    /// handler. Note that you must pass [`DestDefaults::DROP`][crate::DestDefaults::DROP],
891    /// [`DestDefaults::MOTION`][crate::DestDefaults::MOTION] or [`DestDefaults::ALL`][crate::DestDefaults::ALL] to [`WidgetExtManual::drag_dest_set()`][crate::prelude::WidgetExtManual::drag_dest_set()]
892    /// when using the drag-motion signal that way.
893    ///
894    /// Also note that there is no drag-enter signal. The drag receiver has to
895    /// keep track of whether he has received any drag-motion signals since the
896    /// last [`drag-leave`][struct@crate::Widget#drag-leave] and if not, treat the drag-motion signal as
897    /// an "enter" signal. Upon an "enter", the handler will typically highlight
898    /// the drop site with [`WidgetExt::drag_highlight()`][crate::prelude::WidgetExt::drag_highlight()].
899    ///
900    ///
901    /// **⚠️ The following code is in C ⚠️**
902    ///
903    /// ```C
904    /// static void
905    /// drag_motion (GtkWidget      *widget,
906    ///              GdkDragContext *context,
907    ///              gint            x,
908    ///              gint            y,
909    ///              guint           time)
910    /// {
911    ///   GdkAtom target;
912    ///
913    ///   PrivateData *private_data = GET_PRIVATE_DATA (widget);
914    ///
915    ///   if (!private_data->drag_highlight)
916    ///    {
917    ///      private_data->drag_highlight = 1;
918    ///      gtk_drag_highlight (widget);
919    ///    }
920    ///
921    ///   target = gtk_drag_dest_find_target (widget, context, NULL);
922    ///   if (target == GDK_NONE)
923    ///     gdk_drag_status (context, 0, time);
924    ///   else
925    ///    {
926    ///      private_data->pending_status
927    ///         = gdk_drag_context_get_suggested_action (context);
928    ///      gtk_drag_get_data (widget, context, target, time);
929    ///    }
930    ///
931    ///   return TRUE;
932    /// }
933    ///
934    /// static void
935    /// drag_data_received (GtkWidget        *widget,
936    ///                     GdkDragContext   *context,
937    ///                     gint              x,
938    ///                     gint              y,
939    ///                     GtkSelectionData *selection_data,
940    ///                     guint             info,
941    ///                     guint             time)
942    /// {
943    ///   PrivateData *private_data = GET_PRIVATE_DATA (widget);
944    ///
945    ///   if (private_data->suggested_action)
946    ///    {
947    ///      private_data->suggested_action = 0;
948    ///
949    ///      // We are getting this data due to a request in drag_motion,
950    ///      // rather than due to a request in drag_drop, so we are just
951    ///      // supposed to call gdk_drag_status(), not actually paste in
952    ///      // the data.
953    ///
954    ///      str = gtk_selection_data_get_text (selection_data);
955    ///      if (!data_is_acceptable (str))
956    ///        gdk_drag_status (context, 0, time);
957    ///      else
958    ///        gdk_drag_status (context,
959    ///                         private_data->suggested_action,
960    ///                         time);
961    ///    }
962    ///   else
963    ///    {
964    ///      // accept the drop
965    ///    }
966    /// }
967    /// ```
968    ///
969    ///
970    ///
971    ///
972    /// #### `draw`
973    ///  This signal is emitted when a widget is supposed to render itself.
974    /// The `widget`'s top left corner must be painted at the origin of
975    /// the passed in context and be sized to the values returned by
976    /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
977    /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
978    ///
979    /// Signal handlers connected to this signal can modify the cairo
980    /// context passed as `cr` in any way they like and don't need to
981    /// restore it. The signal emission takes care of calling `cairo_save()`
982    /// before and `cairo_restore()` after invoking the handler.
983    ///
984    /// The signal handler will get a `cr` with a clip region already set to the
985    /// widget's dirty region, i.e. to the area that needs repainting. Complicated
986    /// widgets that want to avoid redrawing themselves completely can get the full
987    /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
988    /// get a finer-grained representation of the dirty region with
989    /// `cairo_copy_clip_rectangle_list()`.
990    ///
991    ///
992    ///
993    ///
994    /// #### `enter-notify-event`
995    ///  The ::enter-notify-event will be emitted when the pointer enters
996    /// the `widget`'s window.
997    ///
998    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
999    /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
1000    ///
1001    /// This signal will be sent to the grab widget if there is one.
1002    ///
1003    ///
1004    ///
1005    ///
1006    /// #### `event`
1007    ///  The GTK+ main loop will emit three signals for each GDK event delivered
1008    /// to a widget: one generic ::event signal, another, more specific,
1009    /// signal that matches the type of event delivered (e.g.
1010    /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
1011    /// [`event-after`][struct@crate::Widget#event-after] signal.
1012    ///
1013    ///
1014    ///
1015    ///
1016    /// #### `event-after`
1017    ///  After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
1018    /// the second more specific signal, ::event-after will be emitted
1019    /// regardless of the previous two signals handlers return values.
1020    ///
1021    ///
1022    ///
1023    ///
1024    /// #### `focus`
1025    ///
1026    ///
1027    ///
1028    /// #### `focus-in-event`
1029    ///  The ::focus-in-event signal will be emitted when the keyboard focus
1030    /// enters the `widget`'s window.
1031    ///
1032    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1033    /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
1034    ///
1035    ///
1036    ///
1037    ///
1038    /// #### `focus-out-event`
1039    ///  The ::focus-out-event signal will be emitted when the keyboard focus
1040    /// leaves the `widget`'s window.
1041    ///
1042    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1043    /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
1044    ///
1045    ///
1046    ///
1047    ///
1048    /// #### `grab-broken-event`
1049    ///  Emitted when a pointer or keyboard grab on a window belonging
1050    /// to `widget` gets broken.
1051    ///
1052    /// On X11, this happens when the grab window becomes unviewable
1053    /// (i.e. it or one of its ancestors is unmapped), or if the same
1054    /// application grabs the pointer or keyboard again.
1055    ///
1056    ///
1057    ///
1058    ///
1059    /// #### `grab-focus`
1060    ///  Action
1061    ///
1062    ///
1063    /// #### `grab-notify`
1064    ///  The ::grab-notify signal is emitted when a widget becomes
1065    /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
1066    /// another widget, or when it becomes unshadowed due to a grab
1067    /// being removed.
1068    ///
1069    /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
1070    /// grab widget in the grab stack of its window group is not
1071    /// its ancestor.
1072    ///
1073    ///
1074    ///
1075    ///
1076    /// #### `hide`
1077    ///  The ::hide signal is emitted when `widget` is hidden, for example with
1078    /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
1079    ///
1080    ///
1081    ///
1082    ///
1083    /// #### `hierarchy-changed`
1084    ///  The ::hierarchy-changed signal is emitted when the
1085    /// anchored state of a widget changes. A widget is
1086    /// “anchored” when its toplevel
1087    /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
1088    /// a widget changes from un-anchored to anchored or vice-versa.
1089    ///
1090    ///
1091    ///
1092    ///
1093    /// #### `key-press-event`
1094    ///  The ::key-press-event signal is emitted when a key is pressed. The signal
1095    /// emission will reoccur at the key-repeat rate when the key is kept pressed.
1096    ///
1097    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1098    /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
1099    ///
1100    /// This signal will be sent to the grab widget if there is one.
1101    ///
1102    ///
1103    ///
1104    ///
1105    /// #### `key-release-event`
1106    ///  The ::key-release-event signal is emitted when a key is released.
1107    ///
1108    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1109    /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
1110    ///
1111    /// This signal will be sent to the grab widget if there is one.
1112    ///
1113    ///
1114    ///
1115    ///
1116    /// #### `keynav-failed`
1117    ///  Gets emitted if keyboard navigation fails.
1118    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
1119    ///
1120    ///
1121    ///
1122    ///
1123    /// #### `leave-notify-event`
1124    ///  The ::leave-notify-event will be emitted when the pointer leaves
1125    /// the `widget`'s window.
1126    ///
1127    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1128    /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
1129    ///
1130    /// This signal will be sent to the grab widget if there is one.
1131    ///
1132    ///
1133    ///
1134    ///
1135    /// #### `map`
1136    ///  The ::map signal is emitted when `widget` is going to be mapped, that is
1137    /// when the widget is visible (which is controlled with
1138    /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
1139    /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
1140    /// be emitted.
1141    ///
1142    /// The ::map signal can be used to determine whether a widget will be drawn,
1143    /// for instance it can resume an animation that was stopped during the
1144    /// emission of [`unmap`][struct@crate::Widget#unmap].
1145    ///
1146    ///
1147    ///
1148    ///
1149    /// #### `map-event`
1150    ///  The ::map-event signal will be emitted when the `widget`'s window is
1151    /// mapped. A window is mapped when it becomes visible on the screen.
1152    ///
1153    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1154    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1155    /// automatically for all new windows.
1156    ///
1157    ///
1158    ///
1159    ///
1160    /// #### `mnemonic-activate`
1161    ///  The default handler for this signal activates `widget` if `group_cycling`
1162    /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
1163    ///
1164    ///
1165    ///
1166    ///
1167    /// #### `motion-notify-event`
1168    ///  The ::motion-notify-event signal is emitted when the pointer moves
1169    /// over the widget's [`gdk::Window`][crate::gdk::Window].
1170    ///
1171    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
1172    /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
1173    ///
1174    /// This signal will be sent to the grab widget if there is one.
1175    ///
1176    ///
1177    ///
1178    ///
1179    /// #### `move-focus`
1180    ///  Action
1181    ///
1182    ///
1183    /// #### `parent-set`
1184    ///  The ::parent-set signal is emitted when a new parent
1185    /// has been set on a widget.
1186    ///
1187    ///
1188    ///
1189    ///
1190    /// #### `popup-menu`
1191    ///  This signal gets emitted whenever a widget should pop up a context
1192    /// menu. This usually happens through the standard key binding mechanism;
1193    /// by pressing a certain key while a widget is focused, the user can cause
1194    /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
1195    /// a menu with clipboard commands. See the
1196    /// [Popup Menu Migration Checklist][checklist-popup-menu]
1197    /// for an example of how to use this signal.
1198    ///
1199    /// Action
1200    ///
1201    ///
1202    /// #### `property-notify-event`
1203    ///  The ::property-notify-event signal will be emitted when a property on
1204    /// the `widget`'s window has been changed or deleted.
1205    ///
1206    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1207    /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
1208    ///
1209    ///
1210    ///
1211    ///
1212    /// #### `proximity-in-event`
1213    ///  To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1214    /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
1215    ///
1216    /// This signal will be sent to the grab widget if there is one.
1217    ///
1218    ///
1219    ///
1220    ///
1221    /// #### `proximity-out-event`
1222    ///  To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1223    /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
1224    ///
1225    /// This signal will be sent to the grab widget if there is one.
1226    ///
1227    ///
1228    ///
1229    ///
1230    /// #### `query-tooltip`
1231    ///  Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
1232    /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
1233    /// focus in keyboard mode.
1234    ///
1235    /// Using the given coordinates, the signal handler should determine
1236    /// whether a tooltip should be shown for `widget`. If this is the case
1237    /// [`true`] should be returned, [`false`] otherwise. Note that if
1238    /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
1239    /// should not be used.
1240    ///
1241    /// The signal handler is free to manipulate `tooltip` with the therefore
1242    /// destined function calls.
1243    ///
1244    ///
1245    ///
1246    ///
1247    /// #### `realize`
1248    ///  The ::realize signal is emitted when `widget` is associated with a
1249    /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
1250    /// widget has been mapped (that is, it is going to be drawn).
1251    ///
1252    ///
1253    ///
1254    ///
1255    /// #### `screen-changed`
1256    ///  The ::screen-changed signal gets emitted when the
1257    /// screen of a widget has changed.
1258    ///
1259    ///
1260    ///
1261    ///
1262    /// #### `scroll-event`
1263    ///  The ::scroll-event signal is emitted when a button in the 4 to 7
1264    /// range is pressed. Wheel mice are usually configured to generate
1265    /// button press events for buttons 4 and 5 when the wheel is turned.
1266    ///
1267    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1268    /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
1269    ///
1270    /// This signal will be sent to the grab widget if there is one.
1271    ///
1272    ///
1273    ///
1274    ///
1275    /// #### `selection-clear-event`
1276    ///  The ::selection-clear-event signal will be emitted when the
1277    /// the `widget`'s window has lost ownership of a selection.
1278    ///
1279    ///
1280    ///
1281    ///
1282    /// #### `selection-get`
1283    ///
1284    ///
1285    ///
1286    /// #### `selection-notify-event`
1287    ///
1288    ///
1289    ///
1290    /// #### `selection-received`
1291    ///
1292    ///
1293    ///
1294    /// #### `selection-request-event`
1295    ///  The ::selection-request-event signal will be emitted when
1296    /// another client requests ownership of the selection owned by
1297    /// the `widget`'s window.
1298    ///
1299    ///
1300    ///
1301    ///
1302    /// #### `show`
1303    ///  The ::show signal is emitted when `widget` is shown, for example with
1304    /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
1305    ///
1306    ///
1307    ///
1308    ///
1309    /// #### `show-help`
1310    ///  Action
1311    ///
1312    ///
1313    /// #### `size-allocate`
1314    ///
1315    ///
1316    ///
1317    /// #### `state-changed`
1318    ///  The ::state-changed signal is emitted when the widget state changes.
1319    /// See `gtk_widget_get_state()`.
1320    ///
1321    ///
1322    ///
1323    ///
1324    /// #### `state-flags-changed`
1325    ///  The ::state-flags-changed signal is emitted when the widget state
1326    /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
1327    ///
1328    ///
1329    ///
1330    ///
1331    /// #### `style-set`
1332    ///  The ::style-set signal is emitted when a new style has been set
1333    /// on a widget. Note that style-modifying functions like
1334    /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1335    ///
1336    /// Note that this signal is emitted for changes to the deprecated
1337    /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1338    /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1339    ///
1340    ///
1341    ///
1342    ///
1343    /// #### `style-updated`
1344    ///  The ::style-updated signal is a convenience signal that is emitted when the
1345    /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1346    /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1347    ///
1348    /// Note that style-modifying functions like `gtk_widget_override_color()` also
1349    /// cause this signal to be emitted.
1350    ///
1351    ///
1352    ///
1353    ///
1354    /// #### `touch-event`
1355    ///
1356    ///
1357    ///
1358    /// #### `unmap`
1359    ///  The ::unmap signal is emitted when `widget` is going to be unmapped, which
1360    /// means that either it or any of its parents up to the toplevel widget have
1361    /// been set as hidden.
1362    ///
1363    /// As ::unmap indicates that a widget will not be shown any longer, it can be
1364    /// used to, for example, stop an animation on the widget.
1365    ///
1366    ///
1367    ///
1368    ///
1369    /// #### `unmap-event`
1370    ///  The ::unmap-event signal will be emitted when the `widget`'s window is
1371    /// unmapped. A window is unmapped when it becomes invisible on the screen.
1372    ///
1373    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1374    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1375    /// automatically for all new windows.
1376    ///
1377    ///
1378    ///
1379    ///
1380    /// #### `unrealize`
1381    ///  The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1382    /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1383    /// called or the widget has been unmapped (that is, it is going to be
1384    /// hidden).
1385    ///
1386    ///
1387    ///
1388    ///
1389    /// #### `visibility-notify-event`
1390    ///  The ::visibility-notify-event will be emitted when the `widget`'s
1391    /// window is obscured or unobscured.
1392    ///
1393    /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1394    /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1395    ///
1396    ///
1397    ///
1398    ///
1399    /// #### `window-state-event`
1400    ///  The ::window-state-event will be emitted when the state of the
1401    /// toplevel window associated to the `widget` changes.
1402    ///
1403    /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1404    /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1405    /// this mask automatically for all new windows.
1406    ///
1407    ///
1408    /// </details>
1409    ///
1410    /// # Implements
1411    ///
1412    /// [`GtkMenuExt`][trait@crate::prelude::GtkMenuExt], [`MenuShellExt`][trait@crate::prelude::MenuShellExt], [`ContainerExt`][trait@crate::prelude::ContainerExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`GtkMenuExtManual`][trait@crate::prelude::GtkMenuExtManual], [`ContainerExtManual`][trait@crate::prelude::ContainerExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
1413    #[doc(alias = "GtkMenu")]
1414    pub struct Menu(Object<ffi::GtkMenu, ffi::GtkMenuClass>) @extends MenuShell, Container, Widget, @implements Buildable;
1415
1416    match fn {
1417        type_ => || ffi::gtk_menu_get_type(),
1418    }
1419}
1420
1421impl Menu {
1422    pub const NONE: Option<&'static Menu> = None;
1423
1424    /// Creates a new [`Menu`][crate::Menu]
1425    ///
1426    /// # Returns
1427    ///
1428    /// a new [`Menu`][crate::Menu]
1429    #[doc(alias = "gtk_menu_new")]
1430    pub fn new() -> Menu {
1431        assert_initialized_main_thread!();
1432        unsafe { Widget::from_glib_none(ffi::gtk_menu_new()).unsafe_cast() }
1433    }
1434
1435    /// Creates a [`Menu`][crate::Menu] and populates it with menu items and
1436    /// submenus according to `model`.
1437    ///
1438    /// The created menu items are connected to actions found in the
1439    /// [`ApplicationWindow`][crate::ApplicationWindow] to which the menu belongs - typically
1440    /// by means of being attached to a widget (see `gtk_menu_attach_to_widget()`)
1441    /// that is contained within the `GtkApplicationWindows` widget hierarchy.
1442    ///
1443    /// Actions can also be added using [`WidgetExt::insert_action_group()`][crate::prelude::WidgetExt::insert_action_group()] on the menu's
1444    /// attach widget or on any of its parent widgets.
1445    /// ## `model`
1446    /// a [`gio::MenuModel`][crate::gio::MenuModel]
1447    ///
1448    /// # Returns
1449    ///
1450    /// a new [`Menu`][crate::Menu]
1451    #[doc(alias = "gtk_menu_new_from_model")]
1452    #[doc(alias = "new_from_model")]
1453    pub fn from_model(model: &impl IsA<gio::MenuModel>) -> Menu {
1454        assert_initialized_main_thread!();
1455        unsafe {
1456            Widget::from_glib_none(ffi::gtk_menu_new_from_model(
1457                model.as_ref().to_glib_none().0,
1458            ))
1459            .unsafe_cast()
1460        }
1461    }
1462
1463    // rustdoc-stripper-ignore-next
1464    /// Creates a new builder-pattern struct instance to construct [`Menu`] objects.
1465    ///
1466    /// This method returns an instance of [`MenuBuilder`](crate::builders::MenuBuilder) which can be used to create [`Menu`] objects.
1467    pub fn builder() -> MenuBuilder {
1468        MenuBuilder::new()
1469    }
1470
1471    /// Returns a list of the menus which are attached to this widget.
1472    /// This list is owned by GTK+ and must not be modified.
1473    /// ## `widget`
1474    /// a [`Widget`][crate::Widget]
1475    ///
1476    /// # Returns
1477    ///
1478    /// the list
1479    ///  of menus attached to his widget.
1480    #[doc(alias = "gtk_menu_get_for_attach_widget")]
1481    #[doc(alias = "get_for_attach_widget")]
1482    pub fn for_attach_widget(widget: &impl IsA<Widget>) -> Vec<Widget> {
1483        skip_assert_initialized!();
1484        unsafe {
1485            FromGlibPtrContainer::from_glib_none(ffi::gtk_menu_get_for_attach_widget(
1486                widget.as_ref().to_glib_none().0,
1487            ))
1488        }
1489    }
1490}
1491
1492impl Default for Menu {
1493    fn default() -> Self {
1494        Self::new()
1495    }
1496}
1497
1498// rustdoc-stripper-ignore-next
1499/// A [builder-pattern] type to construct [`Menu`] objects.
1500///
1501/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1502#[must_use = "The builder must be built to be used"]
1503pub struct MenuBuilder {
1504    builder: glib::object::ObjectBuilder<'static, Menu>,
1505}
1506
1507impl MenuBuilder {
1508    fn new() -> Self {
1509        Self {
1510            builder: glib::object::Object::builder(),
1511        }
1512    }
1513
1514    /// The accel group holding accelerators for the menu.
1515    pub fn accel_group(self, accel_group: &impl IsA<AccelGroup>) -> Self {
1516        Self {
1517            builder: self
1518                .builder
1519                .property("accel-group", accel_group.clone().upcast()),
1520        }
1521    }
1522
1523    /// An accel path used to conveniently construct accel paths of child items.
1524    pub fn accel_path(self, accel_path: impl Into<glib::GString>) -> Self {
1525        Self {
1526            builder: self.builder.property("accel-path", accel_path.into()),
1527        }
1528    }
1529
1530    /// The index of the currently selected menu item, or -1 if no
1531    /// menu item is selected.
1532    pub fn active(self, active: i32) -> Self {
1533        Self {
1534            builder: self.builder.property("active", active),
1535        }
1536    }
1537
1538    /// Positioning hints for aligning the menu relative to a rectangle.
1539    ///
1540    /// These hints determine how the menu should be positioned in the case that
1541    /// the menu would fall off-screen if placed in its ideal position.
1542    ///
1543    /// ![](popup-flip.png)
1544    ///
1545    /// For example, [`gdk::AnchorHints::FLIP_Y`][crate::gdk::AnchorHints::FLIP_Y] will replace [`gdk::Gravity::NorthWest`][crate::gdk::Gravity::NorthWest] with
1546    /// [`gdk::Gravity::SouthWest`][crate::gdk::Gravity::SouthWest] and vice versa if the menu extends beyond the
1547    /// bottom edge of the monitor.
1548    ///
1549    /// See gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (),
1550    /// gtk_menu_popup_at_pointer (), [`rect-anchor-dx`][struct@crate::Menu#rect-anchor-dx],
1551    /// [`rect-anchor-dy`][struct@crate::Menu#rect-anchor-dy], [`menu-type-hint`][struct@crate::Menu#menu-type-hint], and [`popped-up`][struct@crate::Menu#popped-up].
1552    pub fn anchor_hints(self, anchor_hints: gdk::AnchorHints) -> Self {
1553        Self {
1554            builder: self.builder.property("anchor-hints", anchor_hints),
1555        }
1556    }
1557
1558    /// The widget the menu is attached to. Setting this property attaches
1559    /// the menu without a `GtkMenuDetachFunc`. If you need to use a detacher,
1560    /// use `gtk_menu_attach_to_widget()` directly.
1561    pub fn attach_widget(self, attach_widget: &impl IsA<Widget>) -> Self {
1562        Self {
1563            builder: self
1564                .builder
1565                .property("attach-widget", attach_widget.clone().upcast()),
1566        }
1567    }
1568
1569    /// The [`gdk::WindowTypeHint`][crate::gdk::WindowTypeHint] to use for the menu's [`gdk::Window`][crate::gdk::Window].
1570    ///
1571    /// See gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (),
1572    /// gtk_menu_popup_at_pointer (), [`anchor-hints`][struct@crate::Menu#anchor-hints],
1573    /// [`rect-anchor-dx`][struct@crate::Menu#rect-anchor-dx], [`rect-anchor-dy`][struct@crate::Menu#rect-anchor-dy], and [`popped-up`][struct@crate::Menu#popped-up].
1574    pub fn menu_type_hint(self, menu_type_hint: gdk::WindowTypeHint) -> Self {
1575        Self {
1576            builder: self.builder.property("menu-type-hint", menu_type_hint),
1577        }
1578    }
1579
1580    /// The monitor the menu will be popped up on.
1581    pub fn monitor(self, monitor: i32) -> Self {
1582        Self {
1583            builder: self.builder.property("monitor", monitor),
1584        }
1585    }
1586
1587    /// Horizontal offset to apply to the menu, i.e. the rectangle or widget
1588    /// anchor.
1589    ///
1590    /// See gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (),
1591    /// gtk_menu_popup_at_pointer (), [`anchor-hints`][struct@crate::Menu#anchor-hints],
1592    /// [`rect-anchor-dy`][struct@crate::Menu#rect-anchor-dy], [`menu-type-hint`][struct@crate::Menu#menu-type-hint], and [`popped-up`][struct@crate::Menu#popped-up].
1593    pub fn rect_anchor_dx(self, rect_anchor_dx: i32) -> Self {
1594        Self {
1595            builder: self.builder.property("rect-anchor-dx", rect_anchor_dx),
1596        }
1597    }
1598
1599    /// Vertical offset to apply to the menu, i.e. the rectangle or widget anchor.
1600    ///
1601    /// See gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (),
1602    /// gtk_menu_popup_at_pointer (), [`anchor-hints`][struct@crate::Menu#anchor-hints],
1603    /// [`rect-anchor-dx`][struct@crate::Menu#rect-anchor-dx], [`menu-type-hint`][struct@crate::Menu#menu-type-hint], and [`popped-up`][struct@crate::Menu#popped-up].
1604    pub fn rect_anchor_dy(self, rect_anchor_dy: i32) -> Self {
1605        Self {
1606            builder: self.builder.property("rect-anchor-dy", rect_anchor_dy),
1607        }
1608    }
1609
1610    /// A boolean that indicates whether the menu reserves space for
1611    /// toggles and icons, regardless of their actual presence.
1612    ///
1613    /// This property should only be changed from its default value
1614    /// for special-purposes such as tabular menus. Regular menus that
1615    /// are connected to a menu bar or context menus should reserve
1616    /// toggle space for consistency.
1617    pub fn reserve_toggle_size(self, reserve_toggle_size: bool) -> Self {
1618        Self {
1619            builder: self
1620                .builder
1621                .property("reserve-toggle-size", reserve_toggle_size),
1622        }
1623    }
1624
1625    /// A boolean that determines whether the menu and its submenus grab the
1626    /// keyboard focus. See [`MenuShellExt::set_take_focus()`][crate::prelude::MenuShellExt::set_take_focus()] and
1627    /// [`MenuShellExt::takes_focus()`][crate::prelude::MenuShellExt::takes_focus()].
1628    pub fn take_focus(self, take_focus: bool) -> Self {
1629        Self {
1630            builder: self.builder.property("take-focus", take_focus),
1631        }
1632    }
1633
1634    pub fn border_width(self, border_width: u32) -> Self {
1635        Self {
1636            builder: self.builder.property("border-width", border_width),
1637        }
1638    }
1639
1640    pub fn child(self, child: &impl IsA<Widget>) -> Self {
1641        Self {
1642            builder: self.builder.property("child", child.clone().upcast()),
1643        }
1644    }
1645
1646    pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
1647        Self {
1648            builder: self.builder.property("resize-mode", resize_mode),
1649        }
1650    }
1651
1652    pub fn app_paintable(self, app_paintable: bool) -> Self {
1653        Self {
1654            builder: self.builder.property("app-paintable", app_paintable),
1655        }
1656    }
1657
1658    pub fn can_default(self, can_default: bool) -> Self {
1659        Self {
1660            builder: self.builder.property("can-default", can_default),
1661        }
1662    }
1663
1664    pub fn can_focus(self, can_focus: bool) -> Self {
1665        Self {
1666            builder: self.builder.property("can-focus", can_focus),
1667        }
1668    }
1669
1670    pub fn events(self, events: gdk::EventMask) -> Self {
1671        Self {
1672            builder: self.builder.property("events", events),
1673        }
1674    }
1675
1676    /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1677    pub fn expand(self, expand: bool) -> Self {
1678        Self {
1679            builder: self.builder.property("expand", expand),
1680        }
1681    }
1682
1683    /// Whether the widget should grab focus when it is clicked with the mouse.
1684    ///
1685    /// This property is only relevant for widgets that can take focus.
1686    ///
1687    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1688    /// GtkComboBox) implemented this property individually.
1689    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1690        Self {
1691            builder: self.builder.property("focus-on-click", focus_on_click),
1692        }
1693    }
1694
1695    /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1696    pub fn halign(self, halign: Align) -> Self {
1697        Self {
1698            builder: self.builder.property("halign", halign),
1699        }
1700    }
1701
1702    pub fn has_default(self, has_default: bool) -> Self {
1703        Self {
1704            builder: self.builder.property("has-default", has_default),
1705        }
1706    }
1707
1708    pub fn has_focus(self, has_focus: bool) -> Self {
1709        Self {
1710            builder: self.builder.property("has-focus", has_focus),
1711        }
1712    }
1713
1714    /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1715    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1716    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1717    /// whether it will provide a tooltip or not.
1718    ///
1719    /// Note that setting this property to [`true`] for the first time will change
1720    /// the event masks of the GdkWindows of this widget to include leave-notify
1721    /// and motion-notify events. This cannot and will not be undone when the
1722    /// property is set to [`false`] again.
1723    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1724        Self {
1725            builder: self.builder.property("has-tooltip", has_tooltip),
1726        }
1727    }
1728
1729    pub fn height_request(self, height_request: i32) -> Self {
1730        Self {
1731            builder: self.builder.property("height-request", height_request),
1732        }
1733    }
1734
1735    /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1736    pub fn hexpand(self, hexpand: bool) -> Self {
1737        Self {
1738            builder: self.builder.property("hexpand", hexpand),
1739        }
1740    }
1741
1742    /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1743    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1744        Self {
1745            builder: self.builder.property("hexpand-set", hexpand_set),
1746        }
1747    }
1748
1749    pub fn is_focus(self, is_focus: bool) -> Self {
1750        Self {
1751            builder: self.builder.property("is-focus", is_focus),
1752        }
1753    }
1754
1755    /// Sets all four sides' margin at once. If read, returns max
1756    /// margin on any side.
1757    pub fn margin(self, margin: i32) -> Self {
1758        Self {
1759            builder: self.builder.property("margin", margin),
1760        }
1761    }
1762
1763    /// Margin on bottom side of widget.
1764    ///
1765    /// This property adds margin outside of the widget's normal size
1766    /// request, the margin will be added in addition to the size from
1767    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1768    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1769        Self {
1770            builder: self.builder.property("margin-bottom", margin_bottom),
1771        }
1772    }
1773
1774    /// Margin on end of widget, horizontally. This property supports
1775    /// left-to-right and right-to-left text directions.
1776    ///
1777    /// This property adds margin outside of the widget's normal size
1778    /// request, the margin will be added in addition to the size from
1779    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1780    pub fn margin_end(self, margin_end: i32) -> Self {
1781        Self {
1782            builder: self.builder.property("margin-end", margin_end),
1783        }
1784    }
1785
1786    /// Margin on start of widget, horizontally. This property supports
1787    /// left-to-right and right-to-left text directions.
1788    ///
1789    /// This property adds margin outside of the widget's normal size
1790    /// request, the margin will be added in addition to the size from
1791    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1792    pub fn margin_start(self, margin_start: i32) -> Self {
1793        Self {
1794            builder: self.builder.property("margin-start", margin_start),
1795        }
1796    }
1797
1798    /// Margin on top side of widget.
1799    ///
1800    /// This property adds margin outside of the widget's normal size
1801    /// request, the margin will be added in addition to the size from
1802    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1803    pub fn margin_top(self, margin_top: i32) -> Self {
1804        Self {
1805            builder: self.builder.property("margin-top", margin_top),
1806        }
1807    }
1808
1809    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1810        Self {
1811            builder: self.builder.property("name", name.into()),
1812        }
1813    }
1814
1815    pub fn no_show_all(self, no_show_all: bool) -> Self {
1816        Self {
1817            builder: self.builder.property("no-show-all", no_show_all),
1818        }
1819    }
1820
1821    /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1822    /// more details about window opacity.
1823    ///
1824    /// Before 3.8 this was only available in GtkWindow
1825    pub fn opacity(self, opacity: f64) -> Self {
1826        Self {
1827            builder: self.builder.property("opacity", opacity),
1828        }
1829    }
1830
1831    pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1832        Self {
1833            builder: self.builder.property("parent", parent.clone().upcast()),
1834        }
1835    }
1836
1837    pub fn receives_default(self, receives_default: bool) -> Self {
1838        Self {
1839            builder: self.builder.property("receives-default", receives_default),
1840        }
1841    }
1842
1843    pub fn sensitive(self, sensitive: bool) -> Self {
1844        Self {
1845            builder: self.builder.property("sensitive", sensitive),
1846        }
1847    }
1848
1849    /// Sets the text of tooltip to be the given string, which is marked up
1850    /// with the [Pango text markup language][PangoMarkupFormat].
1851    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1852    ///
1853    /// This is a convenience property which will take care of getting the
1854    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1855    /// will automatically be set to [`true`] and there will be taken care of
1856    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1857    ///
1858    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1859    /// are set, the last one wins.
1860    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1861        Self {
1862            builder: self
1863                .builder
1864                .property("tooltip-markup", tooltip_markup.into()),
1865        }
1866    }
1867
1868    /// Sets the text of tooltip to be the given string.
1869    ///
1870    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1871    ///
1872    /// This is a convenience property which will take care of getting the
1873    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1874    /// will automatically be set to [`true`] and there will be taken care of
1875    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1876    ///
1877    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1878    /// are set, the last one wins.
1879    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1880        Self {
1881            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1882        }
1883    }
1884
1885    /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1886    pub fn valign(self, valign: Align) -> Self {
1887        Self {
1888            builder: self.builder.property("valign", valign),
1889        }
1890    }
1891
1892    /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1893    pub fn vexpand(self, vexpand: bool) -> Self {
1894        Self {
1895            builder: self.builder.property("vexpand", vexpand),
1896        }
1897    }
1898
1899    /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1900    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1901        Self {
1902            builder: self.builder.property("vexpand-set", vexpand_set),
1903        }
1904    }
1905
1906    pub fn visible(self, visible: bool) -> Self {
1907        Self {
1908            builder: self.builder.property("visible", visible),
1909        }
1910    }
1911
1912    pub fn width_request(self, width_request: i32) -> Self {
1913        Self {
1914            builder: self.builder.property("width-request", width_request),
1915        }
1916    }
1917
1918    // rustdoc-stripper-ignore-next
1919    /// Build the [`Menu`].
1920    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1921    pub fn build(self) -> Menu {
1922        assert_initialized_main_thread!();
1923        self.builder.build()
1924    }
1925}
1926
1927/// Trait containing all [`struct@Menu`] methods.
1928///
1929/// # Implementors
1930///
1931/// [`Menu`][struct@crate::Menu], [`RecentChooserMenu`][struct@crate::RecentChooserMenu]
1932pub trait GtkMenuExt: IsA<Menu> + 'static {
1933    /// Adds a new [`MenuItem`][crate::MenuItem] to a (table) menu. The number of “cells” that
1934    /// an item will occupy is specified by `left_attach`, `right_attach`,
1935    /// `top_attach` and `bottom_attach`. These each represent the leftmost,
1936    /// rightmost, uppermost and lower column and row numbers of the table.
1937    /// (Columns and rows are indexed from zero).
1938    ///
1939    /// Note that this function is not related to [`detach()`][Self::detach()].
1940    /// ## `child`
1941    /// a [`MenuItem`][crate::MenuItem]
1942    /// ## `left_attach`
1943    /// The column number to attach the left side of the item to
1944    /// ## `right_attach`
1945    /// The column number to attach the right side of the item to
1946    /// ## `top_attach`
1947    /// The row number to attach the top of the item to
1948    /// ## `bottom_attach`
1949    /// The row number to attach the bottom of the item to
1950    #[doc(alias = "gtk_menu_attach")]
1951    fn attach(
1952        &self,
1953        child: &impl IsA<Widget>,
1954        left_attach: u32,
1955        right_attach: u32,
1956        top_attach: u32,
1957        bottom_attach: u32,
1958    ) {
1959        unsafe {
1960            ffi::gtk_menu_attach(
1961                self.as_ref().to_glib_none().0,
1962                child.as_ref().to_glib_none().0,
1963                left_attach,
1964                right_attach,
1965                top_attach,
1966                bottom_attach,
1967            );
1968        }
1969    }
1970
1971    /// Detaches the menu from the widget to which it had been attached.
1972    /// This function will call the callback function, `detacher`, provided
1973    /// when the `gtk_menu_attach_to_widget()` function was called.
1974    #[doc(alias = "gtk_menu_detach")]
1975    fn detach(&self) {
1976        unsafe {
1977            ffi::gtk_menu_detach(self.as_ref().to_glib_none().0);
1978        }
1979    }
1980
1981    /// Gets the [`AccelGroup`][crate::AccelGroup] which holds global accelerators for the
1982    /// menu. See [`set_accel_group()`][Self::set_accel_group()].
1983    ///
1984    /// # Returns
1985    ///
1986    /// the [`AccelGroup`][crate::AccelGroup] associated with the menu
1987    #[doc(alias = "gtk_menu_get_accel_group")]
1988    #[doc(alias = "get_accel_group")]
1989    #[doc(alias = "accel-group")]
1990    fn accel_group(&self) -> Option<AccelGroup> {
1991        unsafe {
1992            from_glib_none(ffi::gtk_menu_get_accel_group(
1993                self.as_ref().to_glib_none().0,
1994            ))
1995        }
1996    }
1997
1998    /// Retrieves the accelerator path set on the menu.
1999    ///
2000    /// # Returns
2001    ///
2002    /// the accelerator path set on the menu.
2003    #[doc(alias = "gtk_menu_get_accel_path")]
2004    #[doc(alias = "get_accel_path")]
2005    #[doc(alias = "accel-path")]
2006    fn accel_path(&self) -> Option<glib::GString> {
2007        unsafe { from_glib_none(ffi::gtk_menu_get_accel_path(self.as_ref().to_glib_none().0)) }
2008    }
2009
2010    /// Returns the selected menu item from the menu. This is used by the
2011    /// [`ComboBox`][crate::ComboBox].
2012    ///
2013    /// # Returns
2014    ///
2015    /// the [`MenuItem`][crate::MenuItem] that was last selected
2016    ///  in the menu. If a selection has not yet been made, the
2017    ///  first menu item is selected.
2018    #[doc(alias = "gtk_menu_get_active")]
2019    #[doc(alias = "get_active")]
2020    fn active(&self) -> Option<Widget> {
2021        unsafe { from_glib_none(ffi::gtk_menu_get_active(self.as_ref().to_glib_none().0)) }
2022    }
2023
2024    /// Returns the [`Widget`][crate::Widget] that the menu is attached to.
2025    ///
2026    /// # Returns
2027    ///
2028    /// the [`Widget`][crate::Widget] that the menu is attached to
2029    #[doc(alias = "gtk_menu_get_attach_widget")]
2030    #[doc(alias = "get_attach_widget")]
2031    #[doc(alias = "attach-widget")]
2032    fn attach_widget(&self) -> Option<Widget> {
2033        unsafe {
2034            from_glib_none(ffi::gtk_menu_get_attach_widget(
2035                self.as_ref().to_glib_none().0,
2036            ))
2037        }
2038    }
2039
2040    /// Retrieves the number of the monitor on which to show the menu.
2041    ///
2042    /// # Returns
2043    ///
2044    /// the number of the monitor on which the menu should
2045    ///  be popped up or -1, if no monitor has been set
2046    #[doc(alias = "gtk_menu_get_monitor")]
2047    #[doc(alias = "get_monitor")]
2048    fn monitor(&self) -> i32 {
2049        unsafe { ffi::gtk_menu_get_monitor(self.as_ref().to_glib_none().0) }
2050    }
2051
2052    /// Returns whether the menu reserves space for toggles and
2053    /// icons, regardless of their actual presence.
2054    ///
2055    /// # Returns
2056    ///
2057    /// Whether the menu reserves toggle space
2058    #[doc(alias = "gtk_menu_get_reserve_toggle_size")]
2059    #[doc(alias = "get_reserve_toggle_size")]
2060    #[doc(alias = "reserve-toggle-size")]
2061    fn must_reserve_toggle_size(&self) -> bool {
2062        unsafe {
2063            from_glib(ffi::gtk_menu_get_reserve_toggle_size(
2064                self.as_ref().to_glib_none().0,
2065            ))
2066        }
2067    }
2068
2069    /// Places `self` on the given monitor.
2070    /// ## `monitor`
2071    /// the monitor to place the menu on
2072    #[doc(alias = "gtk_menu_place_on_monitor")]
2073    fn place_on_monitor(&self, monitor: &gdk::Monitor) {
2074        unsafe {
2075            ffi::gtk_menu_place_on_monitor(
2076                self.as_ref().to_glib_none().0,
2077                monitor.to_glib_none().0,
2078            );
2079        }
2080    }
2081
2082    /// Removes the menu from the screen.
2083    #[doc(alias = "gtk_menu_popdown")]
2084    fn popdown(&self) {
2085        unsafe {
2086            ffi::gtk_menu_popdown(self.as_ref().to_glib_none().0);
2087        }
2088    }
2089
2090    /// Displays `self` and makes it available for selection.
2091    ///
2092    /// See gtk_menu_popup_at_widget () to pop up a menu at a widget.
2093    /// gtk_menu_popup_at_rect () also allows you to position a menu at an arbitrary
2094    /// rectangle.
2095    ///
2096    /// `self` will be positioned at the pointer associated with `trigger_event`.
2097    ///
2098    /// Properties that influence the behaviour of this function are
2099    /// [`anchor-hints`][struct@crate::Menu#anchor-hints], [`rect-anchor-dx`][struct@crate::Menu#rect-anchor-dx], [`rect-anchor-dy`][struct@crate::Menu#rect-anchor-dy], and
2100    /// [`menu-type-hint`][struct@crate::Menu#menu-type-hint]. Connect to the [`popped-up`][struct@crate::Menu#popped-up] signal to find
2101    /// out how it was actually positioned.
2102    /// ## `trigger_event`
2103    /// the `GdkEvent` that initiated this request or
2104    ///  [`None`] if it's the current event
2105    #[doc(alias = "gtk_menu_popup_at_pointer")]
2106    fn popup_at_pointer(&self, trigger_event: Option<&gdk::Event>) {
2107        unsafe {
2108            ffi::gtk_menu_popup_at_pointer(
2109                self.as_ref().to_glib_none().0,
2110                trigger_event.to_glib_none().0,
2111            );
2112        }
2113    }
2114
2115    /// Displays `self` and makes it available for selection.
2116    ///
2117    /// See gtk_menu_popup_at_widget () and gtk_menu_popup_at_pointer (), which
2118    /// handle more common cases for popping up menus.
2119    ///
2120    /// `self` will be positioned at `rect`, aligning their anchor points. `rect` is
2121    /// relative to the top-left corner of `rect_window`. `rect_anchor` and
2122    /// `menu_anchor` determine anchor points on `rect` and `self` to pin together.
2123    /// `self` can optionally be offset by [`rect-anchor-dx`][struct@crate::Menu#rect-anchor-dx] and
2124    /// [`rect-anchor-dy`][struct@crate::Menu#rect-anchor-dy].
2125    ///
2126    /// Anchors should be specified under the assumption that the text direction is
2127    /// left-to-right; they will be flipped horizontally automatically if the text
2128    /// direction is right-to-left.
2129    ///
2130    /// Other properties that influence the behaviour of this function are
2131    /// [`anchor-hints`][struct@crate::Menu#anchor-hints] and [`menu-type-hint`][struct@crate::Menu#menu-type-hint]. Connect to the
2132    /// [`popped-up`][struct@crate::Menu#popped-up] signal to find out how it was actually positioned.
2133    /// ## `rect_window`
2134    /// the [`gdk::Window`][crate::gdk::Window] `rect` is relative to
2135    /// ## `rect`
2136    /// the [`gdk::Rectangle`][crate::gdk::Rectangle] to align `self` with
2137    /// ## `rect_anchor`
2138    /// the point on `rect` to align with `self`'s anchor point
2139    /// ## `menu_anchor`
2140    /// the point on `self` to align with `rect`'s anchor point
2141    /// ## `trigger_event`
2142    /// the `GdkEvent` that initiated this request or
2143    ///  [`None`] if it's the current event
2144    #[doc(alias = "gtk_menu_popup_at_rect")]
2145    fn popup_at_rect(
2146        &self,
2147        rect_window: &gdk::Window,
2148        rect: &gdk::Rectangle,
2149        rect_anchor: gdk::Gravity,
2150        menu_anchor: gdk::Gravity,
2151        trigger_event: Option<&gdk::Event>,
2152    ) {
2153        unsafe {
2154            ffi::gtk_menu_popup_at_rect(
2155                self.as_ref().to_glib_none().0,
2156                rect_window.to_glib_none().0,
2157                rect.to_glib_none().0,
2158                rect_anchor.into_glib(),
2159                menu_anchor.into_glib(),
2160                trigger_event.to_glib_none().0,
2161            );
2162        }
2163    }
2164
2165    /// Displays `self` and makes it available for selection.
2166    ///
2167    /// See gtk_menu_popup_at_pointer () to pop up a menu at the master pointer.
2168    /// gtk_menu_popup_at_rect () also allows you to position a menu at an arbitrary
2169    /// rectangle.
2170    ///
2171    /// ![](popup-anchors.png)
2172    ///
2173    /// `self` will be positioned at `widget`, aligning their anchor points.
2174    /// `widget_anchor` and `menu_anchor` determine anchor points on `widget` and `self`
2175    /// to pin together. `self` can optionally be offset by [`rect-anchor-dx`][struct@crate::Menu#rect-anchor-dx]
2176    /// and [`rect-anchor-dy`][struct@crate::Menu#rect-anchor-dy].
2177    ///
2178    /// Anchors should be specified under the assumption that the text direction is
2179    /// left-to-right; they will be flipped horizontally automatically if the text
2180    /// direction is right-to-left.
2181    ///
2182    /// Other properties that influence the behaviour of this function are
2183    /// [`anchor-hints`][struct@crate::Menu#anchor-hints] and [`menu-type-hint`][struct@crate::Menu#menu-type-hint]. Connect to the
2184    /// [`popped-up`][struct@crate::Menu#popped-up] signal to find out how it was actually positioned.
2185    /// ## `widget`
2186    /// the [`Widget`][crate::Widget] to align `self` with
2187    /// ## `widget_anchor`
2188    /// the point on `widget` to align with `self`'s anchor point
2189    /// ## `menu_anchor`
2190    /// the point on `self` to align with `widget`'s anchor point
2191    /// ## `trigger_event`
2192    /// the `GdkEvent` that initiated this request or
2193    ///  [`None`] if it's the current event
2194    #[doc(alias = "gtk_menu_popup_at_widget")]
2195    fn popup_at_widget(
2196        &self,
2197        widget: &impl IsA<Widget>,
2198        widget_anchor: gdk::Gravity,
2199        menu_anchor: gdk::Gravity,
2200        trigger_event: Option<&gdk::Event>,
2201    ) {
2202        unsafe {
2203            ffi::gtk_menu_popup_at_widget(
2204                self.as_ref().to_glib_none().0,
2205                widget.as_ref().to_glib_none().0,
2206                widget_anchor.into_glib(),
2207                menu_anchor.into_glib(),
2208                trigger_event.to_glib_none().0,
2209            );
2210        }
2211    }
2212
2213    /// Moves `child` to a new `position` in the list of `self`
2214    /// children.
2215    /// ## `child`
2216    /// the [`MenuItem`][crate::MenuItem] to move
2217    /// ## `position`
2218    /// the new position to place `child`.
2219    ///  Positions are numbered from 0 to n - 1
2220    #[doc(alias = "gtk_menu_reorder_child")]
2221    fn reorder_child(&self, child: &impl IsA<Widget>, position: i32) {
2222        unsafe {
2223            ffi::gtk_menu_reorder_child(
2224                self.as_ref().to_glib_none().0,
2225                child.as_ref().to_glib_none().0,
2226                position,
2227            );
2228        }
2229    }
2230
2231    /// Repositions the menu according to its position function.
2232    #[doc(alias = "gtk_menu_reposition")]
2233    fn reposition(&self) {
2234        unsafe {
2235            ffi::gtk_menu_reposition(self.as_ref().to_glib_none().0);
2236        }
2237    }
2238
2239    /// Set the [`AccelGroup`][crate::AccelGroup] which holds global accelerators for the
2240    /// menu. This accelerator group needs to also be added to all windows
2241    /// that this menu is being used in with [`GtkWindowExt::add_accel_group()`][crate::prelude::GtkWindowExt::add_accel_group()],
2242    /// in order for those windows to support all the accelerators
2243    /// contained in this group.
2244    /// ## `accel_group`
2245    /// the [`AccelGroup`][crate::AccelGroup] to be associated
2246    ///  with the menu.
2247    #[doc(alias = "gtk_menu_set_accel_group")]
2248    #[doc(alias = "accel-group")]
2249    fn set_accel_group(&self, accel_group: Option<&impl IsA<AccelGroup>>) {
2250        unsafe {
2251            ffi::gtk_menu_set_accel_group(
2252                self.as_ref().to_glib_none().0,
2253                accel_group.map(|p| p.as_ref()).to_glib_none().0,
2254            );
2255        }
2256    }
2257
2258    /// Sets an accelerator path for this menu from which accelerator paths
2259    /// for its immediate children, its menu items, can be constructed.
2260    /// The main purpose of this function is to spare the programmer the
2261    /// inconvenience of having to call [`GtkMenuItemExt::set_accel_path()`][crate::prelude::GtkMenuItemExt::set_accel_path()] on
2262    /// each menu item that should support runtime user changable accelerators.
2263    /// Instead, by just calling [`set_accel_path()`][Self::set_accel_path()] on their parent,
2264    /// each menu item of this menu, that contains a label describing its
2265    /// purpose, automatically gets an accel path assigned.
2266    ///
2267    /// For example, a menu containing menu items “New” and “Exit”, will, after
2268    /// `gtk_menu_set_accel_path (menu, "`<Gnumeric-Sheet>`/File");` has been
2269    /// called, assign its items the accel paths: `"`<Gnumeric-Sheet>`/File/New"`
2270    /// and `"`<Gnumeric-Sheet>`/File/Exit"`.
2271    ///
2272    /// Assigning accel paths to menu items then enables the user to change
2273    /// their accelerators at runtime. More details about accelerator paths
2274    /// and their default setups can be found at `gtk_accel_map_add_entry()`.
2275    ///
2276    /// Note that `accel_path` string will be stored in a `GQuark`. Therefore,
2277    /// if you pass a static string, you can save some memory by interning
2278    /// it first with `g_intern_static_string()`.
2279    /// ## `accel_path`
2280    /// a valid accelerator path, or [`None`] to unset the path
2281    #[doc(alias = "gtk_menu_set_accel_path")]
2282    #[doc(alias = "accel-path")]
2283    fn set_accel_path(&self, accel_path: Option<&str>) {
2284        unsafe {
2285            ffi::gtk_menu_set_accel_path(
2286                self.as_ref().to_glib_none().0,
2287                accel_path.to_glib_none().0,
2288            );
2289        }
2290    }
2291
2292    /// Selects the specified menu item within the menu. This is used by
2293    /// the [`ComboBox`][crate::ComboBox] and should not be used by anyone else.
2294    /// ## `index`
2295    /// the index of the menu item to select. Index values are
2296    ///  from 0 to n-1
2297    #[doc(alias = "gtk_menu_set_active")]
2298    #[doc(alias = "active")]
2299    fn set_active(&self, index: u32) {
2300        unsafe {
2301            ffi::gtk_menu_set_active(self.as_ref().to_glib_none().0, index);
2302        }
2303    }
2304
2305    /// Informs GTK+ on which monitor a menu should be popped up.
2306    /// See [`Monitor::geometry()`][crate::gdk::Monitor::geometry()].
2307    ///
2308    /// This function should be called from a `GtkMenuPositionFunc`
2309    /// if the menu should not appear on the same monitor as the pointer.
2310    /// This information can’t be reliably inferred from the coordinates
2311    /// returned by a `GtkMenuPositionFunc`, since, for very long menus,
2312    /// these coordinates may extend beyond the monitor boundaries or even
2313    /// the screen boundaries.
2314    /// ## `monitor_num`
2315    /// the number of the monitor on which the menu should
2316    ///  be popped up
2317    #[doc(alias = "gtk_menu_set_monitor")]
2318    #[doc(alias = "monitor")]
2319    fn set_monitor(&self, monitor_num: i32) {
2320        unsafe {
2321            ffi::gtk_menu_set_monitor(self.as_ref().to_glib_none().0, monitor_num);
2322        }
2323    }
2324
2325    /// Sets whether the menu should reserve space for drawing toggles
2326    /// or icons, regardless of their actual presence.
2327    /// ## `reserve_toggle_size`
2328    /// whether to reserve size for toggles
2329    #[doc(alias = "gtk_menu_set_reserve_toggle_size")]
2330    #[doc(alias = "reserve-toggle-size")]
2331    fn set_reserve_toggle_size(&self, reserve_toggle_size: bool) {
2332        unsafe {
2333            ffi::gtk_menu_set_reserve_toggle_size(
2334                self.as_ref().to_glib_none().0,
2335                reserve_toggle_size.into_glib(),
2336            );
2337        }
2338    }
2339
2340    /// Sets the [`gdk::Screen`][crate::gdk::Screen] on which the menu will be displayed.
2341    /// ## `screen`
2342    /// a [`gdk::Screen`][crate::gdk::Screen], or [`None`] if the screen should be
2343    ///  determined by the widget the menu is attached to
2344    #[doc(alias = "gtk_menu_set_screen")]
2345    fn set_screen(&self, screen: Option<&gdk::Screen>) {
2346        unsafe {
2347            ffi::gtk_menu_set_screen(self.as_ref().to_glib_none().0, screen.to_glib_none().0);
2348        }
2349    }
2350
2351    /// Positioning hints for aligning the menu relative to a rectangle.
2352    ///
2353    /// These hints determine how the menu should be positioned in the case that
2354    /// the menu would fall off-screen if placed in its ideal position.
2355    ///
2356    /// ![](popup-flip.png)
2357    ///
2358    /// For example, [`gdk::AnchorHints::FLIP_Y`][crate::gdk::AnchorHints::FLIP_Y] will replace [`gdk::Gravity::NorthWest`][crate::gdk::Gravity::NorthWest] with
2359    /// [`gdk::Gravity::SouthWest`][crate::gdk::Gravity::SouthWest] and vice versa if the menu extends beyond the
2360    /// bottom edge of the monitor.
2361    ///
2362    /// See gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (),
2363    /// gtk_menu_popup_at_pointer (), [`rect-anchor-dx`][struct@crate::Menu#rect-anchor-dx],
2364    /// [`rect-anchor-dy`][struct@crate::Menu#rect-anchor-dy], [`menu-type-hint`][struct@crate::Menu#menu-type-hint], and [`popped-up`][struct@crate::Menu#popped-up].
2365    #[doc(alias = "anchor-hints")]
2366    fn anchor_hints(&self) -> gdk::AnchorHints {
2367        ObjectExt::property(self.as_ref(), "anchor-hints")
2368    }
2369
2370    /// Positioning hints for aligning the menu relative to a rectangle.
2371    ///
2372    /// These hints determine how the menu should be positioned in the case that
2373    /// the menu would fall off-screen if placed in its ideal position.
2374    ///
2375    /// ![](popup-flip.png)
2376    ///
2377    /// For example, [`gdk::AnchorHints::FLIP_Y`][crate::gdk::AnchorHints::FLIP_Y] will replace [`gdk::Gravity::NorthWest`][crate::gdk::Gravity::NorthWest] with
2378    /// [`gdk::Gravity::SouthWest`][crate::gdk::Gravity::SouthWest] and vice versa if the menu extends beyond the
2379    /// bottom edge of the monitor.
2380    ///
2381    /// See gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (),
2382    /// gtk_menu_popup_at_pointer (), [`rect-anchor-dx`][struct@crate::Menu#rect-anchor-dx],
2383    /// [`rect-anchor-dy`][struct@crate::Menu#rect-anchor-dy], [`menu-type-hint`][struct@crate::Menu#menu-type-hint], and [`popped-up`][struct@crate::Menu#popped-up].
2384    #[doc(alias = "anchor-hints")]
2385    fn set_anchor_hints(&self, anchor_hints: gdk::AnchorHints) {
2386        ObjectExt::set_property(self.as_ref(), "anchor-hints", anchor_hints)
2387    }
2388
2389    /// The widget the menu is attached to. Setting this property attaches
2390    /// the menu without a `GtkMenuDetachFunc`. If you need to use a detacher,
2391    /// use `gtk_menu_attach_to_widget()` directly.
2392    #[doc(alias = "attach-widget")]
2393    fn set_attach_widget<P: IsA<Widget>>(&self, attach_widget: Option<&P>) {
2394        ObjectExt::set_property(self.as_ref(), "attach-widget", attach_widget)
2395    }
2396
2397    /// The [`gdk::WindowTypeHint`][crate::gdk::WindowTypeHint] to use for the menu's [`gdk::Window`][crate::gdk::Window].
2398    ///
2399    /// See gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (),
2400    /// gtk_menu_popup_at_pointer (), [`anchor-hints`][struct@crate::Menu#anchor-hints],
2401    /// [`rect-anchor-dx`][struct@crate::Menu#rect-anchor-dx], [`rect-anchor-dy`][struct@crate::Menu#rect-anchor-dy], and [`popped-up`][struct@crate::Menu#popped-up].
2402    #[doc(alias = "menu-type-hint")]
2403    fn menu_type_hint(&self) -> gdk::WindowTypeHint {
2404        ObjectExt::property(self.as_ref(), "menu-type-hint")
2405    }
2406
2407    /// The [`gdk::WindowTypeHint`][crate::gdk::WindowTypeHint] to use for the menu's [`gdk::Window`][crate::gdk::Window].
2408    ///
2409    /// See gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (),
2410    /// gtk_menu_popup_at_pointer (), [`anchor-hints`][struct@crate::Menu#anchor-hints],
2411    /// [`rect-anchor-dx`][struct@crate::Menu#rect-anchor-dx], [`rect-anchor-dy`][struct@crate::Menu#rect-anchor-dy], and [`popped-up`][struct@crate::Menu#popped-up].
2412    #[doc(alias = "menu-type-hint")]
2413    fn set_menu_type_hint(&self, menu_type_hint: gdk::WindowTypeHint) {
2414        ObjectExt::set_property(self.as_ref(), "menu-type-hint", menu_type_hint)
2415    }
2416
2417    /// Horizontal offset to apply to the menu, i.e. the rectangle or widget
2418    /// anchor.
2419    ///
2420    /// See gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (),
2421    /// gtk_menu_popup_at_pointer (), [`anchor-hints`][struct@crate::Menu#anchor-hints],
2422    /// [`rect-anchor-dy`][struct@crate::Menu#rect-anchor-dy], [`menu-type-hint`][struct@crate::Menu#menu-type-hint], and [`popped-up`][struct@crate::Menu#popped-up].
2423    #[doc(alias = "rect-anchor-dx")]
2424    fn rect_anchor_dx(&self) -> i32 {
2425        ObjectExt::property(self.as_ref(), "rect-anchor-dx")
2426    }
2427
2428    /// Horizontal offset to apply to the menu, i.e. the rectangle or widget
2429    /// anchor.
2430    ///
2431    /// See gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (),
2432    /// gtk_menu_popup_at_pointer (), [`anchor-hints`][struct@crate::Menu#anchor-hints],
2433    /// [`rect-anchor-dy`][struct@crate::Menu#rect-anchor-dy], [`menu-type-hint`][struct@crate::Menu#menu-type-hint], and [`popped-up`][struct@crate::Menu#popped-up].
2434    #[doc(alias = "rect-anchor-dx")]
2435    fn set_rect_anchor_dx(&self, rect_anchor_dx: i32) {
2436        ObjectExt::set_property(self.as_ref(), "rect-anchor-dx", rect_anchor_dx)
2437    }
2438
2439    /// Vertical offset to apply to the menu, i.e. the rectangle or widget anchor.
2440    ///
2441    /// See gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (),
2442    /// gtk_menu_popup_at_pointer (), [`anchor-hints`][struct@crate::Menu#anchor-hints],
2443    /// [`rect-anchor-dx`][struct@crate::Menu#rect-anchor-dx], [`menu-type-hint`][struct@crate::Menu#menu-type-hint], and [`popped-up`][struct@crate::Menu#popped-up].
2444    #[doc(alias = "rect-anchor-dy")]
2445    fn rect_anchor_dy(&self) -> i32 {
2446        ObjectExt::property(self.as_ref(), "rect-anchor-dy")
2447    }
2448
2449    /// Vertical offset to apply to the menu, i.e. the rectangle or widget anchor.
2450    ///
2451    /// See gtk_menu_popup_at_rect (), gtk_menu_popup_at_widget (),
2452    /// gtk_menu_popup_at_pointer (), [`anchor-hints`][struct@crate::Menu#anchor-hints],
2453    /// [`rect-anchor-dx`][struct@crate::Menu#rect-anchor-dx], [`menu-type-hint`][struct@crate::Menu#menu-type-hint], and [`popped-up`][struct@crate::Menu#popped-up].
2454    #[doc(alias = "rect-anchor-dy")]
2455    fn set_rect_anchor_dy(&self, rect_anchor_dy: i32) {
2456        ObjectExt::set_property(self.as_ref(), "rect-anchor-dy", rect_anchor_dy)
2457    }
2458
2459    #[doc(alias = "item.bottom-attach")]
2460    fn item_bottom_attach<T: IsA<MenuItem>>(&self, item: &T) -> i32 {
2461        crate::prelude::ContainerExtManual::child_property(
2462            self.as_ref(),
2463            &item.clone().upcast(),
2464            "bottom-attach",
2465        )
2466    }
2467
2468    #[doc(alias = "item.bottom-attach")]
2469    fn set_item_bottom_attach<T: IsA<MenuItem>>(&self, item: &T, bottom_attach: i32) {
2470        crate::prelude::ContainerExtManual::child_set_property(
2471            self.as_ref(),
2472            &item.clone().upcast(),
2473            "bottom-attach",
2474            &bottom_attach,
2475        )
2476    }
2477
2478    #[doc(alias = "item.left-attach")]
2479    fn item_left_attach<T: IsA<MenuItem>>(&self, item: &T) -> i32 {
2480        crate::prelude::ContainerExtManual::child_property(
2481            self.as_ref(),
2482            &item.clone().upcast(),
2483            "left-attach",
2484        )
2485    }
2486
2487    #[doc(alias = "item.left-attach")]
2488    fn set_item_left_attach<T: IsA<MenuItem>>(&self, item: &T, left_attach: i32) {
2489        crate::prelude::ContainerExtManual::child_set_property(
2490            self.as_ref(),
2491            &item.clone().upcast(),
2492            "left-attach",
2493            &left_attach,
2494        )
2495    }
2496
2497    #[doc(alias = "item.right-attach")]
2498    fn item_right_attach<T: IsA<MenuItem>>(&self, item: &T) -> i32 {
2499        crate::prelude::ContainerExtManual::child_property(
2500            self.as_ref(),
2501            &item.clone().upcast(),
2502            "right-attach",
2503        )
2504    }
2505
2506    #[doc(alias = "item.right-attach")]
2507    fn set_item_right_attach<T: IsA<MenuItem>>(&self, item: &T, right_attach: i32) {
2508        crate::prelude::ContainerExtManual::child_set_property(
2509            self.as_ref(),
2510            &item.clone().upcast(),
2511            "right-attach",
2512            &right_attach,
2513        )
2514    }
2515
2516    #[doc(alias = "item.top-attach")]
2517    fn item_top_attach<T: IsA<MenuItem>>(&self, item: &T) -> i32 {
2518        crate::prelude::ContainerExtManual::child_property(
2519            self.as_ref(),
2520            &item.clone().upcast(),
2521            "top-attach",
2522        )
2523    }
2524
2525    #[doc(alias = "item.top-attach")]
2526    fn set_item_top_attach<T: IsA<MenuItem>>(&self, item: &T, top_attach: i32) {
2527        crate::prelude::ContainerExtManual::child_set_property(
2528            self.as_ref(),
2529            &item.clone().upcast(),
2530            "top-attach",
2531            &top_attach,
2532        )
2533    }
2534
2535    /// ## `scroll_type`
2536    /// a [`ScrollType`][crate::ScrollType]
2537    #[doc(alias = "move-scroll")]
2538    fn connect_move_scroll<F: Fn(&Self, ScrollType) + 'static>(&self, f: F) -> SignalHandlerId {
2539        unsafe extern "C" fn move_scroll_trampoline<
2540            P: IsA<Menu>,
2541            F: Fn(&P, ScrollType) + 'static,
2542        >(
2543            this: *mut ffi::GtkMenu,
2544            scroll_type: ffi::GtkScrollType,
2545            f: glib::ffi::gpointer,
2546        ) {
2547            unsafe {
2548                let f: &F = &*(f as *const F);
2549                f(
2550                    Menu::from_glib_borrow(this).unsafe_cast_ref(),
2551                    from_glib(scroll_type),
2552                )
2553            }
2554        }
2555        unsafe {
2556            let f: Box_<F> = Box_::new(f);
2557            connect_raw(
2558                self.as_ptr() as *mut _,
2559                c"move-scroll".as_ptr(),
2560                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2561                    move_scroll_trampoline::<Self, F> as *const (),
2562                )),
2563                Box_::into_raw(f),
2564            )
2565        }
2566    }
2567
2568    fn emit_move_scroll(&self, scroll_type: ScrollType) {
2569        self.emit_by_name::<()>("move-scroll", &[&scroll_type]);
2570    }
2571
2572    //#[doc(alias = "popped-up")]
2573    //fn connect_popped_up<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
2574    //    Unimplemented flipped_rect: *.Pointer
2575    //    Unimplemented final_rect: *.Pointer
2576    //}
2577
2578    #[doc(alias = "accel-group")]
2579    fn connect_accel_group_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2580        unsafe extern "C" fn notify_accel_group_trampoline<P: IsA<Menu>, F: Fn(&P) + 'static>(
2581            this: *mut ffi::GtkMenu,
2582            _param_spec: glib::ffi::gpointer,
2583            f: glib::ffi::gpointer,
2584        ) {
2585            unsafe {
2586                let f: &F = &*(f as *const F);
2587                f(Menu::from_glib_borrow(this).unsafe_cast_ref())
2588            }
2589        }
2590        unsafe {
2591            let f: Box_<F> = Box_::new(f);
2592            connect_raw(
2593                self.as_ptr() as *mut _,
2594                c"notify::accel-group".as_ptr(),
2595                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2596                    notify_accel_group_trampoline::<Self, F> as *const (),
2597                )),
2598                Box_::into_raw(f),
2599            )
2600        }
2601    }
2602
2603    #[doc(alias = "accel-path")]
2604    fn connect_accel_path_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2605        unsafe extern "C" fn notify_accel_path_trampoline<P: IsA<Menu>, F: Fn(&P) + 'static>(
2606            this: *mut ffi::GtkMenu,
2607            _param_spec: glib::ffi::gpointer,
2608            f: glib::ffi::gpointer,
2609        ) {
2610            unsafe {
2611                let f: &F = &*(f as *const F);
2612                f(Menu::from_glib_borrow(this).unsafe_cast_ref())
2613            }
2614        }
2615        unsafe {
2616            let f: Box_<F> = Box_::new(f);
2617            connect_raw(
2618                self.as_ptr() as *mut _,
2619                c"notify::accel-path".as_ptr(),
2620                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2621                    notify_accel_path_trampoline::<Self, F> as *const (),
2622                )),
2623                Box_::into_raw(f),
2624            )
2625        }
2626    }
2627
2628    #[doc(alias = "active")]
2629    fn connect_active_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2630        unsafe extern "C" fn notify_active_trampoline<P: IsA<Menu>, F: Fn(&P) + 'static>(
2631            this: *mut ffi::GtkMenu,
2632            _param_spec: glib::ffi::gpointer,
2633            f: glib::ffi::gpointer,
2634        ) {
2635            unsafe {
2636                let f: &F = &*(f as *const F);
2637                f(Menu::from_glib_borrow(this).unsafe_cast_ref())
2638            }
2639        }
2640        unsafe {
2641            let f: Box_<F> = Box_::new(f);
2642            connect_raw(
2643                self.as_ptr() as *mut _,
2644                c"notify::active".as_ptr(),
2645                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2646                    notify_active_trampoline::<Self, F> as *const (),
2647                )),
2648                Box_::into_raw(f),
2649            )
2650        }
2651    }
2652
2653    #[doc(alias = "anchor-hints")]
2654    fn connect_anchor_hints_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2655        unsafe extern "C" fn notify_anchor_hints_trampoline<P: IsA<Menu>, F: Fn(&P) + 'static>(
2656            this: *mut ffi::GtkMenu,
2657            _param_spec: glib::ffi::gpointer,
2658            f: glib::ffi::gpointer,
2659        ) {
2660            unsafe {
2661                let f: &F = &*(f as *const F);
2662                f(Menu::from_glib_borrow(this).unsafe_cast_ref())
2663            }
2664        }
2665        unsafe {
2666            let f: Box_<F> = Box_::new(f);
2667            connect_raw(
2668                self.as_ptr() as *mut _,
2669                c"notify::anchor-hints".as_ptr(),
2670                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2671                    notify_anchor_hints_trampoline::<Self, F> as *const (),
2672                )),
2673                Box_::into_raw(f),
2674            )
2675        }
2676    }
2677
2678    #[doc(alias = "attach-widget")]
2679    fn connect_attach_widget_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2680        unsafe extern "C" fn notify_attach_widget_trampoline<P: IsA<Menu>, F: Fn(&P) + 'static>(
2681            this: *mut ffi::GtkMenu,
2682            _param_spec: glib::ffi::gpointer,
2683            f: glib::ffi::gpointer,
2684        ) {
2685            unsafe {
2686                let f: &F = &*(f as *const F);
2687                f(Menu::from_glib_borrow(this).unsafe_cast_ref())
2688            }
2689        }
2690        unsafe {
2691            let f: Box_<F> = Box_::new(f);
2692            connect_raw(
2693                self.as_ptr() as *mut _,
2694                c"notify::attach-widget".as_ptr(),
2695                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2696                    notify_attach_widget_trampoline::<Self, F> as *const (),
2697                )),
2698                Box_::into_raw(f),
2699            )
2700        }
2701    }
2702
2703    #[doc(alias = "menu-type-hint")]
2704    fn connect_menu_type_hint_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2705        unsafe extern "C" fn notify_menu_type_hint_trampoline<P: IsA<Menu>, F: Fn(&P) + 'static>(
2706            this: *mut ffi::GtkMenu,
2707            _param_spec: glib::ffi::gpointer,
2708            f: glib::ffi::gpointer,
2709        ) {
2710            unsafe {
2711                let f: &F = &*(f as *const F);
2712                f(Menu::from_glib_borrow(this).unsafe_cast_ref())
2713            }
2714        }
2715        unsafe {
2716            let f: Box_<F> = Box_::new(f);
2717            connect_raw(
2718                self.as_ptr() as *mut _,
2719                c"notify::menu-type-hint".as_ptr(),
2720                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2721                    notify_menu_type_hint_trampoline::<Self, F> as *const (),
2722                )),
2723                Box_::into_raw(f),
2724            )
2725        }
2726    }
2727
2728    #[doc(alias = "monitor")]
2729    fn connect_monitor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2730        unsafe extern "C" fn notify_monitor_trampoline<P: IsA<Menu>, F: Fn(&P) + 'static>(
2731            this: *mut ffi::GtkMenu,
2732            _param_spec: glib::ffi::gpointer,
2733            f: glib::ffi::gpointer,
2734        ) {
2735            unsafe {
2736                let f: &F = &*(f as *const F);
2737                f(Menu::from_glib_borrow(this).unsafe_cast_ref())
2738            }
2739        }
2740        unsafe {
2741            let f: Box_<F> = Box_::new(f);
2742            connect_raw(
2743                self.as_ptr() as *mut _,
2744                c"notify::monitor".as_ptr(),
2745                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2746                    notify_monitor_trampoline::<Self, F> as *const (),
2747                )),
2748                Box_::into_raw(f),
2749            )
2750        }
2751    }
2752
2753    #[doc(alias = "rect-anchor-dx")]
2754    fn connect_rect_anchor_dx_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2755        unsafe extern "C" fn notify_rect_anchor_dx_trampoline<P: IsA<Menu>, F: Fn(&P) + 'static>(
2756            this: *mut ffi::GtkMenu,
2757            _param_spec: glib::ffi::gpointer,
2758            f: glib::ffi::gpointer,
2759        ) {
2760            unsafe {
2761                let f: &F = &*(f as *const F);
2762                f(Menu::from_glib_borrow(this).unsafe_cast_ref())
2763            }
2764        }
2765        unsafe {
2766            let f: Box_<F> = Box_::new(f);
2767            connect_raw(
2768                self.as_ptr() as *mut _,
2769                c"notify::rect-anchor-dx".as_ptr(),
2770                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2771                    notify_rect_anchor_dx_trampoline::<Self, F> as *const (),
2772                )),
2773                Box_::into_raw(f),
2774            )
2775        }
2776    }
2777
2778    #[doc(alias = "rect-anchor-dy")]
2779    fn connect_rect_anchor_dy_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2780        unsafe extern "C" fn notify_rect_anchor_dy_trampoline<P: IsA<Menu>, F: Fn(&P) + 'static>(
2781            this: *mut ffi::GtkMenu,
2782            _param_spec: glib::ffi::gpointer,
2783            f: glib::ffi::gpointer,
2784        ) {
2785            unsafe {
2786                let f: &F = &*(f as *const F);
2787                f(Menu::from_glib_borrow(this).unsafe_cast_ref())
2788            }
2789        }
2790        unsafe {
2791            let f: Box_<F> = Box_::new(f);
2792            connect_raw(
2793                self.as_ptr() as *mut _,
2794                c"notify::rect-anchor-dy".as_ptr(),
2795                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2796                    notify_rect_anchor_dy_trampoline::<Self, F> as *const (),
2797                )),
2798                Box_::into_raw(f),
2799            )
2800        }
2801    }
2802
2803    #[doc(alias = "reserve-toggle-size")]
2804    fn connect_reserve_toggle_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2805        unsafe extern "C" fn notify_reserve_toggle_size_trampoline<
2806            P: IsA<Menu>,
2807            F: Fn(&P) + 'static,
2808        >(
2809            this: *mut ffi::GtkMenu,
2810            _param_spec: glib::ffi::gpointer,
2811            f: glib::ffi::gpointer,
2812        ) {
2813            unsafe {
2814                let f: &F = &*(f as *const F);
2815                f(Menu::from_glib_borrow(this).unsafe_cast_ref())
2816            }
2817        }
2818        unsafe {
2819            let f: Box_<F> = Box_::new(f);
2820            connect_raw(
2821                self.as_ptr() as *mut _,
2822                c"notify::reserve-toggle-size".as_ptr(),
2823                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2824                    notify_reserve_toggle_size_trampoline::<Self, F> as *const (),
2825                )),
2826                Box_::into_raw(f),
2827            )
2828        }
2829    }
2830}
2831
2832impl<O: IsA<Menu>> GtkMenuExt for O {}