Skip to main content

gtk4/auto/
message_dialog.rs

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