Skip to main content

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