Skip to main content

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