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