Skip to main content

libadwaita/auto/
preferences_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
6#[cfg(feature = "v1_7")]
7#[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
8use crate::Banner;
9use crate::{PreferencesGroup, ffi};
10use glib::{
11    prelude::*,
12    signal::{SignalHandlerId, connect_raw},
13    translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18    /// A page from [`PreferencesDialog`][crate::PreferencesDialog].
19    ///
20    /// <picture>
21    ///   <source srcset="preferences-page-dark.png" media="(prefers-color-scheme: dark)">
22    ///   <img src="preferences-page.png" alt="preferences-page">
23    /// </picture>
24    ///
25    /// The [`PreferencesPage`][crate::PreferencesPage] widget gathers preferences groups into a single page
26    /// of a preferences window.
27    ///
28    /// ## CSS nodes
29    ///
30    /// [`PreferencesPage`][crate::PreferencesPage] has a single CSS node with name `preferencespage`.
31    ///
32    /// ## Accessibility
33    ///
34    /// [`PreferencesPage`][crate::PreferencesPage] uses the [enum@Gtk.AccessibleRole.group] role.
35    ///
36    /// ## Properties
37    ///
38    ///
39    /// #### `banner`
40    ///  A [`Banner`][crate::Banner] displayed at the top of the page.
41    ///
42    /// Readable | Writeable
43    ///
44    ///
45    /// #### `description`
46    ///  The description to be displayed at the top of the page.
47    ///
48    /// Readable | Writeable
49    ///
50    ///
51    /// #### `description-centered`
52    ///  Whether the description should be centered.
53    ///
54    /// Readable | Writeable
55    ///
56    ///
57    /// #### `icon-name`
58    ///  The icon name for this page.
59    ///
60    /// Readable | Writeable
61    ///
62    ///
63    /// #### `name`
64    ///  The name of this page.
65    ///
66    /// Readable | Writeable
67    ///
68    ///
69    /// #### `title`
70    ///  The title for this page.
71    ///
72    /// Readable | Writeable
73    ///
74    ///
75    /// #### `use-underline`
76    ///  Whether an embedded underline in the title indicates a mnemonic.
77    ///
78    /// Readable | Writeable
79    /// <details><summary><h4>Widget</h4></summary>
80    ///
81    ///
82    /// #### `can-focus`
83    ///  Whether the widget or any of its descendents can accept
84    /// the input focus.
85    ///
86    /// This property is meant to be set by widget implementations,
87    /// typically in their instance init function.
88    ///
89    /// Readable | Writeable
90    ///
91    ///
92    /// #### `can-target`
93    ///  Whether the widget can receive pointer events.
94    ///
95    /// Readable | Writeable
96    ///
97    ///
98    /// #### `css-classes`
99    ///  A list of css classes applied to this widget.
100    ///
101    /// Readable | Writeable
102    ///
103    ///
104    /// #### `css-name`
105    ///  The name of this widget in the CSS tree.
106    ///
107    /// This property is meant to be set by widget implementations,
108    /// typically in their instance init function.
109    ///
110    /// Readable | Writeable | Construct Only
111    ///
112    ///
113    /// #### `cursor`
114    ///  The cursor used by @widget.
115    ///
116    /// Readable | Writeable
117    ///
118    ///
119    /// #### `focus-on-click`
120    ///  Whether the widget should grab focus when it is clicked with the mouse.
121    ///
122    /// This property is only relevant for widgets that can take focus.
123    ///
124    /// Readable | Writeable
125    ///
126    ///
127    /// #### `focusable`
128    ///  Whether this widget itself will accept the input focus.
129    ///
130    /// Readable | Writeable
131    ///
132    ///
133    /// #### `halign`
134    ///  How to distribute horizontal space if widget gets extra space.
135    ///
136    /// Readable | Writeable
137    ///
138    ///
139    /// #### `has-default`
140    ///  Whether the widget is the default widget.
141    ///
142    /// Readable
143    ///
144    ///
145    /// #### `has-focus`
146    ///  Whether the widget has the input focus.
147    ///
148    /// Readable
149    ///
150    ///
151    /// #### `has-tooltip`
152    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip]
153    /// signal on @widget.
154    ///
155    /// A true value indicates that @widget can have a tooltip, in this case
156    /// the widget will be queried using [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] to
157    /// determine whether it will provide a tooltip or not.
158    ///
159    /// Readable | Writeable
160    ///
161    ///
162    /// #### `height-request`
163    ///  Overrides for height request of the widget.
164    ///
165    /// If this is -1, the natural request will be used.
166    ///
167    /// Readable | Writeable
168    ///
169    ///
170    /// #### `hexpand`
171    ///  Whether to expand horizontally.
172    ///
173    /// Readable | Writeable
174    ///
175    ///
176    /// #### `hexpand-set`
177    ///  Whether to use the `hexpand` property.
178    ///
179    /// Readable | Writeable
180    ///
181    ///
182    /// #### `layout-manager`
183    ///  The [`gtk::LayoutManager`][crate::gtk::LayoutManager] instance to use to compute
184    /// the preferred size of the widget, and allocate its children.
185    ///
186    /// This property is meant to be set by widget implementations,
187    /// typically in their instance init function.
188    ///
189    /// Readable | Writeable
190    ///
191    ///
192    /// #### `limit-events`
193    ///  Makes this widget act like a modal dialog, with respect to
194    /// event delivery.
195    ///
196    /// Global event controllers will not handle events with targets
197    /// inside the widget, unless they are set up to ignore propagation
198    /// limits. See `Gtk::EventController::set_propagation_limit()`.
199    ///
200    /// Readable | Writeable
201    ///
202    ///
203    /// #### `margin-bottom`
204    ///  Margin on bottom side of widget.
205    ///
206    /// This property adds margin outside of the widget's normal size
207    /// request, the margin will be added in addition to the size from
208    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
209    ///
210    /// Readable | Writeable
211    ///
212    ///
213    /// #### `margin-end`
214    ///  Margin on end of widget, horizontally.
215    ///
216    /// This property supports left-to-right and right-to-left text
217    /// directions.
218    ///
219    /// This property adds margin outside of the widget's normal size
220    /// request, the margin will be added in addition to the size from
221    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
222    ///
223    /// Readable | Writeable
224    ///
225    ///
226    /// #### `margin-start`
227    ///  Margin on start of widget, horizontally.
228    ///
229    /// This property supports left-to-right and right-to-left text
230    /// directions.
231    ///
232    /// This property adds margin outside of the widget's normal size
233    /// request, the margin will be added in addition to the size from
234    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
235    ///
236    /// Readable | Writeable
237    ///
238    ///
239    /// #### `margin-top`
240    ///  Margin on top side of widget.
241    ///
242    /// This property adds margin outside of the widget's normal size
243    /// request, the margin will be added in addition to the size from
244    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
245    ///
246    /// Readable | Writeable
247    ///
248    ///
249    /// #### `name`
250    ///  The name of the widget.
251    ///
252    /// Readable | Writeable
253    ///
254    ///
255    /// #### `opacity`
256    ///  The requested opacity of the widget.
257    ///
258    /// Readable | Writeable
259    ///
260    ///
261    /// #### `overflow`
262    ///  How content outside the widget's content area is treated.
263    ///
264    /// This property is meant to be set by widget implementations,
265    /// typically in their instance init function.
266    ///
267    /// Readable | Writeable
268    ///
269    ///
270    /// #### `parent`
271    ///  The parent widget of this widget.
272    ///
273    /// Readable
274    ///
275    ///
276    /// #### `receives-default`
277    ///  Whether the widget will receive the default action when it is focused.
278    ///
279    /// Readable | Writeable
280    ///
281    ///
282    /// #### `root`
283    ///  The [`gtk::Root`][crate::gtk::Root] widget of the widget tree containing this widget.
284    ///
285    /// This will be `NULL` if the widget is not contained in a root widget.
286    ///
287    /// Readable
288    ///
289    ///
290    /// #### `scale-factor`
291    ///  The scale factor of the widget.
292    ///
293    /// Readable
294    ///
295    ///
296    /// #### `sensitive`
297    ///  Whether the widget responds to input.
298    ///
299    /// Readable | Writeable
300    ///
301    ///
302    /// #### `tooltip-markup`
303    ///  Sets the text of tooltip to be the given string, which is marked up
304    /// with Pango markup.
305    ///
306    /// Also see `Gtk::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 `NULL`:
310    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
311    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
312    /// the default signal handler.
313    ///
314    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
315    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
316    ///
317    /// Readable | Writeable
318    ///
319    ///
320    /// #### `tooltip-text`
321    ///  Sets the text of tooltip to be the given string.
322    ///
323    /// Also see `Gtk::Tooltip::set_text()`.
324    ///
325    /// This is a convenience property which will take care of getting the
326    /// tooltip shown if the given string is not `NULL`:
327    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
328    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
329    /// the default signal handler.
330    ///
331    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
332    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
333    ///
334    /// Readable | Writeable
335    ///
336    ///
337    /// #### `valign`
338    ///  How to distribute vertical space if widget gets extra space.
339    ///
340    /// Readable | Writeable
341    ///
342    ///
343    /// #### `vexpand`
344    ///  Whether to expand vertically.
345    ///
346    /// Readable | Writeable
347    ///
348    ///
349    /// #### `vexpand-set`
350    ///  Whether to use the `vexpand` property.
351    ///
352    /// Readable | Writeable
353    ///
354    ///
355    /// #### `visible`
356    ///  Whether the widget is visible.
357    ///
358    /// Readable | Writeable
359    ///
360    ///
361    /// #### `width-request`
362    ///  Overrides for width request of the widget.
363    ///
364    /// If this is -1, the natural request will be used.
365    ///
366    /// Readable | Writeable
367    /// </details>
368    /// <details><summary><h4>Accessible</h4></summary>
369    ///
370    ///
371    /// #### `accessible-role`
372    ///  The accessible role of the given [`gtk::Accessible`][crate::gtk::Accessible] implementation.
373    ///
374    /// The accessible role cannot be changed once set.
375    ///
376    /// Readable | Writeable
377    /// </details>
378    ///
379    /// # Implements
380    ///
381    /// [`PreferencesPageExt`][trait@crate::prelude::PreferencesPageExt], [`trait@gtk::prelude::WidgetExt`], [`trait@glib::ObjectExt`], [`trait@gtk::prelude::AccessibleExt`], [`trait@gtk::prelude::BuildableExt`], [`trait@gtk::prelude::ConstraintTargetExt`]
382    #[doc(alias = "AdwPreferencesPage")]
383    pub struct PreferencesPage(Object<ffi::AdwPreferencesPage, ffi::AdwPreferencesPageClass>) @extends gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget;
384
385    match fn {
386        type_ => || ffi::adw_preferences_page_get_type(),
387    }
388}
389
390impl PreferencesPage {
391    pub const NONE: Option<&'static PreferencesPage> = None;
392
393    /// Creates a new [`PreferencesPage`][crate::PreferencesPage].
394    ///
395    /// # Returns
396    ///
397    /// the newly created [`PreferencesPage`][crate::PreferencesPage]
398    #[doc(alias = "adw_preferences_page_new")]
399    pub fn new() -> PreferencesPage {
400        assert_initialized_main_thread!();
401        unsafe { gtk::Widget::from_glib_none(ffi::adw_preferences_page_new()).unsafe_cast() }
402    }
403
404    // rustdoc-stripper-ignore-next
405    /// Creates a new builder-pattern struct instance to construct [`PreferencesPage`] objects.
406    ///
407    /// This method returns an instance of [`PreferencesPageBuilder`](crate::builders::PreferencesPageBuilder) which can be used to create [`PreferencesPage`] objects.
408    pub fn builder() -> PreferencesPageBuilder {
409        PreferencesPageBuilder::new()
410    }
411}
412
413impl Default for PreferencesPage {
414    fn default() -> Self {
415        Self::new()
416    }
417}
418
419// rustdoc-stripper-ignore-next
420/// A [builder-pattern] type to construct [`PreferencesPage`] objects.
421///
422/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
423#[must_use = "The builder must be built to be used"]
424pub struct PreferencesPageBuilder {
425    builder: glib::object::ObjectBuilder<'static, PreferencesPage>,
426}
427
428impl PreferencesPageBuilder {
429    fn new() -> Self {
430        Self {
431            builder: glib::object::Object::builder(),
432        }
433    }
434
435    /// A [`Banner`][crate::Banner] displayed at the top of the page.
436    #[cfg(feature = "v1_7")]
437    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
438    pub fn banner(self, banner: &Banner) -> Self {
439        Self {
440            builder: self.builder.property("banner", banner.clone()),
441        }
442    }
443
444    /// The description to be displayed at the top of the page.
445    #[cfg(feature = "v1_4")]
446    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
447    pub fn description(self, description: impl Into<glib::GString>) -> Self {
448        Self {
449            builder: self.builder.property("description", description.into()),
450        }
451    }
452
453    /// Whether the description should be centered.
454    #[cfg(feature = "v1_6")]
455    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
456    pub fn description_centered(self, description_centered: bool) -> Self {
457        Self {
458            builder: self
459                .builder
460                .property("description-centered", description_centered),
461        }
462    }
463
464    /// The icon name for this page.
465    pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
466        Self {
467            builder: self.builder.property("icon-name", icon_name.into()),
468        }
469    }
470
471    /// The name of this page.
472    pub fn name(self, name: impl Into<glib::GString>) -> Self {
473        Self {
474            builder: self.builder.property("name", name.into()),
475        }
476    }
477
478    /// The title for this page.
479    pub fn title(self, title: impl Into<glib::GString>) -> Self {
480        Self {
481            builder: self.builder.property("title", title.into()),
482        }
483    }
484
485    /// Whether an embedded underline in the title indicates a mnemonic.
486    pub fn use_underline(self, use_underline: bool) -> Self {
487        Self {
488            builder: self.builder.property("use-underline", use_underline),
489        }
490    }
491
492    /// Whether the widget or any of its descendents can accept
493    /// the input focus.
494    ///
495    /// This property is meant to be set by widget implementations,
496    /// typically in their instance init function.
497    pub fn can_focus(self, can_focus: bool) -> Self {
498        Self {
499            builder: self.builder.property("can-focus", can_focus),
500        }
501    }
502
503    /// Whether the widget can receive pointer events.
504    pub fn can_target(self, can_target: bool) -> Self {
505        Self {
506            builder: self.builder.property("can-target", can_target),
507        }
508    }
509
510    /// A list of css classes applied to this widget.
511    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
512        Self {
513            builder: self.builder.property("css-classes", css_classes.into()),
514        }
515    }
516
517    /// The name of this widget in the CSS tree.
518    ///
519    /// This property is meant to be set by widget implementations,
520    /// typically in their instance init function.
521    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
522        Self {
523            builder: self.builder.property("css-name", css_name.into()),
524        }
525    }
526
527    /// The cursor used by @widget.
528    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
529        Self {
530            builder: self.builder.property("cursor", cursor.clone()),
531        }
532    }
533
534    /// Whether the widget should grab focus when it is clicked with the mouse.
535    ///
536    /// This property is only relevant for widgets that can take focus.
537    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
538        Self {
539            builder: self.builder.property("focus-on-click", focus_on_click),
540        }
541    }
542
543    /// Whether this widget itself will accept the input focus.
544    pub fn focusable(self, focusable: bool) -> Self {
545        Self {
546            builder: self.builder.property("focusable", focusable),
547        }
548    }
549
550    /// How to distribute horizontal space if widget gets extra space.
551    pub fn halign(self, halign: gtk::Align) -> Self {
552        Self {
553            builder: self.builder.property("halign", halign),
554        }
555    }
556
557    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip]
558    /// signal on @widget.
559    ///
560    /// A true value indicates that @widget can have a tooltip, in this case
561    /// the widget will be queried using [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] to
562    /// determine whether it will provide a tooltip or not.
563    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
564        Self {
565            builder: self.builder.property("has-tooltip", has_tooltip),
566        }
567    }
568
569    /// Overrides for height request of the widget.
570    ///
571    /// If this is -1, the natural request will be used.
572    pub fn height_request(self, height_request: i32) -> Self {
573        Self {
574            builder: self.builder.property("height-request", height_request),
575        }
576    }
577
578    /// Whether to expand horizontally.
579    pub fn hexpand(self, hexpand: bool) -> Self {
580        Self {
581            builder: self.builder.property("hexpand", hexpand),
582        }
583    }
584
585    /// Whether to use the `hexpand` property.
586    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
587        Self {
588            builder: self.builder.property("hexpand-set", hexpand_set),
589        }
590    }
591
592    /// The [`gtk::LayoutManager`][crate::gtk::LayoutManager] instance to use to compute
593    /// the preferred size of the widget, and allocate its children.
594    ///
595    /// This property is meant to be set by widget implementations,
596    /// typically in their instance init function.
597    pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
598        Self {
599            builder: self
600                .builder
601                .property("layout-manager", layout_manager.clone().upcast()),
602        }
603    }
604
605    /// Makes this widget act like a modal dialog, with respect to
606    /// event delivery.
607    ///
608    /// Global event controllers will not handle events with targets
609    /// inside the widget, unless they are set up to ignore propagation
610    /// limits. See `Gtk::EventController::set_propagation_limit()`.
611    #[cfg(feature = "gtk_v4_18")]
612    #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
613    pub fn limit_events(self, limit_events: bool) -> Self {
614        Self {
615            builder: self.builder.property("limit-events", limit_events),
616        }
617    }
618
619    /// Margin on bottom side of widget.
620    ///
621    /// This property adds margin outside of the widget's normal size
622    /// request, the margin will be added in addition to the size from
623    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
624    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
625        Self {
626            builder: self.builder.property("margin-bottom", margin_bottom),
627        }
628    }
629
630    /// Margin on end of widget, horizontally.
631    ///
632    /// This property supports left-to-right and right-to-left text
633    /// directions.
634    ///
635    /// This property adds margin outside of the widget's normal size
636    /// request, the margin will be added in addition to the size from
637    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
638    pub fn margin_end(self, margin_end: i32) -> Self {
639        Self {
640            builder: self.builder.property("margin-end", margin_end),
641        }
642    }
643
644    /// Margin on start of widget, horizontally.
645    ///
646    /// This property supports left-to-right and right-to-left text
647    /// directions.
648    ///
649    /// This property adds margin outside of the widget's normal size
650    /// request, the margin will be added in addition to the size from
651    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
652    pub fn margin_start(self, margin_start: i32) -> Self {
653        Self {
654            builder: self.builder.property("margin-start", margin_start),
655        }
656    }
657
658    /// Margin on top side of widget.
659    ///
660    /// This property adds margin outside of the widget's normal size
661    /// request, the margin will be added in addition to the size from
662    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
663    pub fn margin_top(self, margin_top: i32) -> Self {
664        Self {
665            builder: self.builder.property("margin-top", margin_top),
666        }
667    }
668
669    /// The requested opacity of the widget.
670    pub fn opacity(self, opacity: f64) -> Self {
671        Self {
672            builder: self.builder.property("opacity", opacity),
673        }
674    }
675
676    /// How content outside the widget's content area is treated.
677    ///
678    /// This property is meant to be set by widget implementations,
679    /// typically in their instance init function.
680    pub fn overflow(self, overflow: gtk::Overflow) -> Self {
681        Self {
682            builder: self.builder.property("overflow", overflow),
683        }
684    }
685
686    /// Whether the widget will receive the default action when it is focused.
687    pub fn receives_default(self, receives_default: bool) -> Self {
688        Self {
689            builder: self.builder.property("receives-default", receives_default),
690        }
691    }
692
693    /// Whether the widget responds to input.
694    pub fn sensitive(self, sensitive: bool) -> Self {
695        Self {
696            builder: self.builder.property("sensitive", sensitive),
697        }
698    }
699
700    /// Sets the text of tooltip to be the given string, which is marked up
701    /// with Pango markup.
702    ///
703    /// Also see `Gtk::Tooltip::set_markup()`.
704    ///
705    /// This is a convenience property which will take care of getting the
706    /// tooltip shown if the given string is not `NULL`:
707    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
708    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
709    /// the default signal handler.
710    ///
711    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
712    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
713    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
714        Self {
715            builder: self
716                .builder
717                .property("tooltip-markup", tooltip_markup.into()),
718        }
719    }
720
721    /// Sets the text of tooltip to be the given string.
722    ///
723    /// Also see `Gtk::Tooltip::set_text()`.
724    ///
725    /// This is a convenience property which will take care of getting the
726    /// tooltip shown if the given string is not `NULL`:
727    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
728    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
729    /// the default signal handler.
730    ///
731    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
732    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
733    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
734        Self {
735            builder: self.builder.property("tooltip-text", tooltip_text.into()),
736        }
737    }
738
739    /// How to distribute vertical space if widget gets extra space.
740    pub fn valign(self, valign: gtk::Align) -> Self {
741        Self {
742            builder: self.builder.property("valign", valign),
743        }
744    }
745
746    /// Whether to expand vertically.
747    pub fn vexpand(self, vexpand: bool) -> Self {
748        Self {
749            builder: self.builder.property("vexpand", vexpand),
750        }
751    }
752
753    /// Whether to use the `vexpand` property.
754    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
755        Self {
756            builder: self.builder.property("vexpand-set", vexpand_set),
757        }
758    }
759
760    /// Whether the widget is visible.
761    pub fn visible(self, visible: bool) -> Self {
762        Self {
763            builder: self.builder.property("visible", visible),
764        }
765    }
766
767    /// Overrides for width request of the widget.
768    ///
769    /// If this is -1, the natural request will be used.
770    pub fn width_request(self, width_request: i32) -> Self {
771        Self {
772            builder: self.builder.property("width-request", width_request),
773        }
774    }
775
776    /// The accessible role of the given [`gtk::Accessible`][crate::gtk::Accessible] implementation.
777    ///
778    /// The accessible role cannot be changed once set.
779    pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
780        Self {
781            builder: self.builder.property("accessible-role", accessible_role),
782        }
783    }
784
785    // rustdoc-stripper-ignore-next
786    /// Build the [`PreferencesPage`].
787    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
788    pub fn build(self) -> PreferencesPage {
789        assert_initialized_main_thread!();
790        self.builder.build()
791    }
792}
793
794/// Trait containing all [`struct@PreferencesPage`] methods.
795///
796/// # Implementors
797///
798/// [`PreferencesPage`][struct@crate::PreferencesPage]
799pub trait PreferencesPageExt: IsA<PreferencesPage> + 'static {
800    /// Adds a preferences group to @self.
801    /// ## `group`
802    /// the group to add
803    #[doc(alias = "adw_preferences_page_add")]
804    fn add(&self, group: &impl IsA<PreferencesGroup>) {
805        unsafe {
806            ffi::adw_preferences_page_add(
807                self.as_ref().to_glib_none().0,
808                group.as_ref().to_glib_none().0,
809            );
810        }
811    }
812
813    /// Gets the banner displayed at the top of the page.
814    ///
815    /// # Returns
816    ///
817    /// the banner for @self
818    #[cfg(feature = "v1_7")]
819    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
820    #[doc(alias = "adw_preferences_page_get_banner")]
821    #[doc(alias = "get_banner")]
822    fn banner(&self) -> Option<Banner> {
823        unsafe {
824            from_glib_none(ffi::adw_preferences_page_get_banner(
825                self.as_ref().to_glib_none().0,
826            ))
827        }
828    }
829
830    /// Gets the description of @self.
831    ///
832    /// # Returns
833    ///
834    /// the description of @self.
835    #[cfg(feature = "v1_4")]
836    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
837    #[doc(alias = "adw_preferences_page_get_description")]
838    #[doc(alias = "get_description")]
839    fn description(&self) -> glib::GString {
840        unsafe {
841            from_glib_none(ffi::adw_preferences_page_get_description(
842                self.as_ref().to_glib_none().0,
843            ))
844        }
845    }
846
847    /// Gets whether the description is centered.
848    ///
849    /// # Returns
850    ///
851    /// whether the description is centered.
852    #[cfg(feature = "v1_6")]
853    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
854    #[doc(alias = "adw_preferences_page_get_description_centered")]
855    #[doc(alias = "get_description_centered")]
856    #[doc(alias = "description-centered")]
857    fn is_description_centered(&self) -> bool {
858        unsafe {
859            from_glib(ffi::adw_preferences_page_get_description_centered(
860                self.as_ref().to_glib_none().0,
861            ))
862        }
863    }
864
865    /// Gets the group at @index.
866    ///
867    /// Can return `NULL` if @index is larger than the number of groups in the page.
868    /// ## `index`
869    /// a group index
870    ///
871    /// # Returns
872    ///
873    /// the group at @index
874    #[cfg(feature = "v1_8")]
875    #[cfg_attr(docsrs, doc(cfg(feature = "v1_8")))]
876    #[doc(alias = "adw_preferences_page_get_group")]
877    #[doc(alias = "get_group")]
878    fn group(&self, index: u32) -> Option<PreferencesGroup> {
879        unsafe {
880            from_glib_none(ffi::adw_preferences_page_get_group(
881                self.as_ref().to_glib_none().0,
882                index,
883            ))
884        }
885    }
886
887    /// Gets the icon name for @self.
888    ///
889    /// # Returns
890    ///
891    /// the icon name for @self
892    #[doc(alias = "adw_preferences_page_get_icon_name")]
893    #[doc(alias = "get_icon_name")]
894    #[doc(alias = "icon-name")]
895    fn icon_name(&self) -> Option<glib::GString> {
896        unsafe {
897            from_glib_none(ffi::adw_preferences_page_get_icon_name(
898                self.as_ref().to_glib_none().0,
899            ))
900        }
901    }
902
903    /// Gets the name of @self.
904    ///
905    /// # Returns
906    ///
907    /// the name of @self
908    #[doc(alias = "adw_preferences_page_get_name")]
909    #[doc(alias = "get_name")]
910    fn name(&self) -> Option<glib::GString> {
911        unsafe {
912            from_glib_none(ffi::adw_preferences_page_get_name(
913                self.as_ref().to_glib_none().0,
914            ))
915        }
916    }
917
918    /// Gets the title of @self.
919    ///
920    /// # Returns
921    ///
922    /// the title of @self.
923    #[doc(alias = "adw_preferences_page_get_title")]
924    #[doc(alias = "get_title")]
925    fn title(&self) -> glib::GString {
926        unsafe {
927            from_glib_none(ffi::adw_preferences_page_get_title(
928                self.as_ref().to_glib_none().0,
929            ))
930        }
931    }
932
933    /// Gets whether an embedded underline in the title indicates a mnemonic.
934    ///
935    /// # Returns
936    ///
937    /// whether an embedded underline in the title indicates a mnemonic
938    #[doc(alias = "adw_preferences_page_get_use_underline")]
939    #[doc(alias = "get_use_underline")]
940    #[doc(alias = "use-underline")]
941    fn uses_underline(&self) -> bool {
942        unsafe {
943            from_glib(ffi::adw_preferences_page_get_use_underline(
944                self.as_ref().to_glib_none().0,
945            ))
946        }
947    }
948
949    /// Inserts a preferences group to @self at @index.
950    ///
951    /// If @index is negative or larger than the number of groups, appends the group,
952    /// same as [`add()`][Self::add()].
953    /// ## `group`
954    /// the group to add
955    /// ## `index`
956    /// the index to insert @group a
957    #[cfg(feature = "v1_8")]
958    #[cfg_attr(docsrs, doc(cfg(feature = "v1_8")))]
959    #[doc(alias = "adw_preferences_page_insert")]
960    fn insert(&self, group: &impl IsA<PreferencesGroup>, index: i32) {
961        unsafe {
962            ffi::adw_preferences_page_insert(
963                self.as_ref().to_glib_none().0,
964                group.as_ref().to_glib_none().0,
965                index,
966            );
967        }
968    }
969
970    /// Removes a group from @self.
971    /// ## `group`
972    /// the group to remove
973    #[doc(alias = "adw_preferences_page_remove")]
974    fn remove(&self, group: &impl IsA<PreferencesGroup>) {
975        unsafe {
976            ffi::adw_preferences_page_remove(
977                self.as_ref().to_glib_none().0,
978                group.as_ref().to_glib_none().0,
979            );
980        }
981    }
982
983    /// Scrolls the scrolled window of @self to the top.
984    #[cfg(feature = "v1_3")]
985    #[cfg_attr(docsrs, doc(cfg(feature = "v1_3")))]
986    #[doc(alias = "adw_preferences_page_scroll_to_top")]
987    fn scroll_to_top(&self) {
988        unsafe {
989            ffi::adw_preferences_page_scroll_to_top(self.as_ref().to_glib_none().0);
990        }
991    }
992
993    /// Sets the banner displayed at the top of the page.
994    /// ## `banner`
995    /// the banner to display at the top of the page
996    #[cfg(feature = "v1_7")]
997    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
998    #[doc(alias = "adw_preferences_page_set_banner")]
999    #[doc(alias = "banner")]
1000    fn set_banner(&self, banner: Option<&Banner>) {
1001        unsafe {
1002            ffi::adw_preferences_page_set_banner(
1003                self.as_ref().to_glib_none().0,
1004                banner.to_glib_none().0,
1005            );
1006        }
1007    }
1008
1009    /// Sets the description of @self.
1010    ///
1011    /// The description is displayed at the top of the page.
1012    /// ## `description`
1013    /// the description
1014    #[cfg(feature = "v1_4")]
1015    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1016    #[doc(alias = "adw_preferences_page_set_description")]
1017    #[doc(alias = "description")]
1018    fn set_description(&self, description: &str) {
1019        unsafe {
1020            ffi::adw_preferences_page_set_description(
1021                self.as_ref().to_glib_none().0,
1022                description.to_glib_none().0,
1023            );
1024        }
1025    }
1026
1027    /// Sets whether the description should be centered.
1028    /// ## `centered`
1029    /// If the description should be centered
1030    #[cfg(feature = "v1_6")]
1031    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
1032    #[doc(alias = "adw_preferences_page_set_description_centered")]
1033    #[doc(alias = "description-centered")]
1034    fn set_description_centered(&self, centered: bool) {
1035        unsafe {
1036            ffi::adw_preferences_page_set_description_centered(
1037                self.as_ref().to_glib_none().0,
1038                centered.into_glib(),
1039            );
1040        }
1041    }
1042
1043    /// Sets the icon name for @self.
1044    /// ## `icon_name`
1045    /// the icon name
1046    #[doc(alias = "adw_preferences_page_set_icon_name")]
1047    #[doc(alias = "icon-name")]
1048    fn set_icon_name(&self, icon_name: Option<&str>) {
1049        unsafe {
1050            ffi::adw_preferences_page_set_icon_name(
1051                self.as_ref().to_glib_none().0,
1052                icon_name.to_glib_none().0,
1053            );
1054        }
1055    }
1056
1057    /// Sets the name of @self.
1058    /// ## `name`
1059    /// the name
1060    #[doc(alias = "adw_preferences_page_set_name")]
1061    #[doc(alias = "name")]
1062    fn set_name(&self, name: Option<&str>) {
1063        unsafe {
1064            ffi::adw_preferences_page_set_name(
1065                self.as_ref().to_glib_none().0,
1066                name.to_glib_none().0,
1067            );
1068        }
1069    }
1070
1071    /// Sets the title of @self.
1072    /// ## `title`
1073    /// the title
1074    #[doc(alias = "adw_preferences_page_set_title")]
1075    #[doc(alias = "title")]
1076    fn set_title(&self, title: &str) {
1077        unsafe {
1078            ffi::adw_preferences_page_set_title(
1079                self.as_ref().to_glib_none().0,
1080                title.to_glib_none().0,
1081            );
1082        }
1083    }
1084
1085    /// Sets whether an embedded underline in the title indicates a mnemonic.
1086    /// ## `use_underline`
1087    /// `TRUE` if underlines in the text indicate mnemonics
1088    #[doc(alias = "adw_preferences_page_set_use_underline")]
1089    #[doc(alias = "use-underline")]
1090    fn set_use_underline(&self, use_underline: bool) {
1091        unsafe {
1092            ffi::adw_preferences_page_set_use_underline(
1093                self.as_ref().to_glib_none().0,
1094                use_underline.into_glib(),
1095            );
1096        }
1097    }
1098
1099    #[cfg(feature = "v1_7")]
1100    #[cfg_attr(docsrs, doc(cfg(feature = "v1_7")))]
1101    #[doc(alias = "banner")]
1102    fn connect_banner_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1103        unsafe extern "C" fn notify_banner_trampoline<
1104            P: IsA<PreferencesPage>,
1105            F: Fn(&P) + 'static,
1106        >(
1107            this: *mut ffi::AdwPreferencesPage,
1108            _param_spec: glib::ffi::gpointer,
1109            f: glib::ffi::gpointer,
1110        ) {
1111            unsafe {
1112                let f: &F = &*(f as *const F);
1113                f(PreferencesPage::from_glib_borrow(this).unsafe_cast_ref())
1114            }
1115        }
1116        unsafe {
1117            let f: Box_<F> = Box_::new(f);
1118            connect_raw(
1119                self.as_ptr() as *mut _,
1120                c"notify::banner".as_ptr(),
1121                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1122                    notify_banner_trampoline::<Self, F> as *const (),
1123                )),
1124                Box_::into_raw(f),
1125            )
1126        }
1127    }
1128
1129    #[cfg(feature = "v1_4")]
1130    #[cfg_attr(docsrs, doc(cfg(feature = "v1_4")))]
1131    #[doc(alias = "description")]
1132    fn connect_description_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1133        unsafe extern "C" fn notify_description_trampoline<
1134            P: IsA<PreferencesPage>,
1135            F: Fn(&P) + 'static,
1136        >(
1137            this: *mut ffi::AdwPreferencesPage,
1138            _param_spec: glib::ffi::gpointer,
1139            f: glib::ffi::gpointer,
1140        ) {
1141            unsafe {
1142                let f: &F = &*(f as *const F);
1143                f(PreferencesPage::from_glib_borrow(this).unsafe_cast_ref())
1144            }
1145        }
1146        unsafe {
1147            let f: Box_<F> = Box_::new(f);
1148            connect_raw(
1149                self.as_ptr() as *mut _,
1150                c"notify::description".as_ptr(),
1151                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1152                    notify_description_trampoline::<Self, F> as *const (),
1153                )),
1154                Box_::into_raw(f),
1155            )
1156        }
1157    }
1158
1159    #[cfg(feature = "v1_6")]
1160    #[cfg_attr(docsrs, doc(cfg(feature = "v1_6")))]
1161    #[doc(alias = "description-centered")]
1162    fn connect_description_centered_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1163        unsafe extern "C" fn notify_description_centered_trampoline<
1164            P: IsA<PreferencesPage>,
1165            F: Fn(&P) + 'static,
1166        >(
1167            this: *mut ffi::AdwPreferencesPage,
1168            _param_spec: glib::ffi::gpointer,
1169            f: glib::ffi::gpointer,
1170        ) {
1171            unsafe {
1172                let f: &F = &*(f as *const F);
1173                f(PreferencesPage::from_glib_borrow(this).unsafe_cast_ref())
1174            }
1175        }
1176        unsafe {
1177            let f: Box_<F> = Box_::new(f);
1178            connect_raw(
1179                self.as_ptr() as *mut _,
1180                c"notify::description-centered".as_ptr(),
1181                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1182                    notify_description_centered_trampoline::<Self, F> as *const (),
1183                )),
1184                Box_::into_raw(f),
1185            )
1186        }
1187    }
1188
1189    #[doc(alias = "icon-name")]
1190    fn connect_icon_name_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1191        unsafe extern "C" fn notify_icon_name_trampoline<
1192            P: IsA<PreferencesPage>,
1193            F: Fn(&P) + 'static,
1194        >(
1195            this: *mut ffi::AdwPreferencesPage,
1196            _param_spec: glib::ffi::gpointer,
1197            f: glib::ffi::gpointer,
1198        ) {
1199            unsafe {
1200                let f: &F = &*(f as *const F);
1201                f(PreferencesPage::from_glib_borrow(this).unsafe_cast_ref())
1202            }
1203        }
1204        unsafe {
1205            let f: Box_<F> = Box_::new(f);
1206            connect_raw(
1207                self.as_ptr() as *mut _,
1208                c"notify::icon-name".as_ptr(),
1209                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1210                    notify_icon_name_trampoline::<Self, F> as *const (),
1211                )),
1212                Box_::into_raw(f),
1213            )
1214        }
1215    }
1216
1217    #[doc(alias = "title")]
1218    fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1219        unsafe extern "C" fn notify_title_trampoline<
1220            P: IsA<PreferencesPage>,
1221            F: Fn(&P) + 'static,
1222        >(
1223            this: *mut ffi::AdwPreferencesPage,
1224            _param_spec: glib::ffi::gpointer,
1225            f: glib::ffi::gpointer,
1226        ) {
1227            unsafe {
1228                let f: &F = &*(f as *const F);
1229                f(PreferencesPage::from_glib_borrow(this).unsafe_cast_ref())
1230            }
1231        }
1232        unsafe {
1233            let f: Box_<F> = Box_::new(f);
1234            connect_raw(
1235                self.as_ptr() as *mut _,
1236                c"notify::title".as_ptr(),
1237                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1238                    notify_title_trampoline::<Self, F> as *const (),
1239                )),
1240                Box_::into_raw(f),
1241            )
1242        }
1243    }
1244
1245    #[doc(alias = "use-underline")]
1246    fn connect_use_underline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1247        unsafe extern "C" fn notify_use_underline_trampoline<
1248            P: IsA<PreferencesPage>,
1249            F: Fn(&P) + 'static,
1250        >(
1251            this: *mut ffi::AdwPreferencesPage,
1252            _param_spec: glib::ffi::gpointer,
1253            f: glib::ffi::gpointer,
1254        ) {
1255            unsafe {
1256                let f: &F = &*(f as *const F);
1257                f(PreferencesPage::from_glib_borrow(this).unsafe_cast_ref())
1258            }
1259        }
1260        unsafe {
1261            let f: Box_<F> = Box_::new(f);
1262            connect_raw(
1263                self.as_ptr() as *mut _,
1264                c"notify::use-underline".as_ptr(),
1265                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1266                    notify_use_underline_trampoline::<Self, F> as *const (),
1267                )),
1268                Box_::into_raw(f),
1269            )
1270        }
1271    }
1272}
1273
1274impl<O: IsA<PreferencesPage>> PreferencesPageExt for O {}