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