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