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