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