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