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