gtk/auto/radio_tool_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 Actionable, Align, Bin, Buildable, Container, RadioButton, ResizeMode, ToggleToolButton,
7 ToolButton, ToolItem, Widget, ffi,
8};
9use glib::{prelude::*, translate::*};
10
11glib::wrapper! {
12 /// A [`RadioToolButton`][crate::RadioToolButton] is a [`ToolItem`][crate::ToolItem] that contains a radio button,
13 /// that is, a button that is part of a group of toggle buttons where only
14 /// one button can be active at a time.
15 ///
16 /// Use [`new()`][Self::new()] to create a new GtkRadioToolButton. Use
17 /// [`from_widget()`][Self::from_widget()] to create a new GtkRadioToolButton
18 /// that is part of the same group as an existing GtkRadioToolButton.
19 ///
20 /// # CSS nodes
21 ///
22 /// GtkRadioToolButton has a single CSS node with name toolbutton.
23 ///
24 /// ## Properties
25 ///
26 ///
27 /// #### `group`
28 /// Sets a new group for a radio tool button.
29 ///
30 /// Writable
31 /// <details><summary><h4>ToggleToolButton</h4></summary>
32 ///
33 ///
34 /// #### `active`
35 /// If the toggle tool button should be pressed in.
36 ///
37 /// Readable | Writable
38 /// </details>
39 /// <details><summary><h4>ToolButton</h4></summary>
40 ///
41 ///
42 /// #### `icon-name`
43 /// The name of the themed icon displayed on the item.
44 /// This property only has an effect if not overridden by
45 /// [`label-widget`][struct@crate::ToolButton#label-widget], [`icon-widget`][struct@crate::ToolButton#icon-widget] or
46 /// [`stock-id`][struct@crate::ToolButton#stock-id] properties.
47 ///
48 /// Readable | Writable
49 ///
50 ///
51 /// #### `icon-widget`
52 /// Readable | Writable
53 ///
54 ///
55 /// #### `label`
56 /// Readable | Writable
57 ///
58 ///
59 /// #### `label-widget`
60 /// Readable | Writable
61 ///
62 ///
63 /// #### `stock-id`
64 /// Readable | Writable
65 ///
66 ///
67 /// #### `use-underline`
68 /// Readable | Writable
69 /// </details>
70 /// <details><summary><h4>ToolItem</h4></summary>
71 ///
72 ///
73 /// #### `is-important`
74 /// Readable | Writable
75 ///
76 ///
77 /// #### `visible-horizontal`
78 /// Readable | Writable
79 ///
80 ///
81 /// #### `visible-vertical`
82 /// Readable | Writable
83 /// </details>
84 /// <details><summary><h4>Container</h4></summary>
85 ///
86 ///
87 /// #### `border-width`
88 /// Readable | Writable
89 ///
90 ///
91 /// #### `child`
92 /// Writable
93 ///
94 ///
95 /// #### `resize-mode`
96 /// Readable | Writable
97 /// </details>
98 /// <details><summary><h4>Widget</h4></summary>
99 ///
100 ///
101 /// #### `app-paintable`
102 /// Readable | Writable
103 ///
104 ///
105 /// #### `can-default`
106 /// Readable | Writable
107 ///
108 ///
109 /// #### `can-focus`
110 /// Readable | Writable
111 ///
112 ///
113 /// #### `composite-child`
114 /// Readable
115 ///
116 ///
117 /// #### `double-buffered`
118 /// Whether the widget is double buffered.
119 ///
120 /// Readable | Writable
121 ///
122 ///
123 /// #### `events`
124 /// Readable | Writable
125 ///
126 ///
127 /// #### `expand`
128 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
129 ///
130 /// Readable | Writable
131 ///
132 ///
133 /// #### `focus-on-click`
134 /// Whether the widget should grab focus when it is clicked with the mouse.
135 ///
136 /// This property is only relevant for widgets that can take focus.
137 ///
138 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
139 /// GtkComboBox) implemented this property individually.
140 ///
141 /// Readable | Writable
142 ///
143 ///
144 /// #### `halign`
145 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
146 ///
147 /// Readable | Writable
148 ///
149 ///
150 /// #### `has-default`
151 /// Readable | Writable
152 ///
153 ///
154 /// #### `has-focus`
155 /// Readable | Writable
156 ///
157 ///
158 /// #### `has-tooltip`
159 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
160 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
161 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
162 /// whether it will provide a tooltip or not.
163 ///
164 /// Note that setting this property to [`true`] for the first time will change
165 /// the event masks of the GdkWindows of this widget to include leave-notify
166 /// and motion-notify events. This cannot and will not be undone when the
167 /// property is set to [`false`] again.
168 ///
169 /// Readable | Writable
170 ///
171 ///
172 /// #### `height-request`
173 /// Readable | Writable
174 ///
175 ///
176 /// #### `hexpand`
177 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
178 ///
179 /// Readable | Writable
180 ///
181 ///
182 /// #### `hexpand-set`
183 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
184 ///
185 /// Readable | Writable
186 ///
187 ///
188 /// #### `is-focus`
189 /// Readable | Writable
190 ///
191 ///
192 /// #### `margin`
193 /// Sets all four sides' margin at once. If read, returns max
194 /// margin on any side.
195 ///
196 /// Readable | Writable
197 ///
198 ///
199 /// #### `margin-bottom`
200 /// Margin on bottom side of widget.
201 ///
202 /// This property adds margin outside of the widget's normal size
203 /// request, the margin will be added in addition to the size from
204 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
205 ///
206 /// Readable | Writable
207 ///
208 ///
209 /// #### `margin-end`
210 /// Margin on end of widget, horizontally. This property supports
211 /// left-to-right and right-to-left text directions.
212 ///
213 /// This property adds margin outside of the widget's normal size
214 /// request, the margin will be added in addition to the size from
215 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
216 ///
217 /// Readable | Writable
218 ///
219 ///
220 /// #### `margin-left`
221 /// Margin on left side of widget.
222 ///
223 /// This property adds margin outside of the widget's normal size
224 /// request, the margin will be added in addition to the size from
225 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
226 ///
227 /// Readable | Writable
228 ///
229 ///
230 /// #### `margin-right`
231 /// Margin on right side of widget.
232 ///
233 /// This property adds margin outside of the widget's normal size
234 /// request, the margin will be added in addition to the size from
235 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
236 ///
237 /// Readable | Writable
238 ///
239 ///
240 /// #### `margin-start`
241 /// Margin on start of widget, horizontally. This property supports
242 /// left-to-right and right-to-left text directions.
243 ///
244 /// This property adds margin outside of the widget's normal size
245 /// request, the margin will be added in addition to the size from
246 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
247 ///
248 /// Readable | Writable
249 ///
250 ///
251 /// #### `margin-top`
252 /// Margin on top side of widget.
253 ///
254 /// This property adds margin outside of the widget's normal size
255 /// request, the margin will be added in addition to the size from
256 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
257 ///
258 /// Readable | Writable
259 ///
260 ///
261 /// #### `name`
262 /// Readable | Writable
263 ///
264 ///
265 /// #### `no-show-all`
266 /// Readable | Writable
267 ///
268 ///
269 /// #### `opacity`
270 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
271 /// more details about window opacity.
272 ///
273 /// Before 3.8 this was only available in GtkWindow
274 ///
275 /// Readable | Writable
276 ///
277 ///
278 /// #### `parent`
279 /// Readable | Writable
280 ///
281 ///
282 /// #### `receives-default`
283 /// Readable | Writable
284 ///
285 ///
286 /// #### `scale-factor`
287 /// The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
288 /// more details about widget scaling.
289 ///
290 /// Readable
291 ///
292 ///
293 /// #### `sensitive`
294 /// Readable | Writable
295 ///
296 ///
297 /// #### `style`
298 /// The style of the widget, which contains information about how it will look (colors, etc).
299 ///
300 /// Readable | Writable
301 ///
302 ///
303 /// #### `tooltip-markup`
304 /// Sets the text of tooltip to be the given string, which is marked up
305 /// with the [Pango text markup language][PangoMarkupFormat].
306 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
307 ///
308 /// This is a convenience property which will take care of getting the
309 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
310 /// will automatically be set to [`true`] and there will be taken care of
311 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
312 ///
313 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
314 /// are set, the last one wins.
315 ///
316 /// Readable | Writable
317 ///
318 ///
319 /// #### `tooltip-text`
320 /// Sets the text of tooltip to be the given string.
321 ///
322 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
323 ///
324 /// This is a convenience property which will take care of getting the
325 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
326 /// will automatically be set to [`true`] and there will be taken care of
327 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
328 ///
329 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
330 /// are set, the last one wins.
331 ///
332 /// Readable | Writable
333 ///
334 ///
335 /// #### `valign`
336 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
337 ///
338 /// Readable | Writable
339 ///
340 ///
341 /// #### `vexpand`
342 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
343 ///
344 /// Readable | Writable
345 ///
346 ///
347 /// #### `vexpand-set`
348 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
349 ///
350 /// Readable | Writable
351 ///
352 ///
353 /// #### `visible`
354 /// Readable | Writable
355 ///
356 ///
357 /// #### `width-request`
358 /// Readable | Writable
359 ///
360 ///
361 /// #### `window`
362 /// The widget's window if it is realized, [`None`] otherwise.
363 ///
364 /// Readable
365 /// </details>
366 /// <details><summary><h4>Activatable</h4></summary>
367 ///
368 ///
369 /// #### `related-action`
370 /// call `gtk_activatable_do_set_related_action()` when it changes.
371 ///
372 /// Readable | Writable
373 ///
374 ///
375 /// #### `use-action-appearance`
376 /// widget when it changes.
377 ///
378 /// Readable | Writable
379 /// </details>
380 /// <details><summary><h4>Actionable</h4></summary>
381 ///
382 ///
383 /// #### `action-name`
384 /// Readable | Writable
385 ///
386 ///
387 /// #### `action-target`
388 /// Readable | Writable
389 /// </details>
390 ///
391 /// # Implements
392 ///
393 /// [`RadioToolButtonExt`][trait@crate::prelude::RadioToolButtonExt], [`ToggleToolButtonExt`][trait@crate::prelude::ToggleToolButtonExt], [`ToolButtonExt`][trait@crate::prelude::ToolButtonExt], [`ToolItemExt`][trait@crate::prelude::ToolItemExt], [`BinExt`][trait@crate::prelude::BinExt], [`ContainerExt`][trait@crate::prelude::ContainerExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ActionableExt`][trait@crate::prelude::ActionableExt], [`ContainerExtManual`][trait@crate::prelude::ContainerExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
394 #[doc(alias = "GtkRadioToolButton")]
395 pub struct RadioToolButton(Object<ffi::GtkRadioToolButton, ffi::GtkRadioToolButtonClass>) @extends ToggleToolButton, ToolButton, ToolItem, Bin, Container, Widget, @implements Buildable, Actionable;
396
397 match fn {
398 type_ => || ffi::gtk_radio_tool_button_get_type(),
399 }
400}
401
402impl RadioToolButton {
403 pub const NONE: Option<&'static RadioToolButton> = None;
404
405 /// Creates a new [`RadioToolButton`][crate::RadioToolButton] adding it to the same group as `gruup`
406 /// ## `group`
407 /// An existing [`RadioToolButton`][crate::RadioToolButton], or [`None`]
408 ///
409 /// # Returns
410 ///
411 /// The new [`RadioToolButton`][crate::RadioToolButton]
412 #[doc(alias = "gtk_radio_tool_button_new_from_widget")]
413 #[doc(alias = "new_from_widget")]
414 pub fn from_widget(group: &impl IsA<RadioToolButton>) -> RadioToolButton {
415 skip_assert_initialized!();
416 unsafe {
417 ToolItem::from_glib_none(ffi::gtk_radio_tool_button_new_from_widget(
418 group.as_ref().to_glib_none().0,
419 ))
420 .unsafe_cast()
421 }
422 }
423
424 // rustdoc-stripper-ignore-next
425 /// Creates a new builder-pattern struct instance to construct [`RadioToolButton`] objects.
426 ///
427 /// This method returns an instance of [`RadioToolButtonBuilder`](crate::builders::RadioToolButtonBuilder) which can be used to create [`RadioToolButton`] objects.
428 pub fn builder() -> RadioToolButtonBuilder {
429 RadioToolButtonBuilder::new()
430 }
431}
432
433// rustdoc-stripper-ignore-next
434/// A [builder-pattern] type to construct [`RadioToolButton`] objects.
435///
436/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
437#[must_use = "The builder must be built to be used"]
438pub struct RadioToolButtonBuilder {
439 builder: glib::object::ObjectBuilder<'static, RadioToolButton>,
440}
441
442impl RadioToolButtonBuilder {
443 fn new() -> Self {
444 Self {
445 builder: glib::object::Object::builder(),
446 }
447 }
448
449 /// If the toggle tool button should be pressed in.
450 pub fn active(self, active: bool) -> Self {
451 Self {
452 builder: self.builder.property("active", active),
453 }
454 }
455
456 /// The name of the themed icon displayed on the item.
457 /// This property only has an effect if not overridden by
458 /// [`label-widget`][struct@crate::ToolButton#label-widget], [`icon-widget`][struct@crate::ToolButton#icon-widget] or
459 /// [`stock-id`][struct@crate::ToolButton#stock-id] properties.
460 pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
461 Self {
462 builder: self.builder.property("icon-name", icon_name.into()),
463 }
464 }
465
466 pub fn icon_widget(self, icon_widget: &impl IsA<Widget>) -> Self {
467 Self {
468 builder: self
469 .builder
470 .property("icon-widget", icon_widget.clone().upcast()),
471 }
472 }
473
474 pub fn label(self, label: impl Into<glib::GString>) -> Self {
475 Self {
476 builder: self.builder.property("label", label.into()),
477 }
478 }
479
480 pub fn label_widget(self, label_widget: &impl IsA<Widget>) -> Self {
481 Self {
482 builder: self
483 .builder
484 .property("label-widget", label_widget.clone().upcast()),
485 }
486 }
487
488 pub fn use_underline(self, use_underline: bool) -> Self {
489 Self {
490 builder: self.builder.property("use-underline", use_underline),
491 }
492 }
493
494 pub fn is_important(self, is_important: bool) -> Self {
495 Self {
496 builder: self.builder.property("is-important", is_important),
497 }
498 }
499
500 pub fn visible_horizontal(self, visible_horizontal: bool) -> Self {
501 Self {
502 builder: self
503 .builder
504 .property("visible-horizontal", visible_horizontal),
505 }
506 }
507
508 pub fn visible_vertical(self, visible_vertical: bool) -> Self {
509 Self {
510 builder: self.builder.property("visible-vertical", visible_vertical),
511 }
512 }
513
514 pub fn border_width(self, border_width: u32) -> Self {
515 Self {
516 builder: self.builder.property("border-width", border_width),
517 }
518 }
519
520 pub fn child(self, child: &impl IsA<Widget>) -> Self {
521 Self {
522 builder: self.builder.property("child", child.clone().upcast()),
523 }
524 }
525
526 pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
527 Self {
528 builder: self.builder.property("resize-mode", resize_mode),
529 }
530 }
531
532 pub fn app_paintable(self, app_paintable: bool) -> Self {
533 Self {
534 builder: self.builder.property("app-paintable", app_paintable),
535 }
536 }
537
538 pub fn can_default(self, can_default: bool) -> Self {
539 Self {
540 builder: self.builder.property("can-default", can_default),
541 }
542 }
543
544 pub fn can_focus(self, can_focus: bool) -> Self {
545 Self {
546 builder: self.builder.property("can-focus", can_focus),
547 }
548 }
549
550 pub fn events(self, events: gdk::EventMask) -> Self {
551 Self {
552 builder: self.builder.property("events", events),
553 }
554 }
555
556 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
557 pub fn expand(self, expand: bool) -> Self {
558 Self {
559 builder: self.builder.property("expand", expand),
560 }
561 }
562
563 /// Whether the widget should grab focus when it is clicked with the mouse.
564 ///
565 /// This property is only relevant for widgets that can take focus.
566 ///
567 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
568 /// GtkComboBox) implemented this property individually.
569 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
570 Self {
571 builder: self.builder.property("focus-on-click", focus_on_click),
572 }
573 }
574
575 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
576 pub fn halign(self, halign: Align) -> Self {
577 Self {
578 builder: self.builder.property("halign", halign),
579 }
580 }
581
582 pub fn has_default(self, has_default: bool) -> Self {
583 Self {
584 builder: self.builder.property("has-default", has_default),
585 }
586 }
587
588 pub fn has_focus(self, has_focus: bool) -> Self {
589 Self {
590 builder: self.builder.property("has-focus", has_focus),
591 }
592 }
593
594 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
595 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
596 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
597 /// whether it will provide a tooltip or not.
598 ///
599 /// Note that setting this property to [`true`] for the first time will change
600 /// the event masks of the GdkWindows of this widget to include leave-notify
601 /// and motion-notify events. This cannot and will not be undone when the
602 /// property is set to [`false`] again.
603 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
604 Self {
605 builder: self.builder.property("has-tooltip", has_tooltip),
606 }
607 }
608
609 pub fn height_request(self, height_request: i32) -> Self {
610 Self {
611 builder: self.builder.property("height-request", height_request),
612 }
613 }
614
615 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
616 pub fn hexpand(self, hexpand: bool) -> Self {
617 Self {
618 builder: self.builder.property("hexpand", hexpand),
619 }
620 }
621
622 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
623 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
624 Self {
625 builder: self.builder.property("hexpand-set", hexpand_set),
626 }
627 }
628
629 pub fn is_focus(self, is_focus: bool) -> Self {
630 Self {
631 builder: self.builder.property("is-focus", is_focus),
632 }
633 }
634
635 /// Sets all four sides' margin at once. If read, returns max
636 /// margin on any side.
637 pub fn margin(self, margin: i32) -> Self {
638 Self {
639 builder: self.builder.property("margin", margin),
640 }
641 }
642
643 /// Margin on bottom side of widget.
644 ///
645 /// This property adds margin outside of the widget's normal size
646 /// request, the margin will be added in addition to the size from
647 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
648 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
649 Self {
650 builder: self.builder.property("margin-bottom", margin_bottom),
651 }
652 }
653
654 /// Margin on end of widget, horizontally. This property supports
655 /// left-to-right and right-to-left text directions.
656 ///
657 /// This property adds margin outside of the widget's normal size
658 /// request, the margin will be added in addition to the size from
659 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
660 pub fn margin_end(self, margin_end: i32) -> Self {
661 Self {
662 builder: self.builder.property("margin-end", margin_end),
663 }
664 }
665
666 /// Margin on start of widget, horizontally. This property supports
667 /// left-to-right and right-to-left text directions.
668 ///
669 /// This property adds margin outside of the widget's normal size
670 /// request, the margin will be added in addition to the size from
671 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
672 pub fn margin_start(self, margin_start: i32) -> Self {
673 Self {
674 builder: self.builder.property("margin-start", margin_start),
675 }
676 }
677
678 /// Margin on top side of widget.
679 ///
680 /// This property adds margin outside of the widget's normal size
681 /// request, the margin will be added in addition to the size from
682 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
683 pub fn margin_top(self, margin_top: i32) -> Self {
684 Self {
685 builder: self.builder.property("margin-top", margin_top),
686 }
687 }
688
689 pub fn name(self, name: impl Into<glib::GString>) -> Self {
690 Self {
691 builder: self.builder.property("name", name.into()),
692 }
693 }
694
695 pub fn no_show_all(self, no_show_all: bool) -> Self {
696 Self {
697 builder: self.builder.property("no-show-all", no_show_all),
698 }
699 }
700
701 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
702 /// more details about window opacity.
703 ///
704 /// Before 3.8 this was only available in GtkWindow
705 pub fn opacity(self, opacity: f64) -> Self {
706 Self {
707 builder: self.builder.property("opacity", opacity),
708 }
709 }
710
711 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
712 Self {
713 builder: self.builder.property("parent", parent.clone().upcast()),
714 }
715 }
716
717 pub fn receives_default(self, receives_default: bool) -> Self {
718 Self {
719 builder: self.builder.property("receives-default", receives_default),
720 }
721 }
722
723 pub fn sensitive(self, sensitive: bool) -> Self {
724 Self {
725 builder: self.builder.property("sensitive", sensitive),
726 }
727 }
728
729 /// Sets the text of tooltip to be the given string, which is marked up
730 /// with the [Pango text markup language][PangoMarkupFormat].
731 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
732 ///
733 /// This is a convenience property which will take care of getting the
734 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
735 /// will automatically be set to [`true`] and there will be taken care of
736 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
737 ///
738 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
739 /// are set, the last one wins.
740 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
741 Self {
742 builder: self
743 .builder
744 .property("tooltip-markup", tooltip_markup.into()),
745 }
746 }
747
748 /// Sets the text of tooltip to be the given string.
749 ///
750 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
751 ///
752 /// This is a convenience property which will take care of getting the
753 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
754 /// will automatically be set to [`true`] and there will be taken care of
755 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
756 ///
757 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
758 /// are set, the last one wins.
759 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
760 Self {
761 builder: self.builder.property("tooltip-text", tooltip_text.into()),
762 }
763 }
764
765 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
766 pub fn valign(self, valign: Align) -> Self {
767 Self {
768 builder: self.builder.property("valign", valign),
769 }
770 }
771
772 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
773 pub fn vexpand(self, vexpand: bool) -> Self {
774 Self {
775 builder: self.builder.property("vexpand", vexpand),
776 }
777 }
778
779 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
780 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
781 Self {
782 builder: self.builder.property("vexpand-set", vexpand_set),
783 }
784 }
785
786 pub fn visible(self, visible: bool) -> Self {
787 Self {
788 builder: self.builder.property("visible", visible),
789 }
790 }
791
792 pub fn width_request(self, width_request: i32) -> Self {
793 Self {
794 builder: self.builder.property("width-request", width_request),
795 }
796 }
797
798 pub fn action_name(self, action_name: impl Into<glib::GString>) -> Self {
799 Self {
800 builder: self.builder.property("action-name", action_name.into()),
801 }
802 }
803
804 pub fn action_target(self, action_target: &glib::Variant) -> Self {
805 Self {
806 builder: self
807 .builder
808 .property("action-target", action_target.clone()),
809 }
810 }
811
812 // rustdoc-stripper-ignore-next
813 /// Build the [`RadioToolButton`].
814 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
815 pub fn build(self) -> RadioToolButton {
816 assert_initialized_main_thread!();
817 self.builder.build()
818 }
819}
820
821/// Trait containing all [`struct@RadioToolButton`] methods.
822///
823/// # Implementors
824///
825/// [`RadioToolButton`][struct@crate::RadioToolButton]
826pub trait RadioToolButtonExt: IsA<RadioToolButton> + 'static {
827 /// Returns the radio button group `self` belongs to.
828 ///
829 /// # Returns
830 ///
831 /// The group `self` belongs to.
832 #[doc(alias = "gtk_radio_tool_button_get_group")]
833 #[doc(alias = "get_group")]
834 fn group(&self) -> Vec<RadioButton> {
835 unsafe {
836 FromGlibPtrContainer::from_glib_none(ffi::gtk_radio_tool_button_get_group(
837 self.as_ref().to_glib_none().0,
838 ))
839 }
840 }
841}
842
843impl<O: IsA<RadioToolButton>> RadioToolButtonExt for O {}