libadwaita/auto/
status_page.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::{
8    prelude::*,
9    signal::{connect_raw, SignalHandlerId},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15    #[doc(alias = "AdwStatusPage")]
16    pub struct StatusPage(Object<ffi::AdwStatusPage, ffi::AdwStatusPageClass>) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget;
17
18    match fn {
19        type_ => || ffi::adw_status_page_get_type(),
20    }
21}
22
23impl StatusPage {
24    #[doc(alias = "adw_status_page_new")]
25    pub fn new() -> StatusPage {
26        assert_initialized_main_thread!();
27        unsafe { gtk::Widget::from_glib_none(ffi::adw_status_page_new()).unsafe_cast() }
28    }
29
30    // rustdoc-stripper-ignore-next
31    /// Creates a new builder-pattern struct instance to construct [`StatusPage`] objects.
32    ///
33    /// This method returns an instance of [`StatusPageBuilder`](crate::builders::StatusPageBuilder) which can be used to create [`StatusPage`] objects.
34    pub fn builder() -> StatusPageBuilder {
35        StatusPageBuilder::new()
36    }
37
38    #[doc(alias = "adw_status_page_get_child")]
39    #[doc(alias = "get_child")]
40    pub fn child(&self) -> Option<gtk::Widget> {
41        unsafe { from_glib_none(ffi::adw_status_page_get_child(self.to_glib_none().0)) }
42    }
43
44    #[doc(alias = "adw_status_page_get_description")]
45    #[doc(alias = "get_description")]
46    pub fn description(&self) -> Option<glib::GString> {
47        unsafe { from_glib_none(ffi::adw_status_page_get_description(self.to_glib_none().0)) }
48    }
49
50    #[doc(alias = "adw_status_page_get_icon_name")]
51    #[doc(alias = "get_icon_name")]
52    #[doc(alias = "icon-name")]
53    pub fn icon_name(&self) -> Option<glib::GString> {
54        unsafe { from_glib_none(ffi::adw_status_page_get_icon_name(self.to_glib_none().0)) }
55    }
56
57    #[doc(alias = "adw_status_page_get_paintable")]
58    #[doc(alias = "get_paintable")]
59    pub fn paintable(&self) -> Option<gdk::Paintable> {
60        unsafe { from_glib_none(ffi::adw_status_page_get_paintable(self.to_glib_none().0)) }
61    }
62
63    #[doc(alias = "adw_status_page_get_title")]
64    #[doc(alias = "get_title")]
65    pub fn title(&self) -> glib::GString {
66        unsafe { from_glib_none(ffi::adw_status_page_get_title(self.to_glib_none().0)) }
67    }
68
69    #[doc(alias = "adw_status_page_set_child")]
70    #[doc(alias = "child")]
71    pub fn set_child(&self, child: Option<&impl IsA<gtk::Widget>>) {
72        unsafe {
73            ffi::adw_status_page_set_child(
74                self.to_glib_none().0,
75                child.map(|p| p.as_ref()).to_glib_none().0,
76            );
77        }
78    }
79
80    #[doc(alias = "adw_status_page_set_description")]
81    #[doc(alias = "description")]
82    pub fn set_description(&self, description: Option<&str>) {
83        unsafe {
84            ffi::adw_status_page_set_description(
85                self.to_glib_none().0,
86                description.to_glib_none().0,
87            );
88        }
89    }
90
91    #[doc(alias = "adw_status_page_set_icon_name")]
92    #[doc(alias = "icon-name")]
93    pub fn set_icon_name(&self, icon_name: Option<&str>) {
94        unsafe {
95            ffi::adw_status_page_set_icon_name(self.to_glib_none().0, icon_name.to_glib_none().0);
96        }
97    }
98
99    #[doc(alias = "adw_status_page_set_paintable")]
100    #[doc(alias = "paintable")]
101    pub fn set_paintable(&self, paintable: Option<&impl IsA<gdk::Paintable>>) {
102        unsafe {
103            ffi::adw_status_page_set_paintable(
104                self.to_glib_none().0,
105                paintable.map(|p| p.as_ref()).to_glib_none().0,
106            );
107        }
108    }
109
110    #[doc(alias = "adw_status_page_set_title")]
111    #[doc(alias = "title")]
112    pub fn set_title(&self, title: &str) {
113        unsafe {
114            ffi::adw_status_page_set_title(self.to_glib_none().0, title.to_glib_none().0);
115        }
116    }
117
118    #[doc(alias = "child")]
119    pub fn connect_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
120        unsafe extern "C" fn notify_child_trampoline<F: Fn(&StatusPage) + 'static>(
121            this: *mut ffi::AdwStatusPage,
122            _param_spec: glib::ffi::gpointer,
123            f: glib::ffi::gpointer,
124        ) {
125            let f: &F = &*(f as *const F);
126            f(&from_glib_borrow(this))
127        }
128        unsafe {
129            let f: Box_<F> = Box_::new(f);
130            connect_raw(
131                self.as_ptr() as *mut _,
132                c"notify::child".as_ptr() as *const _,
133                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
134                    notify_child_trampoline::<F> as *const (),
135                )),
136                Box_::into_raw(f),
137            )
138        }
139    }
140
141    #[doc(alias = "description")]
142    pub fn connect_description_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
143        unsafe extern "C" fn notify_description_trampoline<F: Fn(&StatusPage) + 'static>(
144            this: *mut ffi::AdwStatusPage,
145            _param_spec: glib::ffi::gpointer,
146            f: glib::ffi::gpointer,
147        ) {
148            let f: &F = &*(f as *const F);
149            f(&from_glib_borrow(this))
150        }
151        unsafe {
152            let f: Box_<F> = Box_::new(f);
153            connect_raw(
154                self.as_ptr() as *mut _,
155                c"notify::description".as_ptr() as *const _,
156                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
157                    notify_description_trampoline::<F> as *const (),
158                )),
159                Box_::into_raw(f),
160            )
161        }
162    }
163
164    #[doc(alias = "icon-name")]
165    pub fn connect_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
166        unsafe extern "C" fn notify_icon_name_trampoline<F: Fn(&StatusPage) + 'static>(
167            this: *mut ffi::AdwStatusPage,
168            _param_spec: glib::ffi::gpointer,
169            f: glib::ffi::gpointer,
170        ) {
171            let f: &F = &*(f as *const F);
172            f(&from_glib_borrow(this))
173        }
174        unsafe {
175            let f: Box_<F> = Box_::new(f);
176            connect_raw(
177                self.as_ptr() as *mut _,
178                c"notify::icon-name".as_ptr() as *const _,
179                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
180                    notify_icon_name_trampoline::<F> as *const (),
181                )),
182                Box_::into_raw(f),
183            )
184        }
185    }
186
187    #[doc(alias = "paintable")]
188    pub fn connect_paintable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
189        unsafe extern "C" fn notify_paintable_trampoline<F: Fn(&StatusPage) + 'static>(
190            this: *mut ffi::AdwStatusPage,
191            _param_spec: glib::ffi::gpointer,
192            f: glib::ffi::gpointer,
193        ) {
194            let f: &F = &*(f as *const F);
195            f(&from_glib_borrow(this))
196        }
197        unsafe {
198            let f: Box_<F> = Box_::new(f);
199            connect_raw(
200                self.as_ptr() as *mut _,
201                c"notify::paintable".as_ptr() as *const _,
202                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
203                    notify_paintable_trampoline::<F> as *const (),
204                )),
205                Box_::into_raw(f),
206            )
207        }
208    }
209
210    #[doc(alias = "title")]
211    pub fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
212        unsafe extern "C" fn notify_title_trampoline<F: Fn(&StatusPage) + 'static>(
213            this: *mut ffi::AdwStatusPage,
214            _param_spec: glib::ffi::gpointer,
215            f: glib::ffi::gpointer,
216        ) {
217            let f: &F = &*(f as *const F);
218            f(&from_glib_borrow(this))
219        }
220        unsafe {
221            let f: Box_<F> = Box_::new(f);
222            connect_raw(
223                self.as_ptr() as *mut _,
224                c"notify::title".as_ptr() as *const _,
225                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
226                    notify_title_trampoline::<F> as *const (),
227                )),
228                Box_::into_raw(f),
229            )
230        }
231    }
232}
233
234impl Default for StatusPage {
235    fn default() -> Self {
236        Self::new()
237    }
238}
239
240// rustdoc-stripper-ignore-next
241/// A [builder-pattern] type to construct [`StatusPage`] objects.
242///
243/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
244#[must_use = "The builder must be built to be used"]
245pub struct StatusPageBuilder {
246    builder: glib::object::ObjectBuilder<'static, StatusPage>,
247}
248
249impl StatusPageBuilder {
250    fn new() -> Self {
251        Self {
252            builder: glib::object::Object::builder(),
253        }
254    }
255
256    pub fn child(self, child: &impl IsA<gtk::Widget>) -> Self {
257        Self {
258            builder: self.builder.property("child", child.clone().upcast()),
259        }
260    }
261
262    pub fn description(self, description: impl Into<glib::GString>) -> Self {
263        Self {
264            builder: self.builder.property("description", description.into()),
265        }
266    }
267
268    pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
269        Self {
270            builder: self.builder.property("icon-name", icon_name.into()),
271        }
272    }
273
274    pub fn paintable(self, paintable: &impl IsA<gdk::Paintable>) -> Self {
275        Self {
276            builder: self
277                .builder
278                .property("paintable", paintable.clone().upcast()),
279        }
280    }
281
282    pub fn title(self, title: impl Into<glib::GString>) -> Self {
283        Self {
284            builder: self.builder.property("title", title.into()),
285        }
286    }
287
288    pub fn can_focus(self, can_focus: bool) -> Self {
289        Self {
290            builder: self.builder.property("can-focus", can_focus),
291        }
292    }
293
294    pub fn can_target(self, can_target: bool) -> Self {
295        Self {
296            builder: self.builder.property("can-target", can_target),
297        }
298    }
299
300    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
301        Self {
302            builder: self.builder.property("css-classes", css_classes.into()),
303        }
304    }
305
306    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
307        Self {
308            builder: self.builder.property("css-name", css_name.into()),
309        }
310    }
311
312    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
313        Self {
314            builder: self.builder.property("cursor", cursor.clone()),
315        }
316    }
317
318    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
319        Self {
320            builder: self.builder.property("focus-on-click", focus_on_click),
321        }
322    }
323
324    pub fn focusable(self, focusable: bool) -> Self {
325        Self {
326            builder: self.builder.property("focusable", focusable),
327        }
328    }
329
330    pub fn halign(self, halign: gtk::Align) -> Self {
331        Self {
332            builder: self.builder.property("halign", halign),
333        }
334    }
335
336    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
337        Self {
338            builder: self.builder.property("has-tooltip", has_tooltip),
339        }
340    }
341
342    pub fn height_request(self, height_request: i32) -> Self {
343        Self {
344            builder: self.builder.property("height-request", height_request),
345        }
346    }
347
348    pub fn hexpand(self, hexpand: bool) -> Self {
349        Self {
350            builder: self.builder.property("hexpand", hexpand),
351        }
352    }
353
354    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
355        Self {
356            builder: self.builder.property("hexpand-set", hexpand_set),
357        }
358    }
359
360    pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
361        Self {
362            builder: self
363                .builder
364                .property("layout-manager", layout_manager.clone().upcast()),
365        }
366    }
367
368    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
369        Self {
370            builder: self.builder.property("margin-bottom", margin_bottom),
371        }
372    }
373
374    pub fn margin_end(self, margin_end: i32) -> Self {
375        Self {
376            builder: self.builder.property("margin-end", margin_end),
377        }
378    }
379
380    pub fn margin_start(self, margin_start: i32) -> Self {
381        Self {
382            builder: self.builder.property("margin-start", margin_start),
383        }
384    }
385
386    pub fn margin_top(self, margin_top: i32) -> Self {
387        Self {
388            builder: self.builder.property("margin-top", margin_top),
389        }
390    }
391
392    pub fn name(self, name: impl Into<glib::GString>) -> Self {
393        Self {
394            builder: self.builder.property("name", name.into()),
395        }
396    }
397
398    pub fn opacity(self, opacity: f64) -> Self {
399        Self {
400            builder: self.builder.property("opacity", opacity),
401        }
402    }
403
404    pub fn overflow(self, overflow: gtk::Overflow) -> Self {
405        Self {
406            builder: self.builder.property("overflow", overflow),
407        }
408    }
409
410    pub fn receives_default(self, receives_default: bool) -> Self {
411        Self {
412            builder: self.builder.property("receives-default", receives_default),
413        }
414    }
415
416    pub fn sensitive(self, sensitive: bool) -> Self {
417        Self {
418            builder: self.builder.property("sensitive", sensitive),
419        }
420    }
421
422    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
423        Self {
424            builder: self
425                .builder
426                .property("tooltip-markup", tooltip_markup.into()),
427        }
428    }
429
430    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
431        Self {
432            builder: self.builder.property("tooltip-text", tooltip_text.into()),
433        }
434    }
435
436    pub fn valign(self, valign: gtk::Align) -> Self {
437        Self {
438            builder: self.builder.property("valign", valign),
439        }
440    }
441
442    pub fn vexpand(self, vexpand: bool) -> Self {
443        Self {
444            builder: self.builder.property("vexpand", vexpand),
445        }
446    }
447
448    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
449        Self {
450            builder: self.builder.property("vexpand-set", vexpand_set),
451        }
452    }
453
454    pub fn visible(self, visible: bool) -> Self {
455        Self {
456            builder: self.builder.property("visible", visible),
457        }
458    }
459
460    pub fn width_request(self, width_request: i32) -> Self {
461        Self {
462            builder: self.builder.property("width-request", width_request),
463        }
464    }
465
466    pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
467        Self {
468            builder: self.builder.property("accessible-role", accessible_role),
469        }
470    }
471
472    // rustdoc-stripper-ignore-next
473    /// Build the [`StatusPage`].
474    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
475    pub fn build(self) -> StatusPage {
476        assert_initialized_main_thread!();
477        self.builder.build()
478    }
479}