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