Skip to main content

gtk/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
5use crate::{
6    Align, Application, Bin, Box, Buildable, Container, HeaderBar, ResizeMode, ResponseType,
7    Widget, Window, WindowPosition, WindowType, ffi,
8};
9use glib::{
10    object::ObjectType as _,
11    prelude::*,
12    signal::{SignalHandlerId, connect_raw},
13    translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18    ///
19    /// ]|
20    ///
21    /// ## Properties
22    ///
23    ///
24    /// #### `use-header-bar`
25    ///  [`true`] if the dialog uses a [`HeaderBar`][crate::HeaderBar] for action buttons
26    /// instead of the action-area.
27    ///
28    /// For technical reasons, this property is declared as an integer
29    /// property, but you should only set it to [`true`] or [`false`].
30    ///
31    /// Readable | Writable | Construct Only
32    /// <details><summary><h4>Window</h4></summary>
33    ///
34    ///
35    /// #### `accept-focus`
36    ///  Whether the window should receive the input focus.
37    ///
38    /// Readable | Writable
39    ///
40    ///
41    /// #### `application`
42    ///  The [`Application`][crate::Application] associated with the window.
43    ///
44    /// The application will be kept alive for at least as long as it
45    /// has any windows associated with it (see [`ApplicationExtManual::hold()`][crate::gio::prelude::ApplicationExtManual::hold()]
46    /// for a way to keep it alive without windows).
47    ///
48    /// Normally, the connection between the application and the window
49    /// will remain until the window is destroyed, but you can explicitly
50    /// remove it by setting the :application property to [`None`].
51    ///
52    /// Readable | Writable
53    ///
54    ///
55    /// #### `attached-to`
56    ///  The widget to which this window is attached.
57    /// See [`GtkWindowExt::set_attached_to()`][crate::prelude::GtkWindowExt::set_attached_to()].
58    ///
59    /// Examples of places where specifying this relation is useful are
60    /// for instance a [`Menu`][crate::Menu] created by a [`ComboBox`][crate::ComboBox], a completion
61    /// popup window created by [`Entry`][crate::Entry] or a typeahead search entry
62    /// created by [`TreeView`][crate::TreeView].
63    ///
64    /// Readable | Writable | Construct
65    ///
66    ///
67    /// #### `decorated`
68    ///  Whether the window should be decorated by the window manager.
69    ///
70    /// Readable | Writable
71    ///
72    ///
73    /// #### `default-height`
74    ///  Readable | Writable
75    ///
76    ///
77    /// #### `default-width`
78    ///  Readable | Writable
79    ///
80    ///
81    /// #### `deletable`
82    ///  Whether the window frame should have a close button.
83    ///
84    /// Readable | Writable
85    ///
86    ///
87    /// #### `destroy-with-parent`
88    ///  Readable | Writable
89    ///
90    ///
91    /// #### `focus-on-map`
92    ///  Whether the window should receive the input focus when mapped.
93    ///
94    /// Readable | Writable
95    ///
96    ///
97    /// #### `focus-visible`
98    ///  Whether 'focus rectangles' are currently visible in this window.
99    ///
100    /// This property is maintained by GTK+ based on user input
101    /// and should not be set by applications.
102    ///
103    /// Readable | Writable
104    ///
105    ///
106    /// #### `gravity`
107    ///  The window gravity of the window. See [`GtkWindowExt::move_()`][crate::prelude::GtkWindowExt::move_()] and [`gdk::Gravity`][crate::gdk::Gravity] for
108    /// more details about window gravity.
109    ///
110    /// Readable | Writable
111    ///
112    ///
113    /// #### `has-resize-grip`
114    ///  Whether the window has a corner resize grip.
115    ///
116    /// Note that the resize grip is only shown if the window is
117    /// actually resizable and not maximized. Use
118    /// [`resize-grip-visible`][struct@crate::Window#resize-grip-visible] to find out if the resize
119    /// grip is currently shown.
120    ///
121    /// Readable | Writable
122    ///
123    ///
124    /// #### `has-toplevel-focus`
125    ///  Readable
126    ///
127    ///
128    /// #### `hide-titlebar-when-maximized`
129    ///  Whether the titlebar should be hidden during maximization.
130    ///
131    /// Readable | Writable
132    ///
133    ///
134    /// #### `icon`
135    ///  Readable | Writable
136    ///
137    ///
138    /// #### `icon-name`
139    ///  The :icon-name property specifies the name of the themed icon to
140    /// use as the window icon. See [`IconTheme`][crate::IconTheme] for more details.
141    ///
142    /// Readable | Writable
143    ///
144    ///
145    /// #### `is-active`
146    ///  Readable
147    ///
148    ///
149    /// #### `is-maximized`
150    ///  Readable
151    ///
152    ///
153    /// #### `mnemonics-visible`
154    ///  Whether mnemonics are currently visible in this window.
155    ///
156    /// This property is maintained by GTK+ based on user input,
157    /// and should not be set by applications.
158    ///
159    /// Readable | Writable
160    ///
161    ///
162    /// #### `modal`
163    ///  Readable | Writable
164    ///
165    ///
166    /// #### `resizable`
167    ///  Readable | Writable
168    ///
169    ///
170    /// #### `resize-grip-visible`
171    ///  Whether a corner resize grip is currently shown.
172    ///
173    /// Readable
174    ///
175    ///
176    /// #### `role`
177    ///  Readable | Writable
178    ///
179    ///
180    /// #### `screen`
181    ///  Readable | Writable
182    ///
183    ///
184    /// #### `skip-pager-hint`
185    ///  Readable | Writable
186    ///
187    ///
188    /// #### `skip-taskbar-hint`
189    ///  Readable | Writable
190    ///
191    ///
192    /// #### `startup-id`
193    ///  The :startup-id is a write-only property for setting window's
194    /// startup notification identifier. See [`GtkWindowExt::set_startup_id()`][crate::prelude::GtkWindowExt::set_startup_id()]
195    /// for more details.
196    ///
197    /// Writable
198    ///
199    ///
200    /// #### `title`
201    ///  Readable | Writable
202    ///
203    ///
204    /// #### `transient-for`
205    ///  The transient parent of the window. See [`GtkWindowExt::set_transient_for()`][crate::prelude::GtkWindowExt::set_transient_for()] for
206    /// more details about transient windows.
207    ///
208    /// Readable | Writable | Construct
209    ///
210    ///
211    /// #### `type`
212    ///  Readable | Writable | Construct Only
213    ///
214    ///
215    /// #### `type-hint`
216    ///  Readable | Writable
217    ///
218    ///
219    /// #### `urgency-hint`
220    ///  Readable | Writable
221    ///
222    ///
223    /// #### `window-position`
224    ///  Readable | Writable
225    /// </details>
226    /// <details><summary><h4>Container</h4></summary>
227    ///
228    ///
229    /// #### `border-width`
230    ///  Readable | Writable
231    ///
232    ///
233    /// #### `child`
234    ///  Writable
235    ///
236    ///
237    /// #### `resize-mode`
238    ///  Readable | Writable
239    /// </details>
240    /// <details><summary><h4>Widget</h4></summary>
241    ///
242    ///
243    /// #### `app-paintable`
244    ///  Readable | Writable
245    ///
246    ///
247    /// #### `can-default`
248    ///  Readable | Writable
249    ///
250    ///
251    /// #### `can-focus`
252    ///  Readable | Writable
253    ///
254    ///
255    /// #### `composite-child`
256    ///  Readable
257    ///
258    ///
259    /// #### `double-buffered`
260    ///  Whether the widget is double buffered.
261    ///
262    /// Readable | Writable
263    ///
264    ///
265    /// #### `events`
266    ///  Readable | Writable
267    ///
268    ///
269    /// #### `expand`
270    ///  Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
271    ///
272    /// Readable | Writable
273    ///
274    ///
275    /// #### `focus-on-click`
276    ///  Whether the widget should grab focus when it is clicked with the mouse.
277    ///
278    /// This property is only relevant for widgets that can take focus.
279    ///
280    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
281    /// GtkComboBox) implemented this property individually.
282    ///
283    /// Readable | Writable
284    ///
285    ///
286    /// #### `halign`
287    ///  How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
288    ///
289    /// Readable | Writable
290    ///
291    ///
292    /// #### `has-default`
293    ///  Readable | Writable
294    ///
295    ///
296    /// #### `has-focus`
297    ///  Readable | Writable
298    ///
299    ///
300    /// #### `has-tooltip`
301    ///  Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
302    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
303    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
304    /// whether it will provide a tooltip or not.
305    ///
306    /// Note that setting this property to [`true`] for the first time will change
307    /// the event masks of the GdkWindows of this widget to include leave-notify
308    /// and motion-notify events. This cannot and will not be undone when the
309    /// property is set to [`false`] again.
310    ///
311    /// Readable | Writable
312    ///
313    ///
314    /// #### `height-request`
315    ///  Readable | Writable
316    ///
317    ///
318    /// #### `hexpand`
319    ///  Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
320    ///
321    /// Readable | Writable
322    ///
323    ///
324    /// #### `hexpand-set`
325    ///  Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
326    ///
327    /// Readable | Writable
328    ///
329    ///
330    /// #### `is-focus`
331    ///  Readable | Writable
332    ///
333    ///
334    /// #### `margin`
335    ///  Sets all four sides' margin at once. If read, returns max
336    /// margin on any side.
337    ///
338    /// Readable | Writable
339    ///
340    ///
341    /// #### `margin-bottom`
342    ///  Margin on bottom side of widget.
343    ///
344    /// This property adds margin outside of the widget's normal size
345    /// request, the margin will be added in addition to the size from
346    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
347    ///
348    /// Readable | Writable
349    ///
350    ///
351    /// #### `margin-end`
352    ///  Margin on end of widget, horizontally. This property supports
353    /// left-to-right and right-to-left text directions.
354    ///
355    /// This property adds margin outside of the widget's normal size
356    /// request, the margin will be added in addition to the size from
357    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
358    ///
359    /// Readable | Writable
360    ///
361    ///
362    /// #### `margin-left`
363    ///  Margin on left side of widget.
364    ///
365    /// This property adds margin outside of the widget's normal size
366    /// request, the margin will be added in addition to the size from
367    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
368    ///
369    /// Readable | Writable
370    ///
371    ///
372    /// #### `margin-right`
373    ///  Margin on right side of widget.
374    ///
375    /// This property adds margin outside of the widget's normal size
376    /// request, the margin will be added in addition to the size from
377    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
378    ///
379    /// Readable | Writable
380    ///
381    ///
382    /// #### `margin-start`
383    ///  Margin on start of widget, horizontally. This property supports
384    /// left-to-right and right-to-left text directions.
385    ///
386    /// This property adds margin outside of the widget's normal size
387    /// request, the margin will be added in addition to the size from
388    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
389    ///
390    /// Readable | Writable
391    ///
392    ///
393    /// #### `margin-top`
394    ///  Margin on top side of widget.
395    ///
396    /// This property adds margin outside of the widget's normal size
397    /// request, the margin will be added in addition to the size from
398    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
399    ///
400    /// Readable | Writable
401    ///
402    ///
403    /// #### `name`
404    ///  Readable | Writable
405    ///
406    ///
407    /// #### `no-show-all`
408    ///  Readable | Writable
409    ///
410    ///
411    /// #### `opacity`
412    ///  The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
413    /// more details about window opacity.
414    ///
415    /// Before 3.8 this was only available in GtkWindow
416    ///
417    /// Readable | Writable
418    ///
419    ///
420    /// #### `parent`
421    ///  Readable | Writable
422    ///
423    ///
424    /// #### `receives-default`
425    ///  Readable | Writable
426    ///
427    ///
428    /// #### `scale-factor`
429    ///  The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
430    /// more details about widget scaling.
431    ///
432    /// Readable
433    ///
434    ///
435    /// #### `sensitive`
436    ///  Readable | Writable
437    ///
438    ///
439    /// #### `style`
440    ///  The style of the widget, which contains information about how it will look (colors, etc).
441    ///
442    /// Readable | Writable
443    ///
444    ///
445    /// #### `tooltip-markup`
446    ///  Sets the text of tooltip to be the given string, which is marked up
447    /// with the [Pango text markup language][PangoMarkupFormat].
448    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
449    ///
450    /// This is a convenience property which will take care of getting the
451    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
452    /// will automatically be set to [`true`] and there will be taken care of
453    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
454    ///
455    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
456    /// are set, the last one wins.
457    ///
458    /// Readable | Writable
459    ///
460    ///
461    /// #### `tooltip-text`
462    ///  Sets the text of tooltip to be the given string.
463    ///
464    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
465    ///
466    /// This is a convenience property which will take care of getting the
467    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
468    /// will automatically be set to [`true`] and there will be taken care of
469    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
470    ///
471    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
472    /// are set, the last one wins.
473    ///
474    /// Readable | Writable
475    ///
476    ///
477    /// #### `valign`
478    ///  How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
479    ///
480    /// Readable | Writable
481    ///
482    ///
483    /// #### `vexpand`
484    ///  Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
485    ///
486    /// Readable | Writable
487    ///
488    ///
489    /// #### `vexpand-set`
490    ///  Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
491    ///
492    /// Readable | Writable
493    ///
494    ///
495    /// #### `visible`
496    ///  Readable | Writable
497    ///
498    ///
499    /// #### `width-request`
500    ///  Readable | Writable
501    ///
502    ///
503    /// #### `window`
504    ///  The widget's window if it is realized, [`None`] otherwise.
505    ///
506    /// Readable
507    /// </details>
508    ///
509    /// ## Signals
510    ///
511    ///
512    /// #### `close`
513    ///  The ::close signal is a
514    /// [keybinding signal][GtkBindingSignal]
515    /// which gets emitted when the user uses a keybinding to close
516    /// the dialog.
517    ///
518    /// The default binding for this signal is the Escape key.
519    ///
520    /// Action
521    ///
522    ///
523    /// #### `response`
524    ///  Emitted when an action widget is clicked, the dialog receives a
525    /// delete event, or the application programmer calls [`DialogExt::response()`][crate::prelude::DialogExt::response()].
526    /// On a delete event, the response ID is [`ResponseType::DeleteEvent`][crate::ResponseType::DeleteEvent].
527    /// Otherwise, it depends on which action widget was clicked.
528    ///
529    ///
530    /// <details><summary><h4>Window</h4></summary>
531    ///
532    ///
533    /// #### `activate-default`
534    ///  The ::activate-default signal is a
535    /// [keybinding signal][GtkBindingSignal]
536    /// which gets emitted when the user activates the default widget
537    /// of `window`.
538    ///
539    /// Action
540    ///
541    ///
542    /// #### `activate-focus`
543    ///  The ::activate-focus signal is a
544    /// [keybinding signal][GtkBindingSignal]
545    /// which gets emitted when the user activates the currently
546    /// focused widget of `window`.
547    ///
548    /// Action
549    ///
550    ///
551    /// #### `enable-debugging`
552    ///  The ::enable-debugging signal is a [keybinding signal][GtkBindingSignal]
553    /// which gets emitted when the user enables or disables interactive
554    /// debugging. When `toggle` is [`true`], interactive debugging is toggled
555    /// on or off, when it is [`false`], the debugger will be pointed at the
556    /// widget under the pointer.
557    ///
558    /// The default bindings for this signal are Ctrl-Shift-I
559    /// and Ctrl-Shift-D.
560    ///
561    /// Action
562    ///
563    ///
564    /// #### `keys-changed`
565    ///  The ::keys-changed signal gets emitted when the set of accelerators
566    /// or mnemonics that are associated with `window` changes.
567    ///
568    ///
569    ///
570    ///
571    /// #### `set-focus`
572    ///  This signal is emitted whenever the currently focused widget in
573    /// this window changes.
574    ///
575    ///
576    /// </details>
577    /// <details><summary><h4>Container</h4></summary>
578    ///
579    ///
580    /// #### `add`
581    ///
582    ///
583    ///
584    /// #### `check-resize`
585    ///
586    ///
587    ///
588    /// #### `remove`
589    ///
590    ///
591    ///
592    /// #### `set-focus-child`
593    ///
594    /// </details>
595    /// <details><summary><h4>Widget</h4></summary>
596    ///
597    ///
598    /// #### `accel-closures-changed`
599    ///
600    ///
601    ///
602    /// #### `button-press-event`
603    ///  The ::button-press-event signal will be emitted when a button
604    /// (typically from a mouse) is pressed.
605    ///
606    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
607    /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
608    ///
609    /// This signal will be sent to the grab widget if there is one.
610    ///
611    ///
612    ///
613    ///
614    /// #### `button-release-event`
615    ///  The ::button-release-event signal will be emitted when a button
616    /// (typically from a mouse) is released.
617    ///
618    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
619    /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
620    ///
621    /// This signal will be sent to the grab widget if there is one.
622    ///
623    ///
624    ///
625    ///
626    /// #### `can-activate-accel`
627    ///  Determines whether an accelerator that activates the signal
628    /// identified by `signal_id` can currently be activated.
629    /// This signal is present to allow applications and derived
630    /// widgets to override the default [`Widget`][crate::Widget] handling
631    /// for determining whether an accelerator can be activated.
632    ///
633    ///
634    ///
635    ///
636    /// #### `child-notify`
637    ///  The ::child-notify signal is emitted for each
638    /// [child property][child-properties] that has
639    /// changed on an object. The signal's detail holds the property name.
640    ///
641    /// Detailed
642    ///
643    ///
644    /// #### `composited-changed`
645    ///  The ::composited-changed signal is emitted when the composited
646    /// status of `widgets` screen changes.
647    /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
648    ///
649    /// Action
650    ///
651    ///
652    /// #### `configure-event`
653    ///  The ::configure-event signal will be emitted when the size, position or
654    /// stacking of the `widget`'s window has changed.
655    ///
656    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
657    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
658    /// automatically for all new windows.
659    ///
660    ///
661    ///
662    ///
663    /// #### `damage-event`
664    ///  Emitted when a redirected window belonging to `widget` gets drawn into.
665    /// The region/area members of the event shows what area of the redirected
666    /// drawable was drawn into.
667    ///
668    ///
669    ///
670    ///
671    /// #### `delete-event`
672    ///  The ::delete-event signal is emitted if a user requests that
673    /// a toplevel window is closed. The default handler for this signal
674    /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
675    /// this signal will cause the window to be hidden instead, so that
676    /// it can later be shown again without reconstructing it.
677    ///
678    ///
679    ///
680    ///
681    /// #### `destroy`
682    ///  Signals that all holders of a reference to the widget should release
683    /// the reference that they hold. May result in finalization of the widget
684    /// if all references are released.
685    ///
686    /// This signal is not suitable for saving widget state.
687    ///
688    ///
689    ///
690    ///
691    /// #### `destroy-event`
692    ///  The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
693    /// You rarely get this signal, because most widgets disconnect themselves
694    /// from their window before they destroy it, so no widget owns the
695    /// window at destroy time.
696    ///
697    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
698    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
699    /// automatically for all new windows.
700    ///
701    ///
702    ///
703    ///
704    /// #### `direction-changed`
705    ///  The ::direction-changed signal is emitted when the text direction
706    /// of a widget changes.
707    ///
708    ///
709    ///
710    ///
711    /// #### `drag-begin`
712    ///  The ::drag-begin signal is emitted on the drag source when a drag is
713    /// started. A typical reason to connect to this signal is to set up a
714    /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
715    ///
716    /// Note that some widgets set up a drag icon in the default handler of
717    /// this signal, so you may have to use `g_signal_connect_after()` to
718    /// override what the default handler did.
719    ///
720    ///
721    ///
722    ///
723    /// #### `drag-data-delete`
724    ///  The ::drag-data-delete signal is emitted on the drag source when a drag
725    /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
726    /// handler is responsible for deleting the data that has been dropped. What
727    /// "delete" means depends on the context of the drag operation.
728    ///
729    ///
730    ///
731    ///
732    /// #### `drag-data-get`
733    ///  The ::drag-data-get signal is emitted on the drag source when the drop
734    /// site requests the data which is dragged. It is the responsibility of
735    /// the signal handler to fill `data` with the data in the format which
736    /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
737    /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
738    ///
739    ///
740    ///
741    ///
742    /// #### `drag-data-received`
743    ///  format == 8))
744    ///  {
745    ///  GdkDragAction action;
746    ///
747    ///  // handle data here
748    ///
749    ///  action = gdk_drag_context_get_selected_action (context);
750    ///  if (action == GDK_ACTION_ASK)
751    ///  {
752    ///  GtkWidget *dialog;
753    ///  gint response;
754    ///
755    ///  dialog = gtk_message_dialog_new (NULL,
756    ///  GTK_DIALOG_MODAL |
757    ///  GTK_DIALOG_DESTROY_WITH_PARENT,
758    ///  GTK_MESSAGE_INFO,
759    ///  GTK_BUTTONS_YES_NO,
760    ///  "Move the data ?\n");
761    ///  response = gtk_dialog_run (GTK_DIALOG (dialog));
762    ///  gtk_widget_destroy (dialog);
763    ///
764    ///  if (response == GTK_RESPONSE_YES)
765    ///  action = GDK_ACTION_MOVE;
766    ///  else
767    ///  action = GDK_ACTION_COPY;
768    ///  }
769    ///
770    ///  gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
771    ///  }
772    ///  else
773    ///  gtk_drag_finish (context, FALSE, FALSE, time);
774    ///  }
775    /// ]|
776    ///
777    ///
778    ///
779    ///
780    /// #### `drag-drop`
781    ///  The ::drag-drop signal is emitted on the drop site when the user drops
782    /// the data onto the widget. The signal handler must determine whether
783    /// the cursor position is in a drop zone or not. If it is not in a drop
784    /// zone, it returns [`false`] and no further processing is necessary.
785    /// Otherwise, the handler returns [`true`]. In this case, the handler must
786    /// ensure that `gtk_drag_finish()` is called to let the source know that
787    /// the drop is done. The call to `gtk_drag_finish()` can be done either
788    /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
789    /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
790    /// or more of the supported targets.
791    ///
792    ///
793    ///
794    ///
795    /// #### `drag-end`
796    ///  The ::drag-end signal is emitted on the drag source when a drag is
797    /// finished. A typical reason to connect to this signal is to undo
798    /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
799    ///
800    ///
801    ///
802    ///
803    /// #### `drag-failed`
804    ///  The ::drag-failed signal is emitted on the drag source when a drag has
805    /// failed. The signal handler may hook custom code to handle a failed DnD
806    /// operation based on the type of error, it returns [`true`] is the failure has
807    /// been already handled (not showing the default "drag operation failed"
808    /// animation), otherwise it returns [`false`].
809    ///
810    ///
811    ///
812    ///
813    /// #### `drag-leave`
814    ///  The ::drag-leave signal is emitted on the drop site when the cursor
815    /// leaves the widget. A typical reason to connect to this signal is to
816    /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
817    /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
818    ///
819    ///
820    /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
821    /// ::drag-drop signal, for instance to allow cleaning up of a preview item
822    /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
823    ///
824    ///
825    ///
826    ///
827    /// #### `drag-motion`
828    ///  suggested_action,
829    ///  time);
830    ///  }
831    ///  else
832    ///  {
833    ///  // accept the drop
834    ///  }
835    /// }
836    /// ]|
837    ///
838    ///
839    ///
840    ///
841    /// #### `draw`
842    ///  This signal is emitted when a widget is supposed to render itself.
843    /// The `widget`'s top left corner must be painted at the origin of
844    /// the passed in context and be sized to the values returned by
845    /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
846    /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
847    ///
848    /// Signal handlers connected to this signal can modify the cairo
849    /// context passed as `cr` in any way they like and don't need to
850    /// restore it. The signal emission takes care of calling `cairo_save()`
851    /// before and `cairo_restore()` after invoking the handler.
852    ///
853    /// The signal handler will get a `cr` with a clip region already set to the
854    /// widget's dirty region, i.e. to the area that needs repainting. Complicated
855    /// widgets that want to avoid redrawing themselves completely can get the full
856    /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
857    /// get a finer-grained representation of the dirty region with
858    /// `cairo_copy_clip_rectangle_list()`.
859    ///
860    ///
861    ///
862    ///
863    /// #### `enter-notify-event`
864    ///  The ::enter-notify-event will be emitted when the pointer enters
865    /// the `widget`'s window.
866    ///
867    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
868    /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
869    ///
870    /// This signal will be sent to the grab widget if there is one.
871    ///
872    ///
873    ///
874    ///
875    /// #### `event`
876    ///  The GTK+ main loop will emit three signals for each GDK event delivered
877    /// to a widget: one generic ::event signal, another, more specific,
878    /// signal that matches the type of event delivered (e.g.
879    /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
880    /// [`event-after`][struct@crate::Widget#event-after] signal.
881    ///
882    ///
883    ///
884    ///
885    /// #### `event-after`
886    ///  After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
887    /// the second more specific signal, ::event-after will be emitted
888    /// regardless of the previous two signals handlers return values.
889    ///
890    ///
891    ///
892    ///
893    /// #### `focus`
894    ///
895    ///
896    ///
897    /// #### `focus-in-event`
898    ///  The ::focus-in-event signal will be emitted when the keyboard focus
899    /// enters the `widget`'s window.
900    ///
901    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
902    /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
903    ///
904    ///
905    ///
906    ///
907    /// #### `focus-out-event`
908    ///  The ::focus-out-event signal will be emitted when the keyboard focus
909    /// leaves the `widget`'s window.
910    ///
911    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
912    /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
913    ///
914    ///
915    ///
916    ///
917    /// #### `grab-broken-event`
918    ///  Emitted when a pointer or keyboard grab on a window belonging
919    /// to `widget` gets broken.
920    ///
921    /// On X11, this happens when the grab window becomes unviewable
922    /// (i.e. it or one of its ancestors is unmapped), or if the same
923    /// application grabs the pointer or keyboard again.
924    ///
925    ///
926    ///
927    ///
928    /// #### `grab-focus`
929    ///  Action
930    ///
931    ///
932    /// #### `grab-notify`
933    ///  The ::grab-notify signal is emitted when a widget becomes
934    /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
935    /// another widget, or when it becomes unshadowed due to a grab
936    /// being removed.
937    ///
938    /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
939    /// grab widget in the grab stack of its window group is not
940    /// its ancestor.
941    ///
942    ///
943    ///
944    ///
945    /// #### `hide`
946    ///  The ::hide signal is emitted when `widget` is hidden, for example with
947    /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
948    ///
949    ///
950    ///
951    ///
952    /// #### `hierarchy-changed`
953    ///  The ::hierarchy-changed signal is emitted when the
954    /// anchored state of a widget changes. A widget is
955    /// “anchored” when its toplevel
956    /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
957    /// a widget changes from un-anchored to anchored or vice-versa.
958    ///
959    ///
960    ///
961    ///
962    /// #### `key-press-event`
963    ///  The ::key-press-event signal is emitted when a key is pressed. The signal
964    /// emission will reoccur at the key-repeat rate when the key is kept pressed.
965    ///
966    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
967    /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
968    ///
969    /// This signal will be sent to the grab widget if there is one.
970    ///
971    ///
972    ///
973    ///
974    /// #### `key-release-event`
975    ///  The ::key-release-event signal is emitted when a key is released.
976    ///
977    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
978    /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
979    ///
980    /// This signal will be sent to the grab widget if there is one.
981    ///
982    ///
983    ///
984    ///
985    /// #### `keynav-failed`
986    ///  Gets emitted if keyboard navigation fails.
987    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
988    ///
989    ///
990    ///
991    ///
992    /// #### `leave-notify-event`
993    ///  The ::leave-notify-event will be emitted when the pointer leaves
994    /// the `widget`'s window.
995    ///
996    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
997    /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
998    ///
999    /// This signal will be sent to the grab widget if there is one.
1000    ///
1001    ///
1002    ///
1003    ///
1004    /// #### `map`
1005    ///  The ::map signal is emitted when `widget` is going to be mapped, that is
1006    /// when the widget is visible (which is controlled with
1007    /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
1008    /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
1009    /// be emitted.
1010    ///
1011    /// The ::map signal can be used to determine whether a widget will be drawn,
1012    /// for instance it can resume an animation that was stopped during the
1013    /// emission of [`unmap`][struct@crate::Widget#unmap].
1014    ///
1015    ///
1016    ///
1017    ///
1018    /// #### `map-event`
1019    ///  The ::map-event signal will be emitted when the `widget`'s window is
1020    /// mapped. A window is mapped when it becomes visible on the screen.
1021    ///
1022    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1023    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1024    /// automatically for all new windows.
1025    ///
1026    ///
1027    ///
1028    ///
1029    /// #### `mnemonic-activate`
1030    ///  The default handler for this signal activates `widget` if `group_cycling`
1031    /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
1032    ///
1033    ///
1034    ///
1035    ///
1036    /// #### `motion-notify-event`
1037    ///  The ::motion-notify-event signal is emitted when the pointer moves
1038    /// over the widget's [`gdk::Window`][crate::gdk::Window].
1039    ///
1040    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
1041    /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
1042    ///
1043    /// This signal will be sent to the grab widget if there is one.
1044    ///
1045    ///
1046    ///
1047    ///
1048    /// #### `move-focus`
1049    ///  Action
1050    ///
1051    ///
1052    /// #### `parent-set`
1053    ///  The ::parent-set signal is emitted when a new parent
1054    /// has been set on a widget.
1055    ///
1056    ///
1057    ///
1058    ///
1059    /// #### `popup-menu`
1060    ///  This signal gets emitted whenever a widget should pop up a context
1061    /// menu. This usually happens through the standard key binding mechanism;
1062    /// by pressing a certain key while a widget is focused, the user can cause
1063    /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
1064    /// a menu with clipboard commands. See the
1065    /// [Popup Menu Migration Checklist][checklist-popup-menu]
1066    /// for an example of how to use this signal.
1067    ///
1068    /// Action
1069    ///
1070    ///
1071    /// #### `property-notify-event`
1072    ///  The ::property-notify-event signal will be emitted when a property on
1073    /// the `widget`'s window has been changed or deleted.
1074    ///
1075    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1076    /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
1077    ///
1078    ///
1079    ///
1080    ///
1081    /// #### `proximity-in-event`
1082    ///  To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1083    /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
1084    ///
1085    /// This signal will be sent to the grab widget if there is one.
1086    ///
1087    ///
1088    ///
1089    ///
1090    /// #### `proximity-out-event`
1091    ///  To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1092    /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
1093    ///
1094    /// This signal will be sent to the grab widget if there is one.
1095    ///
1096    ///
1097    ///
1098    ///
1099    /// #### `query-tooltip`
1100    ///  Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
1101    /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
1102    /// focus in keyboard mode.
1103    ///
1104    /// Using the given coordinates, the signal handler should determine
1105    /// whether a tooltip should be shown for `widget`. If this is the case
1106    /// [`true`] should be returned, [`false`] otherwise. Note that if
1107    /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
1108    /// should not be used.
1109    ///
1110    /// The signal handler is free to manipulate `tooltip` with the therefore
1111    /// destined function calls.
1112    ///
1113    ///
1114    ///
1115    ///
1116    /// #### `realize`
1117    ///  The ::realize signal is emitted when `widget` is associated with a
1118    /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
1119    /// widget has been mapped (that is, it is going to be drawn).
1120    ///
1121    ///
1122    ///
1123    ///
1124    /// #### `screen-changed`
1125    ///  The ::screen-changed signal gets emitted when the
1126    /// screen of a widget has changed.
1127    ///
1128    ///
1129    ///
1130    ///
1131    /// #### `scroll-event`
1132    ///  The ::scroll-event signal is emitted when a button in the 4 to 7
1133    /// range is pressed. Wheel mice are usually configured to generate
1134    /// button press events for buttons 4 and 5 when the wheel is turned.
1135    ///
1136    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1137    /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
1138    ///
1139    /// This signal will be sent to the grab widget if there is one.
1140    ///
1141    ///
1142    ///
1143    ///
1144    /// #### `selection-clear-event`
1145    ///  The ::selection-clear-event signal will be emitted when the
1146    /// the `widget`'s window has lost ownership of a selection.
1147    ///
1148    ///
1149    ///
1150    ///
1151    /// #### `selection-get`
1152    ///
1153    ///
1154    ///
1155    /// #### `selection-notify-event`
1156    ///
1157    ///
1158    ///
1159    /// #### `selection-received`
1160    ///
1161    ///
1162    ///
1163    /// #### `selection-request-event`
1164    ///  The ::selection-request-event signal will be emitted when
1165    /// another client requests ownership of the selection owned by
1166    /// the `widget`'s window.
1167    ///
1168    ///
1169    ///
1170    ///
1171    /// #### `show`
1172    ///  The ::show signal is emitted when `widget` is shown, for example with
1173    /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
1174    ///
1175    ///
1176    ///
1177    ///
1178    /// #### `show-help`
1179    ///  Action
1180    ///
1181    ///
1182    /// #### `size-allocate`
1183    ///
1184    ///
1185    ///
1186    /// #### `state-changed`
1187    ///  The ::state-changed signal is emitted when the widget state changes.
1188    /// See `gtk_widget_get_state()`.
1189    ///
1190    ///
1191    ///
1192    ///
1193    /// #### `state-flags-changed`
1194    ///  The ::state-flags-changed signal is emitted when the widget state
1195    /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
1196    ///
1197    ///
1198    ///
1199    ///
1200    /// #### `style-set`
1201    ///  The ::style-set signal is emitted when a new style has been set
1202    /// on a widget. Note that style-modifying functions like
1203    /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1204    ///
1205    /// Note that this signal is emitted for changes to the deprecated
1206    /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1207    /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1208    ///
1209    ///
1210    ///
1211    ///
1212    /// #### `style-updated`
1213    ///  The ::style-updated signal is a convenience signal that is emitted when the
1214    /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1215    /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1216    ///
1217    /// Note that style-modifying functions like `gtk_widget_override_color()` also
1218    /// cause this signal to be emitted.
1219    ///
1220    ///
1221    ///
1222    ///
1223    /// #### `touch-event`
1224    ///
1225    ///
1226    ///
1227    /// #### `unmap`
1228    ///  The ::unmap signal is emitted when `widget` is going to be unmapped, which
1229    /// means that either it or any of its parents up to the toplevel widget have
1230    /// been set as hidden.
1231    ///
1232    /// As ::unmap indicates that a widget will not be shown any longer, it can be
1233    /// used to, for example, stop an animation on the widget.
1234    ///
1235    ///
1236    ///
1237    ///
1238    /// #### `unmap-event`
1239    ///  The ::unmap-event signal will be emitted when the `widget`'s window is
1240    /// unmapped. A window is unmapped when it becomes invisible on the screen.
1241    ///
1242    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1243    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1244    /// automatically for all new windows.
1245    ///
1246    ///
1247    ///
1248    ///
1249    /// #### `unrealize`
1250    ///  The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1251    /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1252    /// called or the widget has been unmapped (that is, it is going to be
1253    /// hidden).
1254    ///
1255    ///
1256    ///
1257    ///
1258    /// #### `visibility-notify-event`
1259    ///  The ::visibility-notify-event will be emitted when the `widget`'s
1260    /// window is obscured or unobscured.
1261    ///
1262    /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1263    /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1264    ///
1265    ///
1266    ///
1267    ///
1268    /// #### `window-state-event`
1269    ///  The ::window-state-event will be emitted when the state of the
1270    /// toplevel window associated to the `widget` changes.
1271    ///
1272    /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1273    /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1274    /// this mask automatically for all new windows.
1275    ///
1276    ///
1277    /// </details>
1278    ///
1279    /// # Implements
1280    ///
1281    /// [`DialogExt`][trait@crate::prelude::DialogExt], [`GtkWindowExt`][trait@crate::prelude::GtkWindowExt], [`BinExt`][trait@crate::prelude::BinExt], [`ContainerExt`][trait@crate::prelude::ContainerExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`DialogExtManual`][trait@crate::prelude::DialogExtManual], [`GtkWindowExtManual`][trait@crate::prelude::GtkWindowExtManual], [`ContainerExtManual`][trait@crate::prelude::ContainerExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
1282    #[doc(alias = "GtkDialog")]
1283    pub struct Dialog(Object<ffi::GtkDialog, ffi::GtkDialogClass>) @extends Window, Bin, Container, Widget, @implements Buildable;
1284
1285    match fn {
1286        type_ => || ffi::gtk_dialog_get_type(),
1287    }
1288}
1289
1290impl Dialog {
1291    pub const NONE: Option<&'static Dialog> = None;
1292
1293    /// Creates a new dialog box.
1294    ///
1295    /// Widgets should not be packed into this [`Window`][crate::Window]
1296    /// directly, but into the `vbox` and `action_area`, as described above.
1297    ///
1298    /// # Returns
1299    ///
1300    /// the new dialog as a [`Widget`][crate::Widget]
1301    #[doc(alias = "gtk_dialog_new")]
1302    pub fn new() -> Dialog {
1303        assert_initialized_main_thread!();
1304        unsafe { Widget::from_glib_none(ffi::gtk_dialog_new()).unsafe_cast() }
1305    }
1306
1307    //#[doc(alias = "gtk_dialog_new_with_buttons")]
1308    //#[doc(alias = "new_with_buttons")]
1309    //pub fn with_buttons(title: Option<&str>, parent: Option<&impl IsA<Window>>, flags: DialogFlags, first_button_text: Option<&str>, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) -> Dialog {
1310    //    unsafe { TODO: call ffi:gtk_dialog_new_with_buttons() }
1311    //}
1312
1313    // rustdoc-stripper-ignore-next
1314    /// Creates a new builder-pattern struct instance to construct [`Dialog`] objects.
1315    ///
1316    /// This method returns an instance of [`DialogBuilder`](crate::builders::DialogBuilder) which can be used to create [`Dialog`] objects.
1317    pub fn builder() -> DialogBuilder {
1318        DialogBuilder::new()
1319    }
1320}
1321
1322impl Default for Dialog {
1323    fn default() -> Self {
1324        Self::new()
1325    }
1326}
1327
1328// rustdoc-stripper-ignore-next
1329/// A [builder-pattern] type to construct [`Dialog`] objects.
1330///
1331/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1332#[must_use = "The builder must be built to be used"]
1333pub struct DialogBuilder {
1334    builder: glib::object::ObjectBuilder<'static, Dialog>,
1335}
1336
1337impl DialogBuilder {
1338    fn new() -> Self {
1339        Self {
1340            builder: glib::object::Object::builder(),
1341        }
1342    }
1343
1344    /// [`true`] if the dialog uses a [`HeaderBar`][crate::HeaderBar] for action buttons
1345    /// instead of the action-area.
1346    ///
1347    /// For technical reasons, this property is declared as an integer
1348    /// property, but you should only set it to [`true`] or [`false`].
1349    pub fn use_header_bar(self, use_header_bar: i32) -> Self {
1350        Self {
1351            builder: self.builder.property("use-header-bar", use_header_bar),
1352        }
1353    }
1354
1355    /// Whether the window should receive the input focus.
1356    pub fn accept_focus(self, accept_focus: bool) -> Self {
1357        Self {
1358            builder: self.builder.property("accept-focus", accept_focus),
1359        }
1360    }
1361
1362    /// The [`Application`][crate::Application] associated with the window.
1363    ///
1364    /// The application will be kept alive for at least as long as it
1365    /// has any windows associated with it (see [`ApplicationExtManual::hold()`][crate::gio::prelude::ApplicationExtManual::hold()]
1366    /// for a way to keep it alive without windows).
1367    ///
1368    /// Normally, the connection between the application and the window
1369    /// will remain until the window is destroyed, but you can explicitly
1370    /// remove it by setting the :application property to [`None`].
1371    pub fn application(self, application: &impl IsA<Application>) -> Self {
1372        Self {
1373            builder: self
1374                .builder
1375                .property("application", application.clone().upcast()),
1376        }
1377    }
1378
1379    /// The widget to which this window is attached.
1380    /// See [`GtkWindowExt::set_attached_to()`][crate::prelude::GtkWindowExt::set_attached_to()].
1381    ///
1382    /// Examples of places where specifying this relation is useful are
1383    /// for instance a [`Menu`][crate::Menu] created by a [`ComboBox`][crate::ComboBox], a completion
1384    /// popup window created by [`Entry`][crate::Entry] or a typeahead search entry
1385    /// created by [`TreeView`][crate::TreeView].
1386    pub fn attached_to(self, attached_to: &impl IsA<Widget>) -> Self {
1387        Self {
1388            builder: self
1389                .builder
1390                .property("attached-to", attached_to.clone().upcast()),
1391        }
1392    }
1393
1394    /// Whether the window should be decorated by the window manager.
1395    pub fn decorated(self, decorated: bool) -> Self {
1396        Self {
1397            builder: self.builder.property("decorated", decorated),
1398        }
1399    }
1400
1401    pub fn default_height(self, default_height: i32) -> Self {
1402        Self {
1403            builder: self.builder.property("default-height", default_height),
1404        }
1405    }
1406
1407    pub fn default_width(self, default_width: i32) -> Self {
1408        Self {
1409            builder: self.builder.property("default-width", default_width),
1410        }
1411    }
1412
1413    /// Whether the window frame should have a close button.
1414    pub fn deletable(self, deletable: bool) -> Self {
1415        Self {
1416            builder: self.builder.property("deletable", deletable),
1417        }
1418    }
1419
1420    pub fn destroy_with_parent(self, destroy_with_parent: bool) -> Self {
1421        Self {
1422            builder: self
1423                .builder
1424                .property("destroy-with-parent", destroy_with_parent),
1425        }
1426    }
1427
1428    /// Whether the window should receive the input focus when mapped.
1429    pub fn focus_on_map(self, focus_on_map: bool) -> Self {
1430        Self {
1431            builder: self.builder.property("focus-on-map", focus_on_map),
1432        }
1433    }
1434
1435    /// Whether 'focus rectangles' are currently visible in this window.
1436    ///
1437    /// This property is maintained by GTK+ based on user input
1438    /// and should not be set by applications.
1439    pub fn focus_visible(self, focus_visible: bool) -> Self {
1440        Self {
1441            builder: self.builder.property("focus-visible", focus_visible),
1442        }
1443    }
1444
1445    /// The window gravity of the window. See [`GtkWindowExt::move_()`][crate::prelude::GtkWindowExt::move_()] and [`gdk::Gravity`][crate::gdk::Gravity] for
1446    /// more details about window gravity.
1447    pub fn gravity(self, gravity: gdk::Gravity) -> Self {
1448        Self {
1449            builder: self.builder.property("gravity", gravity),
1450        }
1451    }
1452
1453    /// Whether the titlebar should be hidden during maximization.
1454    pub fn hide_titlebar_when_maximized(self, hide_titlebar_when_maximized: bool) -> Self {
1455        Self {
1456            builder: self
1457                .builder
1458                .property("hide-titlebar-when-maximized", hide_titlebar_when_maximized),
1459        }
1460    }
1461
1462    pub fn icon(self, icon: &gdk_pixbuf::Pixbuf) -> Self {
1463        Self {
1464            builder: self.builder.property("icon", icon.clone()),
1465        }
1466    }
1467
1468    /// The :icon-name property specifies the name of the themed icon to
1469    /// use as the window icon. See [`IconTheme`][crate::IconTheme] for more details.
1470    pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
1471        Self {
1472            builder: self.builder.property("icon-name", icon_name.into()),
1473        }
1474    }
1475
1476    /// Whether mnemonics are currently visible in this window.
1477    ///
1478    /// This property is maintained by GTK+ based on user input,
1479    /// and should not be set by applications.
1480    pub fn mnemonics_visible(self, mnemonics_visible: bool) -> Self {
1481        Self {
1482            builder: self
1483                .builder
1484                .property("mnemonics-visible", mnemonics_visible),
1485        }
1486    }
1487
1488    pub fn modal(self, modal: bool) -> Self {
1489        Self {
1490            builder: self.builder.property("modal", modal),
1491        }
1492    }
1493
1494    pub fn resizable(self, resizable: bool) -> Self {
1495        Self {
1496            builder: self.builder.property("resizable", resizable),
1497        }
1498    }
1499
1500    pub fn role(self, role: impl Into<glib::GString>) -> Self {
1501        Self {
1502            builder: self.builder.property("role", role.into()),
1503        }
1504    }
1505
1506    pub fn screen(self, screen: &gdk::Screen) -> Self {
1507        Self {
1508            builder: self.builder.property("screen", screen.clone()),
1509        }
1510    }
1511
1512    pub fn skip_pager_hint(self, skip_pager_hint: bool) -> Self {
1513        Self {
1514            builder: self.builder.property("skip-pager-hint", skip_pager_hint),
1515        }
1516    }
1517
1518    pub fn skip_taskbar_hint(self, skip_taskbar_hint: bool) -> Self {
1519        Self {
1520            builder: self
1521                .builder
1522                .property("skip-taskbar-hint", skip_taskbar_hint),
1523        }
1524    }
1525
1526    /// The :startup-id is a write-only property for setting window's
1527    /// startup notification identifier. See [`GtkWindowExt::set_startup_id()`][crate::prelude::GtkWindowExt::set_startup_id()]
1528    /// for more details.
1529    pub fn startup_id(self, startup_id: impl Into<glib::GString>) -> Self {
1530        Self {
1531            builder: self.builder.property("startup-id", startup_id.into()),
1532        }
1533    }
1534
1535    pub fn title(self, title: impl Into<glib::GString>) -> Self {
1536        Self {
1537            builder: self.builder.property("title", title.into()),
1538        }
1539    }
1540
1541    /// The transient parent of the window. See [`GtkWindowExt::set_transient_for()`][crate::prelude::GtkWindowExt::set_transient_for()] for
1542    /// more details about transient windows.
1543    pub fn transient_for(self, transient_for: &impl IsA<Window>) -> Self {
1544        Self {
1545            builder: self
1546                .builder
1547                .property("transient-for", transient_for.clone().upcast()),
1548        }
1549    }
1550
1551    pub fn type_(self, type_: WindowType) -> Self {
1552        Self {
1553            builder: self.builder.property("type", type_),
1554        }
1555    }
1556
1557    pub fn type_hint(self, type_hint: gdk::WindowTypeHint) -> Self {
1558        Self {
1559            builder: self.builder.property("type-hint", type_hint),
1560        }
1561    }
1562
1563    pub fn urgency_hint(self, urgency_hint: bool) -> Self {
1564        Self {
1565            builder: self.builder.property("urgency-hint", urgency_hint),
1566        }
1567    }
1568
1569    pub fn window_position(self, window_position: WindowPosition) -> Self {
1570        Self {
1571            builder: self.builder.property("window-position", window_position),
1572        }
1573    }
1574
1575    pub fn border_width(self, border_width: u32) -> Self {
1576        Self {
1577            builder: self.builder.property("border-width", border_width),
1578        }
1579    }
1580
1581    pub fn child(self, child: &impl IsA<Widget>) -> Self {
1582        Self {
1583            builder: self.builder.property("child", child.clone().upcast()),
1584        }
1585    }
1586
1587    pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
1588        Self {
1589            builder: self.builder.property("resize-mode", resize_mode),
1590        }
1591    }
1592
1593    pub fn app_paintable(self, app_paintable: bool) -> Self {
1594        Self {
1595            builder: self.builder.property("app-paintable", app_paintable),
1596        }
1597    }
1598
1599    pub fn can_default(self, can_default: bool) -> Self {
1600        Self {
1601            builder: self.builder.property("can-default", can_default),
1602        }
1603    }
1604
1605    pub fn can_focus(self, can_focus: bool) -> Self {
1606        Self {
1607            builder: self.builder.property("can-focus", can_focus),
1608        }
1609    }
1610
1611    pub fn events(self, events: gdk::EventMask) -> Self {
1612        Self {
1613            builder: self.builder.property("events", events),
1614        }
1615    }
1616
1617    /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1618    pub fn expand(self, expand: bool) -> Self {
1619        Self {
1620            builder: self.builder.property("expand", expand),
1621        }
1622    }
1623
1624    /// Whether the widget should grab focus when it is clicked with the mouse.
1625    ///
1626    /// This property is only relevant for widgets that can take focus.
1627    ///
1628    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1629    /// GtkComboBox) implemented this property individually.
1630    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1631        Self {
1632            builder: self.builder.property("focus-on-click", focus_on_click),
1633        }
1634    }
1635
1636    /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1637    pub fn halign(self, halign: Align) -> Self {
1638        Self {
1639            builder: self.builder.property("halign", halign),
1640        }
1641    }
1642
1643    pub fn has_default(self, has_default: bool) -> Self {
1644        Self {
1645            builder: self.builder.property("has-default", has_default),
1646        }
1647    }
1648
1649    pub fn has_focus(self, has_focus: bool) -> Self {
1650        Self {
1651            builder: self.builder.property("has-focus", has_focus),
1652        }
1653    }
1654
1655    /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1656    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1657    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1658    /// whether it will provide a tooltip or not.
1659    ///
1660    /// Note that setting this property to [`true`] for the first time will change
1661    /// the event masks of the GdkWindows of this widget to include leave-notify
1662    /// and motion-notify events. This cannot and will not be undone when the
1663    /// property is set to [`false`] again.
1664    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1665        Self {
1666            builder: self.builder.property("has-tooltip", has_tooltip),
1667        }
1668    }
1669
1670    pub fn height_request(self, height_request: i32) -> Self {
1671        Self {
1672            builder: self.builder.property("height-request", height_request),
1673        }
1674    }
1675
1676    /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1677    pub fn hexpand(self, hexpand: bool) -> Self {
1678        Self {
1679            builder: self.builder.property("hexpand", hexpand),
1680        }
1681    }
1682
1683    /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1684    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1685        Self {
1686            builder: self.builder.property("hexpand-set", hexpand_set),
1687        }
1688    }
1689
1690    pub fn is_focus(self, is_focus: bool) -> Self {
1691        Self {
1692            builder: self.builder.property("is-focus", is_focus),
1693        }
1694    }
1695
1696    /// Sets all four sides' margin at once. If read, returns max
1697    /// margin on any side.
1698    pub fn margin(self, margin: i32) -> Self {
1699        Self {
1700            builder: self.builder.property("margin", margin),
1701        }
1702    }
1703
1704    /// Margin on bottom side of widget.
1705    ///
1706    /// This property adds margin outside of the widget's normal size
1707    /// request, the margin will be added in addition to the size from
1708    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1709    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1710        Self {
1711            builder: self.builder.property("margin-bottom", margin_bottom),
1712        }
1713    }
1714
1715    /// Margin on end of widget, horizontally. This property supports
1716    /// left-to-right and right-to-left text directions.
1717    ///
1718    /// This property adds margin outside of the widget's normal size
1719    /// request, the margin will be added in addition to the size from
1720    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1721    pub fn margin_end(self, margin_end: i32) -> Self {
1722        Self {
1723            builder: self.builder.property("margin-end", margin_end),
1724        }
1725    }
1726
1727    /// Margin on start of widget, horizontally. This property supports
1728    /// left-to-right and right-to-left text directions.
1729    ///
1730    /// This property adds margin outside of the widget's normal size
1731    /// request, the margin will be added in addition to the size from
1732    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1733    pub fn margin_start(self, margin_start: i32) -> Self {
1734        Self {
1735            builder: self.builder.property("margin-start", margin_start),
1736        }
1737    }
1738
1739    /// Margin on top side of widget.
1740    ///
1741    /// This property adds margin outside of the widget's normal size
1742    /// request, the margin will be added in addition to the size from
1743    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1744    pub fn margin_top(self, margin_top: i32) -> Self {
1745        Self {
1746            builder: self.builder.property("margin-top", margin_top),
1747        }
1748    }
1749
1750    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1751        Self {
1752            builder: self.builder.property("name", name.into()),
1753        }
1754    }
1755
1756    pub fn no_show_all(self, no_show_all: bool) -> Self {
1757        Self {
1758            builder: self.builder.property("no-show-all", no_show_all),
1759        }
1760    }
1761
1762    /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1763    /// more details about window opacity.
1764    ///
1765    /// Before 3.8 this was only available in GtkWindow
1766    pub fn opacity(self, opacity: f64) -> Self {
1767        Self {
1768            builder: self.builder.property("opacity", opacity),
1769        }
1770    }
1771
1772    pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1773        Self {
1774            builder: self.builder.property("parent", parent.clone().upcast()),
1775        }
1776    }
1777
1778    pub fn receives_default(self, receives_default: bool) -> Self {
1779        Self {
1780            builder: self.builder.property("receives-default", receives_default),
1781        }
1782    }
1783
1784    pub fn sensitive(self, sensitive: bool) -> Self {
1785        Self {
1786            builder: self.builder.property("sensitive", sensitive),
1787        }
1788    }
1789
1790    /// Sets the text of tooltip to be the given string, which is marked up
1791    /// with the [Pango text markup language][PangoMarkupFormat].
1792    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1793    ///
1794    /// This is a convenience property which will take care of getting the
1795    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1796    /// will automatically be set to [`true`] and there will be taken care of
1797    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1798    ///
1799    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1800    /// are set, the last one wins.
1801    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1802        Self {
1803            builder: self
1804                .builder
1805                .property("tooltip-markup", tooltip_markup.into()),
1806        }
1807    }
1808
1809    /// Sets the text of tooltip to be the given string.
1810    ///
1811    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1812    ///
1813    /// This is a convenience property which will take care of getting the
1814    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1815    /// will automatically be set to [`true`] and there will be taken care of
1816    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1817    ///
1818    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1819    /// are set, the last one wins.
1820    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1821        Self {
1822            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1823        }
1824    }
1825
1826    /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1827    pub fn valign(self, valign: Align) -> Self {
1828        Self {
1829            builder: self.builder.property("valign", valign),
1830        }
1831    }
1832
1833    /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1834    pub fn vexpand(self, vexpand: bool) -> Self {
1835        Self {
1836            builder: self.builder.property("vexpand", vexpand),
1837        }
1838    }
1839
1840    /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1841    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1842        Self {
1843            builder: self.builder.property("vexpand-set", vexpand_set),
1844        }
1845    }
1846
1847    pub fn visible(self, visible: bool) -> Self {
1848        Self {
1849            builder: self.builder.property("visible", visible),
1850        }
1851    }
1852
1853    pub fn width_request(self, width_request: i32) -> Self {
1854        Self {
1855            builder: self.builder.property("width-request", width_request),
1856        }
1857    }
1858
1859    // rustdoc-stripper-ignore-next
1860    /// Build the [`Dialog`].
1861    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1862    pub fn build(self) -> Dialog {
1863        assert_initialized_main_thread!();
1864        self.builder.build()
1865    }
1866}
1867
1868/// Trait containing all [`struct@Dialog`] methods.
1869///
1870/// # Implementors
1871///
1872/// [`AboutDialog`][struct@crate::AboutDialog], [`AppChooserDialog`][struct@crate::AppChooserDialog], [`ColorChooserDialog`][struct@crate::ColorChooserDialog], [`Dialog`][struct@crate::Dialog], [`FileChooserDialog`][struct@crate::FileChooserDialog], [`FontChooserDialog`][struct@crate::FontChooserDialog], [`MessageDialog`][struct@crate::MessageDialog], [`RecentChooserDialog`][struct@crate::RecentChooserDialog]
1873pub trait DialogExt: IsA<Dialog> + 'static {
1874    /// Adds an activatable widget to the action area of a [`Dialog`][crate::Dialog],
1875    /// connecting a signal handler that will emit the [`response`][struct@crate::Dialog#response]
1876    /// signal on the dialog when the widget is activated. The widget is
1877    /// appended to the end of the dialog’s action area. If you want to add a
1878    /// non-activatable widget, simply pack it into the `action_area` field
1879    /// of the [`Dialog`][crate::Dialog] struct.
1880    /// ## `child`
1881    /// an activatable widget
1882    /// ## `response_id`
1883    /// response ID for `child`
1884    #[doc(alias = "gtk_dialog_add_action_widget")]
1885    fn add_action_widget(&self, child: &impl IsA<Widget>, response_id: ResponseType) {
1886        unsafe {
1887            ffi::gtk_dialog_add_action_widget(
1888                self.as_ref().to_glib_none().0,
1889                child.as_ref().to_glib_none().0,
1890                response_id.into_glib(),
1891            );
1892        }
1893    }
1894
1895    /// Adds a button with the given text and sets things up so that
1896    /// clicking the button will emit the [`response`][struct@crate::Dialog#response] signal with
1897    /// the given `response_id`. The button is appended to the end of the
1898    /// dialog’s action area. The button widget is returned, but usually
1899    /// you don’t need it.
1900    /// ## `button_text`
1901    /// text of button
1902    /// ## `response_id`
1903    /// response ID for the button
1904    ///
1905    /// # Returns
1906    ///
1907    /// the [`Button`][crate::Button] widget that was added
1908    #[doc(alias = "gtk_dialog_add_button")]
1909    fn add_button(&self, button_text: &str, response_id: ResponseType) -> Widget {
1910        unsafe {
1911            from_glib_none(ffi::gtk_dialog_add_button(
1912                self.as_ref().to_glib_none().0,
1913                button_text.to_glib_none().0,
1914                response_id.into_glib(),
1915            ))
1916        }
1917    }
1918
1919    /// Returns the content area of `self`.
1920    ///
1921    /// # Returns
1922    ///
1923    /// the content area [`Box`][crate::Box].
1924    #[doc(alias = "gtk_dialog_get_content_area")]
1925    #[doc(alias = "get_content_area")]
1926    fn content_area(&self) -> Box {
1927        unsafe {
1928            from_glib_none(ffi::gtk_dialog_get_content_area(
1929                self.as_ref().to_glib_none().0,
1930            ))
1931        }
1932    }
1933
1934    /// Returns the header bar of `self`. Note that the
1935    /// headerbar is only used by the dialog if the
1936    /// [`use-header-bar`][struct@crate::Dialog#use-header-bar] property is [`true`].
1937    ///
1938    /// # Returns
1939    ///
1940    /// the header bar
1941    #[doc(alias = "gtk_dialog_get_header_bar")]
1942    #[doc(alias = "get_header_bar")]
1943    fn header_bar(&self) -> Option<HeaderBar> {
1944        unsafe {
1945            from_glib_none(ffi::gtk_dialog_get_header_bar(
1946                self.as_ref().to_glib_none().0,
1947            ))
1948        }
1949    }
1950
1951    /// Gets the response id of a widget in the action area
1952    /// of a dialog.
1953    /// ## `widget`
1954    /// a widget in the action area of `self`
1955    ///
1956    /// # Returns
1957    ///
1958    /// the response id of `widget`, or [`ResponseType::None`][crate::ResponseType::None]
1959    ///  if `widget` doesn’t have a response id set.
1960    #[doc(alias = "gtk_dialog_get_response_for_widget")]
1961    #[doc(alias = "get_response_for_widget")]
1962    fn response_for_widget(&self, widget: &impl IsA<Widget>) -> ResponseType {
1963        unsafe {
1964            from_glib(ffi::gtk_dialog_get_response_for_widget(
1965                self.as_ref().to_glib_none().0,
1966                widget.as_ref().to_glib_none().0,
1967            ))
1968        }
1969    }
1970
1971    /// Gets the widget button that uses the given response ID in the action area
1972    /// of a dialog.
1973    /// ## `response_id`
1974    /// the response ID used by the `self` widget
1975    ///
1976    /// # Returns
1977    ///
1978    /// the `widget` button that uses the given
1979    ///  `response_id`, or [`None`].
1980    #[doc(alias = "gtk_dialog_get_widget_for_response")]
1981    #[doc(alias = "get_widget_for_response")]
1982    fn widget_for_response(&self, response_id: ResponseType) -> Option<Widget> {
1983        unsafe {
1984            from_glib_none(ffi::gtk_dialog_get_widget_for_response(
1985                self.as_ref().to_glib_none().0,
1986                response_id.into_glib(),
1987            ))
1988        }
1989    }
1990
1991    /// Emits the [`response`][struct@crate::Dialog#response] signal with the given response ID.
1992    /// Used to indicate that the user has responded to the dialog in some way;
1993    /// typically either you or [`run()`][Self::run()] will be monitoring the
1994    /// ::response signal and take appropriate action.
1995    /// ## `response_id`
1996    /// response ID
1997    #[doc(alias = "gtk_dialog_response")]
1998    fn response(&self, response_id: ResponseType) {
1999        unsafe {
2000            ffi::gtk_dialog_response(self.as_ref().to_glib_none().0, response_id.into_glib());
2001        }
2002    }
2003
2004    ///
2005    ///  GtkWidget *dialog = gtk_dialog_new ();
2006    ///  // Set up dialog...
2007    ///
2008    ///  int result = gtk_dialog_run (GTK_DIALOG (dialog));
2009    ///  switch (result)
2010    ///  {
2011    ///  case GTK_RESPONSE_ACCEPT:
2012    ///  // do_application_specific_something ();
2013    ///  break;
2014    ///  default:
2015    ///  // do_nothing_since_dialog_was_cancelled ();
2016    ///  break;
2017    ///  }
2018    ///  gtk_widget_destroy (dialog);
2019    /// ]|
2020    ///
2021    /// Note that even though the recursive main loop gives the effect of a
2022    /// modal dialog (it prevents the user from interacting with other
2023    /// windows in the same window group while the dialog is run), callbacks
2024    /// such as timeouts, IO channel watches, DND drops, etc, will
2025    /// be triggered during a [`run()`][Self::run()] call.
2026    ///
2027    /// # Returns
2028    ///
2029    /// response ID
2030    #[doc(alias = "gtk_dialog_run")]
2031    fn run(&self) -> ResponseType {
2032        unsafe { from_glib(ffi::gtk_dialog_run(self.as_ref().to_glib_none().0)) }
2033    }
2034
2035    /// Sets the last widget in the dialog’s action area with the given `response_id`
2036    /// as the default widget for the dialog. Pressing “Enter” normally activates
2037    /// the default widget.
2038    /// ## `response_id`
2039    /// a response ID
2040    #[doc(alias = "gtk_dialog_set_default_response")]
2041    fn set_default_response(&self, response_id: ResponseType) {
2042        unsafe {
2043            ffi::gtk_dialog_set_default_response(
2044                self.as_ref().to_glib_none().0,
2045                response_id.into_glib(),
2046            );
2047        }
2048    }
2049
2050    /// Calls `gtk_widget_set_sensitive (widget, `setting`)`
2051    /// for each widget in the dialog’s action area with the given `response_id`.
2052    /// A convenient way to sensitize/desensitize dialog buttons.
2053    /// ## `response_id`
2054    /// a response ID
2055    /// ## `setting`
2056    /// [`true`] for sensitive
2057    #[doc(alias = "gtk_dialog_set_response_sensitive")]
2058    fn set_response_sensitive(&self, response_id: ResponseType, setting: bool) {
2059        unsafe {
2060            ffi::gtk_dialog_set_response_sensitive(
2061                self.as_ref().to_glib_none().0,
2062                response_id.into_glib(),
2063                setting.into_glib(),
2064            );
2065        }
2066    }
2067
2068    /// [`true`] if the dialog uses a [`HeaderBar`][crate::HeaderBar] for action buttons
2069    /// instead of the action-area.
2070    ///
2071    /// For technical reasons, this property is declared as an integer
2072    /// property, but you should only set it to [`true`] or [`false`].
2073    #[doc(alias = "use-header-bar")]
2074    fn use_header_bar(&self) -> i32 {
2075        ObjectExt::property(self.as_ref(), "use-header-bar")
2076    }
2077
2078    /// The ::close signal is a
2079    /// [keybinding signal][GtkBindingSignal]
2080    /// which gets emitted when the user uses a keybinding to close
2081    /// the dialog.
2082    ///
2083    /// The default binding for this signal is the Escape key.
2084    #[doc(alias = "close")]
2085    fn connect_close<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2086        unsafe extern "C" fn close_trampoline<P: IsA<Dialog>, F: Fn(&P) + 'static>(
2087            this: *mut ffi::GtkDialog,
2088            f: glib::ffi::gpointer,
2089        ) {
2090            unsafe {
2091                let f: &F = &*(f as *const F);
2092                f(Dialog::from_glib_borrow(this).unsafe_cast_ref())
2093            }
2094        }
2095        unsafe {
2096            let f: Box_<F> = Box_::new(f);
2097            connect_raw(
2098                self.as_ptr() as *mut _,
2099                c"close".as_ptr(),
2100                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2101                    close_trampoline::<Self, F> as *const (),
2102                )),
2103                Box_::into_raw(f),
2104            )
2105        }
2106    }
2107
2108    fn emit_close(&self) {
2109        self.emit_by_name::<()>("close", &[]);
2110    }
2111
2112    /// Emitted when an action widget is clicked, the dialog receives a
2113    /// delete event, or the application programmer calls [`response()`][Self::response()].
2114    /// On a delete event, the response ID is [`ResponseType::DeleteEvent`][crate::ResponseType::DeleteEvent].
2115    /// Otherwise, it depends on which action widget was clicked.
2116    /// ## `response_id`
2117    /// the response ID
2118    #[doc(alias = "response")]
2119    fn connect_response<F: Fn(&Self, ResponseType) + 'static>(&self, f: F) -> SignalHandlerId {
2120        unsafe extern "C" fn response_trampoline<
2121            P: IsA<Dialog>,
2122            F: Fn(&P, ResponseType) + 'static,
2123        >(
2124            this: *mut ffi::GtkDialog,
2125            response_id: ffi::GtkResponseType,
2126            f: glib::ffi::gpointer,
2127        ) {
2128            unsafe {
2129                let f: &F = &*(f as *const F);
2130                f(
2131                    Dialog::from_glib_borrow(this).unsafe_cast_ref(),
2132                    from_glib(response_id),
2133                )
2134            }
2135        }
2136        unsafe {
2137            let f: Box_<F> = Box_::new(f);
2138            connect_raw(
2139                self.as_ptr() as *mut _,
2140                c"response".as_ptr(),
2141                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2142                    response_trampoline::<Self, F> as *const (),
2143                )),
2144                Box_::into_raw(f),
2145            )
2146        }
2147    }
2148}
2149
2150impl<O: IsA<Dialog>> DialogExt for O {}