Skip to main content

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