gtk4/auto/font_chooser_dialog.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_20")]
7#[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
8use crate::WindowGravity;
9use crate::{
10 ffi, Accessible, AccessibleRole, Align, Application, Buildable, ConstraintTarget, Dialog,
11 FontChooser, FontChooserLevel, LayoutManager, Native, Overflow, Root, ShortcutManager, Widget,
12 Window,
13};
14use glib::{prelude::*, translate::*};
15
16glib::wrapper! {
17 /// Use [`FontDialog`][crate::FontDialog] instead
18 /// The [`FontChooserDialog`][crate::FontChooserDialog] widget is a dialog for selecting a font.
19 ///
20 /// <picture>
21 /// <source srcset="fontchooser-dark.png" media="(prefers-color-scheme: dark)">
22 /// <img alt="An example GtkFontChooserDialog" src="fontchooser.png">
23 /// </picture>
24 ///
25 /// [`FontChooserDialog`][crate::FontChooserDialog] implements the [`FontChooser`][crate::FontChooser] interface
26 /// and does not provide much API of its own.
27 ///
28 /// To create a [`FontChooserDialog`][crate::FontChooserDialog], use [`new()`][Self::new()].
29 ///
30 /// # GtkFontChooserDialog as GtkBuildable
31 ///
32 /// The [`FontChooserDialog`][crate::FontChooserDialog] implementation of the [`Buildable`][crate::Buildable]
33 /// interface exposes the buttons with the names “select_button”
34 /// and “cancel_button”.
35 ///
36 /// ## CSS nodes
37 ///
38 /// [`FontChooserDialog`][crate::FontChooserDialog] has a single CSS node with the name `window` and style
39 /// class `.fontchooser`.
40 ///
41 /// # Implements
42 ///
43 /// [`DialogExt`][trait@crate::prelude::DialogExt], [`GtkWindowExt`][trait@crate::prelude::GtkWindowExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`AccessibleExt`][trait@crate::prelude::AccessibleExt], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ConstraintTargetExt`][trait@crate::prelude::ConstraintTargetExt], [`NativeExt`][trait@crate::prelude::NativeExt], [`RootExt`][trait@crate::prelude::RootExt], [`ShortcutManagerExt`][trait@crate::prelude::ShortcutManagerExt], [`FontChooserExt`][trait@crate::prelude::FontChooserExt], [`DialogExtManual`][trait@crate::prelude::DialogExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`AccessibleExtManual`][trait@crate::prelude::AccessibleExtManual], [`FontChooserExtManual`][trait@crate::prelude::FontChooserExtManual]
44 #[doc(alias = "GtkFontChooserDialog")]
45 pub struct FontChooserDialog(Object<ffi::GtkFontChooserDialog>) @extends Dialog, Window, Widget, @implements Accessible, Buildable, ConstraintTarget, Native, Root, ShortcutManager, FontChooser;
46
47 match fn {
48 type_ => || ffi::gtk_font_chooser_dialog_get_type(),
49 }
50}
51
52impl FontChooserDialog {
53 /// Creates a new [`FontChooserDialog`][crate::FontChooserDialog].
54 ///
55 /// # Deprecated since 4.10
56 ///
57 /// Use [`FontDialog`][crate::FontDialog] instead
58 /// ## `title`
59 /// Title of the dialog
60 /// ## `parent`
61 /// Transient parent of the dialog
62 ///
63 /// # Returns
64 ///
65 /// a new [`FontChooserDialog`][crate::FontChooserDialog]
66 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
67 #[allow(deprecated)]
68 #[doc(alias = "gtk_font_chooser_dialog_new")]
69 pub fn new(title: Option<&str>, parent: Option<&impl IsA<Window>>) -> FontChooserDialog {
70 assert_initialized_main_thread!();
71 unsafe {
72 Widget::from_glib_none(ffi::gtk_font_chooser_dialog_new(
73 title.to_glib_none().0,
74 parent.map(|p| p.as_ref()).to_glib_none().0,
75 ))
76 .unsafe_cast()
77 }
78 }
79
80 // rustdoc-stripper-ignore-next
81 /// Creates a new builder-pattern struct instance to construct [`FontChooserDialog`] objects.
82 ///
83 /// This method returns an instance of [`FontChooserDialogBuilder`](crate::builders::FontChooserDialogBuilder) which can be used to create [`FontChooserDialog`] objects.
84 pub fn builder() -> FontChooserDialogBuilder {
85 FontChooserDialogBuilder::new()
86 }
87}
88
89impl Default for FontChooserDialog {
90 fn default() -> Self {
91 glib::object::Object::new::<Self>()
92 }
93}
94
95// rustdoc-stripper-ignore-next
96/// A [builder-pattern] type to construct [`FontChooserDialog`] objects.
97///
98/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
99#[must_use = "The builder must be built to be used"]
100pub struct FontChooserDialogBuilder {
101 builder: glib::object::ObjectBuilder<'static, FontChooserDialog>,
102}
103
104impl FontChooserDialogBuilder {
105 fn new() -> Self {
106 Self {
107 builder: glib::object::Object::builder(),
108 }
109 }
110
111 /// [`true`] if the dialog uses a headerbar for action buttons
112 /// instead of the action-area.
113 ///
114 /// For technical reasons, this property is declared as an integer
115 /// property, but you should only set it to [`true`] or [`false`].
116 ///
117 /// ## Creating a dialog with headerbar
118 ///
119 /// Builtin [`Dialog`][crate::Dialog] subclasses such as [`ColorChooserDialog`][crate::ColorChooserDialog]
120 /// set this property according to platform conventions (using the
121 /// [`gtk-dialogs-use-header`][struct@crate::Settings#gtk-dialogs-use-header] setting).
122 ///
123 /// Here is how you can achieve the same:
124 ///
125 /// **⚠️ The following code is in c ⚠️**
126 ///
127 /// ```c
128 /// g_object_get (settings, "gtk-dialogs-use-header", &header, NULL);
129 /// dialog = g_object_new (GTK_TYPE_DIALOG, header, TRUE, NULL);
130 /// ```
131 /// Use [`Window`][crate::Window] instead
132 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
133 pub fn use_header_bar(self, use_header_bar: i32) -> Self {
134 Self {
135 builder: self.builder.property("use-header-bar", use_header_bar),
136 }
137 }
138
139 /// The [`Application`][crate::Application] associated with the window.
140 ///
141 /// The application will be kept alive for at least as long as it
142 /// has any windows associated with it (see g_application_hold()
143 /// for a way to keep it alive without windows).
144 ///
145 /// Normally, the connection between the application and the window
146 /// will remain until the window is destroyed, but you can explicitly
147 /// remove it by setting the this property to `NULL`.
148 pub fn application(self, application: &impl IsA<Application>) -> Self {
149 Self {
150 builder: self
151 .builder
152 .property("application", application.clone().upcast()),
153 }
154 }
155
156 /// The child widget.
157 pub fn child(self, child: &impl IsA<Widget>) -> Self {
158 Self {
159 builder: self.builder.property("child", child.clone().upcast()),
160 }
161 }
162
163 /// Whether the window should have a frame (also known as *decorations*).
164 pub fn decorated(self, decorated: bool) -> Self {
165 Self {
166 builder: self.builder.property("decorated", decorated),
167 }
168 }
169
170 /// The default height of the window.
171 pub fn default_height(self, default_height: i32) -> Self {
172 Self {
173 builder: self.builder.property("default-height", default_height),
174 }
175 }
176
177 /// The default widget.
178 pub fn default_widget(self, default_widget: &impl IsA<Widget>) -> Self {
179 Self {
180 builder: self
181 .builder
182 .property("default-widget", default_widget.clone().upcast()),
183 }
184 }
185
186 /// The default width of the window.
187 pub fn default_width(self, default_width: i32) -> Self {
188 Self {
189 builder: self.builder.property("default-width", default_width),
190 }
191 }
192
193 /// Whether the window frame should have a close button.
194 pub fn deletable(self, deletable: bool) -> Self {
195 Self {
196 builder: self.builder.property("deletable", deletable),
197 }
198 }
199
200 /// If this window should be destroyed when the parent is destroyed.
201 pub fn destroy_with_parent(self, destroy_with_parent: bool) -> Self {
202 Self {
203 builder: self
204 .builder
205 .property("destroy-with-parent", destroy_with_parent),
206 }
207 }
208
209 /// The display that will display this window.
210 pub fn display(self, display: &impl IsA<gdk::Display>) -> Self {
211 Self {
212 builder: self.builder.property("display", display.clone().upcast()),
213 }
214 }
215
216 /// Whether 'focus rectangles' are currently visible in this window.
217 ///
218 /// This property is maintained by GTK based on user input
219 /// and should not be set by applications.
220 pub fn focus_visible(self, focus_visible: bool) -> Self {
221 Self {
222 builder: self.builder.property("focus-visible", focus_visible),
223 }
224 }
225
226 /// The focus widget.
227 pub fn focus_widget(self, focus_widget: &impl IsA<Widget>) -> Self {
228 Self {
229 builder: self
230 .builder
231 .property("focus-widget", focus_widget.clone().upcast()),
232 }
233 }
234
235 /// Whether the window is fullscreen.
236 ///
237 /// Setting this property is the equivalent of calling
238 /// [`GtkWindowExt::fullscreen()`][crate::prelude::GtkWindowExt::fullscreen()] or [`GtkWindowExt::unfullscreen()`][crate::prelude::GtkWindowExt::unfullscreen()];
239 /// either operation is asynchronous, which means you will need to
240 /// connect to the ::notify signal in order to know whether the
241 /// operation was successful.
242 pub fn fullscreened(self, fullscreened: bool) -> Self {
243 Self {
244 builder: self.builder.property("fullscreened", fullscreened),
245 }
246 }
247
248 /// The gravity to use when resizing the window programmatically.
249 ///
250 /// Gravity describes which point of the window we want to keep
251 /// fixed (meaning that the window will grow in the opposite direction).
252 /// For example, a gravity of `GTK_WINDOW_GRAVITY_TOP_RIGHT` means that we
253 /// want the to fix top right corner of the window.
254 #[cfg(feature = "v4_20")]
255 #[cfg_attr(docsrs, doc(cfg(feature = "v4_20")))]
256 pub fn gravity(self, gravity: WindowGravity) -> Self {
257 Self {
258 builder: self.builder.property("gravity", gravity),
259 }
260 }
261
262 /// Whether the window frame should handle <kbd>F10</kbd> for activating
263 /// menubars.
264 #[cfg(feature = "v4_2")]
265 #[cfg_attr(docsrs, doc(cfg(feature = "v4_2")))]
266 pub fn handle_menubar_accel(self, handle_menubar_accel: bool) -> Self {
267 Self {
268 builder: self
269 .builder
270 .property("handle-menubar-accel", handle_menubar_accel),
271 }
272 }
273
274 /// If this window should be hidden instead of destroyed when the user clicks
275 /// the close button.
276 pub fn hide_on_close(self, hide_on_close: bool) -> Self {
277 Self {
278 builder: self.builder.property("hide-on-close", hide_on_close),
279 }
280 }
281
282 /// Specifies the name of the themed icon to use as the window icon.
283 ///
284 /// See [`IconTheme`][crate::IconTheme] for more details.
285 pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
286 Self {
287 builder: self.builder.property("icon-name", icon_name.into()),
288 }
289 }
290
291 /// Whether the window is maximized.
292 ///
293 /// Setting this property is the equivalent of calling
294 /// [`GtkWindowExt::maximize()`][crate::prelude::GtkWindowExt::maximize()] or [`GtkWindowExt::unmaximize()`][crate::prelude::GtkWindowExt::unmaximize()];
295 /// either operation is asynchronous, which means you will need to
296 /// connect to the ::notify signal in order to know whether the
297 /// operation was successful.
298 pub fn maximized(self, maximized: bool) -> Self {
299 Self {
300 builder: self.builder.property("maximized", maximized),
301 }
302 }
303
304 /// Whether mnemonics are currently visible in this window.
305 ///
306 /// This property is maintained by GTK based on user input,
307 /// and should not be set by applications.
308 pub fn mnemonics_visible(self, mnemonics_visible: bool) -> Self {
309 Self {
310 builder: self
311 .builder
312 .property("mnemonics-visible", mnemonics_visible),
313 }
314 }
315
316 /// If true, the window is modal.
317 pub fn modal(self, modal: bool) -> Self {
318 Self {
319 builder: self.builder.property("modal", modal),
320 }
321 }
322
323 /// If true, users can resize the window.
324 pub fn resizable(self, resizable: bool) -> Self {
325 Self {
326 builder: self.builder.property("resizable", resizable),
327 }
328 }
329
330 /// A write-only property for setting window's startup notification identifier.
331 pub fn startup_id(self, startup_id: impl Into<glib::GString>) -> Self {
332 Self {
333 builder: self.builder.property("startup-id", startup_id.into()),
334 }
335 }
336
337 /// The title of the window.
338 pub fn title(self, title: impl Into<glib::GString>) -> Self {
339 Self {
340 builder: self.builder.property("title", title.into()),
341 }
342 }
343
344 /// The titlebar widget.
345 #[cfg(feature = "v4_6")]
346 #[cfg_attr(docsrs, doc(cfg(feature = "v4_6")))]
347 pub fn titlebar(self, titlebar: &impl IsA<Widget>) -> Self {
348 Self {
349 builder: self.builder.property("titlebar", titlebar.clone().upcast()),
350 }
351 }
352
353 /// The transient parent of the window.
354 pub fn transient_for(self, transient_for: &impl IsA<Window>) -> Self {
355 Self {
356 builder: self
357 .builder
358 .property("transient-for", transient_for.clone().upcast()),
359 }
360 }
361
362 /// Whether the widget or any of its descendents can accept
363 /// the input focus.
364 ///
365 /// This property is meant to be set by widget implementations,
366 /// typically in their instance init function.
367 pub fn can_focus(self, can_focus: bool) -> Self {
368 Self {
369 builder: self.builder.property("can-focus", can_focus),
370 }
371 }
372
373 /// Whether the widget can receive pointer events.
374 pub fn can_target(self, can_target: bool) -> Self {
375 Self {
376 builder: self.builder.property("can-target", can_target),
377 }
378 }
379
380 /// A list of css classes applied to this widget.
381 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
382 Self {
383 builder: self.builder.property("css-classes", css_classes.into()),
384 }
385 }
386
387 /// The name of this widget in the CSS tree.
388 ///
389 /// This property is meant to be set by widget implementations,
390 /// typically in their instance init function.
391 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
392 Self {
393 builder: self.builder.property("css-name", css_name.into()),
394 }
395 }
396
397 /// The cursor used by @widget.
398 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
399 Self {
400 builder: self.builder.property("cursor", cursor.clone()),
401 }
402 }
403
404 /// Whether the widget should grab focus when it is clicked with the mouse.
405 ///
406 /// This property is only relevant for widgets that can take focus.
407 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
408 Self {
409 builder: self.builder.property("focus-on-click", focus_on_click),
410 }
411 }
412
413 /// Whether this widget itself will accept the input focus.
414 pub fn focusable(self, focusable: bool) -> Self {
415 Self {
416 builder: self.builder.property("focusable", focusable),
417 }
418 }
419
420 /// How to distribute horizontal space if widget gets extra space.
421 pub fn halign(self, halign: Align) -> Self {
422 Self {
423 builder: self.builder.property("halign", halign),
424 }
425 }
426
427 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
428 /// signal on @widget.
429 ///
430 /// A true value indicates that @widget can have a tooltip, in this case
431 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
432 /// determine whether it will provide a tooltip or not.
433 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
434 Self {
435 builder: self.builder.property("has-tooltip", has_tooltip),
436 }
437 }
438
439 /// Overrides for height request of the widget.
440 ///
441 /// If this is -1, the natural request will be used.
442 pub fn height_request(self, height_request: i32) -> Self {
443 Self {
444 builder: self.builder.property("height-request", height_request),
445 }
446 }
447
448 /// Whether to expand horizontally.
449 pub fn hexpand(self, hexpand: bool) -> Self {
450 Self {
451 builder: self.builder.property("hexpand", hexpand),
452 }
453 }
454
455 /// Whether to use the `hexpand` property.
456 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
457 Self {
458 builder: self.builder.property("hexpand-set", hexpand_set),
459 }
460 }
461
462 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
463 /// the preferred size of the widget, and allocate its children.
464 ///
465 /// This property is meant to be set by widget implementations,
466 /// typically in their instance init function.
467 pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
468 Self {
469 builder: self
470 .builder
471 .property("layout-manager", layout_manager.clone().upcast()),
472 }
473 }
474
475 /// Makes this widget act like a modal dialog, with respect to
476 /// event delivery.
477 ///
478 /// Global event controllers will not handle events with targets
479 /// inside the widget, unless they are set up to ignore propagation
480 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
481 #[cfg(feature = "v4_18")]
482 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
483 pub fn limit_events(self, limit_events: bool) -> Self {
484 Self {
485 builder: self.builder.property("limit-events", limit_events),
486 }
487 }
488
489 /// Margin on bottom side of widget.
490 ///
491 /// This property adds margin outside of the widget's normal size
492 /// request, the margin will be added in addition to the size from
493 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
494 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
495 Self {
496 builder: self.builder.property("margin-bottom", margin_bottom),
497 }
498 }
499
500 /// Margin on end of widget, horizontally.
501 ///
502 /// This property supports left-to-right and right-to-left text
503 /// directions.
504 ///
505 /// This property adds margin outside of the widget's normal size
506 /// request, the margin will be added in addition to the size from
507 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
508 pub fn margin_end(self, margin_end: i32) -> Self {
509 Self {
510 builder: self.builder.property("margin-end", margin_end),
511 }
512 }
513
514 /// Margin on start of widget, horizontally.
515 ///
516 /// This property supports left-to-right and right-to-left text
517 /// directions.
518 ///
519 /// This property adds margin outside of the widget's normal size
520 /// request, the margin will be added in addition to the size from
521 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
522 pub fn margin_start(self, margin_start: i32) -> Self {
523 Self {
524 builder: self.builder.property("margin-start", margin_start),
525 }
526 }
527
528 /// Margin on top side of widget.
529 ///
530 /// This property adds margin outside of the widget's normal size
531 /// request, the margin will be added in addition to the size from
532 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
533 pub fn margin_top(self, margin_top: i32) -> Self {
534 Self {
535 builder: self.builder.property("margin-top", margin_top),
536 }
537 }
538
539 /// The name of the widget.
540 pub fn name(self, name: impl Into<glib::GString>) -> Self {
541 Self {
542 builder: self.builder.property("name", name.into()),
543 }
544 }
545
546 /// The requested opacity of the widget.
547 pub fn opacity(self, opacity: f64) -> Self {
548 Self {
549 builder: self.builder.property("opacity", opacity),
550 }
551 }
552
553 /// How content outside the widget's content area is treated.
554 ///
555 /// This property is meant to be set by widget implementations,
556 /// typically in their instance init function.
557 pub fn overflow(self, overflow: Overflow) -> Self {
558 Self {
559 builder: self.builder.property("overflow", overflow),
560 }
561 }
562
563 /// Whether the widget will receive the default action when it is focused.
564 pub fn receives_default(self, receives_default: bool) -> Self {
565 Self {
566 builder: self.builder.property("receives-default", receives_default),
567 }
568 }
569
570 /// Whether the widget responds to input.
571 pub fn sensitive(self, sensitive: bool) -> Self {
572 Self {
573 builder: self.builder.property("sensitive", sensitive),
574 }
575 }
576
577 /// Sets the text of tooltip to be the given string, which is marked up
578 /// with Pango markup.
579 ///
580 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
581 ///
582 /// This is a convenience property which will take care of getting the
583 /// tooltip shown if the given string is not `NULL`:
584 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
585 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
586 /// the default signal handler.
587 ///
588 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
589 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
590 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
591 Self {
592 builder: self
593 .builder
594 .property("tooltip-markup", tooltip_markup.into()),
595 }
596 }
597
598 /// Sets the text of tooltip to be the given string.
599 ///
600 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
601 ///
602 /// This is a convenience property which will take care of getting the
603 /// tooltip shown if the given string is not `NULL`:
604 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
605 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
606 /// the default signal handler.
607 ///
608 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
609 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
610 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
611 Self {
612 builder: self.builder.property("tooltip-text", tooltip_text.into()),
613 }
614 }
615
616 /// How to distribute vertical space if widget gets extra space.
617 pub fn valign(self, valign: Align) -> Self {
618 Self {
619 builder: self.builder.property("valign", valign),
620 }
621 }
622
623 /// Whether to expand vertically.
624 pub fn vexpand(self, vexpand: bool) -> Self {
625 Self {
626 builder: self.builder.property("vexpand", vexpand),
627 }
628 }
629
630 /// Whether to use the `vexpand` property.
631 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
632 Self {
633 builder: self.builder.property("vexpand-set", vexpand_set),
634 }
635 }
636
637 /// Whether the widget is visible.
638 pub fn visible(self, visible: bool) -> Self {
639 Self {
640 builder: self.builder.property("visible", visible),
641 }
642 }
643
644 /// Overrides for width request of the widget.
645 ///
646 /// If this is -1, the natural request will be used.
647 pub fn width_request(self, width_request: i32) -> Self {
648 Self {
649 builder: self.builder.property("width-request", width_request),
650 }
651 }
652
653 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
654 ///
655 /// The accessible role cannot be changed once set.
656 pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
657 Self {
658 builder: self.builder.property("accessible-role", accessible_role),
659 }
660 }
661
662 /// The font description as a string, e.g. "Sans Italic 12".
663 /// Use [`FontDialog`][crate::FontDialog] and [`FontDialogButton`][crate::FontDialogButton] instead
664 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
665 pub fn font(self, font: impl Into<glib::GString>) -> Self {
666 Self {
667 builder: self.builder.property("font", font.into()),
668 }
669 }
670
671 /// The font description as a [`pango::FontDescription`][crate::pango::FontDescription].
672 /// Use [`FontDialog`][crate::FontDialog] and [`FontDialogButton`][crate::FontDialogButton] instead
673 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
674 pub fn font_desc(self, font_desc: &pango::FontDescription) -> Self {
675 Self {
676 builder: self.builder.property("font-desc", font_desc),
677 }
678 }
679
680 /// The language for which the font features were selected.
681 /// Use [`FontDialog`][crate::FontDialog] and [`FontDialogButton`][crate::FontDialogButton] instead
682 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
683 pub fn language(self, language: impl Into<glib::GString>) -> Self {
684 Self {
685 builder: self.builder.property("language", language.into()),
686 }
687 }
688
689 /// The level of granularity to offer for selecting fonts.
690 /// Use [`FontDialog`][crate::FontDialog] and [`FontDialogButton`][crate::FontDialogButton] instead
691 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
692 pub fn level(self, level: FontChooserLevel) -> Self {
693 Self {
694 builder: self.builder.property("level", level),
695 }
696 }
697
698 /// The string with which to preview the font.
699 /// Use [`FontDialog`][crate::FontDialog] and [`FontDialogButton`][crate::FontDialogButton] instead
700 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
701 pub fn preview_text(self, preview_text: impl Into<glib::GString>) -> Self {
702 Self {
703 builder: self.builder.property("preview-text", preview_text.into()),
704 }
705 }
706
707 /// Whether to show an entry to change the preview text.
708 /// Use [`FontDialog`][crate::FontDialog] and [`FontDialogButton`][crate::FontDialogButton] instead
709 #[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
710 pub fn show_preview_entry(self, show_preview_entry: bool) -> Self {
711 Self {
712 builder: self
713 .builder
714 .property("show-preview-entry", show_preview_entry),
715 }
716 }
717
718 // rustdoc-stripper-ignore-next
719 /// Build the [`FontChooserDialog`].
720 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
721 pub fn build(self) -> FontChooserDialog {
722 assert_initialized_main_thread!();
723 self.builder.build()
724 }
725}