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