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