Skip to main content

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::{SignalHandlerId, connect_raw},
10    translate::*,
11};
12use std::boxed::Box as Box_;
13
14glib::wrapper! {
15    /// A page used for empty/error states and similar use-cases.
16    ///
17    /// <picture>
18    ///   <source srcset="status-page-dark.png" media="(prefers-color-scheme: dark)">
19    ///   <img src="status-page.png" alt="status-page">
20    /// </picture>
21    ///
22    /// The [`StatusPage`][crate::StatusPage] widget can have an icon, a title, a description and a
23    /// custom widget which is displayed below them.
24    ///
25    /// ## CSS nodes
26    ///
27    /// [`StatusPage`][crate::StatusPage] has a main CSS node with name `statuspage`.
28    ///
29    /// When setting an [`SpinnerPaintable`][crate::SpinnerPaintable] as [`paintable`][struct@crate::StatusPage#paintable],
30    /// the main nodes gains the `.spinner` style class for a more compact
31    /// appearance.
32    ///
33    /// ## Style classes
34    ///
35    /// [`StatusPage`][crate::StatusPage] can use the
36    /// [`.compact`](style-classes.html#compact-status-page) style class for when it
37    /// needs to fit into a small space such a sidebar or a popover, similar to when
38    /// using a spinner as the paintable.
39    ///
40    /// <picture>
41    ///   <source srcset="status-page-compact-dark.png" media="(prefers-color-scheme: dark)">
42    ///   <img src="status-page-compact.png" alt="status-page-compact">
43    /// </picture>
44    ///
45    /// ## Properties
46    ///
47    ///
48    /// #### `child`
49    ///  The child widget.
50    ///
51    /// Readable | Writeable
52    ///
53    ///
54    /// #### `description`
55    ///  The description markup to be displayed below the title.
56    ///
57    /// Readable | Writeable
58    ///
59    ///
60    /// #### `icon-name`
61    ///  The name of the icon to be used.
62    ///
63    /// Changing this will set [`paintable`][struct@crate::StatusPage#paintable] to `NULL`.
64    ///
65    /// Readable | Writeable
66    ///
67    ///
68    /// #### `paintable`
69    ///  The paintable to be used.
70    ///
71    /// Changing this will set [`icon-name`][struct@crate::StatusPage#icon-name] to `NULL`.
72    ///
73    /// Readable | Writeable
74    ///
75    ///
76    /// #### `title`
77    ///  The title to be displayed below the icon.
78    ///
79    /// It is not parsed as Pango markup.
80    ///
81    /// Readable | Writeable
82    /// <details><summary><h4>Widget</h4></summary>
83    ///
84    ///
85    /// #### `can-focus`
86    ///  Whether the widget or any of its descendents can accept
87    /// the input focus.
88    ///
89    /// This property is meant to be set by widget implementations,
90    /// typically in their instance init function.
91    ///
92    /// Readable | Writeable
93    ///
94    ///
95    /// #### `can-target`
96    ///  Whether the widget can receive pointer events.
97    ///
98    /// Readable | Writeable
99    ///
100    ///
101    /// #### `css-classes`
102    ///  A list of css classes applied to this widget.
103    ///
104    /// Readable | Writeable
105    ///
106    ///
107    /// #### `css-name`
108    ///  The name of this widget in the CSS tree.
109    ///
110    /// This property is meant to be set by widget implementations,
111    /// typically in their instance init function.
112    ///
113    /// Readable | Writeable | Construct Only
114    ///
115    ///
116    /// #### `cursor`
117    ///  The cursor used by @widget.
118    ///
119    /// Readable | Writeable
120    ///
121    ///
122    /// #### `focus-on-click`
123    ///  Whether the widget should grab focus when it is clicked with the mouse.
124    ///
125    /// This property is only relevant for widgets that can take focus.
126    ///
127    /// Readable | Writeable
128    ///
129    ///
130    /// #### `focusable`
131    ///  Whether this widget itself will accept the input focus.
132    ///
133    /// Readable | Writeable
134    ///
135    ///
136    /// #### `halign`
137    ///  How to distribute horizontal space if widget gets extra space.
138    ///
139    /// Readable | Writeable
140    ///
141    ///
142    /// #### `has-default`
143    ///  Whether the widget is the default widget.
144    ///
145    /// Readable
146    ///
147    ///
148    /// #### `has-focus`
149    ///  Whether the widget has the input focus.
150    ///
151    /// Readable
152    ///
153    ///
154    /// #### `has-tooltip`
155    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip]
156    /// signal on @widget.
157    ///
158    /// A true value indicates that @widget can have a tooltip, in this case
159    /// the widget will be queried using [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] to
160    /// determine whether it will provide a tooltip or not.
161    ///
162    /// Readable | Writeable
163    ///
164    ///
165    /// #### `height-request`
166    ///  Overrides for height request of the widget.
167    ///
168    /// If this is -1, the natural request will be used.
169    ///
170    /// Readable | Writeable
171    ///
172    ///
173    /// #### `hexpand`
174    ///  Whether to expand horizontally.
175    ///
176    /// Readable | Writeable
177    ///
178    ///
179    /// #### `hexpand-set`
180    ///  Whether to use the `hexpand` property.
181    ///
182    /// Readable | Writeable
183    ///
184    ///
185    /// #### `layout-manager`
186    ///  The [`gtk::LayoutManager`][crate::gtk::LayoutManager] instance to use to compute
187    /// the preferred size of the widget, and allocate its children.
188    ///
189    /// This property is meant to be set by widget implementations,
190    /// typically in their instance init function.
191    ///
192    /// Readable | Writeable
193    ///
194    ///
195    /// #### `limit-events`
196    ///  Makes this widget act like a modal dialog, with respect to
197    /// event delivery.
198    ///
199    /// Global event controllers will not handle events with targets
200    /// inside the widget, unless they are set up to ignore propagation
201    /// limits. See `Gtk::EventController::set_propagation_limit()`.
202    ///
203    /// Readable | Writeable
204    ///
205    ///
206    /// #### `margin-bottom`
207    ///  Margin on bottom side of widget.
208    ///
209    /// This property adds margin outside of the widget's normal size
210    /// request, the margin will be added in addition to the size from
211    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
212    ///
213    /// Readable | Writeable
214    ///
215    ///
216    /// #### `margin-end`
217    ///  Margin on end of widget, horizontally.
218    ///
219    /// This property supports left-to-right and right-to-left text
220    /// directions.
221    ///
222    /// This property adds margin outside of the widget's normal size
223    /// request, the margin will be added in addition to the size from
224    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
225    ///
226    /// Readable | Writeable
227    ///
228    ///
229    /// #### `margin-start`
230    ///  Margin on start of widget, horizontally.
231    ///
232    /// This property supports left-to-right and right-to-left text
233    /// directions.
234    ///
235    /// This property adds margin outside of the widget's normal size
236    /// request, the margin will be added in addition to the size from
237    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
238    ///
239    /// Readable | Writeable
240    ///
241    ///
242    /// #### `margin-top`
243    ///  Margin on top side of widget.
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    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
248    ///
249    /// Readable | Writeable
250    ///
251    ///
252    /// #### `name`
253    ///  The name of the widget.
254    ///
255    /// Readable | Writeable
256    ///
257    ///
258    /// #### `opacity`
259    ///  The requested opacity of the widget.
260    ///
261    /// Readable | Writeable
262    ///
263    ///
264    /// #### `overflow`
265    ///  How content outside the widget's content area is treated.
266    ///
267    /// This property is meant to be set by widget implementations,
268    /// typically in their instance init function.
269    ///
270    /// Readable | Writeable
271    ///
272    ///
273    /// #### `parent`
274    ///  The parent widget of this widget.
275    ///
276    /// Readable
277    ///
278    ///
279    /// #### `receives-default`
280    ///  Whether the widget will receive the default action when it is focused.
281    ///
282    /// Readable | Writeable
283    ///
284    ///
285    /// #### `root`
286    ///  The [`gtk::Root`][crate::gtk::Root] widget of the widget tree containing this widget.
287    ///
288    /// This will be `NULL` if the widget is not contained in a root widget.
289    ///
290    /// Readable
291    ///
292    ///
293    /// #### `scale-factor`
294    ///  The scale factor of the widget.
295    ///
296    /// Readable
297    ///
298    ///
299    /// #### `sensitive`
300    ///  Whether the widget responds to input.
301    ///
302    /// Readable | Writeable
303    ///
304    ///
305    /// #### `tooltip-markup`
306    ///  Sets the text of tooltip to be the given string, which is marked up
307    /// with Pango markup.
308    ///
309    /// Also see `Gtk::Tooltip::set_markup()`.
310    ///
311    /// This is a convenience property which will take care of getting the
312    /// tooltip shown if the given string is not `NULL`:
313    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
314    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
315    /// the default signal handler.
316    ///
317    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
318    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
319    ///
320    /// Readable | Writeable
321    ///
322    ///
323    /// #### `tooltip-text`
324    ///  Sets the text of tooltip to be the given string.
325    ///
326    /// Also see `Gtk::Tooltip::set_text()`.
327    ///
328    /// This is a convenience property which will take care of getting the
329    /// tooltip shown if the given string is not `NULL`:
330    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
331    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
332    /// the default signal handler.
333    ///
334    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
335    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
336    ///
337    /// Readable | Writeable
338    ///
339    ///
340    /// #### `valign`
341    ///  How to distribute vertical space if widget gets extra space.
342    ///
343    /// Readable | Writeable
344    ///
345    ///
346    /// #### `vexpand`
347    ///  Whether to expand vertically.
348    ///
349    /// Readable | Writeable
350    ///
351    ///
352    /// #### `vexpand-set`
353    ///  Whether to use the `vexpand` property.
354    ///
355    /// Readable | Writeable
356    ///
357    ///
358    /// #### `visible`
359    ///  Whether the widget is visible.
360    ///
361    /// Readable | Writeable
362    ///
363    ///
364    /// #### `width-request`
365    ///  Overrides for width request of the widget.
366    ///
367    /// If this is -1, the natural request will be used.
368    ///
369    /// Readable | Writeable
370    /// </details>
371    /// <details><summary><h4>Accessible</h4></summary>
372    ///
373    ///
374    /// #### `accessible-role`
375    ///  The accessible role of the given [`gtk::Accessible`][crate::gtk::Accessible] implementation.
376    ///
377    /// The accessible role cannot be changed once set.
378    ///
379    /// Readable | Writeable
380    /// </details>
381    ///
382    /// # Implements
383    ///
384    /// [`trait@gtk::prelude::WidgetExt`], [`trait@glib::ObjectExt`], [`trait@gtk::prelude::AccessibleExt`], [`trait@gtk::prelude::BuildableExt`], [`trait@gtk::prelude::ConstraintTargetExt`]
385    #[doc(alias = "AdwStatusPage")]
386    pub struct StatusPage(Object<ffi::AdwStatusPage, ffi::AdwStatusPageClass>) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget;
387
388    match fn {
389        type_ => || ffi::adw_status_page_get_type(),
390    }
391}
392
393impl StatusPage {
394    /// Creates a new [`StatusPage`][crate::StatusPage].
395    ///
396    /// # Returns
397    ///
398    /// the newly created [`StatusPage`][crate::StatusPage]
399    #[doc(alias = "adw_status_page_new")]
400    pub fn new() -> StatusPage {
401        assert_initialized_main_thread!();
402        unsafe { gtk::Widget::from_glib_none(ffi::adw_status_page_new()).unsafe_cast() }
403    }
404
405    // rustdoc-stripper-ignore-next
406    /// Creates a new builder-pattern struct instance to construct [`StatusPage`] objects.
407    ///
408    /// This method returns an instance of [`StatusPageBuilder`](crate::builders::StatusPageBuilder) which can be used to create [`StatusPage`] objects.
409    pub fn builder() -> StatusPageBuilder {
410        StatusPageBuilder::new()
411    }
412
413    /// Gets the child widget of @self.
414    ///
415    /// # Returns
416    ///
417    /// the child widget of @self
418    #[doc(alias = "adw_status_page_get_child")]
419    #[doc(alias = "get_child")]
420    pub fn child(&self) -> Option<gtk::Widget> {
421        unsafe { from_glib_none(ffi::adw_status_page_get_child(self.to_glib_none().0)) }
422    }
423
424    /// Gets the description markup for @self.
425    ///
426    /// # Returns
427    ///
428    /// the description
429    #[doc(alias = "adw_status_page_get_description")]
430    #[doc(alias = "get_description")]
431    pub fn description(&self) -> Option<glib::GString> {
432        unsafe { from_glib_none(ffi::adw_status_page_get_description(self.to_glib_none().0)) }
433    }
434
435    /// Gets the icon name for @self.
436    ///
437    /// # Returns
438    ///
439    /// the icon name
440    #[doc(alias = "adw_status_page_get_icon_name")]
441    #[doc(alias = "get_icon_name")]
442    #[doc(alias = "icon-name")]
443    pub fn icon_name(&self) -> Option<glib::GString> {
444        unsafe { from_glib_none(ffi::adw_status_page_get_icon_name(self.to_glib_none().0)) }
445    }
446
447    /// Gets the paintable for @self.
448    ///
449    /// # Returns
450    ///
451    /// the paintable
452    #[doc(alias = "adw_status_page_get_paintable")]
453    #[doc(alias = "get_paintable")]
454    pub fn paintable(&self) -> Option<gdk::Paintable> {
455        unsafe { from_glib_none(ffi::adw_status_page_get_paintable(self.to_glib_none().0)) }
456    }
457
458    /// Gets the title for @self.
459    ///
460    /// # Returns
461    ///
462    /// the title
463    #[doc(alias = "adw_status_page_get_title")]
464    #[doc(alias = "get_title")]
465    pub fn title(&self) -> glib::GString {
466        unsafe { from_glib_none(ffi::adw_status_page_get_title(self.to_glib_none().0)) }
467    }
468
469    /// Sets the child widget of @self.
470    /// ## `child`
471    /// the child widget
472    #[doc(alias = "adw_status_page_set_child")]
473    #[doc(alias = "child")]
474    pub fn set_child(&self, child: Option<&impl IsA<gtk::Widget>>) {
475        unsafe {
476            ffi::adw_status_page_set_child(
477                self.to_glib_none().0,
478                child.map(|p| p.as_ref()).to_glib_none().0,
479            );
480        }
481    }
482
483    /// Sets the description markup for @self.
484    ///
485    /// The description is displayed below the title. It is parsed as Pango markup.
486    /// ## `description`
487    /// the description
488    #[doc(alias = "adw_status_page_set_description")]
489    #[doc(alias = "description")]
490    pub fn set_description(&self, description: Option<&str>) {
491        unsafe {
492            ffi::adw_status_page_set_description(
493                self.to_glib_none().0,
494                description.to_glib_none().0,
495            );
496        }
497    }
498
499    /// Sets the icon name for @self.
500    ///
501    /// Changing this will set [`paintable`][struct@crate::StatusPage#paintable] to `NULL`.
502    /// ## `icon_name`
503    /// the icon name
504    #[doc(alias = "adw_status_page_set_icon_name")]
505    #[doc(alias = "icon-name")]
506    pub fn set_icon_name(&self, icon_name: Option<&str>) {
507        unsafe {
508            ffi::adw_status_page_set_icon_name(self.to_glib_none().0, icon_name.to_glib_none().0);
509        }
510    }
511
512    /// Sets the paintable for @self.
513    ///
514    /// Changing this will set [`icon-name`][struct@crate::StatusPage#icon-name] to `NULL`.
515    /// ## `paintable`
516    /// the paintable
517    #[doc(alias = "adw_status_page_set_paintable")]
518    #[doc(alias = "paintable")]
519    pub fn set_paintable(&self, paintable: Option<&impl IsA<gdk::Paintable>>) {
520        unsafe {
521            ffi::adw_status_page_set_paintable(
522                self.to_glib_none().0,
523                paintable.map(|p| p.as_ref()).to_glib_none().0,
524            );
525        }
526    }
527
528    /// Sets the title for @self.
529    ///
530    /// The title is displayed below the icon. It is not parsed as Pango markup.
531    /// ## `title`
532    /// the title
533    #[doc(alias = "adw_status_page_set_title")]
534    #[doc(alias = "title")]
535    pub fn set_title(&self, title: &str) {
536        unsafe {
537            ffi::adw_status_page_set_title(self.to_glib_none().0, title.to_glib_none().0);
538        }
539    }
540
541    #[doc(alias = "child")]
542    pub fn connect_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
543        unsafe extern "C" fn notify_child_trampoline<F: Fn(&StatusPage) + 'static>(
544            this: *mut ffi::AdwStatusPage,
545            _param_spec: glib::ffi::gpointer,
546            f: glib::ffi::gpointer,
547        ) {
548            unsafe {
549                let f: &F = &*(f as *const F);
550                f(&from_glib_borrow(this))
551            }
552        }
553        unsafe {
554            let f: Box_<F> = Box_::new(f);
555            connect_raw(
556                self.as_ptr() as *mut _,
557                c"notify::child".as_ptr(),
558                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
559                    notify_child_trampoline::<F> as *const (),
560                )),
561                Box_::into_raw(f),
562            )
563        }
564    }
565
566    #[doc(alias = "description")]
567    pub fn connect_description_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
568        unsafe extern "C" fn notify_description_trampoline<F: Fn(&StatusPage) + 'static>(
569            this: *mut ffi::AdwStatusPage,
570            _param_spec: glib::ffi::gpointer,
571            f: glib::ffi::gpointer,
572        ) {
573            unsafe {
574                let f: &F = &*(f as *const F);
575                f(&from_glib_borrow(this))
576            }
577        }
578        unsafe {
579            let f: Box_<F> = Box_::new(f);
580            connect_raw(
581                self.as_ptr() as *mut _,
582                c"notify::description".as_ptr(),
583                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
584                    notify_description_trampoline::<F> as *const (),
585                )),
586                Box_::into_raw(f),
587            )
588        }
589    }
590
591    #[doc(alias = "icon-name")]
592    pub fn connect_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
593        unsafe extern "C" fn notify_icon_name_trampoline<F: Fn(&StatusPage) + 'static>(
594            this: *mut ffi::AdwStatusPage,
595            _param_spec: glib::ffi::gpointer,
596            f: glib::ffi::gpointer,
597        ) {
598            unsafe {
599                let f: &F = &*(f as *const F);
600                f(&from_glib_borrow(this))
601            }
602        }
603        unsafe {
604            let f: Box_<F> = Box_::new(f);
605            connect_raw(
606                self.as_ptr() as *mut _,
607                c"notify::icon-name".as_ptr(),
608                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
609                    notify_icon_name_trampoline::<F> as *const (),
610                )),
611                Box_::into_raw(f),
612            )
613        }
614    }
615
616    #[doc(alias = "paintable")]
617    pub fn connect_paintable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
618        unsafe extern "C" fn notify_paintable_trampoline<F: Fn(&StatusPage) + 'static>(
619            this: *mut ffi::AdwStatusPage,
620            _param_spec: glib::ffi::gpointer,
621            f: glib::ffi::gpointer,
622        ) {
623            unsafe {
624                let f: &F = &*(f as *const F);
625                f(&from_glib_borrow(this))
626            }
627        }
628        unsafe {
629            let f: Box_<F> = Box_::new(f);
630            connect_raw(
631                self.as_ptr() as *mut _,
632                c"notify::paintable".as_ptr(),
633                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
634                    notify_paintable_trampoline::<F> as *const (),
635                )),
636                Box_::into_raw(f),
637            )
638        }
639    }
640
641    #[doc(alias = "title")]
642    pub fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
643        unsafe extern "C" fn notify_title_trampoline<F: Fn(&StatusPage) + 'static>(
644            this: *mut ffi::AdwStatusPage,
645            _param_spec: glib::ffi::gpointer,
646            f: glib::ffi::gpointer,
647        ) {
648            unsafe {
649                let f: &F = &*(f as *const F);
650                f(&from_glib_borrow(this))
651            }
652        }
653        unsafe {
654            let f: Box_<F> = Box_::new(f);
655            connect_raw(
656                self.as_ptr() as *mut _,
657                c"notify::title".as_ptr(),
658                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
659                    notify_title_trampoline::<F> as *const (),
660                )),
661                Box_::into_raw(f),
662            )
663        }
664    }
665}
666
667impl Default for StatusPage {
668    fn default() -> Self {
669        Self::new()
670    }
671}
672
673// rustdoc-stripper-ignore-next
674/// A [builder-pattern] type to construct [`StatusPage`] objects.
675///
676/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
677#[must_use = "The builder must be built to be used"]
678pub struct StatusPageBuilder {
679    builder: glib::object::ObjectBuilder<'static, StatusPage>,
680}
681
682impl StatusPageBuilder {
683    fn new() -> Self {
684        Self {
685            builder: glib::object::Object::builder(),
686        }
687    }
688
689    /// The child widget.
690    pub fn child(self, child: &impl IsA<gtk::Widget>) -> Self {
691        Self {
692            builder: self.builder.property("child", child.clone().upcast()),
693        }
694    }
695
696    /// The description markup to be displayed below the title.
697    pub fn description(self, description: impl Into<glib::GString>) -> Self {
698        Self {
699            builder: self.builder.property("description", description.into()),
700        }
701    }
702
703    /// The name of the icon to be used.
704    ///
705    /// Changing this will set [`paintable`][struct@crate::StatusPage#paintable] to `NULL`.
706    pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
707        Self {
708            builder: self.builder.property("icon-name", icon_name.into()),
709        }
710    }
711
712    /// The paintable to be used.
713    ///
714    /// Changing this will set [`icon-name`][struct@crate::StatusPage#icon-name] to `NULL`.
715    pub fn paintable(self, paintable: &impl IsA<gdk::Paintable>) -> Self {
716        Self {
717            builder: self
718                .builder
719                .property("paintable", paintable.clone().upcast()),
720        }
721    }
722
723    /// The title to be displayed below the icon.
724    ///
725    /// It is not parsed as Pango markup.
726    pub fn title(self, title: impl Into<glib::GString>) -> Self {
727        Self {
728            builder: self.builder.property("title", title.into()),
729        }
730    }
731
732    /// Whether the widget or any of its descendents can accept
733    /// the input focus.
734    ///
735    /// This property is meant to be set by widget implementations,
736    /// typically in their instance init function.
737    pub fn can_focus(self, can_focus: bool) -> Self {
738        Self {
739            builder: self.builder.property("can-focus", can_focus),
740        }
741    }
742
743    /// Whether the widget can receive pointer events.
744    pub fn can_target(self, can_target: bool) -> Self {
745        Self {
746            builder: self.builder.property("can-target", can_target),
747        }
748    }
749
750    /// A list of css classes applied to this widget.
751    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
752        Self {
753            builder: self.builder.property("css-classes", css_classes.into()),
754        }
755    }
756
757    /// The name of this widget in the CSS tree.
758    ///
759    /// This property is meant to be set by widget implementations,
760    /// typically in their instance init function.
761    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
762        Self {
763            builder: self.builder.property("css-name", css_name.into()),
764        }
765    }
766
767    /// The cursor used by @widget.
768    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
769        Self {
770            builder: self.builder.property("cursor", cursor.clone()),
771        }
772    }
773
774    /// Whether the widget should grab focus when it is clicked with the mouse.
775    ///
776    /// This property is only relevant for widgets that can take focus.
777    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
778        Self {
779            builder: self.builder.property("focus-on-click", focus_on_click),
780        }
781    }
782
783    /// Whether this widget itself will accept the input focus.
784    pub fn focusable(self, focusable: bool) -> Self {
785        Self {
786            builder: self.builder.property("focusable", focusable),
787        }
788    }
789
790    /// How to distribute horizontal space if widget gets extra space.
791    pub fn halign(self, halign: gtk::Align) -> Self {
792        Self {
793            builder: self.builder.property("halign", halign),
794        }
795    }
796
797    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip]
798    /// signal on @widget.
799    ///
800    /// A true value indicates that @widget can have a tooltip, in this case
801    /// the widget will be queried using [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] to
802    /// determine whether it will provide a tooltip or not.
803    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
804        Self {
805            builder: self.builder.property("has-tooltip", has_tooltip),
806        }
807    }
808
809    /// Overrides for height request of the widget.
810    ///
811    /// If this is -1, the natural request will be used.
812    pub fn height_request(self, height_request: i32) -> Self {
813        Self {
814            builder: self.builder.property("height-request", height_request),
815        }
816    }
817
818    /// Whether to expand horizontally.
819    pub fn hexpand(self, hexpand: bool) -> Self {
820        Self {
821            builder: self.builder.property("hexpand", hexpand),
822        }
823    }
824
825    /// Whether to use the `hexpand` property.
826    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
827        Self {
828            builder: self.builder.property("hexpand-set", hexpand_set),
829        }
830    }
831
832    /// The [`gtk::LayoutManager`][crate::gtk::LayoutManager] instance to use to compute
833    /// the preferred size of the widget, and allocate its children.
834    ///
835    /// This property is meant to be set by widget implementations,
836    /// typically in their instance init function.
837    pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
838        Self {
839            builder: self
840                .builder
841                .property("layout-manager", layout_manager.clone().upcast()),
842        }
843    }
844
845    /// Makes this widget act like a modal dialog, with respect to
846    /// event delivery.
847    ///
848    /// Global event controllers will not handle events with targets
849    /// inside the widget, unless they are set up to ignore propagation
850    /// limits. See `Gtk::EventController::set_propagation_limit()`.
851    #[cfg(feature = "gtk_v4_18")]
852    #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
853    pub fn limit_events(self, limit_events: bool) -> Self {
854        Self {
855            builder: self.builder.property("limit-events", limit_events),
856        }
857    }
858
859    /// Margin on bottom side of widget.
860    ///
861    /// This property adds margin outside of the widget's normal size
862    /// request, the margin will be added in addition to the size from
863    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
864    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
865        Self {
866            builder: self.builder.property("margin-bottom", margin_bottom),
867        }
868    }
869
870    /// Margin on end of widget, horizontally.
871    ///
872    /// This property supports left-to-right and right-to-left text
873    /// directions.
874    ///
875    /// This property adds margin outside of the widget's normal size
876    /// request, the margin will be added in addition to the size from
877    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
878    pub fn margin_end(self, margin_end: i32) -> Self {
879        Self {
880            builder: self.builder.property("margin-end", margin_end),
881        }
882    }
883
884    /// Margin on start of widget, horizontally.
885    ///
886    /// This property supports left-to-right and right-to-left text
887    /// directions.
888    ///
889    /// This property adds margin outside of the widget's normal size
890    /// request, the margin will be added in addition to the size from
891    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
892    pub fn margin_start(self, margin_start: i32) -> Self {
893        Self {
894            builder: self.builder.property("margin-start", margin_start),
895        }
896    }
897
898    /// Margin on top side of widget.
899    ///
900    /// This property adds margin outside of the widget's normal size
901    /// request, the margin will be added in addition to the size from
902    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
903    pub fn margin_top(self, margin_top: i32) -> Self {
904        Self {
905            builder: self.builder.property("margin-top", margin_top),
906        }
907    }
908
909    /// The name of the widget.
910    pub fn name(self, name: impl Into<glib::GString>) -> Self {
911        Self {
912            builder: self.builder.property("name", name.into()),
913        }
914    }
915
916    /// The requested opacity of the widget.
917    pub fn opacity(self, opacity: f64) -> Self {
918        Self {
919            builder: self.builder.property("opacity", opacity),
920        }
921    }
922
923    /// How content outside the widget's content area is treated.
924    ///
925    /// This property is meant to be set by widget implementations,
926    /// typically in their instance init function.
927    pub fn overflow(self, overflow: gtk::Overflow) -> Self {
928        Self {
929            builder: self.builder.property("overflow", overflow),
930        }
931    }
932
933    /// Whether the widget will receive the default action when it is focused.
934    pub fn receives_default(self, receives_default: bool) -> Self {
935        Self {
936            builder: self.builder.property("receives-default", receives_default),
937        }
938    }
939
940    /// Whether the widget responds to input.
941    pub fn sensitive(self, sensitive: bool) -> Self {
942        Self {
943            builder: self.builder.property("sensitive", sensitive),
944        }
945    }
946
947    /// Sets the text of tooltip to be the given string, which is marked up
948    /// with Pango markup.
949    ///
950    /// Also see `Gtk::Tooltip::set_markup()`.
951    ///
952    /// This is a convenience property which will take care of getting the
953    /// tooltip shown if the given string is not `NULL`:
954    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
955    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
956    /// the default signal handler.
957    ///
958    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
959    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
960    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
961        Self {
962            builder: self
963                .builder
964                .property("tooltip-markup", tooltip_markup.into()),
965        }
966    }
967
968    /// Sets the text of tooltip to be the given string.
969    ///
970    /// Also see `Gtk::Tooltip::set_text()`.
971    ///
972    /// This is a convenience property which will take care of getting the
973    /// tooltip shown if the given string is not `NULL`:
974    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
975    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
976    /// the default signal handler.
977    ///
978    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
979    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
980    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
981        Self {
982            builder: self.builder.property("tooltip-text", tooltip_text.into()),
983        }
984    }
985
986    /// How to distribute vertical space if widget gets extra space.
987    pub fn valign(self, valign: gtk::Align) -> Self {
988        Self {
989            builder: self.builder.property("valign", valign),
990        }
991    }
992
993    /// Whether to expand vertically.
994    pub fn vexpand(self, vexpand: bool) -> Self {
995        Self {
996            builder: self.builder.property("vexpand", vexpand),
997        }
998    }
999
1000    /// Whether to use the `vexpand` property.
1001    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1002        Self {
1003            builder: self.builder.property("vexpand-set", vexpand_set),
1004        }
1005    }
1006
1007    /// Whether the widget is visible.
1008    pub fn visible(self, visible: bool) -> Self {
1009        Self {
1010            builder: self.builder.property("visible", visible),
1011        }
1012    }
1013
1014    /// Overrides for width request of the widget.
1015    ///
1016    /// If this is -1, the natural request will be used.
1017    pub fn width_request(self, width_request: i32) -> Self {
1018        Self {
1019            builder: self.builder.property("width-request", width_request),
1020        }
1021    }
1022
1023    /// The accessible role of the given [`gtk::Accessible`][crate::gtk::Accessible] implementation.
1024    ///
1025    /// The accessible role cannot be changed once set.
1026    pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
1027        Self {
1028            builder: self.builder.property("accessible-role", accessible_role),
1029        }
1030    }
1031
1032    // rustdoc-stripper-ignore-next
1033    /// Build the [`StatusPage`].
1034    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1035    pub fn build(self) -> StatusPage {
1036        assert_initialized_main_thread!();
1037        self.builder.build()
1038    }
1039}