1 // This file was generated by gir (https://github.com/gtk-rs/gir)
2 // from gir-files (https://github.com/gtk-rs/gir-files)
3 // DO NOT EDIT
4 
5 use crate::Actionable;
6 use crate::Align;
7 use crate::Bin;
8 use crate::Buildable;
9 use crate::Container;
10 use crate::RadioButton;
11 use crate::ResizeMode;
12 use crate::ToggleToolButton;
13 use crate::ToolButton;
14 use crate::ToolItem;
15 use crate::Widget;
16 use glib::object::Cast;
17 use glib::object::IsA;
18 use glib::translate::*;
19 use glib::StaticType;
20 use glib::ToValue;
21 use std::fmt;
22 
23 glib::wrapper! {
24     #[doc(alias = "GtkRadioToolButton")]
25     pub struct RadioToolButton(Object<ffi::GtkRadioToolButton, ffi::GtkRadioToolButtonClass>) @extends ToggleToolButton, ToolButton, ToolItem, Bin, Container, Widget, @implements Buildable, Actionable;
26 
27     match fn {
28         type_ => || ffi::gtk_radio_tool_button_get_type(),
29     }
30 }
31 
32 impl RadioToolButton {
33     #[doc(alias = "gtk_radio_tool_button_new_from_widget")]
34     #[doc(alias = "new_from_widget")]
from_widget<P: IsA<RadioToolButton>>(group: &P) -> RadioToolButton35     pub fn from_widget<P: IsA<RadioToolButton>>(group: &P) -> RadioToolButton {
36         skip_assert_initialized!();
37         unsafe {
38             ToolItem::from_glib_none(ffi::gtk_radio_tool_button_new_from_widget(
39                 group.as_ref().to_glib_none().0,
40             ))
41             .unsafe_cast()
42         }
43     }
44 
45     // rustdoc-stripper-ignore-next
46     /// Creates a new builder-pattern struct instance to construct [`RadioToolButton`] objects.
47     ///
48     /// This method returns an instance of [`RadioToolButtonBuilder`] which can be used to create [`RadioToolButton`] objects.
builder() -> RadioToolButtonBuilder49     pub fn builder() -> RadioToolButtonBuilder {
50         RadioToolButtonBuilder::default()
51     }
52 }
53 
54 #[derive(Clone, Default)]
55 // rustdoc-stripper-ignore-next
56 /// A [builder-pattern] type to construct [`RadioToolButton`] objects.
57 ///
58 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
59 pub struct RadioToolButtonBuilder {
60     active: Option<bool>,
61     icon_name: Option<String>,
62     icon_widget: Option<Widget>,
63     label: Option<String>,
64     label_widget: Option<Widget>,
65     use_underline: Option<bool>,
66     is_important: Option<bool>,
67     visible_horizontal: Option<bool>,
68     visible_vertical: Option<bool>,
69     border_width: Option<u32>,
70     child: Option<Widget>,
71     resize_mode: Option<ResizeMode>,
72     app_paintable: Option<bool>,
73     can_default: Option<bool>,
74     can_focus: Option<bool>,
75     events: Option<gdk::EventMask>,
76     expand: Option<bool>,
77     #[cfg(any(feature = "v3_20", feature = "dox"))]
78     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))]
79     focus_on_click: Option<bool>,
80     halign: Option<Align>,
81     has_default: Option<bool>,
82     has_focus: Option<bool>,
83     has_tooltip: Option<bool>,
84     height_request: Option<i32>,
85     hexpand: Option<bool>,
86     hexpand_set: Option<bool>,
87     is_focus: Option<bool>,
88     margin: Option<i32>,
89     margin_bottom: Option<i32>,
90     margin_end: Option<i32>,
91     margin_start: Option<i32>,
92     margin_top: Option<i32>,
93     name: Option<String>,
94     no_show_all: Option<bool>,
95     opacity: Option<f64>,
96     parent: Option<Container>,
97     receives_default: Option<bool>,
98     sensitive: Option<bool>,
99     tooltip_markup: Option<String>,
100     tooltip_text: Option<String>,
101     valign: Option<Align>,
102     vexpand: Option<bool>,
103     vexpand_set: Option<bool>,
104     visible: Option<bool>,
105     width_request: Option<i32>,
106     action_name: Option<String>,
107     action_target: Option<glib::Variant>,
108 }
109 
110 impl RadioToolButtonBuilder {
111     // rustdoc-stripper-ignore-next
112     /// Create a new [`RadioToolButtonBuilder`].
new() -> Self113     pub fn new() -> Self {
114         Self::default()
115     }
116 
117     // rustdoc-stripper-ignore-next
118     /// Build the [`RadioToolButton`].
build(self) -> RadioToolButton119     pub fn build(self) -> RadioToolButton {
120         let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
121         if let Some(ref active) = self.active {
122             properties.push(("active", active));
123         }
124         if let Some(ref icon_name) = self.icon_name {
125             properties.push(("icon-name", icon_name));
126         }
127         if let Some(ref icon_widget) = self.icon_widget {
128             properties.push(("icon-widget", icon_widget));
129         }
130         if let Some(ref label) = self.label {
131             properties.push(("label", label));
132         }
133         if let Some(ref label_widget) = self.label_widget {
134             properties.push(("label-widget", label_widget));
135         }
136         if let Some(ref use_underline) = self.use_underline {
137             properties.push(("use-underline", use_underline));
138         }
139         if let Some(ref is_important) = self.is_important {
140             properties.push(("is-important", is_important));
141         }
142         if let Some(ref visible_horizontal) = self.visible_horizontal {
143             properties.push(("visible-horizontal", visible_horizontal));
144         }
145         if let Some(ref visible_vertical) = self.visible_vertical {
146             properties.push(("visible-vertical", visible_vertical));
147         }
148         if let Some(ref border_width) = self.border_width {
149             properties.push(("border-width", border_width));
150         }
151         if let Some(ref child) = self.child {
152             properties.push(("child", child));
153         }
154         if let Some(ref resize_mode) = self.resize_mode {
155             properties.push(("resize-mode", resize_mode));
156         }
157         if let Some(ref app_paintable) = self.app_paintable {
158             properties.push(("app-paintable", app_paintable));
159         }
160         if let Some(ref can_default) = self.can_default {
161             properties.push(("can-default", can_default));
162         }
163         if let Some(ref can_focus) = self.can_focus {
164             properties.push(("can-focus", can_focus));
165         }
166         if let Some(ref events) = self.events {
167             properties.push(("events", events));
168         }
169         if let Some(ref expand) = self.expand {
170             properties.push(("expand", expand));
171         }
172         #[cfg(any(feature = "v3_20", feature = "dox"))]
173         if let Some(ref focus_on_click) = self.focus_on_click {
174             properties.push(("focus-on-click", focus_on_click));
175         }
176         if let Some(ref halign) = self.halign {
177             properties.push(("halign", halign));
178         }
179         if let Some(ref has_default) = self.has_default {
180             properties.push(("has-default", has_default));
181         }
182         if let Some(ref has_focus) = self.has_focus {
183             properties.push(("has-focus", has_focus));
184         }
185         if let Some(ref has_tooltip) = self.has_tooltip {
186             properties.push(("has-tooltip", has_tooltip));
187         }
188         if let Some(ref height_request) = self.height_request {
189             properties.push(("height-request", height_request));
190         }
191         if let Some(ref hexpand) = self.hexpand {
192             properties.push(("hexpand", hexpand));
193         }
194         if let Some(ref hexpand_set) = self.hexpand_set {
195             properties.push(("hexpand-set", hexpand_set));
196         }
197         if let Some(ref is_focus) = self.is_focus {
198             properties.push(("is-focus", is_focus));
199         }
200         if let Some(ref margin) = self.margin {
201             properties.push(("margin", margin));
202         }
203         if let Some(ref margin_bottom) = self.margin_bottom {
204             properties.push(("margin-bottom", margin_bottom));
205         }
206         if let Some(ref margin_end) = self.margin_end {
207             properties.push(("margin-end", margin_end));
208         }
209         if let Some(ref margin_start) = self.margin_start {
210             properties.push(("margin-start", margin_start));
211         }
212         if let Some(ref margin_top) = self.margin_top {
213             properties.push(("margin-top", margin_top));
214         }
215         if let Some(ref name) = self.name {
216             properties.push(("name", name));
217         }
218         if let Some(ref no_show_all) = self.no_show_all {
219             properties.push(("no-show-all", no_show_all));
220         }
221         if let Some(ref opacity) = self.opacity {
222             properties.push(("opacity", opacity));
223         }
224         if let Some(ref parent) = self.parent {
225             properties.push(("parent", parent));
226         }
227         if let Some(ref receives_default) = self.receives_default {
228             properties.push(("receives-default", receives_default));
229         }
230         if let Some(ref sensitive) = self.sensitive {
231             properties.push(("sensitive", sensitive));
232         }
233         if let Some(ref tooltip_markup) = self.tooltip_markup {
234             properties.push(("tooltip-markup", tooltip_markup));
235         }
236         if let Some(ref tooltip_text) = self.tooltip_text {
237             properties.push(("tooltip-text", tooltip_text));
238         }
239         if let Some(ref valign) = self.valign {
240             properties.push(("valign", valign));
241         }
242         if let Some(ref vexpand) = self.vexpand {
243             properties.push(("vexpand", vexpand));
244         }
245         if let Some(ref vexpand_set) = self.vexpand_set {
246             properties.push(("vexpand-set", vexpand_set));
247         }
248         if let Some(ref visible) = self.visible {
249             properties.push(("visible", visible));
250         }
251         if let Some(ref width_request) = self.width_request {
252             properties.push(("width-request", width_request));
253         }
254         if let Some(ref action_name) = self.action_name {
255             properties.push(("action-name", action_name));
256         }
257         if let Some(ref action_target) = self.action_target {
258             properties.push(("action-target", action_target));
259         }
260         glib::Object::new::<RadioToolButton>(&properties)
261             .expect("Failed to create an instance of RadioToolButton")
262     }
263 
active(mut self, active: bool) -> Self264     pub fn active(mut self, active: bool) -> Self {
265         self.active = Some(active);
266         self
267     }
268 
icon_name(mut self, icon_name: &str) -> Self269     pub fn icon_name(mut self, icon_name: &str) -> Self {
270         self.icon_name = Some(icon_name.to_string());
271         self
272     }
273 
icon_widget<P: IsA<Widget>>(mut self, icon_widget: &P) -> Self274     pub fn icon_widget<P: IsA<Widget>>(mut self, icon_widget: &P) -> Self {
275         self.icon_widget = Some(icon_widget.clone().upcast());
276         self
277     }
278 
label(mut self, label: &str) -> Self279     pub fn label(mut self, label: &str) -> Self {
280         self.label = Some(label.to_string());
281         self
282     }
283 
label_widget<P: IsA<Widget>>(mut self, label_widget: &P) -> Self284     pub fn label_widget<P: IsA<Widget>>(mut self, label_widget: &P) -> Self {
285         self.label_widget = Some(label_widget.clone().upcast());
286         self
287     }
288 
use_underline(mut self, use_underline: bool) -> Self289     pub fn use_underline(mut self, use_underline: bool) -> Self {
290         self.use_underline = Some(use_underline);
291         self
292     }
293 
is_important(mut self, is_important: bool) -> Self294     pub fn is_important(mut self, is_important: bool) -> Self {
295         self.is_important = Some(is_important);
296         self
297     }
298 
visible_horizontal(mut self, visible_horizontal: bool) -> Self299     pub fn visible_horizontal(mut self, visible_horizontal: bool) -> Self {
300         self.visible_horizontal = Some(visible_horizontal);
301         self
302     }
303 
visible_vertical(mut self, visible_vertical: bool) -> Self304     pub fn visible_vertical(mut self, visible_vertical: bool) -> Self {
305         self.visible_vertical = Some(visible_vertical);
306         self
307     }
308 
border_width(mut self, border_width: u32) -> Self309     pub fn border_width(mut self, border_width: u32) -> Self {
310         self.border_width = Some(border_width);
311         self
312     }
313 
child<P: IsA<Widget>>(mut self, child: &P) -> Self314     pub fn child<P: IsA<Widget>>(mut self, child: &P) -> Self {
315         self.child = Some(child.clone().upcast());
316         self
317     }
318 
resize_mode(mut self, resize_mode: ResizeMode) -> Self319     pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self {
320         self.resize_mode = Some(resize_mode);
321         self
322     }
323 
app_paintable(mut self, app_paintable: bool) -> Self324     pub fn app_paintable(mut self, app_paintable: bool) -> Self {
325         self.app_paintable = Some(app_paintable);
326         self
327     }
328 
can_default(mut self, can_default: bool) -> Self329     pub fn can_default(mut self, can_default: bool) -> Self {
330         self.can_default = Some(can_default);
331         self
332     }
333 
can_focus(mut self, can_focus: bool) -> Self334     pub fn can_focus(mut self, can_focus: bool) -> Self {
335         self.can_focus = Some(can_focus);
336         self
337     }
338 
events(mut self, events: gdk::EventMask) -> Self339     pub fn events(mut self, events: gdk::EventMask) -> Self {
340         self.events = Some(events);
341         self
342     }
343 
expand(mut self, expand: bool) -> Self344     pub fn expand(mut self, expand: bool) -> Self {
345         self.expand = Some(expand);
346         self
347     }
348 
349     #[cfg(any(feature = "v3_20", feature = "dox"))]
350     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))]
focus_on_click(mut self, focus_on_click: bool) -> Self351     pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
352         self.focus_on_click = Some(focus_on_click);
353         self
354     }
355 
halign(mut self, halign: Align) -> Self356     pub fn halign(mut self, halign: Align) -> Self {
357         self.halign = Some(halign);
358         self
359     }
360 
has_default(mut self, has_default: bool) -> Self361     pub fn has_default(mut self, has_default: bool) -> Self {
362         self.has_default = Some(has_default);
363         self
364     }
365 
has_focus(mut self, has_focus: bool) -> Self366     pub fn has_focus(mut self, has_focus: bool) -> Self {
367         self.has_focus = Some(has_focus);
368         self
369     }
370 
has_tooltip(mut self, has_tooltip: bool) -> Self371     pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
372         self.has_tooltip = Some(has_tooltip);
373         self
374     }
375 
height_request(mut self, height_request: i32) -> Self376     pub fn height_request(mut self, height_request: i32) -> Self {
377         self.height_request = Some(height_request);
378         self
379     }
380 
hexpand(mut self, hexpand: bool) -> Self381     pub fn hexpand(mut self, hexpand: bool) -> Self {
382         self.hexpand = Some(hexpand);
383         self
384     }
385 
hexpand_set(mut self, hexpand_set: bool) -> Self386     pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
387         self.hexpand_set = Some(hexpand_set);
388         self
389     }
390 
is_focus(mut self, is_focus: bool) -> Self391     pub fn is_focus(mut self, is_focus: bool) -> Self {
392         self.is_focus = Some(is_focus);
393         self
394     }
395 
margin(mut self, margin: i32) -> Self396     pub fn margin(mut self, margin: i32) -> Self {
397         self.margin = Some(margin);
398         self
399     }
400 
margin_bottom(mut self, margin_bottom: i32) -> Self401     pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
402         self.margin_bottom = Some(margin_bottom);
403         self
404     }
405 
margin_end(mut self, margin_end: i32) -> Self406     pub fn margin_end(mut self, margin_end: i32) -> Self {
407         self.margin_end = Some(margin_end);
408         self
409     }
410 
margin_start(mut self, margin_start: i32) -> Self411     pub fn margin_start(mut self, margin_start: i32) -> Self {
412         self.margin_start = Some(margin_start);
413         self
414     }
415 
margin_top(mut self, margin_top: i32) -> Self416     pub fn margin_top(mut self, margin_top: i32) -> Self {
417         self.margin_top = Some(margin_top);
418         self
419     }
420 
name(mut self, name: &str) -> Self421     pub fn name(mut self, name: &str) -> Self {
422         self.name = Some(name.to_string());
423         self
424     }
425 
no_show_all(mut self, no_show_all: bool) -> Self426     pub fn no_show_all(mut self, no_show_all: bool) -> Self {
427         self.no_show_all = Some(no_show_all);
428         self
429     }
430 
opacity(mut self, opacity: f64) -> Self431     pub fn opacity(mut self, opacity: f64) -> Self {
432         self.opacity = Some(opacity);
433         self
434     }
435 
parent<P: IsA<Container>>(mut self, parent: &P) -> Self436     pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self {
437         self.parent = Some(parent.clone().upcast());
438         self
439     }
440 
receives_default(mut self, receives_default: bool) -> Self441     pub fn receives_default(mut self, receives_default: bool) -> Self {
442         self.receives_default = Some(receives_default);
443         self
444     }
445 
sensitive(mut self, sensitive: bool) -> Self446     pub fn sensitive(mut self, sensitive: bool) -> Self {
447         self.sensitive = Some(sensitive);
448         self
449     }
450 
tooltip_markup(mut self, tooltip_markup: &str) -> Self451     pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
452         self.tooltip_markup = Some(tooltip_markup.to_string());
453         self
454     }
455 
tooltip_text(mut self, tooltip_text: &str) -> Self456     pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
457         self.tooltip_text = Some(tooltip_text.to_string());
458         self
459     }
460 
valign(mut self, valign: Align) -> Self461     pub fn valign(mut self, valign: Align) -> Self {
462         self.valign = Some(valign);
463         self
464     }
465 
vexpand(mut self, vexpand: bool) -> Self466     pub fn vexpand(mut self, vexpand: bool) -> Self {
467         self.vexpand = Some(vexpand);
468         self
469     }
470 
vexpand_set(mut self, vexpand_set: bool) -> Self471     pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
472         self.vexpand_set = Some(vexpand_set);
473         self
474     }
475 
visible(mut self, visible: bool) -> Self476     pub fn visible(mut self, visible: bool) -> Self {
477         self.visible = Some(visible);
478         self
479     }
480 
width_request(mut self, width_request: i32) -> Self481     pub fn width_request(mut self, width_request: i32) -> Self {
482         self.width_request = Some(width_request);
483         self
484     }
485 
action_name(mut self, action_name: &str) -> Self486     pub fn action_name(mut self, action_name: &str) -> Self {
487         self.action_name = Some(action_name.to_string());
488         self
489     }
490 
action_target(mut self, action_target: &glib::Variant) -> Self491     pub fn action_target(mut self, action_target: &glib::Variant) -> Self {
492         self.action_target = Some(action_target.clone());
493         self
494     }
495 }
496 
497 pub const NONE_RADIO_TOOL_BUTTON: Option<&RadioToolButton> = None;
498 
499 pub trait RadioToolButtonExt: 'static {
500     #[doc(alias = "gtk_radio_tool_button_get_group")]
501     #[doc(alias = "get_group")]
group(&self) -> Vec<RadioButton>502     fn group(&self) -> Vec<RadioButton>;
503 }
504 
505 impl<O: IsA<RadioToolButton>> RadioToolButtonExt for O {
group(&self) -> Vec<RadioButton>506     fn group(&self) -> Vec<RadioButton> {
507         unsafe {
508             FromGlibPtrContainer::from_glib_none(ffi::gtk_radio_tool_button_get_group(
509                 self.as_ref().to_glib_none().0,
510             ))
511         }
512     }
513 }
514 
515 impl fmt::Display for RadioToolButton {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result516     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
517         f.write_str("RadioToolButton")
518     }
519 }
520