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