gtk4/auto/
font_dialog_button.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
5use crate::{
6    ffi, Accessible, AccessibleRole, Align, Buildable, ConstraintTarget, FontDialog, FontLevel,
7    LayoutManager, Overflow, Widget,
8};
9#[cfg(feature = "v4_14")]
10#[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
11use glib::object::ObjectType as _;
12use glib::{
13    prelude::*,
14    signal::{connect_raw, SignalHandlerId},
15    translate::*,
16};
17use std::boxed::Box as Box_;
18
19glib::wrapper! {
20    /// Opens a font chooser dialog to select a font.
21    ///
22    /// <picture>
23    ///   <source srcset="font-button-dark.png" media="(prefers-color-scheme: dark)">
24    ///   <img alt="An example GtkFontDialogButton" src="font-button.png">
25    /// </picture>
26    ///
27    /// It is suitable widget for selecting a font in a preference dialog.
28    ///
29    /// # CSS nodes
30    ///
31    /// ```text
32    /// fontbutton
33    /// ╰── button.font
34    ///     ╰── [content]
35    /// ```
36    ///
37    /// [`FontDialogButton`][crate::FontDialogButton] has a single CSS node with name fontbutton which
38    /// contains a button node with the .font style class.
39    ///
40    /// ## Properties
41    ///
42    ///
43    /// #### `dialog`
44    ///  The [`FontDialog`][crate::FontDialog] that contains parameters for
45    /// the font chooser dialog.
46    ///
47    /// Readable | Writeable
48    ///
49    ///
50    /// #### `font-desc`
51    ///  The selected font.
52    ///
53    /// This property can be set to give the button its initial
54    /// font, and it will be updated to reflect the users choice
55    /// in the font chooser dialog.
56    ///
57    /// Listen to `notify::font-desc` to get informed about changes
58    /// to the buttons font.
59    ///
60    /// Readable | Writeable
61    ///
62    ///
63    /// #### `font-features`
64    ///  The selected font features.
65    ///
66    /// This property will be updated to reflect the users choice
67    /// in the font chooser dialog.
68    ///
69    /// Listen to `notify::font-features` to get informed about changes
70    /// to the buttons font features.
71    ///
72    /// Readable | Writeable
73    ///
74    ///
75    /// #### `language`
76    ///  The selected language for font features.
77    ///
78    /// This property will be updated to reflect the users choice
79    /// in the font chooser dialog.
80    ///
81    /// Listen to `notify::language` to get informed about changes
82    /// to the buttons language.
83    ///
84    /// Readable | Writeable
85    ///
86    ///
87    /// #### `level`
88    ///  The level of detail for the font chooser dialog.
89    ///
90    /// Readable | Writeable
91    ///
92    ///
93    /// #### `use-font`
94    ///  Whether the buttons label will be drawn in the selected font.
95    ///
96    /// Readable | Writeable
97    ///
98    ///
99    /// #### `use-size`
100    ///  Whether the buttons label will use the selected font size.
101    ///
102    /// Readable | Writeable
103    /// <details><summary><h4>Widget</h4></summary>
104    ///
105    ///
106    /// #### `can-focus`
107    ///  Whether the widget or any of its descendents can accept
108    /// the input focus.
109    ///
110    /// This property is meant to be set by widget implementations,
111    /// typically in their instance init function.
112    ///
113    /// Readable | Writeable
114    ///
115    ///
116    /// #### `can-target`
117    ///  Whether the widget can receive pointer events.
118    ///
119    /// Readable | Writeable
120    ///
121    ///
122    /// #### `css-classes`
123    ///  A list of css classes applied to this widget.
124    ///
125    /// Readable | Writeable
126    ///
127    ///
128    /// #### `css-name`
129    ///  The name of this widget in the CSS tree.
130    ///
131    /// This property is meant to be set by widget implementations,
132    /// typically in their instance init function.
133    ///
134    /// Readable | Writeable | Construct Only
135    ///
136    ///
137    /// #### `cursor`
138    ///  The cursor used by @widget.
139    ///
140    /// Readable | Writeable
141    ///
142    ///
143    /// #### `focus-on-click`
144    ///  Whether the widget should grab focus when it is clicked with the mouse.
145    ///
146    /// This property is only relevant for widgets that can take focus.
147    ///
148    /// Readable | Writeable
149    ///
150    ///
151    /// #### `focusable`
152    ///  Whether this widget itself will accept the input focus.
153    ///
154    /// Readable | Writeable
155    ///
156    ///
157    /// #### `halign`
158    ///  How to distribute horizontal space if widget gets extra space.
159    ///
160    /// Readable | Writeable
161    ///
162    ///
163    /// #### `has-default`
164    ///  Whether the widget is the default widget.
165    ///
166    /// Readable
167    ///
168    ///
169    /// #### `has-focus`
170    ///  Whether the widget has the input focus.
171    ///
172    /// Readable
173    ///
174    ///
175    /// #### `has-tooltip`
176    ///  Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
177    /// signal on @widget.
178    ///
179    /// A true value indicates that @widget can have a tooltip, in this case
180    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
181    /// determine whether it will provide a tooltip or not.
182    ///
183    /// Readable | Writeable
184    ///
185    ///
186    /// #### `height-request`
187    ///  Overrides for height request of the widget.
188    ///
189    /// If this is -1, the natural request will be used.
190    ///
191    /// Readable | Writeable
192    ///
193    ///
194    /// #### `hexpand`
195    ///  Whether to expand horizontally.
196    ///
197    /// Readable | Writeable
198    ///
199    ///
200    /// #### `hexpand-set`
201    ///  Whether to use the `hexpand` property.
202    ///
203    /// Readable | Writeable
204    ///
205    ///
206    /// #### `layout-manager`
207    ///  The [`LayoutManager`][crate::LayoutManager] instance to use to compute
208    /// the preferred size of the widget, and allocate its children.
209    ///
210    /// This property is meant to be set by widget implementations,
211    /// typically in their instance init function.
212    ///
213    /// Readable | Writeable
214    ///
215    ///
216    /// #### `limit-events`
217    ///  Makes this widget act like a modal dialog, with respect to
218    /// event delivery.
219    ///
220    /// Global event controllers will not handle events with targets
221    /// inside the widget, unless they are set up to ignore propagation
222    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
223    ///
224    /// Readable | Writeable
225    ///
226    ///
227    /// #### `margin-bottom`
228    ///  Margin on bottom side of widget.
229    ///
230    /// This property adds margin outside of the widget's normal size
231    /// request, the margin will be added in addition to the size from
232    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
233    ///
234    /// Readable | Writeable
235    ///
236    ///
237    /// #### `margin-end`
238    ///  Margin on end of widget, horizontally.
239    ///
240    /// This property supports left-to-right and right-to-left text
241    /// directions.
242    ///
243    /// This property adds margin outside of the widget's normal size
244    /// request, the margin will be added in addition to the size from
245    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
246    ///
247    /// Readable | Writeable
248    ///
249    ///
250    /// #### `margin-start`
251    ///  Margin on start of widget, horizontally.
252    ///
253    /// This property supports left-to-right and right-to-left text
254    /// directions.
255    ///
256    /// This property adds margin outside of the widget's normal size
257    /// request, the margin will be added in addition to the size from
258    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
259    ///
260    /// Readable | Writeable
261    ///
262    ///
263    /// #### `margin-top`
264    ///  Margin on top side of widget.
265    ///
266    /// This property adds margin outside of the widget's normal size
267    /// request, the margin will be added in addition to the size from
268    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
269    ///
270    /// Readable | Writeable
271    ///
272    ///
273    /// #### `name`
274    ///  The name of the widget.
275    ///
276    /// Readable | Writeable
277    ///
278    ///
279    /// #### `opacity`
280    ///  The requested opacity of the widget.
281    ///
282    /// Readable | Writeable
283    ///
284    ///
285    /// #### `overflow`
286    ///  How content outside the widget's content area is treated.
287    ///
288    /// This property is meant to be set by widget implementations,
289    /// typically in their instance init function.
290    ///
291    /// Readable | Writeable
292    ///
293    ///
294    /// #### `parent`
295    ///  The parent widget of this widget.
296    ///
297    /// Readable
298    ///
299    ///
300    /// #### `receives-default`
301    ///  Whether the widget will receive the default action when it is focused.
302    ///
303    /// Readable | Writeable
304    ///
305    ///
306    /// #### `root`
307    ///  The [`Root`][crate::Root] widget of the widget tree containing this widget.
308    ///
309    /// This will be `NULL` if the widget is not contained in a root widget.
310    ///
311    /// Readable
312    ///
313    ///
314    /// #### `scale-factor`
315    ///  The scale factor of the widget.
316    ///
317    /// Readable
318    ///
319    ///
320    /// #### `sensitive`
321    ///  Whether the widget responds to input.
322    ///
323    /// Readable | Writeable
324    ///
325    ///
326    /// #### `tooltip-markup`
327    ///  Sets the text of tooltip to be the given string, which is marked up
328    /// with Pango markup.
329    ///
330    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
331    ///
332    /// This is a convenience property which will take care of getting the
333    /// tooltip shown if the given string is not `NULL`:
334    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
335    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
336    /// the default signal handler.
337    ///
338    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
339    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
340    ///
341    /// Readable | Writeable
342    ///
343    ///
344    /// #### `tooltip-text`
345    ///  Sets the text of tooltip to be the given string.
346    ///
347    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
348    ///
349    /// This is a convenience property which will take care of getting the
350    /// tooltip shown if the given string is not `NULL`:
351    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
352    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
353    /// the default signal handler.
354    ///
355    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
356    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
357    ///
358    /// Readable | Writeable
359    ///
360    ///
361    /// #### `valign`
362    ///  How to distribute vertical space if widget gets extra space.
363    ///
364    /// Readable | Writeable
365    ///
366    ///
367    /// #### `vexpand`
368    ///  Whether to expand vertically.
369    ///
370    /// Readable | Writeable
371    ///
372    ///
373    /// #### `vexpand-set`
374    ///  Whether to use the `vexpand` property.
375    ///
376    /// Readable | Writeable
377    ///
378    ///
379    /// #### `visible`
380    ///  Whether the widget is visible.
381    ///
382    /// Readable | Writeable
383    ///
384    ///
385    /// #### `width-request`
386    ///  Overrides for width request of the widget.
387    ///
388    /// If this is -1, the natural request will be used.
389    ///
390    /// Readable | Writeable
391    /// </details>
392    /// <details><summary><h4>Accessible</h4></summary>
393    ///
394    ///
395    /// #### `accessible-role`
396    ///  The accessible role of the given [`Accessible`][crate::Accessible] implementation.
397    ///
398    /// The accessible role cannot be changed once set.
399    ///
400    /// Readable | Writeable
401    /// </details>
402    ///
403    /// ## Signals
404    ///
405    ///
406    /// #### `activate`
407    ///  Emitted when the font dialog button is activated.
408    ///
409    /// The `::activate` signal on [`FontDialogButton`][crate::FontDialogButton] is an action signal
410    /// and emitting it causes the button to pop up its dialog.
411    ///
412    /// Action
413    /// <details><summary><h4>Widget</h4></summary>
414    ///
415    ///
416    /// #### `destroy`
417    ///  Signals that all holders of a reference to the widget should release
418    /// the reference that they hold.
419    ///
420    /// May result in finalization of the widget if all references are released.
421    ///
422    /// This signal is not suitable for saving widget state.
423    ///
424    ///
425    ///
426    ///
427    /// #### `direction-changed`
428    ///  Emitted when the text direction of a widget changes.
429    ///
430    ///
431    ///
432    ///
433    /// #### `hide`
434    ///  Emitted when @widget is hidden.
435    ///
436    ///
437    ///
438    ///
439    /// #### `keynav-failed`
440    ///  Emitted if keyboard navigation fails.
441    ///
442    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
443    ///
444    ///
445    ///
446    ///
447    /// #### `map`
448    ///  Emitted when @widget is going to be mapped.
449    ///
450    /// A widget is mapped when the widget is visible (which is controlled with
451    /// [`visible`][struct@crate::Widget#visible]) and all its parents up to the toplevel widget
452    /// are also visible.
453    ///
454    /// The `::map` signal can be used to determine whether a widget will be drawn,
455    /// for instance it can resume an animation that was stopped during the
456    /// emission of [`unmap`][struct@crate::Widget#unmap].
457    ///
458    ///
459    ///
460    ///
461    /// #### `mnemonic-activate`
462    ///  Emitted when a widget is activated via a mnemonic.
463    ///
464    /// The default handler for this signal activates @widget if @group_cycling
465    /// is false, or just makes @widget grab focus if @group_cycling is true.
466    ///
467    ///
468    ///
469    ///
470    /// #### `move-focus`
471    ///  Emitted when the focus is moved.
472    ///
473    /// The `::move-focus` signal is a [keybinding signal](class.SignalAction.html).
474    ///
475    /// The default bindings for this signal are <kbd>Tab</kbd> to move forward,
476    /// and <kbd>Shift</kbd>+<kbd>Tab</kbd> to move backward.
477    ///
478    /// Action
479    ///
480    ///
481    /// #### `query-tooltip`
482    ///  Emitted when the widget’s tooltip is about to be shown.
483    ///
484    /// This happens when the [`has-tooltip`][struct@crate::Widget#has-tooltip] property
485    /// is true and the hover timeout has expired with the cursor hovering
486    /// above @widget; or emitted when @widget got focus in keyboard mode.
487    ///
488    /// Using the given coordinates, the signal handler should determine
489    /// whether a tooltip should be shown for @widget. If this is the case
490    /// true should be returned, false otherwise. Note that if @keyboard_mode
491    /// is true, the values of @x and @y are undefined and should not be used.
492    ///
493    /// The signal handler is free to manipulate @tooltip with the therefore
494    /// destined function calls.
495    ///
496    ///
497    ///
498    ///
499    /// #### `realize`
500    ///  Emitted when @widget is associated with a [`gdk::Surface`][crate::gdk::Surface].
501    ///
502    /// This means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called
503    /// or the widget has been mapped (that is, it is going to be drawn).
504    ///
505    ///
506    ///
507    ///
508    /// #### `show`
509    ///  Emitted when @widget is shown.
510    ///
511    ///
512    ///
513    ///
514    /// #### `state-flags-changed`
515    ///  Emitted when the widget state changes.
516    ///
517    /// See [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
518    ///
519    ///
520    ///
521    ///
522    /// #### `unmap`
523    ///  Emitted when @widget is going to be unmapped.
524    ///
525    /// A widget is unmapped when either it or any of its parents up to the
526    /// toplevel widget have been set as hidden.
527    ///
528    /// As `::unmap` indicates that a widget will not be shown any longer,
529    /// it can be used to, for example, stop an animation on the widget.
530    ///
531    ///
532    ///
533    ///
534    /// #### `unrealize`
535    ///  Emitted when the [`gdk::Surface`][crate::gdk::Surface] associated with @widget is destroyed.
536    ///
537    /// This means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been called
538    /// or the widget has been unmapped (that is, it is going to be hidden).
539    ///
540    ///
541    /// </details>
542    ///
543    /// # Implements
544    ///
545    /// [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual]
546    #[doc(alias = "GtkFontDialogButton")]
547    pub struct FontDialogButton(Object<ffi::GtkFontDialogButton, ffi::GtkFontDialogButtonClass>) @extends Widget, @implements Accessible, Buildable, ConstraintTarget;
548
549    match fn {
550        type_ => || ffi::gtk_font_dialog_button_get_type(),
551    }
552}
553
554impl FontDialogButton {
555    /// Creates a new [`FontDialogButton`][crate::FontDialogButton] with the
556    /// given [`FontDialog`][crate::FontDialog].
557    ///
558    /// You can pass `NULL` to this function and set a [`FontDialog`][crate::FontDialog]
559    /// later. The button will be insensitive until that happens.
560    /// ## `dialog`
561    /// the [`FontDialog`][crate::FontDialog] to use
562    ///
563    /// # Returns
564    ///
565    /// the new [`FontDialogButton`][crate::FontDialogButton]
566    #[doc(alias = "gtk_font_dialog_button_new")]
567    pub fn new(dialog: Option<FontDialog>) -> FontDialogButton {
568        assert_initialized_main_thread!();
569        unsafe {
570            Widget::from_glib_none(ffi::gtk_font_dialog_button_new(dialog.into_glib_ptr()))
571                .unsafe_cast()
572        }
573    }
574
575    // rustdoc-stripper-ignore-next
576    /// Creates a new builder-pattern struct instance to construct [`FontDialogButton`] objects.
577    ///
578    /// This method returns an instance of [`FontDialogButtonBuilder`](crate::builders::FontDialogButtonBuilder) which can be used to create [`FontDialogButton`] objects.
579    pub fn builder() -> FontDialogButtonBuilder {
580        FontDialogButtonBuilder::new()
581    }
582
583    /// Returns the [`FontDialog`][crate::FontDialog] of @self.
584    ///
585    /// # Returns
586    ///
587    /// the [`FontDialog`][crate::FontDialog]
588    #[doc(alias = "gtk_font_dialog_button_get_dialog")]
589    #[doc(alias = "get_dialog")]
590    pub fn dialog(&self) -> Option<FontDialog> {
591        unsafe {
592            from_glib_none(ffi::gtk_font_dialog_button_get_dialog(
593                self.to_glib_none().0,
594            ))
595        }
596    }
597
598    /// Returns the font of the button.
599    ///
600    /// This function is what should be used to obtain
601    /// the font that was chosen by the user. To get
602    /// informed about changes, listen to "notify::font-desc".
603    ///
604    /// # Returns
605    ///
606    /// the font
607    #[doc(alias = "gtk_font_dialog_button_get_font_desc")]
608    #[doc(alias = "get_font_desc")]
609    #[doc(alias = "font-desc")]
610    pub fn font_desc(&self) -> Option<pango::FontDescription> {
611        unsafe {
612            from_glib_none(ffi::gtk_font_dialog_button_get_font_desc(
613                self.to_glib_none().0,
614            ))
615        }
616    }
617
618    /// Returns the font features of the button.
619    ///
620    /// This function is what should be used to obtain the font features
621    /// that were chosen by the user. To get informed about changes, listen
622    /// to "notify::font-features".
623    ///
624    /// Note that the button will only let users choose font features
625    /// if [`level`][struct@crate::FontDialogButton#level] is set to
626    /// `GTK_FONT_LEVEL_FEATURES`.
627    ///
628    /// # Returns
629    ///
630    /// the font features
631    #[doc(alias = "gtk_font_dialog_button_get_font_features")]
632    #[doc(alias = "get_font_features")]
633    #[doc(alias = "font-features")]
634    pub fn font_features(&self) -> Option<glib::GString> {
635        unsafe {
636            from_glib_none(ffi::gtk_font_dialog_button_get_font_features(
637                self.to_glib_none().0,
638            ))
639        }
640    }
641
642    /// Returns the language that is used for font features.
643    ///
644    /// # Returns
645    ///
646    /// the language
647    #[doc(alias = "gtk_font_dialog_button_get_language")]
648    #[doc(alias = "get_language")]
649    pub fn language(&self) -> Option<pango::Language> {
650        unsafe {
651            from_glib_full(ffi::gtk_font_dialog_button_get_language(
652                self.to_glib_none().0,
653            ))
654        }
655    }
656
657    /// Returns the level of detail at which this dialog
658    /// lets the user select fonts.
659    ///
660    /// # Returns
661    ///
662    /// the level of detail
663    #[doc(alias = "gtk_font_dialog_button_get_level")]
664    #[doc(alias = "get_level")]
665    pub fn level(&self) -> FontLevel {
666        unsafe { from_glib(ffi::gtk_font_dialog_button_get_level(self.to_glib_none().0)) }
667    }
668
669    /// Returns whether the selected font is used in the label.
670    ///
671    /// # Returns
672    ///
673    /// whether the selected font is used in the label
674    #[doc(alias = "gtk_font_dialog_button_get_use_font")]
675    #[doc(alias = "get_use_font")]
676    #[doc(alias = "use-font")]
677    pub fn uses_font(&self) -> bool {
678        unsafe {
679            from_glib(ffi::gtk_font_dialog_button_get_use_font(
680                self.to_glib_none().0,
681            ))
682        }
683    }
684
685    /// Returns whether the selected font size is used in the label.
686    ///
687    /// # Returns
688    ///
689    /// whether the selected font size is used in the label
690    #[doc(alias = "gtk_font_dialog_button_get_use_size")]
691    #[doc(alias = "get_use_size")]
692    #[doc(alias = "use-size")]
693    pub fn uses_size(&self) -> bool {
694        unsafe {
695            from_glib(ffi::gtk_font_dialog_button_get_use_size(
696                self.to_glib_none().0,
697            ))
698        }
699    }
700
701    /// Sets a [`FontDialog`][crate::FontDialog] object to use for
702    /// creating the font chooser dialog that is
703    /// presented when the user clicks the button.
704    /// ## `dialog`
705    /// the new [`FontDialog`][crate::FontDialog]
706    #[doc(alias = "gtk_font_dialog_button_set_dialog")]
707    #[doc(alias = "dialog")]
708    pub fn set_dialog(&self, dialog: &FontDialog) {
709        unsafe {
710            ffi::gtk_font_dialog_button_set_dialog(self.to_glib_none().0, dialog.to_glib_none().0);
711        }
712    }
713
714    /// Sets the font of the button.
715    /// ## `font_desc`
716    /// the new font
717    #[doc(alias = "gtk_font_dialog_button_set_font_desc")]
718    #[doc(alias = "font-desc")]
719    pub fn set_font_desc(&self, font_desc: &pango::FontDescription) {
720        unsafe {
721            ffi::gtk_font_dialog_button_set_font_desc(
722                self.to_glib_none().0,
723                font_desc.to_glib_none().0,
724            );
725        }
726    }
727
728    /// Sets the font features of the button.
729    /// ## `font_features`
730    /// the font features
731    #[doc(alias = "gtk_font_dialog_button_set_font_features")]
732    #[doc(alias = "font-features")]
733    pub fn set_font_features(&self, font_features: Option<&str>) {
734        unsafe {
735            ffi::gtk_font_dialog_button_set_font_features(
736                self.to_glib_none().0,
737                font_features.to_glib_none().0,
738            );
739        }
740    }
741
742    /// Sets the language to use for font features.
743    /// ## `language`
744    /// the new language
745    #[doc(alias = "gtk_font_dialog_button_set_language")]
746    #[doc(alias = "language")]
747    pub fn set_language(&self, language: Option<&pango::Language>) {
748        unsafe {
749            ffi::gtk_font_dialog_button_set_language(
750                self.to_glib_none().0,
751                mut_override(language.to_glib_none().0),
752            );
753        }
754    }
755
756    /// Sets the level of detail at which this dialog
757    /// lets the user select fonts.
758    /// ## `level`
759    /// the level of detail
760    #[doc(alias = "gtk_font_dialog_button_set_level")]
761    #[doc(alias = "level")]
762    pub fn set_level(&self, level: FontLevel) {
763        unsafe {
764            ffi::gtk_font_dialog_button_set_level(self.to_glib_none().0, level.into_glib());
765        }
766    }
767
768    /// If @use_font is `TRUE`, the font name will be written
769    /// using the selected font.
770    /// ## `use_font`
771    /// If `TRUE`, font name will be written using
772    ///   the chosen font
773    #[doc(alias = "gtk_font_dialog_button_set_use_font")]
774    #[doc(alias = "use-font")]
775    pub fn set_use_font(&self, use_font: bool) {
776        unsafe {
777            ffi::gtk_font_dialog_button_set_use_font(self.to_glib_none().0, use_font.into_glib());
778        }
779    }
780
781    /// If @use_size is `TRUE`, the font name will be written
782    /// using the selected font size.
783    /// ## `use_size`
784    /// If `TRUE`, font name will be written using
785    ///   the chosen font size
786    #[doc(alias = "gtk_font_dialog_button_set_use_size")]
787    #[doc(alias = "use-size")]
788    pub fn set_use_size(&self, use_size: bool) {
789        unsafe {
790            ffi::gtk_font_dialog_button_set_use_size(self.to_glib_none().0, use_size.into_glib());
791        }
792    }
793
794    #[cfg(not(feature = "v4_10"))]
795    #[cfg_attr(docsrs, doc(cfg(not(feature = "v4_10"))))]
796    pub fn level(&self) -> FontLevel {
797        ObjectExt::property(self, "level")
798    }
799
800    #[cfg(not(feature = "v4_10"))]
801    #[cfg_attr(docsrs, doc(cfg(not(feature = "v4_10"))))]
802    pub fn set_level(&self, level: FontLevel) {
803        ObjectExt::set_property(self, "level", level)
804    }
805
806    #[cfg(not(feature = "v4_10"))]
807    #[cfg_attr(docsrs, doc(cfg(not(feature = "v4_10"))))]
808    #[doc(alias = "use-font")]
809    pub fn uses_font(&self) -> bool {
810        ObjectExt::property(self, "use-font")
811    }
812
813    #[cfg(not(feature = "v4_10"))]
814    #[cfg_attr(docsrs, doc(cfg(not(feature = "v4_10"))))]
815    #[doc(alias = "use-font")]
816    pub fn set_use_font(&self, use_font: bool) {
817        ObjectExt::set_property(self, "use-font", use_font)
818    }
819
820    #[cfg(not(feature = "v4_10"))]
821    #[cfg_attr(docsrs, doc(cfg(not(feature = "v4_10"))))]
822    #[doc(alias = "use-size")]
823    pub fn uses_size(&self) -> bool {
824        ObjectExt::property(self, "use-size")
825    }
826
827    #[cfg(not(feature = "v4_10"))]
828    #[cfg_attr(docsrs, doc(cfg(not(feature = "v4_10"))))]
829    #[doc(alias = "use-size")]
830    pub fn set_use_size(&self, use_size: bool) {
831        ObjectExt::set_property(self, "use-size", use_size)
832    }
833
834    /// Emitted when the font dialog button is activated.
835    ///
836    /// The `::activate` signal on [`FontDialogButton`][crate::FontDialogButton] is an action signal
837    /// and emitting it causes the button to pop up its dialog.
838    #[cfg(feature = "v4_14")]
839    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
840    #[doc(alias = "activate")]
841    pub fn connect_activate<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
842        unsafe extern "C" fn activate_trampoline<F: Fn(&FontDialogButton) + 'static>(
843            this: *mut ffi::GtkFontDialogButton,
844            f: glib::ffi::gpointer,
845        ) {
846            let f: &F = &*(f as *const F);
847            f(&from_glib_borrow(this))
848        }
849        unsafe {
850            let f: Box_<F> = Box_::new(f);
851            connect_raw(
852                self.as_ptr() as *mut _,
853                c"activate".as_ptr() as *const _,
854                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
855                    activate_trampoline::<F> as *const (),
856                )),
857                Box_::into_raw(f),
858            )
859        }
860    }
861
862    #[cfg(feature = "v4_14")]
863    #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
864    pub fn emit_activate(&self) {
865        self.emit_by_name::<()>("activate", &[]);
866    }
867
868    #[cfg(feature = "v4_10")]
869    #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
870    #[doc(alias = "dialog")]
871    pub fn connect_dialog_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
872        unsafe extern "C" fn notify_dialog_trampoline<F: Fn(&FontDialogButton) + 'static>(
873            this: *mut ffi::GtkFontDialogButton,
874            _param_spec: glib::ffi::gpointer,
875            f: glib::ffi::gpointer,
876        ) {
877            let f: &F = &*(f as *const F);
878            f(&from_glib_borrow(this))
879        }
880        unsafe {
881            let f: Box_<F> = Box_::new(f);
882            connect_raw(
883                self.as_ptr() as *mut _,
884                c"notify::dialog".as_ptr() as *const _,
885                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
886                    notify_dialog_trampoline::<F> as *const (),
887                )),
888                Box_::into_raw(f),
889            )
890        }
891    }
892
893    #[cfg(feature = "v4_10")]
894    #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
895    #[doc(alias = "font-desc")]
896    pub fn connect_font_desc_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
897        unsafe extern "C" fn notify_font_desc_trampoline<F: Fn(&FontDialogButton) + 'static>(
898            this: *mut ffi::GtkFontDialogButton,
899            _param_spec: glib::ffi::gpointer,
900            f: glib::ffi::gpointer,
901        ) {
902            let f: &F = &*(f as *const F);
903            f(&from_glib_borrow(this))
904        }
905        unsafe {
906            let f: Box_<F> = Box_::new(f);
907            connect_raw(
908                self.as_ptr() as *mut _,
909                c"notify::font-desc".as_ptr() as *const _,
910                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
911                    notify_font_desc_trampoline::<F> as *const (),
912                )),
913                Box_::into_raw(f),
914            )
915        }
916    }
917
918    #[cfg(feature = "v4_10")]
919    #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
920    #[doc(alias = "font-features")]
921    pub fn connect_font_features_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
922        unsafe extern "C" fn notify_font_features_trampoline<F: Fn(&FontDialogButton) + 'static>(
923            this: *mut ffi::GtkFontDialogButton,
924            _param_spec: glib::ffi::gpointer,
925            f: glib::ffi::gpointer,
926        ) {
927            let f: &F = &*(f as *const F);
928            f(&from_glib_borrow(this))
929        }
930        unsafe {
931            let f: Box_<F> = Box_::new(f);
932            connect_raw(
933                self.as_ptr() as *mut _,
934                c"notify::font-features".as_ptr() as *const _,
935                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
936                    notify_font_features_trampoline::<F> as *const (),
937                )),
938                Box_::into_raw(f),
939            )
940        }
941    }
942
943    #[cfg(feature = "v4_10")]
944    #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
945    #[doc(alias = "language")]
946    pub fn connect_language_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
947        unsafe extern "C" fn notify_language_trampoline<F: Fn(&FontDialogButton) + 'static>(
948            this: *mut ffi::GtkFontDialogButton,
949            _param_spec: glib::ffi::gpointer,
950            f: glib::ffi::gpointer,
951        ) {
952            let f: &F = &*(f as *const F);
953            f(&from_glib_borrow(this))
954        }
955        unsafe {
956            let f: Box_<F> = Box_::new(f);
957            connect_raw(
958                self.as_ptr() as *mut _,
959                c"notify::language".as_ptr() as *const _,
960                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
961                    notify_language_trampoline::<F> as *const (),
962                )),
963                Box_::into_raw(f),
964            )
965        }
966    }
967
968    #[doc(alias = "level")]
969    pub fn connect_level_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
970        unsafe extern "C" fn notify_level_trampoline<F: Fn(&FontDialogButton) + 'static>(
971            this: *mut ffi::GtkFontDialogButton,
972            _param_spec: glib::ffi::gpointer,
973            f: glib::ffi::gpointer,
974        ) {
975            let f: &F = &*(f as *const F);
976            f(&from_glib_borrow(this))
977        }
978        unsafe {
979            let f: Box_<F> = Box_::new(f);
980            connect_raw(
981                self.as_ptr() as *mut _,
982                c"notify::level".as_ptr() as *const _,
983                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
984                    notify_level_trampoline::<F> as *const (),
985                )),
986                Box_::into_raw(f),
987            )
988        }
989    }
990
991    #[doc(alias = "use-font")]
992    pub fn connect_use_font_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
993        unsafe extern "C" fn notify_use_font_trampoline<F: Fn(&FontDialogButton) + 'static>(
994            this: *mut ffi::GtkFontDialogButton,
995            _param_spec: glib::ffi::gpointer,
996            f: glib::ffi::gpointer,
997        ) {
998            let f: &F = &*(f as *const F);
999            f(&from_glib_borrow(this))
1000        }
1001        unsafe {
1002            let f: Box_<F> = Box_::new(f);
1003            connect_raw(
1004                self.as_ptr() as *mut _,
1005                c"notify::use-font".as_ptr() as *const _,
1006                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1007                    notify_use_font_trampoline::<F> as *const (),
1008                )),
1009                Box_::into_raw(f),
1010            )
1011        }
1012    }
1013
1014    #[doc(alias = "use-size")]
1015    pub fn connect_use_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1016        unsafe extern "C" fn notify_use_size_trampoline<F: Fn(&FontDialogButton) + 'static>(
1017            this: *mut ffi::GtkFontDialogButton,
1018            _param_spec: glib::ffi::gpointer,
1019            f: glib::ffi::gpointer,
1020        ) {
1021            let f: &F = &*(f as *const F);
1022            f(&from_glib_borrow(this))
1023        }
1024        unsafe {
1025            let f: Box_<F> = Box_::new(f);
1026            connect_raw(
1027                self.as_ptr() as *mut _,
1028                c"notify::use-size".as_ptr() as *const _,
1029                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1030                    notify_use_size_trampoline::<F> as *const (),
1031                )),
1032                Box_::into_raw(f),
1033            )
1034        }
1035    }
1036}
1037
1038#[cfg(feature = "v4_10")]
1039#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
1040impl Default for FontDialogButton {
1041    fn default() -> Self {
1042        glib::object::Object::new::<Self>()
1043    }
1044}
1045
1046// rustdoc-stripper-ignore-next
1047/// A [builder-pattern] type to construct [`FontDialogButton`] objects.
1048///
1049/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1050#[must_use = "The builder must be built to be used"]
1051pub struct FontDialogButtonBuilder {
1052    builder: glib::object::ObjectBuilder<'static, FontDialogButton>,
1053}
1054
1055impl FontDialogButtonBuilder {
1056    fn new() -> Self {
1057        Self {
1058            builder: glib::object::Object::builder(),
1059        }
1060    }
1061
1062    /// The [`FontDialog`][crate::FontDialog] that contains parameters for
1063    /// the font chooser dialog.
1064    #[cfg(feature = "v4_10")]
1065    #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
1066    pub fn dialog(self, dialog: &FontDialog) -> Self {
1067        Self {
1068            builder: self.builder.property("dialog", dialog.clone()),
1069        }
1070    }
1071
1072    /// The selected font.
1073    ///
1074    /// This property can be set to give the button its initial
1075    /// font, and it will be updated to reflect the users choice
1076    /// in the font chooser dialog.
1077    ///
1078    /// Listen to `notify::font-desc` to get informed about changes
1079    /// to the buttons font.
1080    #[cfg(feature = "v4_10")]
1081    #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
1082    pub fn font_desc(self, font_desc: &pango::FontDescription) -> Self {
1083        Self {
1084            builder: self.builder.property("font-desc", font_desc),
1085        }
1086    }
1087
1088    /// The selected font features.
1089    ///
1090    /// This property will be updated to reflect the users choice
1091    /// in the font chooser dialog.
1092    ///
1093    /// Listen to `notify::font-features` to get informed about changes
1094    /// to the buttons font features.
1095    #[cfg(feature = "v4_10")]
1096    #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
1097    pub fn font_features(self, font_features: impl Into<glib::GString>) -> Self {
1098        Self {
1099            builder: self.builder.property("font-features", font_features.into()),
1100        }
1101    }
1102
1103    /// The selected language for font features.
1104    ///
1105    /// This property will be updated to reflect the users choice
1106    /// in the font chooser dialog.
1107    ///
1108    /// Listen to `notify::language` to get informed about changes
1109    /// to the buttons language.
1110    #[cfg(feature = "v4_10")]
1111    #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
1112    pub fn language(self, language: &pango::Language) -> Self {
1113        Self {
1114            builder: self.builder.property("language", language),
1115        }
1116    }
1117
1118    /// The level of detail for the font chooser dialog.
1119    pub fn level(self, level: FontLevel) -> Self {
1120        Self {
1121            builder: self.builder.property("level", level),
1122        }
1123    }
1124
1125    /// Whether the buttons label will be drawn in the selected font.
1126    pub fn use_font(self, use_font: bool) -> Self {
1127        Self {
1128            builder: self.builder.property("use-font", use_font),
1129        }
1130    }
1131
1132    /// Whether the buttons label will use the selected font size.
1133    pub fn use_size(self, use_size: bool) -> Self {
1134        Self {
1135            builder: self.builder.property("use-size", use_size),
1136        }
1137    }
1138
1139    /// Whether the widget or any of its descendents can accept
1140    /// the input focus.
1141    ///
1142    /// This property is meant to be set by widget implementations,
1143    /// typically in their instance init function.
1144    pub fn can_focus(self, can_focus: bool) -> Self {
1145        Self {
1146            builder: self.builder.property("can-focus", can_focus),
1147        }
1148    }
1149
1150    /// Whether the widget can receive pointer events.
1151    pub fn can_target(self, can_target: bool) -> Self {
1152        Self {
1153            builder: self.builder.property("can-target", can_target),
1154        }
1155    }
1156
1157    /// A list of css classes applied to this widget.
1158    pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1159        Self {
1160            builder: self.builder.property("css-classes", css_classes.into()),
1161        }
1162    }
1163
1164    /// The name of this widget in the CSS tree.
1165    ///
1166    /// This property is meant to be set by widget implementations,
1167    /// typically in their instance init function.
1168    pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1169        Self {
1170            builder: self.builder.property("css-name", css_name.into()),
1171        }
1172    }
1173
1174    /// The cursor used by @widget.
1175    pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1176        Self {
1177            builder: self.builder.property("cursor", cursor.clone()),
1178        }
1179    }
1180
1181    /// Whether the widget should grab focus when it is clicked with the mouse.
1182    ///
1183    /// This property is only relevant for widgets that can take focus.
1184    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1185        Self {
1186            builder: self.builder.property("focus-on-click", focus_on_click),
1187        }
1188    }
1189
1190    /// Whether this widget itself will accept the input focus.
1191    pub fn focusable(self, focusable: bool) -> Self {
1192        Self {
1193            builder: self.builder.property("focusable", focusable),
1194        }
1195    }
1196
1197    /// How to distribute horizontal space if widget gets extra space.
1198    pub fn halign(self, halign: Align) -> Self {
1199        Self {
1200            builder: self.builder.property("halign", halign),
1201        }
1202    }
1203
1204    /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1205    /// signal on @widget.
1206    ///
1207    /// A true value indicates that @widget can have a tooltip, in this case
1208    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1209    /// determine whether it will provide a tooltip or not.
1210    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1211        Self {
1212            builder: self.builder.property("has-tooltip", has_tooltip),
1213        }
1214    }
1215
1216    /// Overrides for height request of the widget.
1217    ///
1218    /// If this is -1, the natural request will be used.
1219    pub fn height_request(self, height_request: i32) -> Self {
1220        Self {
1221            builder: self.builder.property("height-request", height_request),
1222        }
1223    }
1224
1225    /// Whether to expand horizontally.
1226    pub fn hexpand(self, hexpand: bool) -> Self {
1227        Self {
1228            builder: self.builder.property("hexpand", hexpand),
1229        }
1230    }
1231
1232    /// Whether to use the `hexpand` property.
1233    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1234        Self {
1235            builder: self.builder.property("hexpand-set", hexpand_set),
1236        }
1237    }
1238
1239    /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1240    /// the preferred size of the widget, and allocate its children.
1241    ///
1242    /// This property is meant to be set by widget implementations,
1243    /// typically in their instance init function.
1244    pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1245        Self {
1246            builder: self
1247                .builder
1248                .property("layout-manager", layout_manager.clone().upcast()),
1249        }
1250    }
1251
1252    /// Makes this widget act like a modal dialog, with respect to
1253    /// event delivery.
1254    ///
1255    /// Global event controllers will not handle events with targets
1256    /// inside the widget, unless they are set up to ignore propagation
1257    /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1258    #[cfg(feature = "v4_18")]
1259    #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1260    pub fn limit_events(self, limit_events: bool) -> Self {
1261        Self {
1262            builder: self.builder.property("limit-events", limit_events),
1263        }
1264    }
1265
1266    /// Margin on bottom side of widget.
1267    ///
1268    /// This property adds margin outside of the widget's normal size
1269    /// request, the margin will be added in addition to the size from
1270    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1271    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1272        Self {
1273            builder: self.builder.property("margin-bottom", margin_bottom),
1274        }
1275    }
1276
1277    /// Margin on end of widget, horizontally.
1278    ///
1279    /// This property supports left-to-right and right-to-left text
1280    /// directions.
1281    ///
1282    /// This property adds margin outside of the widget's normal size
1283    /// request, the margin will be added in addition to the size from
1284    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1285    pub fn margin_end(self, margin_end: i32) -> Self {
1286        Self {
1287            builder: self.builder.property("margin-end", margin_end),
1288        }
1289    }
1290
1291    /// Margin on start of widget, horizontally.
1292    ///
1293    /// This property supports left-to-right and right-to-left text
1294    /// directions.
1295    ///
1296    /// This property adds margin outside of the widget's normal size
1297    /// request, the margin will be added in addition to the size from
1298    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1299    pub fn margin_start(self, margin_start: i32) -> Self {
1300        Self {
1301            builder: self.builder.property("margin-start", margin_start),
1302        }
1303    }
1304
1305    /// Margin on top side of widget.
1306    ///
1307    /// This property adds margin outside of the widget's normal size
1308    /// request, the margin will be added in addition to the size from
1309    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1310    pub fn margin_top(self, margin_top: i32) -> Self {
1311        Self {
1312            builder: self.builder.property("margin-top", margin_top),
1313        }
1314    }
1315
1316    /// The name of the widget.
1317    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1318        Self {
1319            builder: self.builder.property("name", name.into()),
1320        }
1321    }
1322
1323    /// The requested opacity of the widget.
1324    pub fn opacity(self, opacity: f64) -> Self {
1325        Self {
1326            builder: self.builder.property("opacity", opacity),
1327        }
1328    }
1329
1330    /// How content outside the widget's content area is treated.
1331    ///
1332    /// This property is meant to be set by widget implementations,
1333    /// typically in their instance init function.
1334    pub fn overflow(self, overflow: Overflow) -> Self {
1335        Self {
1336            builder: self.builder.property("overflow", overflow),
1337        }
1338    }
1339
1340    /// Whether the widget will receive the default action when it is focused.
1341    pub fn receives_default(self, receives_default: bool) -> Self {
1342        Self {
1343            builder: self.builder.property("receives-default", receives_default),
1344        }
1345    }
1346
1347    /// Whether the widget responds to input.
1348    pub fn sensitive(self, sensitive: bool) -> Self {
1349        Self {
1350            builder: self.builder.property("sensitive", sensitive),
1351        }
1352    }
1353
1354    /// Sets the text of tooltip to be the given string, which is marked up
1355    /// with Pango markup.
1356    ///
1357    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1358    ///
1359    /// This is a convenience property which will take care of getting the
1360    /// tooltip shown if the given string is not `NULL`:
1361    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1362    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1363    /// the default signal handler.
1364    ///
1365    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1366    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1367    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1368        Self {
1369            builder: self
1370                .builder
1371                .property("tooltip-markup", tooltip_markup.into()),
1372        }
1373    }
1374
1375    /// Sets the text of tooltip to be the given string.
1376    ///
1377    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1378    ///
1379    /// This is a convenience property which will take care of getting the
1380    /// tooltip shown if the given string is not `NULL`:
1381    /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1382    /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1383    /// the default signal handler.
1384    ///
1385    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1386    /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1387    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1388        Self {
1389            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1390        }
1391    }
1392
1393    /// How to distribute vertical space if widget gets extra space.
1394    pub fn valign(self, valign: Align) -> Self {
1395        Self {
1396            builder: self.builder.property("valign", valign),
1397        }
1398    }
1399
1400    /// Whether to expand vertically.
1401    pub fn vexpand(self, vexpand: bool) -> Self {
1402        Self {
1403            builder: self.builder.property("vexpand", vexpand),
1404        }
1405    }
1406
1407    /// Whether to use the `vexpand` property.
1408    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1409        Self {
1410            builder: self.builder.property("vexpand-set", vexpand_set),
1411        }
1412    }
1413
1414    /// Whether the widget is visible.
1415    pub fn visible(self, visible: bool) -> Self {
1416        Self {
1417            builder: self.builder.property("visible", visible),
1418        }
1419    }
1420
1421    /// Overrides for width request of the widget.
1422    ///
1423    /// If this is -1, the natural request will be used.
1424    pub fn width_request(self, width_request: i32) -> Self {
1425        Self {
1426            builder: self.builder.property("width-request", width_request),
1427        }
1428    }
1429
1430    /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1431    ///
1432    /// The accessible role cannot be changed once set.
1433    pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1434        Self {
1435            builder: self.builder.property("accessible-role", accessible_role),
1436        }
1437    }
1438
1439    // rustdoc-stripper-ignore-next
1440    /// Build the [`FontDialogButton`].
1441    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1442    pub fn build(self) -> FontDialogButton {
1443        assert_initialized_main_thread!();
1444        self.builder.build()
1445    }
1446}