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