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