Skip to main content

libadwaita/auto/
preferences_row.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
14#[cfg(feature = "gtk_v4_10")]
15#[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_10")))]
16glib::wrapper! {
17    /// A [`gtk::ListBoxRow`][crate::gtk::ListBoxRow] used to present preferences.
18    ///
19    /// The [`PreferencesRow`][crate::PreferencesRow] widget has a title that [`PreferencesDialog`][crate::PreferencesDialog]
20    /// will use to let the user look for a preference. It doesn't present the title
21    /// in any way and lets you present the preference as you please.
22    ///
23    /// [`ActionRow`][crate::ActionRow] and its derivatives are convenient to use as preference
24    /// rows as they take care of presenting the preference's title while letting you
25    /// compose the inputs of the preference around it.
26    ///
27    /// ## Properties
28    ///
29    ///
30    /// #### `title`
31    ///  The title of the preference represented by this row.
32    ///
33    /// The title is interpreted as Pango markup unless
34    /// [`use-markup`][struct@crate::PreferencesRow#use-markup] is set to `FALSE`.
35    ///
36    /// Readable | Writable
37    ///
38    ///
39    /// #### `title-selectable`
40    ///  Whether the user can copy the title from the label.
41    ///
42    /// See also [`selectable`][struct@crate::Gtk::Label#selectable].
43    ///
44    /// Readable | Writable
45    ///
46    ///
47    /// #### `use-markup`
48    ///  Whether to use Pango markup for the title label.
49    ///
50    /// Subclasses may also use it for other labels, such as subtitle.
51    ///
52    /// See also `parse_markup()`.
53    ///
54    /// Readable | Writable
55    ///
56    ///
57    /// #### `use-underline`
58    ///  Whether an embedded underline in the title indicates a mnemonic.
59    ///
60    /// Readable | Writable
61    /// <details><summary><h4>ListBoxRow</h4></summary>
62    ///
63    ///
64    /// #### `activatable`
65    ///  Determines whether the ::row-activated
66    /// signal will be emitted for this row.
67    ///
68    /// Readable | Writable
69    ///
70    ///
71    /// #### `child`
72    ///  The child widget.
73    ///
74    /// Readable | Writable
75    ///
76    ///
77    /// #### `selectable`
78    ///  Determines whether this row can be selected.
79    ///
80    /// Readable | Writable
81    /// </details>
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 | Writable
93    ///
94    ///
95    /// #### `can-target`
96    ///  Whether the widget can receive pointer events.
97    ///
98    /// Readable | Writable
99    ///
100    ///
101    /// #### `css-classes`
102    ///  A list of css classes applied to this widget.
103    ///
104    /// Readable | Writable
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 | Writable | Construct Only
114    ///
115    ///
116    /// #### `cursor`
117    ///  The cursor used by @widget.
118    ///
119    /// Readable | Writable
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 | Writable
128    ///
129    ///
130    /// #### `focusable`
131    ///  Whether this widget itself will accept the input focus.
132    ///
133    /// Readable | Writable
134    ///
135    ///
136    /// #### `halign`
137    ///  How to distribute horizontal space if widget gets extra space.
138    ///
139    /// Readable | Writable
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 | Writable
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 | Writable
171    ///
172    ///
173    /// #### `hexpand`
174    ///  Whether to expand horizontally.
175    ///
176    /// Readable | Writable
177    ///
178    ///
179    /// #### `hexpand-set`
180    ///  Whether to use the `hexpand` property.
181    ///
182    /// Readable | Writable
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 | Writable
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 | Writable
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 | Writable
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 | Writable
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 | Writable
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 | Writable
250    ///
251    ///
252    /// #### `name`
253    ///  The name of the widget.
254    ///
255    /// Readable | Writable
256    ///
257    ///
258    /// #### `opacity`
259    ///  The requested opacity of the widget.
260    ///
261    /// Readable | Writable
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 | Writable
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 | Writable
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 | Writable
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 | Writable
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 | Writable
338    ///
339    ///
340    /// #### `valign`
341    ///  How to distribute vertical space if widget gets extra space.
342    ///
343    /// Readable | Writable
344    ///
345    ///
346    /// #### `vexpand`
347    ///  Whether to expand vertically.
348    ///
349    /// Readable | Writable
350    ///
351    ///
352    /// #### `vexpand-set`
353    ///  Whether to use the `vexpand` property.
354    ///
355    /// Readable | Writable
356    ///
357    ///
358    /// #### `visible`
359    ///  Whether the widget is visible.
360    ///
361    /// Readable | Writable
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 | Writable
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 | Writable
380    /// </details>
381    /// <details><summary><h4>Actionable</h4></summary>
382    ///
383    ///
384    /// #### `action-name`
385    ///  The name of the action with which this widget should be associated.
386    ///
387    /// Readable | Writable
388    ///
389    ///
390    /// #### `action-target`
391    ///  The target value of the actionable widget's action.
392    ///
393    /// Readable | Writable
394    /// </details>
395    ///
396    /// # Implements
397    ///
398    /// [`PreferencesRowExt`][trait@crate::prelude::PreferencesRowExt], [`trait@gtk::prelude::ListBoxRowExt`], [`trait@gtk::prelude::WidgetExt`], [`trait@glib::ObjectExt`], [`trait@gtk::prelude::AccessibleExt`], [`trait@gtk::prelude::BuildableExt`], [`trait@gtk::prelude::ConstraintTargetExt`], [`trait@gtk::prelude::ActionableExt`]
399    #[doc(alias = "AdwPreferencesRow")]
400    pub struct PreferencesRow(Object<ffi::AdwPreferencesRow, ffi::AdwPreferencesRowClass>) @extends gtk::ListBoxRow, gtk::Widget, @implements gtk::Accessible, gtk::Buildable, gtk::ConstraintTarget, gtk::Actionable;
401
402    match fn {
403        type_ => || ffi::adw_preferences_row_get_type(),
404    }
405}
406
407#[cfg(not(feature = "gtk_v4_10"))]
408glib::wrapper! {
409    #[doc(alias = "AdwPreferencesRow")]
410    pub struct PreferencesRow(Object<ffi::AdwPreferencesRow, ffi::AdwPreferencesRowClass>) @extends gtk::ListBoxRow, gtk::Widget, @implements gtk::Buildable, gtk::ConstraintTarget, gtk::Actionable;
411
412    match fn {
413        type_ => || ffi::adw_preferences_row_get_type(),
414    }
415}
416
417impl PreferencesRow {
418    pub const NONE: Option<&'static PreferencesRow> = None;
419
420    /// Creates a new [`PreferencesRow`][crate::PreferencesRow].
421    ///
422    /// # Returns
423    ///
424    /// the newly created [`PreferencesRow`][crate::PreferencesRow]
425    #[doc(alias = "adw_preferences_row_new")]
426    pub fn new() -> PreferencesRow {
427        assert_initialized_main_thread!();
428        unsafe { gtk::Widget::from_glib_none(ffi::adw_preferences_row_new()).unsafe_cast() }
429    }
430
431    // rustdoc-stripper-ignore-next
432    /// Creates a new builder-pattern struct instance to construct [`PreferencesRow`] objects.
433    ///
434    /// This method returns an instance of [`PreferencesRowBuilder`](crate::builders::PreferencesRowBuilder) which can be used to create [`PreferencesRow`] objects.
435    pub fn builder() -> PreferencesRowBuilder {
436        PreferencesRowBuilder::new()
437    }
438}
439
440impl Default for PreferencesRow {
441    fn default() -> Self {
442        Self::new()
443    }
444}
445
446// rustdoc-stripper-ignore-next
447/// A [builder-pattern] type to construct [`PreferencesRow`] objects.
448///
449/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
450#[must_use = "The builder must be built to be used"]
451pub struct PreferencesRowBuilder {
452    builder: glib::object::ObjectBuilder<'static, PreferencesRow>,
453}
454
455impl PreferencesRowBuilder {
456    fn new() -> Self {
457        Self {
458            builder: glib::object::Object::builder(),
459        }
460    }
461
462    /// The title of the preference represented by this row.
463    ///
464    /// The title is interpreted as Pango markup unless
465    /// [`use-markup`][struct@crate::PreferencesRow#use-markup] is set to `FALSE`.
466    pub fn title(self, title: impl Into<glib::GString>) -> Self {
467        Self {
468            builder: self.builder.property("title", title.into()),
469        }
470    }
471
472    /// Whether the user can copy the title from the label.
473    ///
474    /// See also [`selectable`][struct@crate::Gtk::Label#selectable].
475    #[cfg(feature = "v1_1")]
476    #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))]
477    pub fn title_selectable(self, title_selectable: bool) -> Self {
478        Self {
479            builder: self.builder.property("title-selectable", title_selectable),
480        }
481    }
482
483    /// Whether to use Pango markup for the title label.
484    ///
485    /// Subclasses may also use it for other labels, such as subtitle.
486    ///
487    /// See also `parse_markup()`.
488    #[cfg(feature = "v1_2")]
489    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
490    pub fn use_markup(self, use_markup: bool) -> Self {
491        Self {
492            builder: self.builder.property("use-markup", use_markup),
493        }
494    }
495
496    /// Whether an embedded underline in the title indicates a mnemonic.
497    pub fn use_underline(self, use_underline: bool) -> Self {
498        Self {
499            builder: self.builder.property("use-underline", use_underline),
500        }
501    }
502
503    /// Determines whether the ::row-activated
504    /// signal will be emitted for this row.
505    pub fn activatable(self, activatable: bool) -> Self {
506        Self {
507            builder: self.builder.property("activatable", activatable),
508        }
509    }
510
511    /// The child widget.
512    pub fn child(self, child: &impl IsA<gtk::Widget>) -> Self {
513        Self {
514            builder: self.builder.property("child", child.clone().upcast()),
515        }
516    }
517
518    /// Determines whether this row can be selected.
519    pub fn selectable(self, selectable: bool) -> Self {
520        Self {
521            builder: self.builder.property("selectable", selectable),
522        }
523    }
524
525    /// Whether the widget or any of its descendents can accept
526    /// the input focus.
527    ///
528    /// This property is meant to be set by widget implementations,
529    /// typically in their instance init function.
530    pub fn can_focus(self, can_focus: bool) -> Self {
531        Self {
532            builder: self.builder.property("can-focus", can_focus),
533        }
534    }
535
536    /// Whether the widget can receive pointer events.
537    pub fn can_target(self, can_target: bool) -> Self {
538        Self {
539            builder: self.builder.property("can-target", can_target),
540        }
541    }
542
543    /// A list of css classes applied to this widget.
544    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
545        Self {
546            builder: self.builder.property("css-classes", css_classes.into()),
547        }
548    }
549
550    /// The name of this widget in the CSS tree.
551    ///
552    /// This property is meant to be set by widget implementations,
553    /// typically in their instance init function.
554    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
555        Self {
556            builder: self.builder.property("css-name", css_name.into()),
557        }
558    }
559
560    /// The cursor used by @widget.
561    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
562        Self {
563            builder: self.builder.property("cursor", cursor.clone()),
564        }
565    }
566
567    /// Whether the widget should grab focus when it is clicked with the mouse.
568    ///
569    /// This property is only relevant for widgets that can take focus.
570    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
571        Self {
572            builder: self.builder.property("focus-on-click", focus_on_click),
573        }
574    }
575
576    /// Whether this widget itself will accept the input focus.
577    pub fn focusable(self, focusable: bool) -> Self {
578        Self {
579            builder: self.builder.property("focusable", focusable),
580        }
581    }
582
583    /// How to distribute horizontal space if widget gets extra space.
584    pub fn halign(self, halign: gtk::Align) -> Self {
585        Self {
586            builder: self.builder.property("halign", halign),
587        }
588    }
589
590    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip]
591    /// signal on @widget.
592    ///
593    /// A true value indicates that @widget can have a tooltip, in this case
594    /// the widget will be queried using [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] to
595    /// determine whether it will provide a tooltip or not.
596    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
597        Self {
598            builder: self.builder.property("has-tooltip", has_tooltip),
599        }
600    }
601
602    /// Overrides for height request of the widget.
603    ///
604    /// If this is -1, the natural request will be used.
605    pub fn height_request(self, height_request: i32) -> Self {
606        Self {
607            builder: self.builder.property("height-request", height_request),
608        }
609    }
610
611    /// Whether to expand horizontally.
612    pub fn hexpand(self, hexpand: bool) -> Self {
613        Self {
614            builder: self.builder.property("hexpand", hexpand),
615        }
616    }
617
618    /// Whether to use the `hexpand` property.
619    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
620        Self {
621            builder: self.builder.property("hexpand-set", hexpand_set),
622        }
623    }
624
625    /// The [`gtk::LayoutManager`][crate::gtk::LayoutManager] instance to use to compute
626    /// the preferred size of the widget, and allocate its children.
627    ///
628    /// This property is meant to be set by widget implementations,
629    /// typically in their instance init function.
630    pub fn layout_manager(self, layout_manager: &impl IsA<gtk::LayoutManager>) -> Self {
631        Self {
632            builder: self
633                .builder
634                .property("layout-manager", layout_manager.clone().upcast()),
635        }
636    }
637
638    /// Makes this widget act like a modal dialog, with respect to
639    /// event delivery.
640    ///
641    /// Global event controllers will not handle events with targets
642    /// inside the widget, unless they are set up to ignore propagation
643    /// limits. See `Gtk::EventController::set_propagation_limit()`.
644    #[cfg(feature = "gtk_v4_18")]
645    #[cfg_attr(docsrs, doc(cfg(feature = "gtk_v4_18")))]
646    pub fn limit_events(self, limit_events: bool) -> Self {
647        Self {
648            builder: self.builder.property("limit-events", limit_events),
649        }
650    }
651
652    /// Margin on bottom side of widget.
653    ///
654    /// This property adds margin outside of the widget's normal size
655    /// request, the margin will be added in addition to the size from
656    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
657    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
658        Self {
659            builder: self.builder.property("margin-bottom", margin_bottom),
660        }
661    }
662
663    /// Margin on end of widget, horizontally.
664    ///
665    /// This property supports left-to-right and right-to-left text
666    /// directions.
667    ///
668    /// This property adds margin outside of the widget's normal size
669    /// request, the margin will be added in addition to the size from
670    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
671    pub fn margin_end(self, margin_end: i32) -> Self {
672        Self {
673            builder: self.builder.property("margin-end", margin_end),
674        }
675    }
676
677    /// Margin on start of widget, horizontally.
678    ///
679    /// This property supports left-to-right and right-to-left text
680    /// directions.
681    ///
682    /// This property adds margin outside of the widget's normal size
683    /// request, the margin will be added in addition to the size from
684    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
685    pub fn margin_start(self, margin_start: i32) -> Self {
686        Self {
687            builder: self.builder.property("margin-start", margin_start),
688        }
689    }
690
691    /// Margin on top side of widget.
692    ///
693    /// This property adds margin outside of the widget's normal size
694    /// request, the margin will be added in addition to the size from
695    /// [`WidgetExtManual::set_size_request()`][crate::gtk::prelude::WidgetExtManual::set_size_request()] for example.
696    pub fn margin_top(self, margin_top: i32) -> Self {
697        Self {
698            builder: self.builder.property("margin-top", margin_top),
699        }
700    }
701
702    /// The name of the widget.
703    pub fn name(self, name: impl Into<glib::GString>) -> Self {
704        Self {
705            builder: self.builder.property("name", name.into()),
706        }
707    }
708
709    /// The requested opacity of the widget.
710    pub fn opacity(self, opacity: f64) -> Self {
711        Self {
712            builder: self.builder.property("opacity", opacity),
713        }
714    }
715
716    /// How content outside the widget's content area is treated.
717    ///
718    /// This property is meant to be set by widget implementations,
719    /// typically in their instance init function.
720    pub fn overflow(self, overflow: gtk::Overflow) -> Self {
721        Self {
722            builder: self.builder.property("overflow", overflow),
723        }
724    }
725
726    /// Whether the widget will receive the default action when it is focused.
727    pub fn receives_default(self, receives_default: bool) -> Self {
728        Self {
729            builder: self.builder.property("receives-default", receives_default),
730        }
731    }
732
733    /// Whether the widget responds to input.
734    pub fn sensitive(self, sensitive: bool) -> Self {
735        Self {
736            builder: self.builder.property("sensitive", sensitive),
737        }
738    }
739
740    /// Sets the text of tooltip to be the given string, which is marked up
741    /// with Pango markup.
742    ///
743    /// Also see `Gtk::Tooltip::set_markup()`.
744    ///
745    /// This is a convenience property which will take care of getting the
746    /// tooltip shown if the given string is not `NULL`:
747    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
748    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
749    /// the default signal handler.
750    ///
751    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
752    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
753    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
754        Self {
755            builder: self
756                .builder
757                .property("tooltip-markup", tooltip_markup.into()),
758        }
759    }
760
761    /// Sets the text of tooltip to be the given string.
762    ///
763    /// Also see `Gtk::Tooltip::set_text()`.
764    ///
765    /// This is a convenience property which will take care of getting the
766    /// tooltip shown if the given string is not `NULL`:
767    /// [`has-tooltip`][struct@crate::gtk::Widget#has-tooltip] will automatically be set to true
768    /// and there will be taken care of [`query-tooltip`][struct@crate::gtk::Widget#query-tooltip] in
769    /// the default signal handler.
770    ///
771    /// Note that if both [`tooltip-text`][struct@crate::gtk::Widget#tooltip-text] and
772    /// [`tooltip-markup`][struct@crate::gtk::Widget#tooltip-markup] are set, the last one wins.
773    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
774        Self {
775            builder: self.builder.property("tooltip-text", tooltip_text.into()),
776        }
777    }
778
779    /// How to distribute vertical space if widget gets extra space.
780    pub fn valign(self, valign: gtk::Align) -> Self {
781        Self {
782            builder: self.builder.property("valign", valign),
783        }
784    }
785
786    /// Whether to expand vertically.
787    pub fn vexpand(self, vexpand: bool) -> Self {
788        Self {
789            builder: self.builder.property("vexpand", vexpand),
790        }
791    }
792
793    /// Whether to use the `vexpand` property.
794    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
795        Self {
796            builder: self.builder.property("vexpand-set", vexpand_set),
797        }
798    }
799
800    /// Whether the widget is visible.
801    pub fn visible(self, visible: bool) -> Self {
802        Self {
803            builder: self.builder.property("visible", visible),
804        }
805    }
806
807    /// Overrides for width request of the widget.
808    ///
809    /// If this is -1, the natural request will be used.
810    pub fn width_request(self, width_request: i32) -> Self {
811        Self {
812            builder: self.builder.property("width-request", width_request),
813        }
814    }
815
816    /// The accessible role of the given [`gtk::Accessible`][crate::gtk::Accessible] implementation.
817    ///
818    /// The accessible role cannot be changed once set.
819    pub fn accessible_role(self, accessible_role: gtk::AccessibleRole) -> Self {
820        Self {
821            builder: self.builder.property("accessible-role", accessible_role),
822        }
823    }
824
825    /// The name of the action with which this widget should be associated.
826    pub fn action_name(self, action_name: impl Into<glib::GString>) -> Self {
827        Self {
828            builder: self.builder.property("action-name", action_name.into()),
829        }
830    }
831
832    /// The target value of the actionable widget's action.
833    pub fn action_target(self, action_target: &glib::Variant) -> Self {
834        Self {
835            builder: self
836                .builder
837                .property("action-target", action_target.clone()),
838        }
839    }
840
841    // rustdoc-stripper-ignore-next
842    /// Build the [`PreferencesRow`].
843    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
844    pub fn build(self) -> PreferencesRow {
845        assert_initialized_main_thread!();
846        self.builder.build()
847    }
848}
849
850/// Trait containing all [`struct@PreferencesRow`] methods.
851///
852/// # Implementors
853///
854/// [`ActionRow`][struct@crate::ActionRow], [`ButtonRow`][struct@crate::ButtonRow], [`EntryRow`][struct@crate::EntryRow], [`ExpanderRow`][struct@crate::ExpanderRow], [`PreferencesRow`][struct@crate::PreferencesRow]
855pub trait PreferencesRowExt: IsA<PreferencesRow> + 'static {
856    /// Gets the title of the preference represented by @self.
857    ///
858    /// # Returns
859    ///
860    /// the title
861    #[doc(alias = "adw_preferences_row_get_title")]
862    #[doc(alias = "get_title")]
863    fn title(&self) -> glib::GString {
864        unsafe {
865            from_glib_none(ffi::adw_preferences_row_get_title(
866                self.as_ref().to_glib_none().0,
867            ))
868        }
869    }
870
871    /// Gets whether the user can copy the title from the label
872    ///
873    /// # Returns
874    ///
875    /// whether the user can copy the title from the label
876    #[cfg(feature = "v1_1")]
877    #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))]
878    #[doc(alias = "adw_preferences_row_get_title_selectable")]
879    #[doc(alias = "get_title_selectable")]
880    #[doc(alias = "title-selectable")]
881    fn is_title_selectable(&self) -> bool {
882        unsafe {
883            from_glib(ffi::adw_preferences_row_get_title_selectable(
884                self.as_ref().to_glib_none().0,
885            ))
886        }
887    }
888
889    /// Gets whether to use Pango markup for the title label.
890    ///
891    /// # Returns
892    ///
893    /// whether to use markup
894    #[cfg(feature = "v1_2")]
895    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
896    #[doc(alias = "adw_preferences_row_get_use_markup")]
897    #[doc(alias = "get_use_markup")]
898    #[doc(alias = "use-markup")]
899    fn uses_markup(&self) -> bool {
900        unsafe {
901            from_glib(ffi::adw_preferences_row_get_use_markup(
902                self.as_ref().to_glib_none().0,
903            ))
904        }
905    }
906
907    /// Gets whether an embedded underline in the title indicates a mnemonic.
908    ///
909    /// # Returns
910    ///
911    /// whether an embedded underline in the title indicates a mnemonic
912    #[doc(alias = "adw_preferences_row_get_use_underline")]
913    #[doc(alias = "get_use_underline")]
914    #[doc(alias = "use-underline")]
915    fn uses_underline(&self) -> bool {
916        unsafe {
917            from_glib(ffi::adw_preferences_row_get_use_underline(
918                self.as_ref().to_glib_none().0,
919            ))
920        }
921    }
922
923    /// Sets the title of the preference represented by @self.
924    ///
925    /// The title is interpreted as Pango markup unless
926    /// [`use-markup`][struct@crate::PreferencesRow#use-markup] is set to `FALSE`.
927    /// ## `title`
928    /// the title
929    #[doc(alias = "adw_preferences_row_set_title")]
930    #[doc(alias = "title")]
931    fn set_title(&self, title: &str) {
932        unsafe {
933            ffi::adw_preferences_row_set_title(
934                self.as_ref().to_glib_none().0,
935                title.to_glib_none().0,
936            );
937        }
938    }
939
940    /// Sets whether the user can copy the title from the label
941    ///
942    /// See also [`selectable`][struct@crate::Gtk::Label#selectable].
943    /// ## `title_selectable`
944    /// `TRUE` if the user can copy the title from the label
945    #[cfg(feature = "v1_1")]
946    #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))]
947    #[doc(alias = "adw_preferences_row_set_title_selectable")]
948    #[doc(alias = "title-selectable")]
949    fn set_title_selectable(&self, title_selectable: bool) {
950        unsafe {
951            ffi::adw_preferences_row_set_title_selectable(
952                self.as_ref().to_glib_none().0,
953                title_selectable.into_glib(),
954            );
955        }
956    }
957
958    /// Sets whether to use Pango markup for the title label.
959    ///
960    /// Subclasses may also use it for other labels, such as subtitle.
961    ///
962    /// See also `parse_markup()`.
963    /// ## `use_markup`
964    /// whether to use markup
965    #[cfg(feature = "v1_2")]
966    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
967    #[doc(alias = "adw_preferences_row_set_use_markup")]
968    #[doc(alias = "use-markup")]
969    fn set_use_markup(&self, use_markup: bool) {
970        unsafe {
971            ffi::adw_preferences_row_set_use_markup(
972                self.as_ref().to_glib_none().0,
973                use_markup.into_glib(),
974            );
975        }
976    }
977
978    /// Sets whether an embedded underline in the title indicates a mnemonic.
979    /// ## `use_underline`
980    /// `TRUE` if underlines in the text indicate mnemonics
981    #[doc(alias = "adw_preferences_row_set_use_underline")]
982    #[doc(alias = "use-underline")]
983    fn set_use_underline(&self, use_underline: bool) {
984        unsafe {
985            ffi::adw_preferences_row_set_use_underline(
986                self.as_ref().to_glib_none().0,
987                use_underline.into_glib(),
988            );
989        }
990    }
991
992    #[doc(alias = "title")]
993    fn connect_title_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
994        unsafe extern "C" fn notify_title_trampoline<
995            P: IsA<PreferencesRow>,
996            F: Fn(&P) + 'static,
997        >(
998            this: *mut ffi::AdwPreferencesRow,
999            _param_spec: glib::ffi::gpointer,
1000            f: glib::ffi::gpointer,
1001        ) {
1002            unsafe {
1003                let f: &F = &*(f as *const F);
1004                f(PreferencesRow::from_glib_borrow(this).unsafe_cast_ref())
1005            }
1006        }
1007        unsafe {
1008            let f: Box_<F> = Box_::new(f);
1009            connect_raw(
1010                self.as_ptr() as *mut _,
1011                c"notify::title".as_ptr(),
1012                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1013                    notify_title_trampoline::<Self, F> as *const (),
1014                )),
1015                Box_::into_raw(f),
1016            )
1017        }
1018    }
1019
1020    #[cfg(feature = "v1_1")]
1021    #[cfg_attr(docsrs, doc(cfg(feature = "v1_1")))]
1022    #[doc(alias = "title-selectable")]
1023    fn connect_title_selectable_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1024        unsafe extern "C" fn notify_title_selectable_trampoline<
1025            P: IsA<PreferencesRow>,
1026            F: Fn(&P) + 'static,
1027        >(
1028            this: *mut ffi::AdwPreferencesRow,
1029            _param_spec: glib::ffi::gpointer,
1030            f: glib::ffi::gpointer,
1031        ) {
1032            unsafe {
1033                let f: &F = &*(f as *const F);
1034                f(PreferencesRow::from_glib_borrow(this).unsafe_cast_ref())
1035            }
1036        }
1037        unsafe {
1038            let f: Box_<F> = Box_::new(f);
1039            connect_raw(
1040                self.as_ptr() as *mut _,
1041                c"notify::title-selectable".as_ptr(),
1042                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1043                    notify_title_selectable_trampoline::<Self, F> as *const (),
1044                )),
1045                Box_::into_raw(f),
1046            )
1047        }
1048    }
1049
1050    #[cfg(feature = "v1_2")]
1051    #[cfg_attr(docsrs, doc(cfg(feature = "v1_2")))]
1052    #[doc(alias = "use-markup")]
1053    fn connect_use_markup_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1054        unsafe extern "C" fn notify_use_markup_trampoline<
1055            P: IsA<PreferencesRow>,
1056            F: Fn(&P) + 'static,
1057        >(
1058            this: *mut ffi::AdwPreferencesRow,
1059            _param_spec: glib::ffi::gpointer,
1060            f: glib::ffi::gpointer,
1061        ) {
1062            unsafe {
1063                let f: &F = &*(f as *const F);
1064                f(PreferencesRow::from_glib_borrow(this).unsafe_cast_ref())
1065            }
1066        }
1067        unsafe {
1068            let f: Box_<F> = Box_::new(f);
1069            connect_raw(
1070                self.as_ptr() as *mut _,
1071                c"notify::use-markup".as_ptr(),
1072                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1073                    notify_use_markup_trampoline::<Self, F> as *const (),
1074                )),
1075                Box_::into_raw(f),
1076            )
1077        }
1078    }
1079
1080    #[doc(alias = "use-underline")]
1081    fn connect_use_underline_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1082        unsafe extern "C" fn notify_use_underline_trampoline<
1083            P: IsA<PreferencesRow>,
1084            F: Fn(&P) + 'static,
1085        >(
1086            this: *mut ffi::AdwPreferencesRow,
1087            _param_spec: glib::ffi::gpointer,
1088            f: glib::ffi::gpointer,
1089        ) {
1090            unsafe {
1091                let f: &F = &*(f as *const F);
1092                f(PreferencesRow::from_glib_borrow(this).unsafe_cast_ref())
1093            }
1094        }
1095        unsafe {
1096            let f: Box_<F> = Box_::new(f);
1097            connect_raw(
1098                self.as_ptr() as *mut _,
1099                c"notify::use-underline".as_ptr(),
1100                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1101                    notify_use_underline_trampoline::<Self, F> as *const (),
1102                )),
1103                Box_::into_raw(f),
1104            )
1105        }
1106    }
1107}
1108
1109impl<O: IsA<PreferencesRow>> PreferencesRowExt for O {}