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