Skip to main content

gtk4/auto/
check_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
5#[cfg(feature = "v4_10")]
6#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
7use crate::Accessible;
8use crate::{
9    AccessibleRole, Actionable, Align, Buildable, ConstraintTarget, LayoutManager, Overflow,
10    Widget, ffi,
11};
12use glib::{
13    object::ObjectType as _,
14    prelude::*,
15    signal::{SignalHandlerId, connect_raw},
16    translate::*,
17};
18use std::boxed::Box as Box_;
19
20#[cfg(feature = "v4_10")]
21#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
22glib::wrapper! {
23    ///  [label]
24    /// ```text
25    ///
26    /// A [`CheckButton`][crate::CheckButton] has a main node with name checkbutton. If the
27    /// [`label`][struct@crate::CheckButton#label] or [`child`][struct@crate::CheckButton#child]
28    /// properties are set, it contains a child widget. The indicator node
29    /// is named check when no group is set, and radio if the checkbutton
30    /// is grouped together with other checkbuttons.
31    ///
32    /// # Accessibility
33    ///
34    /// [`CheckButton`][crate::CheckButton] uses the [enum@Gtk.AccessibleRole.checkbox] role.
35    ///
36    /// ## Properties
37    ///
38    ///
39    /// #### `active`
40    ///  If the check button is active.
41    ///
42    /// Setting `active` to [`true`] will add the `:checked:` state to both
43    /// the check button and the indicator CSS node.
44    ///
45    /// Readable | Writable
46    ///
47    ///
48    /// #### `child`
49    ///  The child widget.
50    ///
51    /// Readable | Writable
52    ///
53    ///
54    /// #### `group`
55    ///  The check button whose group this widget belongs to.
56    ///
57    /// Writable
58    ///
59    ///
60    /// #### `inconsistent`
61    ///   state.
62    ///
63    /// The inconsistent state only affects visual appearance,
64    /// not the semantics of the button.
65    ///
66    /// Readable | Writable
67    ///
68    ///
69    /// #### `label`
70    ///  Text of the label inside the check button, if it contains a label widget.
71    ///
72    /// Readable | Writable
73    ///
74    ///
75    /// #### `use-underline`
76    ///  If set, an underline in the text indicates that the following
77    /// character is to be used as mnemonic.
78    ///
79    /// Readable | Writable
80    /// <details><summary><h4>Widget</h4></summary>
81    ///
82    ///
83    /// #### `can-focus`
84    ///  Whether the widget or any of its descendents can accept
85    /// the input focus.
86    ///
87    /// This property is meant to be set by widget implementations,
88    /// typically in their instance init function.
89    ///
90    /// Readable | Writable
91    ///
92    ///
93    /// #### `can-target`
94    ///  Whether the widget can receive pointer events.
95    ///
96    /// Readable | Writable
97    ///
98    ///
99    /// #### `css-classes`
100    ///  A list of css classes applied to this widget.
101    ///
102    /// Readable | Writable
103    ///
104    ///
105    /// #### `css-name`
106    ///  The name of this widget in the CSS tree.
107    ///
108    /// This property is meant to be set by widget implementations,
109    /// typically in their instance init function.
110    ///
111    /// Readable | Writable | Construct Only
112    ///
113    ///
114    /// #### `cursor`
115    ///  The cursor used by @widget.
116    ///
117    /// Readable | Writable
118    ///
119    ///
120    /// #### `focus-on-click`
121    ///  Whether the widget should grab focus when it is clicked with the mouse.
122    ///
123    /// This property is only relevant for widgets that can take focus.
124    ///
125    /// Readable | Writable
126    ///
127    ///
128    /// #### `focusable`
129    ///  Whether this widget itself will accept the input focus.
130    ///
131    /// Readable | Writable
132    ///
133    ///
134    /// #### `halign`
135    ///  How to distribute horizontal space if widget gets extra space.
136    ///
137    /// Readable | Writable
138    ///
139    ///
140    /// #### `has-default`
141    ///  Whether the widget is the default widget.
142    ///
143    /// Readable
144    ///
145    ///
146    /// #### `has-focus`
147    ///  Whether the widget has the input focus.
148    ///
149    /// Readable
150    ///
151    ///
152    /// #### `has-tooltip`
153    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
154    /// signal on @widget.
155    ///
156    /// A true value indicates that @widget can have a tooltip, in this case
157    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
158    /// determine whether it will provide a tooltip or not.
159    ///
160    /// Readable | Writable
161    ///
162    ///
163    /// #### `height-request`
164    ///  Overrides for height request of the widget.
165    ///
166    /// If this is -1, the natural request will be used.
167    ///
168    /// Readable | Writable
169    ///
170    ///
171    /// #### `hexpand`
172    ///  Whether to expand horizontally.
173    ///
174    /// Readable | Writable
175    ///
176    ///
177    /// #### `hexpand-set`
178    ///  Whether to use the `hexpand` property.
179    ///
180    /// Readable | Writable
181    ///
182    ///
183    /// #### `layout-manager`
184    ///  The [`LayoutManager`][crate::LayoutManager] instance to use to compute
185    /// the preferred size of the widget, and allocate its children.
186    ///
187    /// This property is meant to be set by widget implementations,
188    /// typically in their instance init function.
189    ///
190    /// Readable | Writable
191    ///
192    ///
193    /// #### `limit-events`
194    ///  Makes this widget act like a modal dialog, with respect to
195    /// event delivery.
196    ///
197    /// Global event controllers will not handle events with targets
198    /// inside the widget, unless they are set up to ignore propagation
199    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
200    ///
201    /// Readable | Writable
202    ///
203    ///
204    /// #### `margin-bottom`
205    ///  Margin on bottom side of widget.
206    ///
207    /// This property adds margin outside of the widget's normal size
208    /// request, the margin will be added in addition to the size from
209    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
210    ///
211    /// Readable | Writable
212    ///
213    ///
214    /// #### `margin-end`
215    ///  Margin on end of widget, horizontally.
216    ///
217    /// This property supports left-to-right and right-to-left text
218    /// directions.
219    ///
220    /// This property adds margin outside of the widget's normal size
221    /// request, the margin will be added in addition to the size from
222    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
223    ///
224    /// Readable | Writable
225    ///
226    ///
227    /// #### `margin-start`
228    ///  Margin on start of widget, horizontally.
229    ///
230    /// This property supports left-to-right and right-to-left text
231    /// directions.
232    ///
233    /// This property adds margin outside of the widget's normal size
234    /// request, the margin will be added in addition to the size from
235    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
236    ///
237    /// Readable | Writable
238    ///
239    ///
240    /// #### `margin-top`
241    ///  Margin on top side of widget.
242    ///
243    /// This property adds margin outside of the widget's normal size
244    /// request, the margin will be added in addition to the size from
245    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
246    ///
247    /// Readable | Writable
248    ///
249    ///
250    /// #### `name`
251    ///  The name of the widget.
252    ///
253    /// Readable | Writable
254    ///
255    ///
256    /// #### `opacity`
257    ///  The requested opacity of the widget.
258    ///
259    /// Readable | Writable
260    ///
261    ///
262    /// #### `overflow`
263    ///  How content outside the widget's content area is treated.
264    ///
265    /// This property is meant to be set by widget implementations,
266    /// typically in their instance init function.
267    ///
268    /// Readable | Writable
269    ///
270    ///
271    /// #### `parent`
272    ///  The parent widget of this widget.
273    ///
274    /// Readable
275    ///
276    ///
277    /// #### `receives-default`
278    ///  Whether the widget will receive the default action when it is focused.
279    ///
280    /// Readable | Writable
281    ///
282    ///
283    /// #### `root`
284    ///  The [`Root`][crate::Root] widget of the widget tree containing this widget.
285    ///
286    /// This will be `NULL` if the widget is not contained in a root widget.
287    ///
288    /// Readable
289    ///
290    ///
291    /// #### `scale-factor`
292    ///  The scale factor of the widget.
293    ///
294    /// Readable
295    ///
296    ///
297    /// #### `sensitive`
298    ///  Whether the widget responds to input.
299    ///
300    /// Readable | Writable
301    ///
302    ///
303    /// #### `tooltip-markup`
304    ///  Sets the text of tooltip to be the given string, which is marked up
305    /// with Pango markup.
306    ///
307    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
308    ///
309    /// This is a convenience property which will take care of getting the
310    /// tooltip shown if the given string is not `NULL`:
311    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
312    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
313    /// the default signal handler.
314    ///
315    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
316    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
317    ///
318    /// Readable | Writable
319    ///
320    ///
321    /// #### `tooltip-text`
322    ///  Sets the text of tooltip to be the given string.
323    ///
324    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
325    ///
326    /// This is a convenience property which will take care of getting the
327    /// tooltip shown if the given string is not `NULL`:
328    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
329    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
330    /// the default signal handler.
331    ///
332    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
333    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
334    ///
335    /// Readable | Writable
336    ///
337    ///
338    /// #### `valign`
339    ///  How to distribute vertical space if widget gets extra space.
340    ///
341    /// Readable | Writable
342    ///
343    ///
344    /// #### `vexpand`
345    ///  Whether to expand vertically.
346    ///
347    /// Readable | Writable
348    ///
349    ///
350    /// #### `vexpand-set`
351    ///  Whether to use the `vexpand` property.
352    ///
353    /// Readable | Writable
354    ///
355    ///
356    /// #### `visible`
357    ///  Whether the widget is visible.
358    ///
359    /// Readable | Writable
360    ///
361    ///
362    /// #### `width-request`
363    ///  Overrides for width request of the widget.
364    ///
365    /// If this is -1, the natural request will be used.
366    ///
367    /// Readable | Writable
368    /// </details>
369    /// <details><summary><h4>Accessible</h4></summary>
370    ///
371    ///
372    /// #### `accessible-role`
373    ///  The accessible role of the given [`Accessible`][crate::Accessible] implementation.
374    ///
375    /// The accessible role cannot be changed once set.
376    ///
377    /// Readable | Writable
378    /// </details>
379    /// <details><summary><h4>Actionable</h4></summary>
380    ///
381    ///
382    /// #### `action-name`
383    ///  The name of the action with which this widget should be associated.
384    ///
385    /// Readable | Writable
386    ///
387    ///
388    /// #### `action-target`
389    ///  The target value of the actionable widget's action.
390    ///
391    /// Readable | Writable
392    /// </details>
393    ///
394    /// ## Signals
395    ///
396    ///
397    /// #### `activate`
398    ///   keys.
399    ///
400    /// Action
401    ///
402    ///
403    /// #### `toggled`
404    ///  Emitted when the buttons's [`active`][struct@crate::CheckButton#active]
405    /// property changes.
406    ///
407    ///
408    /// <details><summary><h4>Widget</h4></summary>
409    ///
410    ///
411    /// #### `destroy`
412    ///  Signals that all holders of a reference to the widget should release
413    /// the reference that they hold.
414    ///
415    /// May result in finalization of the widget if all references are released.
416    ///
417    /// This signal is not suitable for saving widget state.
418    ///
419    ///
420    ///
421    ///
422    /// #### `direction-changed`
423    ///  Emitted when the text direction of a widget changes.
424    ///
425    ///
426    ///
427    ///
428    /// #### `hide`
429    ///  Emitted when @widget is hidden.
430    ///
431    ///
432    ///
433    ///
434    /// #### `keynav-failed`
435    ///  Emitted if keyboard navigation fails.
436    ///
437    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
438    ///
439    ///
440    ///
441    ///
442    /// #### `map`
443    ///  Emitted when @widget is going to be mapped.
444    ///
445    /// A widget is mapped when the widget is visible (which is controlled with
446    /// [`visible`][struct@crate::Widget#visible]) and all its parents up to the toplevel widget
447    /// are also visible.
448    ///
449    /// The `::map` signal can be used to determine whether a widget will be drawn,
450    /// for instance it can resume an animation that was stopped during the
451    /// emission of [`unmap`][struct@crate::Widget#unmap].
452    ///
453    ///
454    ///
455    ///
456    /// #### `mnemonic-activate`
457    ///  Emitted when a widget is activated via a mnemonic.
458    ///
459    /// The default handler for this signal activates @widget if @group_cycling
460    /// is false, or just makes @widget grab focus if @group_cycling is true.
461    ///
462    ///
463    ///
464    ///
465    /// #### `move-focus`
466    ///   to move backward.
467    ///
468    /// Action
469    ///
470    ///
471    /// #### `query-tooltip`
472    ///  s tooltip is about to be shown.
473    ///
474    /// This happens when the [`has-tooltip`][struct@crate::Widget#has-tooltip] property
475    /// is true and the hover timeout has expired with the cursor hovering
476    /// above @widget; or emitted when @widget got focus in keyboard mode.
477    ///
478    /// Using the given coordinates, the signal handler should determine
479    /// whether a tooltip should be shown for @widget. If this is the case
480    /// true should be returned, false otherwise. Note that if @keyboard_mode
481    /// is true, the values of @x and @y are undefined and should not be used.
482    ///
483    /// The signal handler is free to manipulate @tooltip with the therefore
484    /// destined function calls.
485    ///
486    ///
487    ///
488    ///
489    /// #### `realize`
490    ///  Emitted when @widget is associated with a [`gdk::Surface`][crate::gdk::Surface].
491    ///
492    /// This means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called
493    /// or the widget has been mapped (that is, it is going to be drawn).
494    ///
495    ///
496    ///
497    ///
498    /// #### `show`
499    ///  Emitted when @widget is shown.
500    ///
501    ///
502    ///
503    ///
504    /// #### `state-flags-changed`
505    ///  Emitted when the widget state changes.
506    ///
507    /// See [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
508    ///
509    ///
510    ///
511    ///
512    /// #### `unmap`
513    ///  Emitted when @widget is going to be unmapped.
514    ///
515    /// A widget is unmapped when either it or any of its parents up to the
516    /// toplevel widget have been set as hidden.
517    ///
518    /// As `::unmap` indicates that a widget will not be shown any longer,
519    /// it can be used to, for example, stop an animation on the widget.
520    ///
521    ///
522    ///
523    ///
524    /// #### `unrealize`
525    ///  Emitted when the [`gdk::Surface`][crate::gdk::Surface] associated with @widget is destroyed.
526    ///
527    /// This means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been called
528    /// or the widget has been unmapped (that is, it is going to be hidden).
529    ///
530    ///
531    /// </details>
532    ///
533    /// # Implements
534    ///
535    /// [`CheckButtonExt`][trait@crate::prelude::CheckButtonExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`ActionableExt`][trait@crate::prelude::ActionableExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual], [`ActionableExtManual`][trait@crate::prelude::ActionableExtManual]
536    #[doc(alias = "GtkCheckButton")]
537    pub struct CheckButton(Object<ffi::GtkCheckButton, ffi::GtkCheckButtonClass>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, Actionable;
538
539    match fn {
540        type_ => || ffi::gtk_check_button_get_type(),
541    }
542}
543
544#[cfg(not(feature = "v4_10"))]
545glib::wrapper! {
546    #[doc(alias = "GtkCheckButton")]
547    pub struct CheckButton(Object<ffi::GtkCheckButton, ffi::GtkCheckButtonClass>) @extends Widget, @implements Buildable, ConstraintTarget, Actionable;
548
549    match fn {
550        type_ => || ffi::gtk_check_button_get_type(),
551    }
552}
553
554impl CheckButton {
555    pub const NONE: Option<&'static CheckButton> = None;
556
557    /// Creates a new [`CheckButton`][crate::CheckButton].
558    ///
559    /// # Returns
560    ///
561    /// a new [`CheckButton`][crate::CheckButton]
562    #[doc(alias = "gtk_check_button_new")]
563    pub fn new() -> CheckButton {
564        assert_initialized_main_thread!();
565        unsafe { Widget::from_glib_none(ffi::gtk_check_button_new()).unsafe_cast() }
566    }
567
568    /// Creates a new [`CheckButton`][crate::CheckButton] with the given text.
569    /// ## `label`
570    /// the text for the check button.
571    ///
572    /// # Returns
573    ///
574    /// a new [`CheckButton`][crate::CheckButton]
575    #[doc(alias = "gtk_check_button_new_with_label")]
576    #[doc(alias = "new_with_label")]
577    pub fn with_label(label: &str) -> CheckButton {
578        assert_initialized_main_thread!();
579        unsafe {
580            Widget::from_glib_none(ffi::gtk_check_button_new_with_label(label.to_glib_none().0))
581                .unsafe_cast()
582        }
583    }
584
585    /// Creates a new [`CheckButton`][crate::CheckButton] with the given text and a mnemonic.
586    /// ## `label`
587    /// The text of the button, with an underscore
588    ///   in front of the mnemonic character
589    ///
590    /// # Returns
591    ///
592    /// a new [`CheckButton`][crate::CheckButton]
593    #[doc(alias = "gtk_check_button_new_with_mnemonic")]
594    #[doc(alias = "new_with_mnemonic")]
595    pub fn with_mnemonic(label: &str) -> CheckButton {
596        assert_initialized_main_thread!();
597        unsafe {
598            Widget::from_glib_none(ffi::gtk_check_button_new_with_mnemonic(
599                label.to_glib_none().0,
600            ))
601            .unsafe_cast()
602        }
603    }
604
605    // rustdoc-stripper-ignore-next
606    /// Creates a new builder-pattern struct instance to construct [`CheckButton`] objects.
607    ///
608    /// This method returns an instance of [`CheckButtonBuilder`](crate::builders::CheckButtonBuilder) which can be used to create [`CheckButton`] objects.
609    pub fn builder() -> CheckButtonBuilder {
610        CheckButtonBuilder::new()
611    }
612}
613
614impl Default for CheckButton {
615    fn default() -> Self {
616        Self::new()
617    }
618}
619
620// rustdoc-stripper-ignore-next
621/// A [builder-pattern] type to construct [`CheckButton`] objects.
622///
623/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
624#[must_use = "The builder must be built to be used"]
625pub struct CheckButtonBuilder {
626    builder: glib::object::ObjectBuilder<'static, CheckButton>,
627}
628
629impl CheckButtonBuilder {
630    fn new() -> Self {
631        Self {
632            builder: glib::object::Object::builder(),
633        }
634    }
635
636    /// If the check button is active.
637    ///
638    /// Setting `active` to [`true`] will add the `:checked:` state to both
639    /// the check button and the indicator CSS node.
640    pub fn active(self, active: bool) -> Self {
641        Self {
642            builder: self.builder.property("active", active),
643        }
644    }
645
646    /// The child widget.
647    #[cfg(feature = "v4_8")]
648    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
649    pub fn child(self, child: &impl IsA<Widget>) -> Self {
650        Self {
651            builder: self.builder.property("child", child.clone().upcast()),
652        }
653    }
654
655    /// The check button whose group this widget belongs to.
656    pub fn group(self, group: &impl IsA<CheckButton>) -> Self {
657        Self {
658            builder: self.builder.property("group", group.clone().upcast()),
659        }
660    }
661
662    ///  state.
663    ///
664    /// The inconsistent state only affects visual appearance,
665    /// not the semantics of the button.
666    pub fn inconsistent(self, inconsistent: bool) -> Self {
667        Self {
668            builder: self.builder.property("inconsistent", inconsistent),
669        }
670    }
671
672    /// Text of the label inside the check button, if it contains a label widget.
673    pub fn label(self, label: impl Into<glib::GString>) -> Self {
674        Self {
675            builder: self.builder.property("label", label.into()),
676        }
677    }
678
679    /// If set, an underline in the text indicates that the following
680    /// character is to be used as mnemonic.
681    pub fn use_underline(self, use_underline: bool) -> Self {
682        Self {
683            builder: self.builder.property("use-underline", use_underline),
684        }
685    }
686
687    /// Whether the widget or any of its descendents can accept
688    /// the input focus.
689    ///
690    /// This property is meant to be set by widget implementations,
691    /// typically in their instance init function.
692    pub fn can_focus(self, can_focus: bool) -> Self {
693        Self {
694            builder: self.builder.property("can-focus", can_focus),
695        }
696    }
697
698    /// Whether the widget can receive pointer events.
699    pub fn can_target(self, can_target: bool) -> Self {
700        Self {
701            builder: self.builder.property("can-target", can_target),
702        }
703    }
704
705    /// A list of css classes applied to this widget.
706    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
707        Self {
708            builder: self.builder.property("css-classes", css_classes.into()),
709        }
710    }
711
712    /// The name of this widget in the CSS tree.
713    ///
714    /// This property is meant to be set by widget implementations,
715    /// typically in their instance init function.
716    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
717        Self {
718            builder: self.builder.property("css-name", css_name.into()),
719        }
720    }
721
722    /// The cursor used by @widget.
723    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
724        Self {
725            builder: self.builder.property("cursor", cursor.clone()),
726        }
727    }
728
729    /// Whether the widget should grab focus when it is clicked with the mouse.
730    ///
731    /// This property is only relevant for widgets that can take focus.
732    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
733        Self {
734            builder: self.builder.property("focus-on-click", focus_on_click),
735        }
736    }
737
738    /// Whether this widget itself will accept the input focus.
739    pub fn focusable(self, focusable: bool) -> Self {
740        Self {
741            builder: self.builder.property("focusable", focusable),
742        }
743    }
744
745    /// How to distribute horizontal space if widget gets extra space.
746    pub fn halign(self, halign: Align) -> Self {
747        Self {
748            builder: self.builder.property("halign", halign),
749        }
750    }
751
752    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
753    /// signal on @widget.
754    ///
755    /// A true value indicates that @widget can have a tooltip, in this case
756    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
757    /// determine whether it will provide a tooltip or not.
758    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
759        Self {
760            builder: self.builder.property("has-tooltip", has_tooltip),
761        }
762    }
763
764    /// Overrides for height request of the widget.
765    ///
766    /// If this is -1, the natural request will be used.
767    pub fn height_request(self, height_request: i32) -> Self {
768        Self {
769            builder: self.builder.property("height-request", height_request),
770        }
771    }
772
773    /// Whether to expand horizontally.
774    pub fn hexpand(self, hexpand: bool) -> Self {
775        Self {
776            builder: self.builder.property("hexpand", hexpand),
777        }
778    }
779
780    /// Whether to use the `hexpand` property.
781    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
782        Self {
783            builder: self.builder.property("hexpand-set", hexpand_set),
784        }
785    }
786
787    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
788    /// the preferred size of the widget, and allocate its children.
789    ///
790    /// This property is meant to be set by widget implementations,
791    /// typically in their instance init function.
792    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
793        Self {
794            builder: self
795                .builder
796                .property("layout-manager", layout_manager.clone().upcast()),
797        }
798    }
799
800    /// Makes this widget act like a modal dialog, with respect to
801    /// event delivery.
802    ///
803    /// Global event controllers will not handle events with targets
804    /// inside the widget, unless they are set up to ignore propagation
805    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
806    #[cfg(feature = "v4_18")]
807    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
808    pub fn limit_events(self, limit_events: bool) -> Self {
809        Self {
810            builder: self.builder.property("limit-events", limit_events),
811        }
812    }
813
814    /// Margin on bottom side of widget.
815    ///
816    /// This property adds margin outside of the widget's normal size
817    /// request, the margin will be added in addition to the size from
818    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
819    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
820        Self {
821            builder: self.builder.property("margin-bottom", margin_bottom),
822        }
823    }
824
825    /// Margin on end of widget, horizontally.
826    ///
827    /// This property supports left-to-right and right-to-left text
828    /// directions.
829    ///
830    /// This property adds margin outside of the widget's normal size
831    /// request, the margin will be added in addition to the size from
832    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
833    pub fn margin_end(self, margin_end: i32) -> Self {
834        Self {
835            builder: self.builder.property("margin-end", margin_end),
836        }
837    }
838
839    /// Margin on start of widget, horizontally.
840    ///
841    /// This property supports left-to-right and right-to-left text
842    /// directions.
843    ///
844    /// This property adds margin outside of the widget's normal size
845    /// request, the margin will be added in addition to the size from
846    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
847    pub fn margin_start(self, margin_start: i32) -> Self {
848        Self {
849            builder: self.builder.property("margin-start", margin_start),
850        }
851    }
852
853    /// Margin on top side of widget.
854    ///
855    /// This property adds margin outside of the widget's normal size
856    /// request, the margin will be added in addition to the size from
857    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
858    pub fn margin_top(self, margin_top: i32) -> Self {
859        Self {
860            builder: self.builder.property("margin-top", margin_top),
861        }
862    }
863
864    /// The name of the widget.
865    pub fn name(self, name: impl Into<glib::GString>) -> Self {
866        Self {
867            builder: self.builder.property("name", name.into()),
868        }
869    }
870
871    /// The requested opacity of the widget.
872    pub fn opacity(self, opacity: f64) -> Self {
873        Self {
874            builder: self.builder.property("opacity", opacity),
875        }
876    }
877
878    /// How content outside the widget's content area is treated.
879    ///
880    /// This property is meant to be set by widget implementations,
881    /// typically in their instance init function.
882    pub fn overflow(self, overflow: Overflow) -> Self {
883        Self {
884            builder: self.builder.property("overflow", overflow),
885        }
886    }
887
888    /// Whether the widget will receive the default action when it is focused.
889    pub fn receives_default(self, receives_default: bool) -> Self {
890        Self {
891            builder: self.builder.property("receives-default", receives_default),
892        }
893    }
894
895    /// Whether the widget responds to input.
896    pub fn sensitive(self, sensitive: bool) -> Self {
897        Self {
898            builder: self.builder.property("sensitive", sensitive),
899        }
900    }
901
902    /// Sets the text of tooltip to be the given string, which is marked up
903    /// with Pango markup.
904    ///
905    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
906    ///
907    /// This is a convenience property which will take care of getting the
908    /// tooltip shown if the given string is not `NULL`:
909    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
910    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
911    /// the default signal handler.
912    ///
913    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
914    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
915    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
916        Self {
917            builder: self
918                .builder
919                .property("tooltip-markup", tooltip_markup.into()),
920        }
921    }
922
923    /// Sets the text of tooltip to be the given string.
924    ///
925    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
926    ///
927    /// This is a convenience property which will take care of getting the
928    /// tooltip shown if the given string is not `NULL`:
929    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
930    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
931    /// the default signal handler.
932    ///
933    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
934    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
935    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
936        Self {
937            builder: self.builder.property("tooltip-text", tooltip_text.into()),
938        }
939    }
940
941    /// How to distribute vertical space if widget gets extra space.
942    pub fn valign(self, valign: Align) -> Self {
943        Self {
944            builder: self.builder.property("valign", valign),
945        }
946    }
947
948    /// Whether to expand vertically.
949    pub fn vexpand(self, vexpand: bool) -> Self {
950        Self {
951            builder: self.builder.property("vexpand", vexpand),
952        }
953    }
954
955    /// Whether to use the `vexpand` property.
956    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
957        Self {
958            builder: self.builder.property("vexpand-set", vexpand_set),
959        }
960    }
961
962    /// Whether the widget is visible.
963    pub fn visible(self, visible: bool) -> Self {
964        Self {
965            builder: self.builder.property("visible", visible),
966        }
967    }
968
969    /// Overrides for width request of the widget.
970    ///
971    /// If this is -1, the natural request will be used.
972    pub fn width_request(self, width_request: i32) -> Self {
973        Self {
974            builder: self.builder.property("width-request", width_request),
975        }
976    }
977
978    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
979    ///
980    /// The accessible role cannot be changed once set.
981    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
982        Self {
983            builder: self.builder.property("accessible-role", accessible_role),
984        }
985    }
986
987    /// The name of the action with which this widget should be associated.
988    pub fn action_name(self, action_name: impl Into<glib::GString>) -> Self {
989        Self {
990            builder: self.builder.property("action-name", action_name.into()),
991        }
992    }
993
994    /// The target value of the actionable widget's action.
995    pub fn action_target(self, action_target: &glib::Variant) -> Self {
996        Self {
997            builder: self
998                .builder
999                .property("action-target", action_target.clone()),
1000        }
1001    }
1002
1003    // rustdoc-stripper-ignore-next
1004    /// Build the [`CheckButton`].
1005    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1006    pub fn build(self) -> CheckButton {
1007        assert_initialized_main_thread!();
1008        self.builder.build()
1009    }
1010}
1011
1012/// Trait containing all [`struct@CheckButton`] methods.
1013///
1014/// # Implementors
1015///
1016/// [`CheckButton`][struct@crate::CheckButton]
1017pub trait CheckButtonExt: IsA<CheckButton> + 'static {
1018    /// Returns whether the check button is active.
1019    ///
1020    /// # Returns
1021    ///
1022    /// whether the check button is active
1023    #[doc(alias = "gtk_check_button_get_active")]
1024    #[doc(alias = "get_active")]
1025    #[doc(alias = "active")]
1026    fn is_active(&self) -> bool {
1027        unsafe {
1028            from_glib(ffi::gtk_check_button_get_active(
1029                self.as_ref().to_glib_none().0,
1030            ))
1031        }
1032    }
1033
1034    /// Gets the child widget of @self or `NULL` if [`label`][struct@crate::CheckButton#label] is set.
1035    ///
1036    /// # Returns
1037    ///
1038    /// the child widget of @self
1039    #[cfg(feature = "v4_8")]
1040    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1041    #[doc(alias = "gtk_check_button_get_child")]
1042    #[doc(alias = "get_child")]
1043    fn child(&self) -> Option<Widget> {
1044        unsafe {
1045            from_glib_none(ffi::gtk_check_button_get_child(
1046                self.as_ref().to_glib_none().0,
1047            ))
1048        }
1049    }
1050
1051    /// Returns whether the check button is in an inconsistent state.
1052    ///
1053    /// # Returns
1054    ///
1055    /// [`true`] if @self is currently in an inconsistent state
1056    #[doc(alias = "gtk_check_button_get_inconsistent")]
1057    #[doc(alias = "get_inconsistent")]
1058    #[doc(alias = "inconsistent")]
1059    fn is_inconsistent(&self) -> bool {
1060        unsafe {
1061            from_glib(ffi::gtk_check_button_get_inconsistent(
1062                self.as_ref().to_glib_none().0,
1063            ))
1064        }
1065    }
1066
1067    /// Returns the label of the check button or `NULL` if [`child`][struct@crate::CheckButton#child] is set.
1068    ///
1069    /// # Returns
1070    ///
1071    /// The label @self shows next
1072    ///   to the indicator. If no label is shown, [`None`] will be returned.
1073    #[doc(alias = "gtk_check_button_get_label")]
1074    #[doc(alias = "get_label")]
1075    fn label(&self) -> Option<glib::GString> {
1076        unsafe {
1077            from_glib_none(ffi::gtk_check_button_get_label(
1078                self.as_ref().to_glib_none().0,
1079            ))
1080        }
1081    }
1082
1083    /// Returns whether underlines in the label indicate mnemonics.
1084    ///
1085    /// # Returns
1086    ///
1087    /// The value of the [`use-underline`][struct@crate::CheckButton#use-underline] property.
1088    ///   See [`set_use_underline()`][Self::set_use_underline()] for details on how to set
1089    ///   a new value.
1090    #[doc(alias = "gtk_check_button_get_use_underline")]
1091    #[doc(alias = "get_use_underline")]
1092    #[doc(alias = "use-underline")]
1093    fn uses_underline(&self) -> bool {
1094        unsafe {
1095            from_glib(ffi::gtk_check_button_get_use_underline(
1096                self.as_ref().to_glib_none().0,
1097            ))
1098        }
1099    }
1100
1101    /// Changes the check buttons active state.
1102    /// ## `setting`
1103    /// the new value to set
1104    #[doc(alias = "gtk_check_button_set_active")]
1105    #[doc(alias = "active")]
1106    fn set_active(&self, setting: bool) {
1107        unsafe {
1108            ffi::gtk_check_button_set_active(self.as_ref().to_glib_none().0, setting.into_glib());
1109        }
1110    }
1111
1112    /// Sets the child widget of @self.
1113    ///
1114    /// Note that by using this API, you take full responsibility for setting
1115    /// up the proper accessibility label and description information for @self.
1116    /// Most likely, you'll either set the accessibility label or description
1117    /// for @self explicitly, or you'll set a labelled-by or described-by
1118    /// relations from @child to @self.
1119    /// ## `child`
1120    /// the child widget
1121    #[cfg(feature = "v4_8")]
1122    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1123    #[doc(alias = "gtk_check_button_set_child")]
1124    #[doc(alias = "child")]
1125    fn set_child(&self, child: Option<&impl IsA<Widget>>) {
1126        unsafe {
1127            ffi::gtk_check_button_set_child(
1128                self.as_ref().to_glib_none().0,
1129                child.map(|p| p.as_ref()).to_glib_none().0,
1130            );
1131        }
1132    }
1133
1134    /// Adds @self to the group of @group.
1135    ///
1136    /// In a group of multiple check buttons, only one button can be active
1137    /// at a time. The behavior of a checkbutton in a group is also commonly
1138    /// known as a *radio button*.
1139    ///
1140    /// Setting the group of a check button also changes the css name of the
1141    /// indicator widget's CSS node to 'radio'.
1142    ///
1143    /// Setting up groups in a cycle leads to undefined behavior.
1144    ///
1145    /// Note that the same effect can be achieved via the [`Actionable`][crate::Actionable]
1146    /// API, by using the same action with parameter type and state type 's'
1147    /// for all buttons in the group, and giving each button its own target
1148    /// value.
1149    /// ## `group`
1150    /// another [`CheckButton`][crate::CheckButton] to
1151    ///   form a group with
1152    #[doc(alias = "gtk_check_button_set_group")]
1153    #[doc(alias = "group")]
1154    fn set_group(&self, group: Option<&impl IsA<CheckButton>>) {
1155        unsafe {
1156            ffi::gtk_check_button_set_group(
1157                self.as_ref().to_glib_none().0,
1158                group.map(|p| p.as_ref()).to_glib_none().0,
1159            );
1160        }
1161    }
1162
1163    /// Sets the [`CheckButton`][crate::CheckButton] to inconsistent state.
1164    ///
1165    /// You should turn off the inconsistent state again if the user checks
1166    /// the check button. This has to be done manually.
1167    /// ## `inconsistent`
1168    /// [`true`] if state is inconsistent
1169    #[doc(alias = "gtk_check_button_set_inconsistent")]
1170    #[doc(alias = "inconsistent")]
1171    fn set_inconsistent(&self, inconsistent: bool) {
1172        unsafe {
1173            ffi::gtk_check_button_set_inconsistent(
1174                self.as_ref().to_glib_none().0,
1175                inconsistent.into_glib(),
1176            );
1177        }
1178    }
1179
1180    /// Sets the text of @self.
1181    ///
1182    /// If [`use-underline`][struct@crate::CheckButton#use-underline] is [`true`], an underscore
1183    /// in @label is interpreted as mnemonic indicator, see
1184    /// [`set_use_underline()`][Self::set_use_underline()] for details on this behavior.
1185    /// ## `label`
1186    /// The text shown next to the indicator, or [`None`]
1187    ///   to show no text
1188    #[doc(alias = "gtk_check_button_set_label")]
1189    #[doc(alias = "label")]
1190    fn set_label(&self, label: Option<&str>) {
1191        unsafe {
1192            ffi::gtk_check_button_set_label(self.as_ref().to_glib_none().0, label.to_glib_none().0);
1193        }
1194    }
1195
1196    /// Sets whether underlines in the label indicate mnemonics.
1197    ///
1198    /// If @setting is [`true`], an underscore character in @self's label
1199    /// indicates a mnemonic accelerator key. This behavior is similar
1200    /// to [`use-underline`][struct@crate::Label#use-underline].
1201    /// ## `setting`
1202    /// the new value to set
1203    #[doc(alias = "gtk_check_button_set_use_underline")]
1204    #[doc(alias = "use-underline")]
1205    fn set_use_underline(&self, setting: bool) {
1206        unsafe {
1207            ffi::gtk_check_button_set_use_underline(
1208                self.as_ref().to_glib_none().0,
1209                setting.into_glib(),
1210            );
1211        }
1212    }
1213
1214    ///  keys.
1215    #[cfg(feature = "v4_2")]
1216    #[cfg_attr(docsrs, doc(cfg(feature = "v4_2")))]
1217    #[doc(alias = "activate")]
1218    fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1219        unsafe extern "C" fn activate_trampoline<P: IsA<CheckButton>, F: Fn(&P) + 'static>(
1220            this: *mut ffi::GtkCheckButton,
1221            f: glib::ffi::gpointer,
1222        ) {
1223            unsafe {
1224                let f: &F = &*(f as *const F);
1225                f(CheckButton::from_glib_borrow(this).unsafe_cast_ref())
1226            }
1227        }
1228        unsafe {
1229            let f: Box_<F> = Box_::new(f);
1230            connect_raw(
1231                self.as_ptr() as *mut _,
1232                c"activate".as_ptr(),
1233                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1234                    activate_trampoline::<Self, F> as *const (),
1235                )),
1236                Box_::into_raw(f),
1237            )
1238        }
1239    }
1240
1241    #[cfg(feature = "v4_2")]
1242    #[cfg_attr(docsrs, doc(cfg(feature = "v4_2")))]
1243    fn emit_activate(&self) {
1244        self.emit_by_name::<()>("activate", &[]);
1245    }
1246
1247    /// Emitted when the buttons's [`active`][struct@crate::CheckButton#active]
1248    /// property changes.
1249    #[doc(alias = "toggled")]
1250    fn connect_toggled<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1251        unsafe extern "C" fn toggled_trampoline<P: IsA<CheckButton>, F: Fn(&P) + 'static>(
1252            this: *mut ffi::GtkCheckButton,
1253            f: glib::ffi::gpointer,
1254        ) {
1255            unsafe {
1256                let f: &F = &*(f as *const F);
1257                f(CheckButton::from_glib_borrow(this).unsafe_cast_ref())
1258            }
1259        }
1260        unsafe {
1261            let f: Box_<F> = Box_::new(f);
1262            connect_raw(
1263                self.as_ptr() as *mut _,
1264                c"toggled".as_ptr(),
1265                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1266                    toggled_trampoline::<Self, F> as *const (),
1267                )),
1268                Box_::into_raw(f),
1269            )
1270        }
1271    }
1272
1273    #[doc(alias = "active")]
1274    fn connect_active_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1275        unsafe extern "C" fn notify_active_trampoline<P: IsA<CheckButton>, F: Fn(&P) + 'static>(
1276            this: *mut ffi::GtkCheckButton,
1277            _param_spec: glib::ffi::gpointer,
1278            f: glib::ffi::gpointer,
1279        ) {
1280            unsafe {
1281                let f: &F = &*(f as *const F);
1282                f(CheckButton::from_glib_borrow(this).unsafe_cast_ref())
1283            }
1284        }
1285        unsafe {
1286            let f: Box_<F> = Box_::new(f);
1287            connect_raw(
1288                self.as_ptr() as *mut _,
1289                c"notify::active".as_ptr(),
1290                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1291                    notify_active_trampoline::<Self, F> as *const (),
1292                )),
1293                Box_::into_raw(f),
1294            )
1295        }
1296    }
1297
1298    #[cfg(feature = "v4_8")]
1299    #[cfg_attr(docsrs, doc(cfg(feature = "v4_8")))]
1300    #[doc(alias = "child")]
1301    fn connect_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1302        unsafe extern "C" fn notify_child_trampoline<P: IsA<CheckButton>, F: Fn(&P) + 'static>(
1303            this: *mut ffi::GtkCheckButton,
1304            _param_spec: glib::ffi::gpointer,
1305            f: glib::ffi::gpointer,
1306        ) {
1307            unsafe {
1308                let f: &F = &*(f as *const F);
1309                f(CheckButton::from_glib_borrow(this).unsafe_cast_ref())
1310            }
1311        }
1312        unsafe {
1313            let f: Box_<F> = Box_::new(f);
1314            connect_raw(
1315                self.as_ptr() as *mut _,
1316                c"notify::child".as_ptr(),
1317                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1318                    notify_child_trampoline::<Self, F> as *const (),
1319                )),
1320                Box_::into_raw(f),
1321            )
1322        }
1323    }
1324
1325    #[doc(alias = "group")]
1326    fn connect_group_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1327        unsafe extern "C" fn notify_group_trampoline<P: IsA<CheckButton>, F: Fn(&P) + 'static>(
1328            this: *mut ffi::GtkCheckButton,
1329            _param_spec: glib::ffi::gpointer,
1330            f: glib::ffi::gpointer,
1331        ) {
1332            unsafe {
1333                let f: &F = &*(f as *const F);
1334                f(CheckButton::from_glib_borrow(this).unsafe_cast_ref())
1335            }
1336        }
1337        unsafe {
1338            let f: Box_<F> = Box_::new(f);
1339            connect_raw(
1340                self.as_ptr() as *mut _,
1341                c"notify::group".as_ptr(),
1342                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1343                    notify_group_trampoline::<Self, F> as *const (),
1344                )),
1345                Box_::into_raw(f),
1346            )
1347        }
1348    }
1349
1350    #[doc(alias = "inconsistent")]
1351    fn connect_inconsistent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1352        unsafe extern "C" fn notify_inconsistent_trampoline<
1353            P: IsA<CheckButton>,
1354            F: Fn(&P) + 'static,
1355        >(
1356            this: *mut ffi::GtkCheckButton,
1357            _param_spec: glib::ffi::gpointer,
1358            f: glib::ffi::gpointer,
1359        ) {
1360            unsafe {
1361                let f: &F = &*(f as *const F);
1362                f(CheckButton::from_glib_borrow(this).unsafe_cast_ref())
1363            }
1364        }
1365        unsafe {
1366            let f: Box_<F> = Box_::new(f);
1367            connect_raw(
1368                self.as_ptr() as *mut _,
1369                c"notify::inconsistent".as_ptr(),
1370                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1371                    notify_inconsistent_trampoline::<Self, F> as *const (),
1372                )),
1373                Box_::into_raw(f),
1374            )
1375        }
1376    }
1377
1378    #[doc(alias = "label")]
1379    fn connect_label_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1380        unsafe extern "C" fn notify_label_trampoline<P: IsA<CheckButton>, F: Fn(&P) + 'static>(
1381            this: *mut ffi::GtkCheckButton,
1382            _param_spec: glib::ffi::gpointer,
1383            f: glib::ffi::gpointer,
1384        ) {
1385            unsafe {
1386                let f: &F = &*(f as *const F);
1387                f(CheckButton::from_glib_borrow(this).unsafe_cast_ref())
1388            }
1389        }
1390        unsafe {
1391            let f: Box_<F> = Box_::new(f);
1392            connect_raw(
1393                self.as_ptr() as *mut _,
1394                c"notify::label".as_ptr(),
1395                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1396                    notify_label_trampoline::<Self, F> as *const (),
1397                )),
1398                Box_::into_raw(f),
1399            )
1400        }
1401    }
1402
1403    #[doc(alias = "use-underline")]
1404    fn connect_use_underline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1405        unsafe extern "C" fn notify_use_underline_trampoline<
1406            P: IsA<CheckButton>,
1407            F: Fn(&P) + 'static,
1408        >(
1409            this: *mut ffi::GtkCheckButton,
1410            _param_spec: glib::ffi::gpointer,
1411            f: glib::ffi::gpointer,
1412        ) {
1413            unsafe {
1414                let f: &F = &*(f as *const F);
1415                f(CheckButton::from_glib_borrow(this).unsafe_cast_ref())
1416            }
1417        }
1418        unsafe {
1419            let f: Box_<F> = Box_::new(f);
1420            connect_raw(
1421                self.as_ptr() as *mut _,
1422                c"notify::use-underline".as_ptr(),
1423                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1424                    notify_use_underline_trampoline::<Self, F> as *const (),
1425                )),
1426                Box_::into_raw(f),
1427            )
1428        }
1429    }
1430}
1431
1432impl<O: IsA<CheckButton>> CheckButtonExt for O {}