Skip to main content

gtk4/auto/
font_chooser_widget.rs

1// This file was generated by gir (https://github.com/gtk-rs/gir)
2// from gir-files (https://github.com/gtk-rs/gir-files)
3// DO NOT EDIT
4#![allow(deprecated)]
5
6#[cfg(feature = "v4_10")]
7#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
8use crate::Accessible;
9use crate::{
10    AccessibleRole, Align, Buildable, ConstraintTarget, FontChooser, FontChooserLevel,
11    LayoutManager, Overflow, Widget, ffi,
12};
13use glib::{
14    prelude::*,
15    signal::{SignalHandlerId, connect_raw},
16    translate::*,
17};
18use std::boxed::Box as Box_;
19
20#[cfg(feature = "v4_10")]
21#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
22glib::wrapper! {
23    /// Direct use of [`FontChooserWidget`][crate::FontChooserWidget] is deprecated.
24    /// The [`FontChooserWidget`][crate::FontChooserWidget] widget lets the user select a font.
25    ///
26    /// It is used in the [`FontChooserDialog`][crate::FontChooserDialog] widget to provide a
27    /// dialog for selecting fonts.
28    ///
29    /// To set the font which is initially selected, use
30    /// [`FontChooserExt::set_font()`][crate::prelude::FontChooserExt::set_font()] or [`FontChooserExt::set_font_desc()`][crate::prelude::FontChooserExt::set_font_desc()].
31    ///
32    /// To get the selected font use [`FontChooserExt::font()`][crate::prelude::FontChooserExt::font()] or
33    /// [`FontChooserExt::font_desc()`][crate::prelude::FontChooserExt::font_desc()].
34    ///
35    /// To change the text which is shown in the preview area, use
36    /// [`FontChooserExt::set_preview_text()`][crate::prelude::FontChooserExt::set_preview_text()].
37    ///
38    /// # CSS nodes
39    ///
40    /// [`FontChooserWidget`][crate::FontChooserWidget] has a single CSS node with name fontchooser.
41    ///
42    /// ## Properties
43    ///
44    ///
45    /// #### `tweak-action`
46    ///  A toggle action that can be used to switch to the tweak page
47    /// of the font chooser widget, which lets the user tweak the
48    /// OpenType features and variation axes of the selected font.
49    ///
50    /// The action will be enabled or disabled depending on whether
51    /// the selected font has any features or axes.
52    ///
53    /// Readable
54    /// <details><summary><h4>Widget</h4></summary>
55    ///
56    ///
57    /// #### `can-focus`
58    ///  Whether the widget or any of its descendents can accept
59    /// the input focus.
60    ///
61    /// This property is meant to be set by widget implementations,
62    /// typically in their instance init function.
63    ///
64    /// Readable | Writable
65    ///
66    ///
67    /// #### `can-target`
68    ///  Whether the widget can receive pointer events.
69    ///
70    /// Readable | Writable
71    ///
72    ///
73    /// #### `css-classes`
74    ///  A list of css classes applied to this widget.
75    ///
76    /// Readable | Writable
77    ///
78    ///
79    /// #### `css-name`
80    ///  The name of this widget in the CSS tree.
81    ///
82    /// This property is meant to be set by widget implementations,
83    /// typically in their instance init function.
84    ///
85    /// Readable | Writable | Construct Only
86    ///
87    ///
88    /// #### `cursor`
89    ///  The cursor used by @widget.
90    ///
91    /// Readable | Writable
92    ///
93    ///
94    /// #### `focus-on-click`
95    ///  Whether the widget should grab focus when it is clicked with the mouse.
96    ///
97    /// This property is only relevant for widgets that can take focus.
98    ///
99    /// Readable | Writable
100    ///
101    ///
102    /// #### `focusable`
103    ///  Whether this widget itself will accept the input focus.
104    ///
105    /// Readable | Writable
106    ///
107    ///
108    /// #### `halign`
109    ///  How to distribute horizontal space if widget gets extra space.
110    ///
111    /// Readable | Writable
112    ///
113    ///
114    /// #### `has-default`
115    ///  Whether the widget is the default widget.
116    ///
117    /// Readable
118    ///
119    ///
120    /// #### `has-focus`
121    ///  Whether the widget has the input focus.
122    ///
123    /// Readable
124    ///
125    ///
126    /// #### `has-tooltip`
127    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
128    /// signal on @widget.
129    ///
130    /// A true value indicates that @widget can have a tooltip, in this case
131    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
132    /// determine whether it will provide a tooltip or not.
133    ///
134    /// Readable | Writable
135    ///
136    ///
137    /// #### `height-request`
138    ///  Overrides for height request of the widget.
139    ///
140    /// If this is -1, the natural request will be used.
141    ///
142    /// Readable | Writable
143    ///
144    ///
145    /// #### `hexpand`
146    ///  Whether to expand horizontally.
147    ///
148    /// Readable | Writable
149    ///
150    ///
151    /// #### `hexpand-set`
152    ///  Whether to use the `hexpand` property.
153    ///
154    /// Readable | Writable
155    ///
156    ///
157    /// #### `layout-manager`
158    ///  The [`LayoutManager`][crate::LayoutManager] instance to use to compute
159    /// the preferred size of the widget, and allocate its children.
160    ///
161    /// This property is meant to be set by widget implementations,
162    /// typically in their instance init function.
163    ///
164    /// Readable | Writable
165    ///
166    ///
167    /// #### `limit-events`
168    ///  Makes this widget act like a modal dialog, with respect to
169    /// event delivery.
170    ///
171    /// Global event controllers will not handle events with targets
172    /// inside the widget, unless they are set up to ignore propagation
173    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
174    ///
175    /// Readable | Writable
176    ///
177    ///
178    /// #### `margin-bottom`
179    ///  Margin on bottom side of widget.
180    ///
181    /// This property adds margin outside of the widget's normal size
182    /// request, the margin will be added in addition to the size from
183    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
184    ///
185    /// Readable | Writable
186    ///
187    ///
188    /// #### `margin-end`
189    ///  Margin on end of widget, horizontally.
190    ///
191    /// This property supports left-to-right and right-to-left text
192    /// directions.
193    ///
194    /// This property adds margin outside of the widget's normal size
195    /// request, the margin will be added in addition to the size from
196    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
197    ///
198    /// Readable | Writable
199    ///
200    ///
201    /// #### `margin-start`
202    ///  Margin on start of widget, horizontally.
203    ///
204    /// This property supports left-to-right and right-to-left text
205    /// directions.
206    ///
207    /// This property adds margin outside of the widget's normal size
208    /// request, the margin will be added in addition to the size from
209    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
210    ///
211    /// Readable | Writable
212    ///
213    ///
214    /// #### `margin-top`
215    ///  Margin on top side of widget.
216    ///
217    /// This property adds margin outside of the widget's normal size
218    /// request, the margin will be added in addition to the size from
219    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
220    ///
221    /// Readable | Writable
222    ///
223    ///
224    /// #### `name`
225    ///  The name of the widget.
226    ///
227    /// Readable | Writable
228    ///
229    ///
230    /// #### `opacity`
231    ///  The requested opacity of the widget.
232    ///
233    /// Readable | Writable
234    ///
235    ///
236    /// #### `overflow`
237    ///  How content outside the widget's content area is treated.
238    ///
239    /// This property is meant to be set by widget implementations,
240    /// typically in their instance init function.
241    ///
242    /// Readable | Writable
243    ///
244    ///
245    /// #### `parent`
246    ///  The parent widget of this widget.
247    ///
248    /// Readable
249    ///
250    ///
251    /// #### `receives-default`
252    ///  Whether the widget will receive the default action when it is focused.
253    ///
254    /// Readable | Writable
255    ///
256    ///
257    /// #### `root`
258    ///  The [`Root`][crate::Root] widget of the widget tree containing this widget.
259    ///
260    /// This will be `NULL` if the widget is not contained in a root widget.
261    ///
262    /// Readable
263    ///
264    ///
265    /// #### `scale-factor`
266    ///  The scale factor of the widget.
267    ///
268    /// Readable
269    ///
270    ///
271    /// #### `sensitive`
272    ///  Whether the widget responds to input.
273    ///
274    /// Readable | Writable
275    ///
276    ///
277    /// #### `tooltip-markup`
278    ///  Sets the text of tooltip to be the given string, which is marked up
279    /// with Pango markup.
280    ///
281    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
282    ///
283    /// This is a convenience property which will take care of getting the
284    /// tooltip shown if the given string is not `NULL`:
285    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
286    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
287    /// the default signal handler.
288    ///
289    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
290    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
291    ///
292    /// Readable | Writable
293    ///
294    ///
295    /// #### `tooltip-text`
296    ///  Sets the text of tooltip to be the given string.
297    ///
298    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
299    ///
300    /// This is a convenience property which will take care of getting the
301    /// tooltip shown if the given string is not `NULL`:
302    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
303    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
304    /// the default signal handler.
305    ///
306    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
307    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
308    ///
309    /// Readable | Writable
310    ///
311    ///
312    /// #### `valign`
313    ///  How to distribute vertical space if widget gets extra space.
314    ///
315    /// Readable | Writable
316    ///
317    ///
318    /// #### `vexpand`
319    ///  Whether to expand vertically.
320    ///
321    /// Readable | Writable
322    ///
323    ///
324    /// #### `vexpand-set`
325    ///  Whether to use the `vexpand` property.
326    ///
327    /// Readable | Writable
328    ///
329    ///
330    /// #### `visible`
331    ///  Whether the widget is visible.
332    ///
333    /// Readable | Writable
334    ///
335    ///
336    /// #### `width-request`
337    ///  Overrides for width request of the widget.
338    ///
339    /// If this is -1, the natural request will be used.
340    ///
341    /// Readable | Writable
342    /// </details>
343    /// <details><summary><h4>Accessible</h4></summary>
344    ///
345    ///
346    /// #### `accessible-role`
347    ///  The accessible role of the given [`Accessible`][crate::Accessible] implementation.
348    ///
349    /// The accessible role cannot be changed once set.
350    ///
351    /// Readable | Writable
352    /// </details>
353    /// <details><summary><h4>FontChooser</h4></summary>
354    ///
355    ///
356    /// #### `font`
357    ///  The font description as a string, e.g. "Sans Italic 12".
358    ///
359    /// Readable | Writable
360    ///
361    ///
362    /// #### `font-desc`
363    ///  The font description as a [`pango::FontDescription`][crate::pango::FontDescription].
364    ///
365    /// Readable | Writable
366    ///
367    ///
368    /// #### `font-features`
369    ///  The selected font features.
370    ///
371    /// The format of the string is compatible with
372    /// CSS and with Pango attributes.
373    ///
374    /// Readable
375    ///
376    ///
377    /// #### `language`
378    ///  The language for which the font features were selected.
379    ///
380    /// Readable | Writable
381    ///
382    ///
383    /// #### `level`
384    ///  The level of granularity to offer for selecting fonts.
385    ///
386    /// Readable | Writable
387    ///
388    ///
389    /// #### `preview-text`
390    ///  The string with which to preview the font.
391    ///
392    /// Readable | Writable
393    ///
394    ///
395    /// #### `show-preview-entry`
396    ///  Whether to show an entry to change the preview text.
397    ///
398    /// Readable | Writable
399    /// </details>
400    ///
401    /// # Implements
402    ///
403    /// [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`FontChooserExt`][trait@crate::prelude::FontChooserExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual], [`FontChooserExtManual`][trait@crate::prelude::FontChooserExtManual]
404    #[doc(alias = "GtkFontChooserWidget")]
405    pub struct FontChooserWidget(Object<ffi::GtkFontChooserWidget>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget, FontChooser;
406
407    match fn {
408        type_ => || ffi::gtk_font_chooser_widget_get_type(),
409    }
410}
411
412#[cfg(not(feature = "v4_10"))]
413glib::wrapper! {
414    #[doc(alias = "GtkFontChooserWidget")]
415    pub struct FontChooserWidget(Object<ffi::GtkFontChooserWidget>) @extends Widget, @implements Buildable, ConstraintTarget, FontChooser;
416
417    match fn {
418        type_ => || ffi::gtk_font_chooser_widget_get_type(),
419    }
420}
421
422impl FontChooserWidget {
423    /// Creates a new [`FontChooserWidget`][crate::FontChooserWidget].
424    ///
425    /// # Deprecated since 4.10
426    ///
427    /// Direct use of [`FontChooserWidget`][crate::FontChooserWidget] is deprecated.
428    ///
429    /// # Returns
430    ///
431    /// a new [`FontChooserWidget`][crate::FontChooserWidget]
432    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
433    #[allow(deprecated)]
434    #[doc(alias = "gtk_font_chooser_widget_new")]
435    pub fn new() -> FontChooserWidget {
436        assert_initialized_main_thread!();
437        unsafe { Widget::from_glib_none(ffi::gtk_font_chooser_widget_new()).unsafe_cast() }
438    }
439
440    // rustdoc-stripper-ignore-next
441    /// Creates a new builder-pattern struct instance to construct [`FontChooserWidget`] objects.
442    ///
443    /// This method returns an instance of [`FontChooserWidgetBuilder`](crate::builders::FontChooserWidgetBuilder) which can be used to create [`FontChooserWidget`] objects.
444    pub fn builder() -> FontChooserWidgetBuilder {
445        FontChooserWidgetBuilder::new()
446    }
447
448    /// A toggle action that can be used to switch to the tweak page
449    /// of the font chooser widget, which lets the user tweak the
450    /// OpenType features and variation axes of the selected font.
451    ///
452    /// The action will be enabled or disabled depending on whether
453    /// the selected font has any features or axes.
454    #[doc(alias = "tweak-action")]
455    pub fn tweak_action(&self) -> Option<gio::Action> {
456        ObjectExt::property(self, "tweak-action")
457    }
458
459    #[doc(alias = "tweak-action")]
460    pub fn connect_tweak_action_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
461        unsafe extern "C" fn notify_tweak_action_trampoline<F: Fn(&FontChooserWidget) + 'static>(
462            this: *mut ffi::GtkFontChooserWidget,
463            _param_spec: glib::ffi::gpointer,
464            f: glib::ffi::gpointer,
465        ) {
466            unsafe {
467                let f: &F = &*(f as *const F);
468                f(&from_glib_borrow(this))
469            }
470        }
471        unsafe {
472            let f: Box_<F> = Box_::new(f);
473            connect_raw(
474                self.as_ptr() as *mut _,
475                c"notify::tweak-action".as_ptr(),
476                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
477                    notify_tweak_action_trampoline::<F> as *const (),
478                )),
479                Box_::into_raw(f),
480            )
481        }
482    }
483}
484
485impl Default for FontChooserWidget {
486    fn default() -> Self {
487        Self::new()
488    }
489}
490
491// rustdoc-stripper-ignore-next
492/// A [builder-pattern] type to construct [`FontChooserWidget`] objects.
493///
494/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
495#[must_use = "The builder must be built to be used"]
496pub struct FontChooserWidgetBuilder {
497    builder: glib::object::ObjectBuilder<'static, FontChooserWidget>,
498}
499
500impl FontChooserWidgetBuilder {
501    fn new() -> Self {
502        Self {
503            builder: glib::object::Object::builder(),
504        }
505    }
506
507    /// Whether the widget or any of its descendents can accept
508    /// the input focus.
509    ///
510    /// This property is meant to be set by widget implementations,
511    /// typically in their instance init function.
512    pub fn can_focus(self, can_focus: bool) -> Self {
513        Self {
514            builder: self.builder.property("can-focus", can_focus),
515        }
516    }
517
518    /// Whether the widget can receive pointer events.
519    pub fn can_target(self, can_target: bool) -> Self {
520        Self {
521            builder: self.builder.property("can-target", can_target),
522        }
523    }
524
525    /// A list of css classes applied to this widget.
526    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
527        Self {
528            builder: self.builder.property("css-classes", css_classes.into()),
529        }
530    }
531
532    /// The name of this widget in the CSS tree.
533    ///
534    /// This property is meant to be set by widget implementations,
535    /// typically in their instance init function.
536    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
537        Self {
538            builder: self.builder.property("css-name", css_name.into()),
539        }
540    }
541
542    /// The cursor used by @widget.
543    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
544        Self {
545            builder: self.builder.property("cursor", cursor.clone()),
546        }
547    }
548
549    /// Whether the widget should grab focus when it is clicked with the mouse.
550    ///
551    /// This property is only relevant for widgets that can take focus.
552    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
553        Self {
554            builder: self.builder.property("focus-on-click", focus_on_click),
555        }
556    }
557
558    /// Whether this widget itself will accept the input focus.
559    pub fn focusable(self, focusable: bool) -> Self {
560        Self {
561            builder: self.builder.property("focusable", focusable),
562        }
563    }
564
565    /// How to distribute horizontal space if widget gets extra space.
566    pub fn halign(self, halign: Align) -> Self {
567        Self {
568            builder: self.builder.property("halign", halign),
569        }
570    }
571
572    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
573    /// signal on @widget.
574    ///
575    /// A true value indicates that @widget can have a tooltip, in this case
576    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
577    /// determine whether it will provide a tooltip or not.
578    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
579        Self {
580            builder: self.builder.property("has-tooltip", has_tooltip),
581        }
582    }
583
584    /// Overrides for height request of the widget.
585    ///
586    /// If this is -1, the natural request will be used.
587    pub fn height_request(self, height_request: i32) -> Self {
588        Self {
589            builder: self.builder.property("height-request", height_request),
590        }
591    }
592
593    /// Whether to expand horizontally.
594    pub fn hexpand(self, hexpand: bool) -> Self {
595        Self {
596            builder: self.builder.property("hexpand", hexpand),
597        }
598    }
599
600    /// Whether to use the `hexpand` property.
601    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
602        Self {
603            builder: self.builder.property("hexpand-set", hexpand_set),
604        }
605    }
606
607    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
608    /// the preferred size of the widget, and allocate its children.
609    ///
610    /// This property is meant to be set by widget implementations,
611    /// typically in their instance init function.
612    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
613        Self {
614            builder: self
615                .builder
616                .property("layout-manager", layout_manager.clone().upcast()),
617        }
618    }
619
620    /// Makes this widget act like a modal dialog, with respect to
621    /// event delivery.
622    ///
623    /// Global event controllers will not handle events with targets
624    /// inside the widget, unless they are set up to ignore propagation
625    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
626    #[cfg(feature = "v4_18")]
627    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
628    pub fn limit_events(self, limit_events: bool) -> Self {
629        Self {
630            builder: self.builder.property("limit-events", limit_events),
631        }
632    }
633
634    /// Margin on bottom side of widget.
635    ///
636    /// This property adds margin outside of the widget's normal size
637    /// request, the margin will be added in addition to the size from
638    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
639    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
640        Self {
641            builder: self.builder.property("margin-bottom", margin_bottom),
642        }
643    }
644
645    /// Margin on end of widget, horizontally.
646    ///
647    /// This property supports left-to-right and right-to-left text
648    /// directions.
649    ///
650    /// This property adds margin outside of the widget's normal size
651    /// request, the margin will be added in addition to the size from
652    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
653    pub fn margin_end(self, margin_end: i32) -> Self {
654        Self {
655            builder: self.builder.property("margin-end", margin_end),
656        }
657    }
658
659    /// Margin on start of widget, horizontally.
660    ///
661    /// This property supports left-to-right and right-to-left text
662    /// directions.
663    ///
664    /// This property adds margin outside of the widget's normal size
665    /// request, the margin will be added in addition to the size from
666    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
667    pub fn margin_start(self, margin_start: i32) -> Self {
668        Self {
669            builder: self.builder.property("margin-start", margin_start),
670        }
671    }
672
673    /// Margin on top side of widget.
674    ///
675    /// This property adds margin outside of the widget's normal size
676    /// request, the margin will be added in addition to the size from
677    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
678    pub fn margin_top(self, margin_top: i32) -> Self {
679        Self {
680            builder: self.builder.property("margin-top", margin_top),
681        }
682    }
683
684    /// The name of the widget.
685    pub fn name(self, name: impl Into<glib::GString>) -> Self {
686        Self {
687            builder: self.builder.property("name", name.into()),
688        }
689    }
690
691    /// The requested opacity of the widget.
692    pub fn opacity(self, opacity: f64) -> Self {
693        Self {
694            builder: self.builder.property("opacity", opacity),
695        }
696    }
697
698    /// How content outside the widget's content area is treated.
699    ///
700    /// This property is meant to be set by widget implementations,
701    /// typically in their instance init function.
702    pub fn overflow(self, overflow: Overflow) -> Self {
703        Self {
704            builder: self.builder.property("overflow", overflow),
705        }
706    }
707
708    /// Whether the widget will receive the default action when it is focused.
709    pub fn receives_default(self, receives_default: bool) -> Self {
710        Self {
711            builder: self.builder.property("receives-default", receives_default),
712        }
713    }
714
715    /// Whether the widget responds to input.
716    pub fn sensitive(self, sensitive: bool) -> Self {
717        Self {
718            builder: self.builder.property("sensitive", sensitive),
719        }
720    }
721
722    /// Sets the text of tooltip to be the given string, which is marked up
723    /// with Pango markup.
724    ///
725    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
726    ///
727    /// This is a convenience property which will take care of getting the
728    /// tooltip shown if the given string is not `NULL`:
729    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
730    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
731    /// the default signal handler.
732    ///
733    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
734    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
735    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
736        Self {
737            builder: self
738                .builder
739                .property("tooltip-markup", tooltip_markup.into()),
740        }
741    }
742
743    /// Sets the text of tooltip to be the given string.
744    ///
745    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
746    ///
747    /// This is a convenience property which will take care of getting the
748    /// tooltip shown if the given string is not `NULL`:
749    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
750    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
751    /// the default signal handler.
752    ///
753    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
754    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
755    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
756        Self {
757            builder: self.builder.property("tooltip-text", tooltip_text.into()),
758        }
759    }
760
761    /// How to distribute vertical space if widget gets extra space.
762    pub fn valign(self, valign: Align) -> Self {
763        Self {
764            builder: self.builder.property("valign", valign),
765        }
766    }
767
768    /// Whether to expand vertically.
769    pub fn vexpand(self, vexpand: bool) -> Self {
770        Self {
771            builder: self.builder.property("vexpand", vexpand),
772        }
773    }
774
775    /// Whether to use the `vexpand` property.
776    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
777        Self {
778            builder: self.builder.property("vexpand-set", vexpand_set),
779        }
780    }
781
782    /// Whether the widget is visible.
783    pub fn visible(self, visible: bool) -> Self {
784        Self {
785            builder: self.builder.property("visible", visible),
786        }
787    }
788
789    /// Overrides for width request of the widget.
790    ///
791    /// If this is -1, the natural request will be used.
792    pub fn width_request(self, width_request: i32) -> Self {
793        Self {
794            builder: self.builder.property("width-request", width_request),
795        }
796    }
797
798    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
799    ///
800    /// The accessible role cannot be changed once set.
801    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
802        Self {
803            builder: self.builder.property("accessible-role", accessible_role),
804        }
805    }
806
807    /// The font description as a string, e.g. "Sans Italic 12".
808    /// Use [`FontDialog`][crate::FontDialog] and [`FontDialogButton`][crate::FontDialogButton] instead
809    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
810    pub fn font(self, font: impl Into<glib::GString>) -> Self {
811        Self {
812            builder: self.builder.property("font", font.into()),
813        }
814    }
815
816    /// The font description as a [`pango::FontDescription`][crate::pango::FontDescription].
817    /// Use [`FontDialog`][crate::FontDialog] and [`FontDialogButton`][crate::FontDialogButton] instead
818    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
819    pub fn font_desc(self, font_desc: &pango::FontDescription) -> Self {
820        Self {
821            builder: self.builder.property("font-desc", font_desc),
822        }
823    }
824
825    /// The language for which the font features were selected.
826    /// Use [`FontDialog`][crate::FontDialog] and [`FontDialogButton`][crate::FontDialogButton] instead
827    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
828    pub fn language(self, language: impl Into<glib::GString>) -> Self {
829        Self {
830            builder: self.builder.property("language", language.into()),
831        }
832    }
833
834    /// The level of granularity to offer for selecting fonts.
835    /// Use [`FontDialog`][crate::FontDialog] and [`FontDialogButton`][crate::FontDialogButton] instead
836    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
837    pub fn level(self, level: FontChooserLevel) -> Self {
838        Self {
839            builder: self.builder.property("level", level),
840        }
841    }
842
843    /// The string with which to preview the font.
844    /// Use [`FontDialog`][crate::FontDialog] and [`FontDialogButton`][crate::FontDialogButton] instead
845    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
846    pub fn preview_text(self, preview_text: impl Into<glib::GString>) -> Self {
847        Self {
848            builder: self.builder.property("preview-text", preview_text.into()),
849        }
850    }
851
852    /// Whether to show an entry to change the preview text.
853    /// Use [`FontDialog`][crate::FontDialog] and [`FontDialogButton`][crate::FontDialogButton] instead
854    #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
855    pub fn show_preview_entry(self, show_preview_entry: bool) -> Self {
856        Self {
857            builder: self
858                .builder
859                .property("show-preview-entry", show_preview_entry),
860        }
861    }
862
863    // rustdoc-stripper-ignore-next
864    /// Build the [`FontChooserWidget`].
865    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
866    pub fn build(self) -> FontChooserWidget {
867        assert_initialized_main_thread!();
868        self.builder.build()
869    }
870}