Skip to main content

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