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