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 Accessible, AccessibleRole, Align, Buildable, ConstraintTarget, FontDialog, FontLevel,
7 LayoutManager, Overflow, Widget, ffi,
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::{SignalHandlerId, connect_raw},
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 unsafe {
847 let f: &F = &*(f as *const F);
848 f(&from_glib_borrow(this))
849 }
850 }
851 unsafe {
852 let f: Box_<F> = Box_::new(f);
853 connect_raw(
854 self.as_ptr() as *mut _,
855 c"activate".as_ptr() as *const _,
856 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
857 activate_trampoline::<F> as *const (),
858 )),
859 Box_::into_raw(f),
860 )
861 }
862 }
863
864 #[cfg(feature = "v4_14")]
865 #[cfg_attr(docsrs, doc(cfg(feature = "v4_14")))]
866 pub fn emit_activate(&self) {
867 self.emit_by_name::<()>("activate", &[]);
868 }
869
870 #[cfg(feature = "v4_10")]
871 #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
872 #[doc(alias = "dialog")]
873 pub fn connect_dialog_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
874 unsafe extern "C" fn notify_dialog_trampoline<F: Fn(&FontDialogButton) + 'static>(
875 this: *mut ffi::GtkFontDialogButton,
876 _param_spec: glib::ffi::gpointer,
877 f: glib::ffi::gpointer,
878 ) {
879 unsafe {
880 let f: &F = &*(f as *const F);
881 f(&from_glib_borrow(this))
882 }
883 }
884 unsafe {
885 let f: Box_<F> = Box_::new(f);
886 connect_raw(
887 self.as_ptr() as *mut _,
888 c"notify::dialog".as_ptr() as *const _,
889 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
890 notify_dialog_trampoline::<F> as *const (),
891 )),
892 Box_::into_raw(f),
893 )
894 }
895 }
896
897 #[cfg(feature = "v4_10")]
898 #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
899 #[doc(alias = "font-desc")]
900 pub fn connect_font_desc_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
901 unsafe extern "C" fn notify_font_desc_trampoline<F: Fn(&FontDialogButton) + 'static>(
902 this: *mut ffi::GtkFontDialogButton,
903 _param_spec: glib::ffi::gpointer,
904 f: glib::ffi::gpointer,
905 ) {
906 unsafe {
907 let f: &F = &*(f as *const F);
908 f(&from_glib_borrow(this))
909 }
910 }
911 unsafe {
912 let f: Box_<F> = Box_::new(f);
913 connect_raw(
914 self.as_ptr() as *mut _,
915 c"notify::font-desc".as_ptr() as *const _,
916 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
917 notify_font_desc_trampoline::<F> as *const (),
918 )),
919 Box_::into_raw(f),
920 )
921 }
922 }
923
924 #[cfg(feature = "v4_10")]
925 #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
926 #[doc(alias = "font-features")]
927 pub fn connect_font_features_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
928 unsafe extern "C" fn notify_font_features_trampoline<F: Fn(&FontDialogButton) + 'static>(
929 this: *mut ffi::GtkFontDialogButton,
930 _param_spec: glib::ffi::gpointer,
931 f: glib::ffi::gpointer,
932 ) {
933 unsafe {
934 let f: &F = &*(f as *const F);
935 f(&from_glib_borrow(this))
936 }
937 }
938 unsafe {
939 let f: Box_<F> = Box_::new(f);
940 connect_raw(
941 self.as_ptr() as *mut _,
942 c"notify::font-features".as_ptr() as *const _,
943 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
944 notify_font_features_trampoline::<F> as *const (),
945 )),
946 Box_::into_raw(f),
947 )
948 }
949 }
950
951 #[cfg(feature = "v4_10")]
952 #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
953 #[doc(alias = "language")]
954 pub fn connect_language_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
955 unsafe extern "C" fn notify_language_trampoline<F: Fn(&FontDialogButton) + 'static>(
956 this: *mut ffi::GtkFontDialogButton,
957 _param_spec: glib::ffi::gpointer,
958 f: glib::ffi::gpointer,
959 ) {
960 unsafe {
961 let f: &F = &*(f as *const F);
962 f(&from_glib_borrow(this))
963 }
964 }
965 unsafe {
966 let f: Box_<F> = Box_::new(f);
967 connect_raw(
968 self.as_ptr() as *mut _,
969 c"notify::language".as_ptr() as *const _,
970 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
971 notify_language_trampoline::<F> as *const (),
972 )),
973 Box_::into_raw(f),
974 )
975 }
976 }
977
978 #[doc(alias = "level")]
979 pub fn connect_level_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
980 unsafe extern "C" fn notify_level_trampoline<F: Fn(&FontDialogButton) + 'static>(
981 this: *mut ffi::GtkFontDialogButton,
982 _param_spec: glib::ffi::gpointer,
983 f: glib::ffi::gpointer,
984 ) {
985 unsafe {
986 let f: &F = &*(f as *const F);
987 f(&from_glib_borrow(this))
988 }
989 }
990 unsafe {
991 let f: Box_<F> = Box_::new(f);
992 connect_raw(
993 self.as_ptr() as *mut _,
994 c"notify::level".as_ptr() as *const _,
995 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
996 notify_level_trampoline::<F> as *const (),
997 )),
998 Box_::into_raw(f),
999 )
1000 }
1001 }
1002
1003 #[doc(alias = "use-font")]
1004 pub fn connect_use_font_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1005 unsafe extern "C" fn notify_use_font_trampoline<F: Fn(&FontDialogButton) + 'static>(
1006 this: *mut ffi::GtkFontDialogButton,
1007 _param_spec: glib::ffi::gpointer,
1008 f: glib::ffi::gpointer,
1009 ) {
1010 unsafe {
1011 let f: &F = &*(f as *const F);
1012 f(&from_glib_borrow(this))
1013 }
1014 }
1015 unsafe {
1016 let f: Box_<F> = Box_::new(f);
1017 connect_raw(
1018 self.as_ptr() as *mut _,
1019 c"notify::use-font".as_ptr() as *const _,
1020 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1021 notify_use_font_trampoline::<F> as *const (),
1022 )),
1023 Box_::into_raw(f),
1024 )
1025 }
1026 }
1027
1028 #[doc(alias = "use-size")]
1029 pub fn connect_use_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1030 unsafe extern "C" fn notify_use_size_trampoline<F: Fn(&FontDialogButton) + 'static>(
1031 this: *mut ffi::GtkFontDialogButton,
1032 _param_spec: glib::ffi::gpointer,
1033 f: glib::ffi::gpointer,
1034 ) {
1035 unsafe {
1036 let f: &F = &*(f as *const F);
1037 f(&from_glib_borrow(this))
1038 }
1039 }
1040 unsafe {
1041 let f: Box_<F> = Box_::new(f);
1042 connect_raw(
1043 self.as_ptr() as *mut _,
1044 c"notify::use-size".as_ptr() as *const _,
1045 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1046 notify_use_size_trampoline::<F> as *const (),
1047 )),
1048 Box_::into_raw(f),
1049 )
1050 }
1051 }
1052}
1053
1054#[cfg(feature = "v4_10")]
1055#[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
1056impl Default for FontDialogButton {
1057 fn default() -> Self {
1058 glib::object::Object::new::<Self>()
1059 }
1060}
1061
1062// rustdoc-stripper-ignore-next
1063/// A [builder-pattern] type to construct [`FontDialogButton`] objects.
1064///
1065/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1066#[must_use = "The builder must be built to be used"]
1067pub struct FontDialogButtonBuilder {
1068 builder: glib::object::ObjectBuilder<'static, FontDialogButton>,
1069}
1070
1071impl FontDialogButtonBuilder {
1072 fn new() -> Self {
1073 Self {
1074 builder: glib::object::Object::builder(),
1075 }
1076 }
1077
1078 /// The [`FontDialog`][crate::FontDialog] that contains parameters for
1079 /// the font chooser dialog.
1080 #[cfg(feature = "v4_10")]
1081 #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
1082 pub fn dialog(self, dialog: &FontDialog) -> Self {
1083 Self {
1084 builder: self.builder.property("dialog", dialog.clone()),
1085 }
1086 }
1087
1088 /// The selected font.
1089 ///
1090 /// This property can be set to give the button its initial
1091 /// font, and it will be updated to reflect the users choice
1092 /// in the font chooser dialog.
1093 ///
1094 /// Listen to `notify::font-desc` to get informed about changes
1095 /// to the buttons font.
1096 #[cfg(feature = "v4_10")]
1097 #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
1098 pub fn font_desc(self, font_desc: &pango::FontDescription) -> Self {
1099 Self {
1100 builder: self.builder.property("font-desc", font_desc),
1101 }
1102 }
1103
1104 /// The selected font features.
1105 ///
1106 /// This property will be updated to reflect the users choice
1107 /// in the font chooser dialog.
1108 ///
1109 /// Listen to `notify::font-features` to get informed about changes
1110 /// to the buttons font features.
1111 #[cfg(feature = "v4_10")]
1112 #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
1113 pub fn font_features(self, font_features: impl Into<glib::GString>) -> Self {
1114 Self {
1115 builder: self.builder.property("font-features", font_features.into()),
1116 }
1117 }
1118
1119 /// The selected language for font features.
1120 ///
1121 /// This property will be updated to reflect the users choice
1122 /// in the font chooser dialog.
1123 ///
1124 /// Listen to `notify::language` to get informed about changes
1125 /// to the buttons language.
1126 #[cfg(feature = "v4_10")]
1127 #[cfg_attr(docsrs, doc(cfg(feature = "v4_10")))]
1128 pub fn language(self, language: &pango::Language) -> Self {
1129 Self {
1130 builder: self.builder.property("language", language),
1131 }
1132 }
1133
1134 /// The level of detail for the font chooser dialog.
1135 pub fn level(self, level: FontLevel) -> Self {
1136 Self {
1137 builder: self.builder.property("level", level),
1138 }
1139 }
1140
1141 /// Whether the buttons label will be drawn in the selected font.
1142 pub fn use_font(self, use_font: bool) -> Self {
1143 Self {
1144 builder: self.builder.property("use-font", use_font),
1145 }
1146 }
1147
1148 /// Whether the buttons label will use the selected font size.
1149 pub fn use_size(self, use_size: bool) -> Self {
1150 Self {
1151 builder: self.builder.property("use-size", use_size),
1152 }
1153 }
1154
1155 /// Whether the widget or any of its descendents can accept
1156 /// the input focus.
1157 ///
1158 /// This property is meant to be set by widget implementations,
1159 /// typically in their instance init function.
1160 pub fn can_focus(self, can_focus: bool) -> Self {
1161 Self {
1162 builder: self.builder.property("can-focus", can_focus),
1163 }
1164 }
1165
1166 /// Whether the widget can receive pointer events.
1167 pub fn can_target(self, can_target: bool) -> Self {
1168 Self {
1169 builder: self.builder.property("can-target", can_target),
1170 }
1171 }
1172
1173 /// A list of css classes applied to this widget.
1174 pub fn css_classes(self, css_classes: impl Into<glib::StrV>) -> Self {
1175 Self {
1176 builder: self.builder.property("css-classes", css_classes.into()),
1177 }
1178 }
1179
1180 /// The name of this widget in the CSS tree.
1181 ///
1182 /// This property is meant to be set by widget implementations,
1183 /// typically in their instance init function.
1184 pub fn css_name(self, css_name: impl Into<glib::GString>) -> Self {
1185 Self {
1186 builder: self.builder.property("css-name", css_name.into()),
1187 }
1188 }
1189
1190 /// The cursor used by @widget.
1191 pub fn cursor(self, cursor: &gdk::Cursor) -> Self {
1192 Self {
1193 builder: self.builder.property("cursor", cursor.clone()),
1194 }
1195 }
1196
1197 /// Whether the widget should grab focus when it is clicked with the mouse.
1198 ///
1199 /// This property is only relevant for widgets that can take focus.
1200 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1201 Self {
1202 builder: self.builder.property("focus-on-click", focus_on_click),
1203 }
1204 }
1205
1206 /// Whether this widget itself will accept the input focus.
1207 pub fn focusable(self, focusable: bool) -> Self {
1208 Self {
1209 builder: self.builder.property("focusable", focusable),
1210 }
1211 }
1212
1213 /// How to distribute horizontal space if widget gets extra space.
1214 pub fn halign(self, halign: Align) -> Self {
1215 Self {
1216 builder: self.builder.property("halign", halign),
1217 }
1218 }
1219
1220 /// Enables or disables the emission of the [`query-tooltip`][struct@crate::Widget#query-tooltip]
1221 /// signal on @widget.
1222 ///
1223 /// A true value indicates that @widget can have a tooltip, in this case
1224 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to
1225 /// determine whether it will provide a tooltip or not.
1226 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1227 Self {
1228 builder: self.builder.property("has-tooltip", has_tooltip),
1229 }
1230 }
1231
1232 /// Overrides for height request of the widget.
1233 ///
1234 /// If this is -1, the natural request will be used.
1235 pub fn height_request(self, height_request: i32) -> Self {
1236 Self {
1237 builder: self.builder.property("height-request", height_request),
1238 }
1239 }
1240
1241 /// Whether to expand horizontally.
1242 pub fn hexpand(self, hexpand: bool) -> Self {
1243 Self {
1244 builder: self.builder.property("hexpand", hexpand),
1245 }
1246 }
1247
1248 /// Whether to use the `hexpand` property.
1249 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1250 Self {
1251 builder: self.builder.property("hexpand-set", hexpand_set),
1252 }
1253 }
1254
1255 /// The [`LayoutManager`][crate::LayoutManager] instance to use to compute
1256 /// the preferred size of the widget, and allocate its children.
1257 ///
1258 /// This property is meant to be set by widget implementations,
1259 /// typically in their instance init function.
1260 pub fn layout_manager(self, layout_manager: &impl IsA<LayoutManager>) -> Self {
1261 Self {
1262 builder: self
1263 .builder
1264 .property("layout-manager", layout_manager.clone().upcast()),
1265 }
1266 }
1267
1268 /// Makes this widget act like a modal dialog, with respect to
1269 /// event delivery.
1270 ///
1271 /// Global event controllers will not handle events with targets
1272 /// inside the widget, unless they are set up to ignore propagation
1273 /// limits. See [`EventControllerExt::set_propagation_limit()`][crate::prelude::EventControllerExt::set_propagation_limit()].
1274 #[cfg(feature = "v4_18")]
1275 #[cfg_attr(docsrs, doc(cfg(feature = "v4_18")))]
1276 pub fn limit_events(self, limit_events: bool) -> Self {
1277 Self {
1278 builder: self.builder.property("limit-events", limit_events),
1279 }
1280 }
1281
1282 /// Margin on bottom side of widget.
1283 ///
1284 /// This property adds margin outside of the widget's normal size
1285 /// request, the margin will be added in addition to the size from
1286 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1287 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1288 Self {
1289 builder: self.builder.property("margin-bottom", margin_bottom),
1290 }
1291 }
1292
1293 /// Margin on end of widget, horizontally.
1294 ///
1295 /// This property supports left-to-right and right-to-left text
1296 /// directions.
1297 ///
1298 /// This property adds margin outside of the widget's normal size
1299 /// request, the margin will be added in addition to the size from
1300 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1301 pub fn margin_end(self, margin_end: i32) -> Self {
1302 Self {
1303 builder: self.builder.property("margin-end", margin_end),
1304 }
1305 }
1306
1307 /// Margin on start of widget, horizontally.
1308 ///
1309 /// This property supports left-to-right and right-to-left text
1310 /// directions.
1311 ///
1312 /// This property adds margin outside of the widget's normal size
1313 /// request, the margin will be added in addition to the size from
1314 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1315 pub fn margin_start(self, margin_start: i32) -> Self {
1316 Self {
1317 builder: self.builder.property("margin-start", margin_start),
1318 }
1319 }
1320
1321 /// Margin on top side of widget.
1322 ///
1323 /// This property adds margin outside of the widget's normal size
1324 /// request, the margin will be added in addition to the size from
1325 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1326 pub fn margin_top(self, margin_top: i32) -> Self {
1327 Self {
1328 builder: self.builder.property("margin-top", margin_top),
1329 }
1330 }
1331
1332 /// The name of the widget.
1333 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1334 Self {
1335 builder: self.builder.property("name", name.into()),
1336 }
1337 }
1338
1339 /// The requested opacity of the widget.
1340 pub fn opacity(self, opacity: f64) -> Self {
1341 Self {
1342 builder: self.builder.property("opacity", opacity),
1343 }
1344 }
1345
1346 /// How content outside the widget's content area is treated.
1347 ///
1348 /// This property is meant to be set by widget implementations,
1349 /// typically in their instance init function.
1350 pub fn overflow(self, overflow: Overflow) -> Self {
1351 Self {
1352 builder: self.builder.property("overflow", overflow),
1353 }
1354 }
1355
1356 /// Whether the widget will receive the default action when it is focused.
1357 pub fn receives_default(self, receives_default: bool) -> Self {
1358 Self {
1359 builder: self.builder.property("receives-default", receives_default),
1360 }
1361 }
1362
1363 /// Whether the widget responds to input.
1364 pub fn sensitive(self, sensitive: bool) -> Self {
1365 Self {
1366 builder: self.builder.property("sensitive", sensitive),
1367 }
1368 }
1369
1370 /// Sets the text of tooltip to be the given string, which is marked up
1371 /// with Pango markup.
1372 ///
1373 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1374 ///
1375 /// This is a convenience property which will take care of getting the
1376 /// tooltip shown if the given string is not `NULL`:
1377 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1378 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1379 /// the default signal handler.
1380 ///
1381 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1382 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1383 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1384 Self {
1385 builder: self
1386 .builder
1387 .property("tooltip-markup", tooltip_markup.into()),
1388 }
1389 }
1390
1391 /// Sets the text of tooltip to be the given string.
1392 ///
1393 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1394 ///
1395 /// This is a convenience property which will take care of getting the
1396 /// tooltip shown if the given string is not `NULL`:
1397 /// [`has-tooltip`][struct@crate::Widget#has-tooltip] will automatically be set to true
1398 /// and there will be taken care of [`query-tooltip`][struct@crate::Widget#query-tooltip] in
1399 /// the default signal handler.
1400 ///
1401 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and
1402 /// [`tooltip-markup`][struct@crate::Widget#tooltip-markup] are set, the last one wins.
1403 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1404 Self {
1405 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1406 }
1407 }
1408
1409 /// How to distribute vertical space if widget gets extra space.
1410 pub fn valign(self, valign: Align) -> Self {
1411 Self {
1412 builder: self.builder.property("valign", valign),
1413 }
1414 }
1415
1416 /// Whether to expand vertically.
1417 pub fn vexpand(self, vexpand: bool) -> Self {
1418 Self {
1419 builder: self.builder.property("vexpand", vexpand),
1420 }
1421 }
1422
1423 /// Whether to use the `vexpand` property.
1424 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1425 Self {
1426 builder: self.builder.property("vexpand-set", vexpand_set),
1427 }
1428 }
1429
1430 /// Whether the widget is visible.
1431 pub fn visible(self, visible: bool) -> Self {
1432 Self {
1433 builder: self.builder.property("visible", visible),
1434 }
1435 }
1436
1437 /// Overrides for width request of the widget.
1438 ///
1439 /// If this is -1, the natural request will be used.
1440 pub fn width_request(self, width_request: i32) -> Self {
1441 Self {
1442 builder: self.builder.property("width-request", width_request),
1443 }
1444 }
1445
1446 /// The accessible role of the given [`Accessible`][crate::Accessible] implementation.
1447 ///
1448 /// The accessible role cannot be changed once set.
1449 pub fn accessible_role(self, accessible_role: AccessibleRole) -> Self {
1450 Self {
1451 builder: self.builder.property("accessible-role", accessible_role),
1452 }
1453 }
1454
1455 // rustdoc-stripper-ignore-next
1456 /// Build the [`FontDialogButton`].
1457 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1458 pub fn build(self) -> FontDialogButton {
1459 assert_initialized_main_thread!();
1460 self.builder.build()
1461 }
1462}