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