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