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