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