libadwaita/auto/
spinner.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from
3// from gir-files (https://github.com/gtk-rs/gir-files.git)
4// DO NOT EDIT
5
6use crate::ffi;
7use glib::{prelude::*, translate::*};
8
9glib::wrapper! {
10    #[doc(alias = "AdwSpinner")]
11    pub struct Spinner(Object<ffi::AdwSpinner, ffi::AdwSpinnerClass>) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget;
12
13    match fn {
14        type_ => || ffi::adw_spinner_get_type(),
15    }
16}
17
18impl Spinner {
19    #[doc(alias = "adw_spinner_new")]
20    pub fn new() -> Spinner {
21        assert_initialized_main_thread!();
22        unsafe { gtk::Widget::from_glib_none(ffi::adw_spinner_new()).unsafe_cast() }
23    }
24
25    // rustdoc-stripper-ignore-next
26    /// Creates a new builder-pattern struct instance to construct [`Spinner`] objects.
27    ///
28    /// This method returns an instance of [`SpinnerBuilder`](crate::builders::SpinnerBuilder) which can be used to create [`Spinner`] objects.
29    pub fn builder() -> SpinnerBuilder {
30        SpinnerBuilder::new()
31    }
32}
33
34#[cfg(feature = "v1_6")]
35#[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
36impl Default for Spinner {
37    fn default() -> Self {
38        Self::new()
39    }
40}
41
42// rustdoc-stripper-ignore-next
43/// A [builder-pattern] type to construct [`Spinner`] objects.
44///
45/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
46#[must_use = "The builder must be built to be used"]
47pub struct SpinnerBuilder {
48    builder: glib::object::ObjectBuilder<'static, Spinner>,
49}
50
51impl SpinnerBuilder {
52    fn new() -> Self {
53        Self {
54            builder: glib::object::Object::builder(),
55        }
56    }
57
58    pub fn can_focus(self, can_focus: bool) -> Self {
59        Self {
60            builder: self.builder.property("can-focus", can_focus),
61        }
62    }
63
64    pub fn can_target(self, can_target: bool) -> Self {
65        Self {
66            builder: self.builder.property("can-target", can_target),
67        }
68    }
69
70    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
71        Self {
72            builder: self.builder.property("css-classes", css_classes.into()),
73        }
74    }
75
76    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
77        Self {
78            builder: self.builder.property("css-name", css_name.into()),
79        }
80    }
81
82    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
83        Self {
84            builder: self.builder.property("cursor", cursor.clone()),
85        }
86    }
87
88    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
89        Self {
90            builder: self.builder.property("focus-on-click", focus_on_click),
91        }
92    }
93
94    pub fn focusable(self, focusable: bool) -> Self {
95        Self {
96            builder: self.builder.property("focusable", focusable),
97        }
98    }
99
100    pub fn halign(self, halign: gtk::Align) -> Self {
101        Self {
102            builder: self.builder.property("halign", halign),
103        }
104    }
105
106    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
107        Self {
108            builder: self.builder.property("has-tooltip", has_tooltip),
109        }
110    }
111
112    pub fn height_request(self, height_request: i32) -> Self {
113        Self {
114            builder: self.builder.property("height-request", height_request),
115        }
116    }
117
118    pub fn hexpand(self, hexpand: bool) -> Self {
119        Self {
120            builder: self.builder.property("hexpand", hexpand),
121        }
122    }
123
124    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
125        Self {
126            builder: self.builder.property("hexpand-set", hexpand_set),
127        }
128    }
129
130    pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
131        Self {
132            builder: self
133                .builder
134                .property("layout-manager", layout_manager.clone().upcast()),
135        }
136    }
137
138    #[cfg(feature = "gtk_v4_18")]
139    #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
140    pub fn limit_events(self, limit_events: bool) -> Self {
141        Self {
142            builder: self.builder.property("limit-events", limit_events),
143        }
144    }
145
146    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
147        Self {
148            builder: self.builder.property("margin-bottom", margin_bottom),
149        }
150    }
151
152    pub fn margin_end(self, margin_end: i32) -> Self {
153        Self {
154            builder: self.builder.property("margin-end", margin_end),
155        }
156    }
157
158    pub fn margin_start(self, margin_start: i32) -> Self {
159        Self {
160            builder: self.builder.property("margin-start", margin_start),
161        }
162    }
163
164    pub fn margin_top(self, margin_top: i32) -> Self {
165        Self {
166            builder: self.builder.property("margin-top", margin_top),
167        }
168    }
169
170    pub fn name(self, name: impl Into<glib::GString>) -> Self {
171        Self {
172            builder: self.builder.property("name", name.into()),
173        }
174    }
175
176    pub fn opacity(self, opacity: f64) -> Self {
177        Self {
178            builder: self.builder.property("opacity", opacity),
179        }
180    }
181
182    pub fn overflow(self, overflow: gtk::Overflow) -> Self {
183        Self {
184            builder: self.builder.property("overflow", overflow),
185        }
186    }
187
188    pub fn receives_default(self, receives_default: bool) -> Self {
189        Self {
190            builder: self.builder.property("receives-default", receives_default),
191        }
192    }
193
194    pub fn sensitive(self, sensitive: bool) -> Self {
195        Self {
196            builder: self.builder.property("sensitive", sensitive),
197        }
198    }
199
200    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
201        Self {
202            builder: self
203                .builder
204                .property("tooltip-markup", tooltip_markup.into()),
205        }
206    }
207
208    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
209        Self {
210            builder: self.builder.property("tooltip-text", tooltip_text.into()),
211        }
212    }
213
214    pub fn valign(self, valign: gtk::Align) -> Self {
215        Self {
216            builder: self.builder.property("valign", valign),
217        }
218    }
219
220    pub fn vexpand(self, vexpand: bool) -> Self {
221        Self {
222            builder: self.builder.property("vexpand", vexpand),
223        }
224    }
225
226    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
227        Self {
228            builder: self.builder.property("vexpand-set", vexpand_set),
229        }
230    }
231
232    pub fn visible(self, visible: bool) -> Self {
233        Self {
234            builder: self.builder.property("visible", visible),
235        }
236    }
237
238    pub fn width_request(self, width_request: i32) -> Self {
239        Self {
240            builder: self.builder.property("width-request", width_request),
241        }
242    }
243
244    pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
245        Self {
246            builder: self.builder.property("accessible-role", accessible_role),
247        }
248    }
249
250    // rustdoc-stripper-ignore-next
251    /// Build the [`Spinner`].
252    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
253    pub fn build(self) -> Spinner {
254        assert_initialized_main_thread!();
255        self.builder.build()
256    }
257}