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