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