Skip to main content

gtk4/auto/
message_dialog.rs

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