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 /// The action that this activatable will activate and receive
371 /// updates from for various states and possibly appearance.
372 ///
373 /// > `GtkActivatable` implementors need to handle the this property and
374 /// > call `gtk_activatable_do_set_related_action()` when it changes.
375 ///
376 /// Readable | Writable
377 ///
378 ///
379 /// #### `use-action-appearance`
380 /// Whether this activatable should reset its layout
381 /// and appearance when setting the related action or when
382 /// the action changes appearance.
383 ///
384 /// See the `GtkAction` documentation directly to find which properties
385 /// should be ignored by the `GtkActivatable` when this property is [`false`].
386 ///
387 /// > `GtkActivatable` implementors need to handle this property
388 /// > and call `gtk_activatable_sync_action_properties()` on the activatable
389 /// > widget when it changes.
390 ///
391 /// Readable | Writable
392 /// </details>
393 /// <details><summary><h4>Actionable</h4></summary>
394 ///
395 ///
396 /// #### `action-name`
397 /// Readable | Writable
398 ///
399 ///
400 /// #### `action-target`
401 /// Readable | Writable
402 /// </details>
403 ///
404 /// # Implements
405 ///
406 /// [`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]
407 #[doc(alias = "GtkRadioToolButton")]
408 pub struct RadioToolButton(Object<ffi::GtkRadioToolButton, ffi::GtkRadioToolButtonClass>) @extends ToggleToolButton, ToolButton, ToolItem, Bin, Container, Widget, @implements Buildable, Actionable;
409
410 match fn {
411 type_ => || ffi::gtk_radio_tool_button_get_type(),
412 }
413}
414
415impl RadioToolButton {
416 pub const NONE: Option<&'static RadioToolButton> = None;
417
418 /// Creates a new [`RadioToolButton`][crate::RadioToolButton] adding it to the same group as `gruup`
419 /// ## `group`
420 /// An existing [`RadioToolButton`][crate::RadioToolButton], or [`None`]
421 ///
422 /// # Returns
423 ///
424 /// The new [`RadioToolButton`][crate::RadioToolButton]
425 #[doc(alias = "gtk_radio_tool_button_new_from_widget")]
426 #[doc(alias = "new_from_widget")]
427 pub fn from_widget(group: &impl IsA<RadioToolButton>) -> RadioToolButton {
428 skip_assert_initialized!();
429 unsafe {
430 ToolItem::from_glib_none(ffi::gtk_radio_tool_button_new_from_widget(
431 group.as_ref().to_glib_none().0,
432 ))
433 .unsafe_cast()
434 }
435 }
436
437 // rustdoc-stripper-ignore-next
438 /// Creates a new builder-pattern struct instance to construct [`RadioToolButton`] objects.
439 ///
440 /// This method returns an instance of [`RadioToolButtonBuilder`](crate::builders::RadioToolButtonBuilder) which can be used to create [`RadioToolButton`] objects.
441 pub fn builder() -> RadioToolButtonBuilder {
442 RadioToolButtonBuilder::new()
443 }
444}
445
446// rustdoc-stripper-ignore-next
447/// A [builder-pattern] type to construct [`RadioToolButton`] objects.
448///
449/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
450#[must_use = "The builder must be built to be used"]
451pub struct RadioToolButtonBuilder {
452 builder: glib::object::ObjectBuilder<'static, RadioToolButton>,
453}
454
455impl RadioToolButtonBuilder {
456 fn new() -> Self {
457 Self {
458 builder: glib::object::Object::builder(),
459 }
460 }
461
462 /// If the toggle tool button should be pressed in.
463 pub fn active(self, active: bool) -> Self {
464 Self {
465 builder: self.builder.property("active", active),
466 }
467 }
468
469 /// The name of the themed icon displayed on the item.
470 /// This property only has an effect if not overridden by
471 /// [`label-widget`][struct@crate::ToolButton#label-widget], [`icon-widget`][struct@crate::ToolButton#icon-widget] or
472 /// [`stock-id`][struct@crate::ToolButton#stock-id] properties.
473 pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
474 Self {
475 builder: self.builder.property("icon-name", icon_name.into()),
476 }
477 }
478
479 pub fn icon_widget(self, icon_widget: &impl IsA<Widget>) -> Self {
480 Self {
481 builder: self
482 .builder
483 .property("icon-widget", icon_widget.clone().upcast()),
484 }
485 }
486
487 pub fn label(self, label: impl Into<glib::GString>) -> Self {
488 Self {
489 builder: self.builder.property("label", label.into()),
490 }
491 }
492
493 pub fn label_widget(self, label_widget: &impl IsA<Widget>) -> Self {
494 Self {
495 builder: self
496 .builder
497 .property("label-widget", label_widget.clone().upcast()),
498 }
499 }
500
501 pub fn use_underline(self, use_underline: bool) -> Self {
502 Self {
503 builder: self.builder.property("use-underline", use_underline),
504 }
505 }
506
507 pub fn is_important(self, is_important: bool) -> Self {
508 Self {
509 builder: self.builder.property("is-important", is_important),
510 }
511 }
512
513 pub fn visible_horizontal(self, visible_horizontal: bool) -> Self {
514 Self {
515 builder: self
516 .builder
517 .property("visible-horizontal", visible_horizontal),
518 }
519 }
520
521 pub fn visible_vertical(self, visible_vertical: bool) -> Self {
522 Self {
523 builder: self.builder.property("visible-vertical", visible_vertical),
524 }
525 }
526
527 pub fn border_width(self, border_width: u32) -> Self {
528 Self {
529 builder: self.builder.property("border-width", border_width),
530 }
531 }
532
533 pub fn child(self, child: &impl IsA<Widget>) -> Self {
534 Self {
535 builder: self.builder.property("child", child.clone().upcast()),
536 }
537 }
538
539 pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
540 Self {
541 builder: self.builder.property("resize-mode", resize_mode),
542 }
543 }
544
545 pub fn app_paintable(self, app_paintable: bool) -> Self {
546 Self {
547 builder: self.builder.property("app-paintable", app_paintable),
548 }
549 }
550
551 pub fn can_default(self, can_default: bool) -> Self {
552 Self {
553 builder: self.builder.property("can-default", can_default),
554 }
555 }
556
557 pub fn can_focus(self, can_focus: bool) -> Self {
558 Self {
559 builder: self.builder.property("can-focus", can_focus),
560 }
561 }
562
563 pub fn events(self, events: gdk::EventMask) -> Self {
564 Self {
565 builder: self.builder.property("events", events),
566 }
567 }
568
569 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
570 pub fn expand(self, expand: bool) -> Self {
571 Self {
572 builder: self.builder.property("expand", expand),
573 }
574 }
575
576 /// Whether the widget should grab focus when it is clicked with the mouse.
577 ///
578 /// This property is only relevant for widgets that can take focus.
579 ///
580 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
581 /// GtkComboBox) implemented this property individually.
582 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
583 Self {
584 builder: self.builder.property("focus-on-click", focus_on_click),
585 }
586 }
587
588 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
589 pub fn halign(self, halign: Align) -> Self {
590 Self {
591 builder: self.builder.property("halign", halign),
592 }
593 }
594
595 pub fn has_default(self, has_default: bool) -> Self {
596 Self {
597 builder: self.builder.property("has-default", has_default),
598 }
599 }
600
601 pub fn has_focus(self, has_focus: bool) -> Self {
602 Self {
603 builder: self.builder.property("has-focus", has_focus),
604 }
605 }
606
607 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
608 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
609 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
610 /// whether it will provide a tooltip or not.
611 ///
612 /// Note that setting this property to [`true`] for the first time will change
613 /// the event masks of the GdkWindows of this widget to include leave-notify
614 /// and motion-notify events. This cannot and will not be undone when the
615 /// property is set to [`false`] again.
616 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
617 Self {
618 builder: self.builder.property("has-tooltip", has_tooltip),
619 }
620 }
621
622 pub fn height_request(self, height_request: i32) -> Self {
623 Self {
624 builder: self.builder.property("height-request", height_request),
625 }
626 }
627
628 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
629 pub fn hexpand(self, hexpand: bool) -> Self {
630 Self {
631 builder: self.builder.property("hexpand", hexpand),
632 }
633 }
634
635 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
636 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
637 Self {
638 builder: self.builder.property("hexpand-set", hexpand_set),
639 }
640 }
641
642 pub fn is_focus(self, is_focus: bool) -> Self {
643 Self {
644 builder: self.builder.property("is-focus", is_focus),
645 }
646 }
647
648 /// Sets all four sides' margin at once. If read, returns max
649 /// margin on any side.
650 pub fn margin(self, margin: i32) -> Self {
651 Self {
652 builder: self.builder.property("margin", margin),
653 }
654 }
655
656 /// Margin on bottom side of widget.
657 ///
658 /// This property adds margin outside of the widget's normal size
659 /// request, the margin will be added in addition to the size from
660 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
661 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
662 Self {
663 builder: self.builder.property("margin-bottom", margin_bottom),
664 }
665 }
666
667 /// Margin on end of widget, horizontally. This property supports
668 /// left-to-right and right-to-left text directions.
669 ///
670 /// This property adds margin outside of the widget's normal size
671 /// request, the margin will be added in addition to the size from
672 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
673 pub fn margin_end(self, margin_end: i32) -> Self {
674 Self {
675 builder: self.builder.property("margin-end", margin_end),
676 }
677 }
678
679 /// Margin on start of widget, horizontally. This property supports
680 /// left-to-right and right-to-left text directions.
681 ///
682 /// This property adds margin outside of the widget's normal size
683 /// request, the margin will be added in addition to the size from
684 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
685 pub fn margin_start(self, margin_start: i32) -> Self {
686 Self {
687 builder: self.builder.property("margin-start", margin_start),
688 }
689 }
690
691 /// Margin on top side of widget.
692 ///
693 /// This property adds margin outside of the widget's normal size
694 /// request, the margin will be added in addition to the size from
695 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
696 pub fn margin_top(self, margin_top: i32) -> Self {
697 Self {
698 builder: self.builder.property("margin-top", margin_top),
699 }
700 }
701
702 pub fn name(self, name: impl Into<glib::GString>) -> Self {
703 Self {
704 builder: self.builder.property("name", name.into()),
705 }
706 }
707
708 pub fn no_show_all(self, no_show_all: bool) -> Self {
709 Self {
710 builder: self.builder.property("no-show-all", no_show_all),
711 }
712 }
713
714 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
715 /// more details about window opacity.
716 ///
717 /// Before 3.8 this was only available in GtkWindow
718 pub fn opacity(self, opacity: f64) -> Self {
719 Self {
720 builder: self.builder.property("opacity", opacity),
721 }
722 }
723
724 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
725 Self {
726 builder: self.builder.property("parent", parent.clone().upcast()),
727 }
728 }
729
730 pub fn receives_default(self, receives_default: bool) -> Self {
731 Self {
732 builder: self.builder.property("receives-default", receives_default),
733 }
734 }
735
736 pub fn sensitive(self, sensitive: bool) -> Self {
737 Self {
738 builder: self.builder.property("sensitive", sensitive),
739 }
740 }
741
742 /// Sets the text of tooltip to be the given string, which is marked up
743 /// with the [Pango text markup language][PangoMarkupFormat].
744 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
745 ///
746 /// This is a convenience property which will take care of getting the
747 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
748 /// will automatically be set to [`true`] and there will be taken care of
749 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
750 ///
751 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
752 /// are set, the last one wins.
753 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
754 Self {
755 builder: self
756 .builder
757 .property("tooltip-markup", tooltip_markup.into()),
758 }
759 }
760
761 /// Sets the text of tooltip to be the given string.
762 ///
763 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
764 ///
765 /// This is a convenience property which will take care of getting the
766 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
767 /// will automatically be set to [`true`] and there will be taken care of
768 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
769 ///
770 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
771 /// are set, the last one wins.
772 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
773 Self {
774 builder: self.builder.property("tooltip-text", tooltip_text.into()),
775 }
776 }
777
778 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
779 pub fn valign(self, valign: Align) -> Self {
780 Self {
781 builder: self.builder.property("valign", valign),
782 }
783 }
784
785 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
786 pub fn vexpand(self, vexpand: bool) -> Self {
787 Self {
788 builder: self.builder.property("vexpand", vexpand),
789 }
790 }
791
792 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
793 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
794 Self {
795 builder: self.builder.property("vexpand-set", vexpand_set),
796 }
797 }
798
799 pub fn visible(self, visible: bool) -> Self {
800 Self {
801 builder: self.builder.property("visible", visible),
802 }
803 }
804
805 pub fn width_request(self, width_request: i32) -> Self {
806 Self {
807 builder: self.builder.property("width-request", width_request),
808 }
809 }
810
811 pub fn action_name(self, action_name: impl Into<glib::GString>) -> Self {
812 Self {
813 builder: self.builder.property("action-name", action_name.into()),
814 }
815 }
816
817 pub fn action_target(self, action_target: &glib::Variant) -> Self {
818 Self {
819 builder: self
820 .builder
821 .property("action-target", action_target.clone()),
822 }
823 }
824
825 // rustdoc-stripper-ignore-next
826 /// Build the [`RadioToolButton`].
827 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
828 pub fn build(self) -> RadioToolButton {
829 assert_initialized_main_thread!();
830 self.builder.build()
831 }
832}
833
834/// Trait containing all [`struct@RadioToolButton`] methods.
835///
836/// # Implementors
837///
838/// [`RadioToolButton`][struct@crate::RadioToolButton]
839pub trait RadioToolButtonExt: IsA<RadioToolButton> + 'static {
840 /// Returns the radio button group `self` belongs to.
841 ///
842 /// # Returns
843 ///
844 /// The group `self` belongs to.
845 #[doc(alias = "gtk_radio_tool_button_get_group")]
846 #[doc(alias = "get_group")]
847 fn group(&self) -> Vec<RadioButton> {
848 unsafe {
849 FromGlibPtrContainer::from_glib_none(ffi::gtk_radio_tool_button_get_group(
850 self.as_ref().to_glib_none().0,
851 ))
852 }
853 }
854}
855
856impl<O: IsA<RadioToolButton>> RadioToolButtonExt for O {}