Skip to main content

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