Skip to main content

gtk/auto/
menu_tool_button.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    Actionable, Align, Bin, Buildable, Container, Menu, ResizeMode, ToolButton, ToolItem, Widget,
7};
8use glib::{
9    prelude::*,
10    signal::{connect_raw, SignalHandlerId},
11    translate::*,
12};
13use std::{boxed::Box as Box_, fmt, mem::transmute};
14
15glib::wrapper! {
16    /// A [`MenuToolButton`][crate::MenuToolButton] is a [`ToolItem`][crate::ToolItem] that contains a button and
17    /// a small additional button with an arrow. When clicked, the arrow
18    /// button pops up a dropdown menu.
19    ///
20    /// Use [`new()`][Self::new()] to create a new
21    /// [`MenuToolButton`][crate::MenuToolButton].
22    ///
23    /// # GtkMenuToolButton as GtkBuildable
24    ///
25    /// The GtkMenuToolButton implementation of the GtkBuildable interface
26    /// supports adding a menu by specifying “menu” as the “type” attribute
27    /// of a ``<child>`` element.
28    ///
29    /// An example for a UI definition fragment with menus:
30    ///
31    ///
32    ///
33    /// **⚠️ The following code is in xml ⚠️**
34    ///
35    /// ```xml
36    /// <object class="GtkMenuToolButton">
37    ///   <child type="menu">
38    ///     <object class="GtkMenu"/>
39    ///   </child>
40    /// </object>
41    /// ```
42    ///
43    /// ## Properties
44    ///
45    ///
46    /// #### `menu`
47    ///  Readable | Writeable
48    /// <details><summary><h4>ToolButton</h4></summary>
49    ///
50    ///
51    /// #### `icon-name`
52    ///  The name of the themed icon displayed on the item.
53    /// This property only has an effect if not overridden by
54    /// [`label-widget`][struct@crate::ToolButton#label-widget], [`icon-widget`][struct@crate::ToolButton#icon-widget] or
55    /// [`stock-id`][struct@crate::ToolButton#stock-id] properties.
56    ///
57    /// Readable | Writeable
58    ///
59    ///
60    /// #### `icon-widget`
61    ///  Readable | Writeable
62    ///
63    ///
64    /// #### `label`
65    ///  Readable | Writeable
66    ///
67    ///
68    /// #### `label-widget`
69    ///  Readable | Writeable
70    ///
71    ///
72    /// #### `stock-id`
73    ///  Readable | Writeable
74    ///
75    ///
76    /// #### `use-underline`
77    ///  Readable | Writeable
78    /// </details>
79    /// <details><summary><h4>ToolItem</h4></summary>
80    ///
81    ///
82    /// #### `is-important`
83    ///  Readable | Writeable
84    ///
85    ///
86    /// #### `visible-horizontal`
87    ///  Readable | Writeable
88    ///
89    ///
90    /// #### `visible-vertical`
91    ///  Readable | Writeable
92    /// </details>
93    /// <details><summary><h4>Container</h4></summary>
94    ///
95    ///
96    /// #### `border-width`
97    ///  Readable | Writeable
98    ///
99    ///
100    /// #### `child`
101    ///  Writeable
102    ///
103    ///
104    /// #### `resize-mode`
105    ///  Readable | Writeable
106    /// </details>
107    /// <details><summary><h4>Widget</h4></summary>
108    ///
109    ///
110    /// #### `app-paintable`
111    ///  Readable | Writeable
112    ///
113    ///
114    /// #### `can-default`
115    ///  Readable | Writeable
116    ///
117    ///
118    /// #### `can-focus`
119    ///  Readable | Writeable
120    ///
121    ///
122    /// #### `composite-child`
123    ///  Readable
124    ///
125    ///
126    /// #### `double-buffered`
127    ///  Whether the widget is double buffered.
128    ///
129    /// Readable | Writeable
130    ///
131    ///
132    /// #### `events`
133    ///  Readable | Writeable
134    ///
135    ///
136    /// #### `expand`
137    ///  Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
138    ///
139    /// Readable | Writeable
140    ///
141    ///
142    /// #### `focus-on-click`
143    ///  Whether the widget should grab focus when it is clicked with the mouse.
144    ///
145    /// This property is only relevant for widgets that can take focus.
146    ///
147    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
148    /// GtkComboBox) implemented this property individually.
149    ///
150    /// Readable | Writeable
151    ///
152    ///
153    /// #### `halign`
154    ///  How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
155    ///
156    /// Readable | Writeable
157    ///
158    ///
159    /// #### `has-default`
160    ///  Readable | Writeable
161    ///
162    ///
163    /// #### `has-focus`
164    ///  Readable | Writeable
165    ///
166    ///
167    /// #### `has-tooltip`
168    ///  Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
169    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
170    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
171    /// whether it will provide a tooltip or not.
172    ///
173    /// Note that setting this property to [`true`] for the first time will change
174    /// the event masks of the GdkWindows of this widget to include leave-notify
175    /// and motion-notify events. This cannot and will not be undone when the
176    /// property is set to [`false`] again.
177    ///
178    /// Readable | Writeable
179    ///
180    ///
181    /// #### `height-request`
182    ///  Readable | Writeable
183    ///
184    ///
185    /// #### `hexpand`
186    ///  Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
187    ///
188    /// Readable | Writeable
189    ///
190    ///
191    /// #### `hexpand-set`
192    ///  Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
193    ///
194    /// Readable | Writeable
195    ///
196    ///
197    /// #### `is-focus`
198    ///  Readable | Writeable
199    ///
200    ///
201    /// #### `margin`
202    ///  Sets all four sides' margin at once. If read, returns max
203    /// margin on any side.
204    ///
205    /// Readable | Writeable
206    ///
207    ///
208    /// #### `margin-bottom`
209    ///  Margin on bottom side of widget.
210    ///
211    /// This property adds margin outside of the widget's normal size
212    /// request, the margin will be added in addition to the size from
213    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
214    ///
215    /// Readable | Writeable
216    ///
217    ///
218    /// #### `margin-end`
219    ///  Margin on end of widget, horizontally. This property supports
220    /// left-to-right and right-to-left text directions.
221    ///
222    /// This property adds margin outside of the widget's normal size
223    /// request, the margin will be added in addition to the size from
224    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
225    ///
226    /// Readable | Writeable
227    ///
228    ///
229    /// #### `margin-left`
230    ///  Margin on left side of widget.
231    ///
232    /// This property adds margin outside of the widget's normal size
233    /// request, the margin will be added in addition to the size from
234    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
235    ///
236    /// Readable | Writeable
237    ///
238    ///
239    /// #### `margin-right`
240    ///  Margin on right side of widget.
241    ///
242    /// This property adds margin outside of the widget's normal size
243    /// request, the margin will be added in addition to the size from
244    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
245    ///
246    /// Readable | Writeable
247    ///
248    ///
249    /// #### `margin-start`
250    ///  Margin on start of widget, horizontally. This property supports
251    /// left-to-right and right-to-left text directions.
252    ///
253    /// This property adds margin outside of the widget's normal size
254    /// request, the margin will be added in addition to the size from
255    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
256    ///
257    /// Readable | Writeable
258    ///
259    ///
260    /// #### `margin-top`
261    ///  Margin on top side of widget.
262    ///
263    /// This property adds margin outside of the widget's normal size
264    /// request, the margin will be added in addition to the size from
265    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
266    ///
267    /// Readable | Writeable
268    ///
269    ///
270    /// #### `name`
271    ///  Readable | Writeable
272    ///
273    ///
274    /// #### `no-show-all`
275    ///  Readable | Writeable
276    ///
277    ///
278    /// #### `opacity`
279    ///  The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
280    /// more details about window opacity.
281    ///
282    /// Before 3.8 this was only available in GtkWindow
283    ///
284    /// Readable | Writeable
285    ///
286    ///
287    /// #### `parent`
288    ///  Readable | Writeable
289    ///
290    ///
291    /// #### `receives-default`
292    ///  Readable | Writeable
293    ///
294    ///
295    /// #### `scale-factor`
296    ///  The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
297    /// more details about widget scaling.
298    ///
299    /// Readable
300    ///
301    ///
302    /// #### `sensitive`
303    ///  Readable | Writeable
304    ///
305    ///
306    /// #### `style`
307    ///  The style of the widget, which contains information about how it will look (colors, etc).
308    ///
309    /// Readable | Writeable
310    ///
311    ///
312    /// #### `tooltip-markup`
313    ///  Sets the text of tooltip to be the given string, which is marked up
314    /// with the [Pango text markup language][PangoMarkupFormat].
315    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
316    ///
317    /// This is a convenience property which will take care of getting the
318    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
319    /// will automatically be set to [`true`] and there will be taken care of
320    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
321    ///
322    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
323    /// are set, the last one wins.
324    ///
325    /// Readable | Writeable
326    ///
327    ///
328    /// #### `tooltip-text`
329    ///  Sets the text of tooltip to be the given string.
330    ///
331    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
332    ///
333    /// This is a convenience property which will take care of getting the
334    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
335    /// will automatically be set to [`true`] and there will be taken care of
336    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
337    ///
338    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
339    /// are set, the last one wins.
340    ///
341    /// Readable | Writeable
342    ///
343    ///
344    /// #### `valign`
345    ///  How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
346    ///
347    /// Readable | Writeable
348    ///
349    ///
350    /// #### `vexpand`
351    ///  Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
352    ///
353    /// Readable | Writeable
354    ///
355    ///
356    /// #### `vexpand-set`
357    ///  Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
358    ///
359    /// Readable | Writeable
360    ///
361    ///
362    /// #### `visible`
363    ///  Readable | Writeable
364    ///
365    ///
366    /// #### `width-request`
367    ///  Readable | Writeable
368    ///
369    ///
370    /// #### `window`
371    ///  The widget's window if it is realized, [`None`] otherwise.
372    ///
373    /// Readable
374    /// </details>
375    /// <details><summary><h4>Activatable</h4></summary>
376    ///
377    ///
378    /// #### `related-action`
379    ///  The action that this activatable will activate and receive
380    /// updates from for various states and possibly appearance.
381    ///
382    /// > `GtkActivatable` implementors need to handle the this property and
383    /// > call `gtk_activatable_do_set_related_action()` when it changes.
384    ///
385    /// Readable | Writeable
386    ///
387    ///
388    /// #### `use-action-appearance`
389    ///  Whether this activatable should reset its layout
390    /// and appearance when setting the related action or when
391    /// the action changes appearance.
392    ///
393    /// See the `GtkAction` documentation directly to find which properties
394    /// should be ignored by the `GtkActivatable` when this property is [`false`].
395    ///
396    /// > `GtkActivatable` implementors need to handle this property
397    /// > and call `gtk_activatable_sync_action_properties()` on the activatable
398    /// > widget when it changes.
399    ///
400    /// Readable | Writeable
401    /// </details>
402    /// <details><summary><h4>Actionable</h4></summary>
403    ///
404    ///
405    /// #### `action-name`
406    ///  Readable | Writeable
407    ///
408    ///
409    /// #### `action-target`
410    ///  Readable | Writeable
411    /// </details>
412    ///
413    /// ## Signals
414    ///
415    ///
416    /// #### `show-menu`
417    ///  The ::show-menu signal is emitted before the menu is shown.
418    ///
419    /// It can be used to populate the menu on demand, using
420    /// [`MenuToolButtonExt::set_menu()`][crate::prelude::MenuToolButtonExt::set_menu()].
421    ///
422    /// Note that even if you populate the menu dynamically in this way,
423    /// you must set an empty menu on the [`MenuToolButton`][crate::MenuToolButton] beforehand,
424    /// since the arrow is made insensitive if the menu is not set.
425    ///
426    ///
427    /// <details><summary><h4>ToolButton</h4></summary>
428    ///
429    ///
430    /// #### `clicked`
431    ///  This signal is emitted when the tool button is clicked with the mouse
432    /// or activated with the keyboard.
433    ///
434    /// Action
435    /// </details>
436    /// <details><summary><h4>ToolItem</h4></summary>
437    ///
438    ///
439    /// #### `create-menu-proxy`
440    ///  This signal is emitted when the toolbar needs information from `tool_item`
441    /// about whether the item should appear in the toolbar overflow menu. In
442    /// response the tool item should either
443    ///
444    /// - call [`ToolItemExt::set_proxy_menu_item()`][crate::prelude::ToolItemExt::set_proxy_menu_item()] with a [`None`]
445    ///  pointer and return [`true`] to indicate that the item should not appear
446    ///  in the overflow menu
447    ///
448    /// - call [`ToolItemExt::set_proxy_menu_item()`][crate::prelude::ToolItemExt::set_proxy_menu_item()] with a new menu
449    ///  item and return [`true`], or
450    ///
451    /// - return [`false`] to indicate that the signal was not handled by the item.
452    ///  This means that the item will not appear in the overflow menu unless
453    ///  a later handler installs a menu item.
454    ///
455    /// The toolbar may cache the result of this signal. When the tool item changes
456    /// how it will respond to this signal it must call [`ToolItemExt::rebuild_menu()`][crate::prelude::ToolItemExt::rebuild_menu()]
457    /// to invalidate the cache and ensure that the toolbar rebuilds its overflow
458    /// menu.
459    ///
460    ///
461    ///
462    ///
463    /// #### `toolbar-reconfigured`
464    ///  This signal is emitted when some property of the toolbar that the
465    /// item is a child of changes. For custom subclasses of [`ToolItem`][crate::ToolItem],
466    /// the default handler of this signal use the functions
467    /// - [`ToolShellExt::orientation()`][crate::prelude::ToolShellExt::orientation()]
468    /// - [`ToolShellExt::style()`][crate::prelude::ToolShellExt::style()]
469    /// - [`ToolShellExt::icon_size()`][crate::prelude::ToolShellExt::icon_size()]
470    /// - [`ToolShellExt::relief_style()`][crate::prelude::ToolShellExt::relief_style()]
471    /// to find out what the toolbar should look like and change
472    /// themselves accordingly.
473    ///
474    ///
475    /// </details>
476    /// <details><summary><h4>Container</h4></summary>
477    ///
478    ///
479    /// #### `add`
480    ///
481    ///
482    ///
483    /// #### `check-resize`
484    ///
485    ///
486    ///
487    /// #### `remove`
488    ///
489    ///
490    ///
491    /// #### `set-focus-child`
492    ///
493    /// </details>
494    /// <details><summary><h4>Widget</h4></summary>
495    ///
496    ///
497    /// #### `accel-closures-changed`
498    ///
499    ///
500    ///
501    /// #### `button-press-event`
502    ///  The ::button-press-event signal will be emitted when a button
503    /// (typically from a mouse) is pressed.
504    ///
505    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
506    /// widget needs to enable the [`gdk::EventMask::BUTTON_PRESS_MASK`][crate::gdk::EventMask::BUTTON_PRESS_MASK] mask.
507    ///
508    /// This signal will be sent to the grab widget if there is one.
509    ///
510    ///
511    ///
512    ///
513    /// #### `button-release-event`
514    ///  The ::button-release-event signal will be emitted when a button
515    /// (typically from a mouse) is released.
516    ///
517    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the
518    /// widget needs to enable the [`gdk::EventMask::BUTTON_RELEASE_MASK`][crate::gdk::EventMask::BUTTON_RELEASE_MASK] mask.
519    ///
520    /// This signal will be sent to the grab widget if there is one.
521    ///
522    ///
523    ///
524    ///
525    /// #### `can-activate-accel`
526    ///  Determines whether an accelerator that activates the signal
527    /// identified by `signal_id` can currently be activated.
528    /// This signal is present to allow applications and derived
529    /// widgets to override the default [`Widget`][crate::Widget] handling
530    /// for determining whether an accelerator can be activated.
531    ///
532    ///
533    ///
534    ///
535    /// #### `child-notify`
536    ///  The ::child-notify signal is emitted for each
537    /// [child property][child-properties] that has
538    /// changed on an object. The signal's detail holds the property name.
539    ///
540    /// Detailed
541    ///
542    ///
543    /// #### `composited-changed`
544    ///  The ::composited-changed signal is emitted when the composited
545    /// status of `widgets` screen changes.
546    /// See [`Screen::is_composited()`][crate::gdk::Screen::is_composited()].
547    ///
548    /// Action
549    ///
550    ///
551    /// #### `configure-event`
552    ///  The ::configure-event signal will be emitted when the size, position or
553    /// stacking of the `widget`'s window has changed.
554    ///
555    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
556    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
557    /// automatically for all new windows.
558    ///
559    ///
560    ///
561    ///
562    /// #### `damage-event`
563    ///  Emitted when a redirected window belonging to `widget` gets drawn into.
564    /// The region/area members of the event shows what area of the redirected
565    /// drawable was drawn into.
566    ///
567    ///
568    ///
569    ///
570    /// #### `delete-event`
571    ///  The ::delete-event signal is emitted if a user requests that
572    /// a toplevel window is closed. The default handler for this signal
573    /// destroys the window. Connecting [`WidgetExtManual::hide_on_delete()`][crate::prelude::WidgetExtManual::hide_on_delete()] to
574    /// this signal will cause the window to be hidden instead, so that
575    /// it can later be shown again without reconstructing it.
576    ///
577    ///
578    ///
579    ///
580    /// #### `destroy`
581    ///  Signals that all holders of a reference to the widget should release
582    /// the reference that they hold. May result in finalization of the widget
583    /// if all references are released.
584    ///
585    /// This signal is not suitable for saving widget state.
586    ///
587    ///
588    ///
589    ///
590    /// #### `destroy-event`
591    ///  The ::destroy-event signal is emitted when a [`gdk::Window`][crate::gdk::Window] is destroyed.
592    /// You rarely get this signal, because most widgets disconnect themselves
593    /// from their window before they destroy it, so no widget owns the
594    /// window at destroy time.
595    ///
596    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
597    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
598    /// automatically for all new windows.
599    ///
600    ///
601    ///
602    ///
603    /// #### `direction-changed`
604    ///  The ::direction-changed signal is emitted when the text direction
605    /// of a widget changes.
606    ///
607    ///
608    ///
609    ///
610    /// #### `drag-begin`
611    ///  The ::drag-begin signal is emitted on the drag source when a drag is
612    /// started. A typical reason to connect to this signal is to set up a
613    /// custom drag icon with e.g. [`WidgetExt::drag_source_set_icon_pixbuf()`][crate::prelude::WidgetExt::drag_source_set_icon_pixbuf()].
614    ///
615    /// Note that some widgets set up a drag icon in the default handler of
616    /// this signal, so you may have to use `g_signal_connect_after()` to
617    /// override what the default handler did.
618    ///
619    ///
620    ///
621    ///
622    /// #### `drag-data-delete`
623    ///  The ::drag-data-delete signal is emitted on the drag source when a drag
624    /// with the action [`gdk::DragAction::MOVE`][crate::gdk::DragAction::MOVE] is successfully completed. The signal
625    /// handler is responsible for deleting the data that has been dropped. What
626    /// "delete" means depends on the context of the drag operation.
627    ///
628    ///
629    ///
630    ///
631    /// #### `drag-data-get`
632    ///  The ::drag-data-get signal is emitted on the drag source when the drop
633    /// site requests the data which is dragged. It is the responsibility of
634    /// the signal handler to fill `data` with the data in the format which
635    /// is indicated by `info`. See [`SelectionData::set()`][crate::SelectionData::set()] and
636    /// [`SelectionData::set_text()`][crate::SelectionData::set_text()].
637    ///
638    ///
639    ///
640    ///
641    /// #### `drag-data-received`
642    ///  The ::drag-data-received signal is emitted on the drop site when the
643    /// dragged data has been received. If the data was received in order to
644    /// determine whether the drop will be accepted, the handler is expected
645    /// to call `gdk_drag_status()` and not finish the drag.
646    /// If the data was received in response to a [`drag-drop`][struct@crate::Widget#drag-drop] signal
647    /// (and this is the last target to be received), the handler for this
648    /// signal is expected to process the received data and then call
649    /// `gtk_drag_finish()`, setting the `success` parameter depending on
650    /// whether the data was processed successfully.
651    ///
652    /// Applications must create some means to determine why the signal was emitted
653    /// and therefore whether to call `gdk_drag_status()` or `gtk_drag_finish()`.
654    ///
655    /// The handler may inspect the selected action with
656    /// [`DragContext::selected_action()`][crate::gdk::DragContext::selected_action()] before calling
657    /// `gtk_drag_finish()`, e.g. to implement [`gdk::DragAction::ASK`][crate::gdk::DragAction::ASK] as
658    /// shown in the following example:
659    ///
660    ///
661    /// **⚠️ The following code is in C ⚠️**
662    ///
663    /// ```C
664    /// void
665    /// drag_data_received (GtkWidget          *widget,
666    ///                     GdkDragContext     *context,
667    ///                     gint                x,
668    ///                     gint                y,
669    ///                     GtkSelectionData   *data,
670    ///                     guint               info,
671    ///                     guint               time)
672    /// {
673    ///   if ((data->length >= 0) && (data->format == 8))
674    ///     {
675    ///       GdkDragAction action;
676    ///
677    ///       // handle data here
678    ///
679    ///       action = gdk_drag_context_get_selected_action (context);
680    ///       if (action == GDK_ACTION_ASK)
681    ///         {
682    ///           GtkWidget *dialog;
683    ///           gint response;
684    ///
685    ///           dialog = gtk_message_dialog_new (NULL,
686    ///                                            GTK_DIALOG_MODAL |
687    ///                                            GTK_DIALOG_DESTROY_WITH_PARENT,
688    ///                                            GTK_MESSAGE_INFO,
689    ///                                            GTK_BUTTONS_YES_NO,
690    ///                                            "Move the data ?\n");
691    ///           response = gtk_dialog_run (GTK_DIALOG (dialog));
692    ///           gtk_widget_destroy (dialog);
693    ///
694    ///           if (response == GTK_RESPONSE_YES)
695    ///             action = GDK_ACTION_MOVE;
696    ///           else
697    ///             action = GDK_ACTION_COPY;
698    ///          }
699    ///
700    ///       gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
701    ///     }
702    ///   else
703    ///     gtk_drag_finish (context, FALSE, FALSE, time);
704    ///  }
705    /// ```
706    ///
707    ///
708    ///
709    ///
710    /// #### `drag-drop`
711    ///  The ::drag-drop signal is emitted on the drop site when the user drops
712    /// the data onto the widget. The signal handler must determine whether
713    /// the cursor position is in a drop zone or not. If it is not in a drop
714    /// zone, it returns [`false`] and no further processing is necessary.
715    /// Otherwise, the handler returns [`true`]. In this case, the handler must
716    /// ensure that `gtk_drag_finish()` is called to let the source know that
717    /// the drop is done. The call to `gtk_drag_finish()` can be done either
718    /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
719    /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
720    /// or more of the supported targets.
721    ///
722    ///
723    ///
724    ///
725    /// #### `drag-end`
726    ///  The ::drag-end signal is emitted on the drag source when a drag is
727    /// finished. A typical reason to connect to this signal is to undo
728    /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
729    ///
730    ///
731    ///
732    ///
733    /// #### `drag-failed`
734    ///  The ::drag-failed signal is emitted on the drag source when a drag has
735    /// failed. The signal handler may hook custom code to handle a failed DnD
736    /// operation based on the type of error, it returns [`true`] is the failure has
737    /// been already handled (not showing the default "drag operation failed"
738    /// animation), otherwise it returns [`false`].
739    ///
740    ///
741    ///
742    ///
743    /// #### `drag-leave`
744    ///  The ::drag-leave signal is emitted on the drop site when the cursor
745    /// leaves the widget. A typical reason to connect to this signal is to
746    /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
747    /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
748    ///
749    ///
750    /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
751    /// ::drag-drop signal, for instance to allow cleaning up of a preview item
752    /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
753    ///
754    ///
755    ///
756    ///
757    /// #### `drag-motion`
758    ///  The ::drag-motion signal is emitted on the drop site when the user
759    /// moves the cursor over the widget during a drag. The signal handler
760    /// must determine whether the cursor position is in a drop zone or not.
761    /// If it is not in a drop zone, it returns [`false`] and no further processing
762    /// is necessary. Otherwise, the handler returns [`true`]. In this case, the
763    /// handler is responsible for providing the necessary information for
764    /// displaying feedback to the user, by calling `gdk_drag_status()`.
765    ///
766    /// If the decision whether the drop will be accepted or rejected can't be
767    /// made based solely on the cursor position and the type of the data, the
768    /// handler may inspect the dragged data by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] and
769    /// defer the `gdk_drag_status()` call to the [`drag-data-received`][struct@crate::Widget#drag-data-received]
770    /// handler. Note that you must pass [`DestDefaults::DROP`][crate::DestDefaults::DROP],
771    /// [`DestDefaults::MOTION`][crate::DestDefaults::MOTION] or [`DestDefaults::ALL`][crate::DestDefaults::ALL] to [`WidgetExtManual::drag_dest_set()`][crate::prelude::WidgetExtManual::drag_dest_set()]
772    /// when using the drag-motion signal that way.
773    ///
774    /// Also note that there is no drag-enter signal. The drag receiver has to
775    /// keep track of whether he has received any drag-motion signals since the
776    /// last [`drag-leave`][struct@crate::Widget#drag-leave] and if not, treat the drag-motion signal as
777    /// an "enter" signal. Upon an "enter", the handler will typically highlight
778    /// the drop site with [`WidgetExt::drag_highlight()`][crate::prelude::WidgetExt::drag_highlight()].
779    ///
780    ///
781    /// **⚠️ The following code is in C ⚠️**
782    ///
783    /// ```C
784    /// static void
785    /// drag_motion (GtkWidget      *widget,
786    ///              GdkDragContext *context,
787    ///              gint            x,
788    ///              gint            y,
789    ///              guint           time)
790    /// {
791    ///   GdkAtom target;
792    ///
793    ///   PrivateData *private_data = GET_PRIVATE_DATA (widget);
794    ///
795    ///   if (!private_data->drag_highlight)
796    ///    {
797    ///      private_data->drag_highlight = 1;
798    ///      gtk_drag_highlight (widget);
799    ///    }
800    ///
801    ///   target = gtk_drag_dest_find_target (widget, context, NULL);
802    ///   if (target == GDK_NONE)
803    ///     gdk_drag_status (context, 0, time);
804    ///   else
805    ///    {
806    ///      private_data->pending_status
807    ///         = gdk_drag_context_get_suggested_action (context);
808    ///      gtk_drag_get_data (widget, context, target, time);
809    ///    }
810    ///
811    ///   return TRUE;
812    /// }
813    ///
814    /// static void
815    /// drag_data_received (GtkWidget        *widget,
816    ///                     GdkDragContext   *context,
817    ///                     gint              x,
818    ///                     gint              y,
819    ///                     GtkSelectionData *selection_data,
820    ///                     guint             info,
821    ///                     guint             time)
822    /// {
823    ///   PrivateData *private_data = GET_PRIVATE_DATA (widget);
824    ///
825    ///   if (private_data->suggested_action)
826    ///    {
827    ///      private_data->suggested_action = 0;
828    ///
829    ///      // We are getting this data due to a request in drag_motion,
830    ///      // rather than due to a request in drag_drop, so we are just
831    ///      // supposed to call gdk_drag_status(), not actually paste in
832    ///      // the data.
833    ///
834    ///      str = gtk_selection_data_get_text (selection_data);
835    ///      if (!data_is_acceptable (str))
836    ///        gdk_drag_status (context, 0, time);
837    ///      else
838    ///        gdk_drag_status (context,
839    ///                         private_data->suggested_action,
840    ///                         time);
841    ///    }
842    ///   else
843    ///    {
844    ///      // accept the drop
845    ///    }
846    /// }
847    /// ```
848    ///
849    ///
850    ///
851    ///
852    /// #### `draw`
853    ///  This signal is emitted when a widget is supposed to render itself.
854    /// The `widget`'s top left corner must be painted at the origin of
855    /// the passed in context and be sized to the values returned by
856    /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
857    /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
858    ///
859    /// Signal handlers connected to this signal can modify the cairo
860    /// context passed as `cr` in any way they like and don't need to
861    /// restore it. The signal emission takes care of calling `cairo_save()`
862    /// before and `cairo_restore()` after invoking the handler.
863    ///
864    /// The signal handler will get a `cr` with a clip region already set to the
865    /// widget's dirty region, i.e. to the area that needs repainting. Complicated
866    /// widgets that want to avoid redrawing themselves completely can get the full
867    /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
868    /// get a finer-grained representation of the dirty region with
869    /// `cairo_copy_clip_rectangle_list()`.
870    ///
871    ///
872    ///
873    ///
874    /// #### `enter-notify-event`
875    ///  The ::enter-notify-event will be emitted when the pointer enters
876    /// the `widget`'s window.
877    ///
878    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
879    /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
880    ///
881    /// This signal will be sent to the grab widget if there is one.
882    ///
883    ///
884    ///
885    ///
886    /// #### `event`
887    ///  The GTK+ main loop will emit three signals for each GDK event delivered
888    /// to a widget: one generic ::event signal, another, more specific,
889    /// signal that matches the type of event delivered (e.g.
890    /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
891    /// [`event-after`][struct@crate::Widget#event-after] signal.
892    ///
893    ///
894    ///
895    ///
896    /// #### `event-after`
897    ///  After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
898    /// the second more specific signal, ::event-after will be emitted
899    /// regardless of the previous two signals handlers return values.
900    ///
901    ///
902    ///
903    ///
904    /// #### `focus`
905    ///
906    ///
907    ///
908    /// #### `focus-in-event`
909    ///  The ::focus-in-event signal will be emitted when the keyboard focus
910    /// enters the `widget`'s window.
911    ///
912    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
913    /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
914    ///
915    ///
916    ///
917    ///
918    /// #### `focus-out-event`
919    ///  The ::focus-out-event signal will be emitted when the keyboard focus
920    /// leaves the `widget`'s window.
921    ///
922    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
923    /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
924    ///
925    ///
926    ///
927    ///
928    /// #### `grab-broken-event`
929    ///  Emitted when a pointer or keyboard grab on a window belonging
930    /// to `widget` gets broken.
931    ///
932    /// On X11, this happens when the grab window becomes unviewable
933    /// (i.e. it or one of its ancestors is unmapped), or if the same
934    /// application grabs the pointer or keyboard again.
935    ///
936    ///
937    ///
938    ///
939    /// #### `grab-focus`
940    ///  Action
941    ///
942    ///
943    /// #### `grab-notify`
944    ///  The ::grab-notify signal is emitted when a widget becomes
945    /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
946    /// another widget, or when it becomes unshadowed due to a grab
947    /// being removed.
948    ///
949    /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
950    /// grab widget in the grab stack of its window group is not
951    /// its ancestor.
952    ///
953    ///
954    ///
955    ///
956    /// #### `hide`
957    ///  The ::hide signal is emitted when `widget` is hidden, for example with
958    /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
959    ///
960    ///
961    ///
962    ///
963    /// #### `hierarchy-changed`
964    ///  The ::hierarchy-changed signal is emitted when the
965    /// anchored state of a widget changes. A widget is
966    /// “anchored” when its toplevel
967    /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
968    /// a widget changes from un-anchored to anchored or vice-versa.
969    ///
970    ///
971    ///
972    ///
973    /// #### `key-press-event`
974    ///  The ::key-press-event signal is emitted when a key is pressed. The signal
975    /// emission will reoccur at the key-repeat rate when the key is kept pressed.
976    ///
977    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
978    /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
979    ///
980    /// This signal will be sent to the grab widget if there is one.
981    ///
982    ///
983    ///
984    ///
985    /// #### `key-release-event`
986    ///  The ::key-release-event signal is emitted when a key is released.
987    ///
988    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
989    /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
990    ///
991    /// This signal will be sent to the grab widget if there is one.
992    ///
993    ///
994    ///
995    ///
996    /// #### `keynav-failed`
997    ///  Gets emitted if keyboard navigation fails.
998    /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
999    ///
1000    ///
1001    ///
1002    ///
1003    /// #### `leave-notify-event`
1004    ///  The ::leave-notify-event will be emitted when the pointer leaves
1005    /// the `widget`'s window.
1006    ///
1007    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1008    /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
1009    ///
1010    /// This signal will be sent to the grab widget if there is one.
1011    ///
1012    ///
1013    ///
1014    ///
1015    /// #### `map`
1016    ///  The ::map signal is emitted when `widget` is going to be mapped, that is
1017    /// when the widget is visible (which is controlled with
1018    /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
1019    /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
1020    /// be emitted.
1021    ///
1022    /// The ::map signal can be used to determine whether a widget will be drawn,
1023    /// for instance it can resume an animation that was stopped during the
1024    /// emission of [`unmap`][struct@crate::Widget#unmap].
1025    ///
1026    ///
1027    ///
1028    ///
1029    /// #### `map-event`
1030    ///  The ::map-event signal will be emitted when the `widget`'s window is
1031    /// mapped. A window is mapped when it becomes visible on the screen.
1032    ///
1033    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1034    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1035    /// automatically for all new windows.
1036    ///
1037    ///
1038    ///
1039    ///
1040    /// #### `mnemonic-activate`
1041    ///  The default handler for this signal activates `widget` if `group_cycling`
1042    /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
1043    ///
1044    ///
1045    ///
1046    ///
1047    /// #### `motion-notify-event`
1048    ///  The ::motion-notify-event signal is emitted when the pointer moves
1049    /// over the widget's [`gdk::Window`][crate::gdk::Window].
1050    ///
1051    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
1052    /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
1053    ///
1054    /// This signal will be sent to the grab widget if there is one.
1055    ///
1056    ///
1057    ///
1058    ///
1059    /// #### `move-focus`
1060    ///  Action
1061    ///
1062    ///
1063    /// #### `parent-set`
1064    ///  The ::parent-set signal is emitted when a new parent
1065    /// has been set on a widget.
1066    ///
1067    ///
1068    ///
1069    ///
1070    /// #### `popup-menu`
1071    ///  This signal gets emitted whenever a widget should pop up a context
1072    /// menu. This usually happens through the standard key binding mechanism;
1073    /// by pressing a certain key while a widget is focused, the user can cause
1074    /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
1075    /// a menu with clipboard commands. See the
1076    /// [Popup Menu Migration Checklist][checklist-popup-menu]
1077    /// for an example of how to use this signal.
1078    ///
1079    /// Action
1080    ///
1081    ///
1082    /// #### `property-notify-event`
1083    ///  The ::property-notify-event signal will be emitted when a property on
1084    /// the `widget`'s window has been changed or deleted.
1085    ///
1086    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1087    /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
1088    ///
1089    ///
1090    ///
1091    ///
1092    /// #### `proximity-in-event`
1093    ///  To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1094    /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
1095    ///
1096    /// This signal will be sent to the grab widget if there is one.
1097    ///
1098    ///
1099    ///
1100    ///
1101    /// #### `proximity-out-event`
1102    ///  To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1103    /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
1104    ///
1105    /// This signal will be sent to the grab widget if there is one.
1106    ///
1107    ///
1108    ///
1109    ///
1110    /// #### `query-tooltip`
1111    ///  Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
1112    /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
1113    /// focus in keyboard mode.
1114    ///
1115    /// Using the given coordinates, the signal handler should determine
1116    /// whether a tooltip should be shown for `widget`. If this is the case
1117    /// [`true`] should be returned, [`false`] otherwise. Note that if
1118    /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
1119    /// should not be used.
1120    ///
1121    /// The signal handler is free to manipulate `tooltip` with the therefore
1122    /// destined function calls.
1123    ///
1124    ///
1125    ///
1126    ///
1127    /// #### `realize`
1128    ///  The ::realize signal is emitted when `widget` is associated with a
1129    /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
1130    /// widget has been mapped (that is, it is going to be drawn).
1131    ///
1132    ///
1133    ///
1134    ///
1135    /// #### `screen-changed`
1136    ///  The ::screen-changed signal gets emitted when the
1137    /// screen of a widget has changed.
1138    ///
1139    ///
1140    ///
1141    ///
1142    /// #### `scroll-event`
1143    ///  The ::scroll-event signal is emitted when a button in the 4 to 7
1144    /// range is pressed. Wheel mice are usually configured to generate
1145    /// button press events for buttons 4 and 5 when the wheel is turned.
1146    ///
1147    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1148    /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
1149    ///
1150    /// This signal will be sent to the grab widget if there is one.
1151    ///
1152    ///
1153    ///
1154    ///
1155    /// #### `selection-clear-event`
1156    ///  The ::selection-clear-event signal will be emitted when the
1157    /// the `widget`'s window has lost ownership of a selection.
1158    ///
1159    ///
1160    ///
1161    ///
1162    /// #### `selection-get`
1163    ///
1164    ///
1165    ///
1166    /// #### `selection-notify-event`
1167    ///
1168    ///
1169    ///
1170    /// #### `selection-received`
1171    ///
1172    ///
1173    ///
1174    /// #### `selection-request-event`
1175    ///  The ::selection-request-event signal will be emitted when
1176    /// another client requests ownership of the selection owned by
1177    /// the `widget`'s window.
1178    ///
1179    ///
1180    ///
1181    ///
1182    /// #### `show`
1183    ///  The ::show signal is emitted when `widget` is shown, for example with
1184    /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
1185    ///
1186    ///
1187    ///
1188    ///
1189    /// #### `show-help`
1190    ///  Action
1191    ///
1192    ///
1193    /// #### `size-allocate`
1194    ///
1195    ///
1196    ///
1197    /// #### `state-changed`
1198    ///  The ::state-changed signal is emitted when the widget state changes.
1199    /// See `gtk_widget_get_state()`.
1200    ///
1201    ///
1202    ///
1203    ///
1204    /// #### `state-flags-changed`
1205    ///  The ::state-flags-changed signal is emitted when the widget state
1206    /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
1207    ///
1208    ///
1209    ///
1210    ///
1211    /// #### `style-set`
1212    ///  The ::style-set signal is emitted when a new style has been set
1213    /// on a widget. Note that style-modifying functions like
1214    /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1215    ///
1216    /// Note that this signal is emitted for changes to the deprecated
1217    /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1218    /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1219    ///
1220    ///
1221    ///
1222    ///
1223    /// #### `style-updated`
1224    ///  The ::style-updated signal is a convenience signal that is emitted when the
1225    /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1226    /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1227    ///
1228    /// Note that style-modifying functions like `gtk_widget_override_color()` also
1229    /// cause this signal to be emitted.
1230    ///
1231    ///
1232    ///
1233    ///
1234    /// #### `touch-event`
1235    ///
1236    ///
1237    ///
1238    /// #### `unmap`
1239    ///  The ::unmap signal is emitted when `widget` is going to be unmapped, which
1240    /// means that either it or any of its parents up to the toplevel widget have
1241    /// been set as hidden.
1242    ///
1243    /// As ::unmap indicates that a widget will not be shown any longer, it can be
1244    /// used to, for example, stop an animation on the widget.
1245    ///
1246    ///
1247    ///
1248    ///
1249    /// #### `unmap-event`
1250    ///  The ::unmap-event signal will be emitted when the `widget`'s window is
1251    /// unmapped. A window is unmapped when it becomes invisible on the screen.
1252    ///
1253    /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1254    /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1255    /// automatically for all new windows.
1256    ///
1257    ///
1258    ///
1259    ///
1260    /// #### `unrealize`
1261    ///  The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1262    /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1263    /// called or the widget has been unmapped (that is, it is going to be
1264    /// hidden).
1265    ///
1266    ///
1267    ///
1268    ///
1269    /// #### `visibility-notify-event`
1270    ///  The ::visibility-notify-event will be emitted when the `widget`'s
1271    /// window is obscured or unobscured.
1272    ///
1273    /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1274    /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1275    ///
1276    ///
1277    ///
1278    ///
1279    /// #### `window-state-event`
1280    ///  The ::window-state-event will be emitted when the state of the
1281    /// toplevel window associated to the `widget` changes.
1282    ///
1283    /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1284    /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1285    /// this mask automatically for all new windows.
1286    ///
1287    ///
1288    /// </details>
1289    ///
1290    /// # Implements
1291    ///
1292    /// [`MenuToolButtonExt`][trait@crate::prelude::MenuToolButtonExt], [`ToolButtonExt`][trait@crate::prelude::ToolButtonExt], [`ToolItemExt`][trait@crate::prelude::ToolItemExt], [`BinExt`][trait@crate::prelude::BinExt], [`ContainerExt`][trait@crate::prelude::ContainerExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`ActionableExt`][trait@crate::prelude::ActionableExt], [`ContainerExtManual`][trait@crate::prelude::ContainerExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
1293    #[doc(alias = "GtkMenuToolButton")]
1294    pub struct MenuToolButton(Object<ffi::GtkMenuToolButton, ffi::GtkMenuToolButtonClass>) @extends ToolButton, ToolItem, Bin, Container, Widget, @implements Buildable, Actionable;
1295
1296    match fn {
1297        type_ => || ffi::gtk_menu_tool_button_get_type(),
1298    }
1299}
1300
1301impl MenuToolButton {
1302    pub const NONE: Option<&'static MenuToolButton> = None;
1303
1304    /// Creates a new [`MenuToolButton`][crate::MenuToolButton] using `icon_widget` as icon and
1305    /// `label` as label.
1306    /// ## `icon_widget`
1307    /// a widget that will be used as icon widget, or [`None`]
1308    /// ## `label`
1309    /// a string that will be used as label, or [`None`]
1310    ///
1311    /// # Returns
1312    ///
1313    /// the new [`MenuToolButton`][crate::MenuToolButton]
1314    #[doc(alias = "gtk_menu_tool_button_new")]
1315    pub fn new(icon_widget: Option<&impl IsA<Widget>>, label: Option<&str>) -> MenuToolButton {
1316        assert_initialized_main_thread!();
1317        unsafe {
1318            ToolItem::from_glib_none(ffi::gtk_menu_tool_button_new(
1319                icon_widget.map(|p| p.as_ref()).to_glib_none().0,
1320                label.to_glib_none().0,
1321            ))
1322            .unsafe_cast()
1323        }
1324    }
1325
1326    // rustdoc-stripper-ignore-next
1327    /// Creates a new builder-pattern struct instance to construct [`MenuToolButton`] objects.
1328    ///
1329    /// This method returns an instance of [`MenuToolButtonBuilder`](crate::builders::MenuToolButtonBuilder) which can be used to create [`MenuToolButton`] objects.
1330    pub fn builder() -> MenuToolButtonBuilder {
1331        MenuToolButtonBuilder::new()
1332    }
1333}
1334
1335impl Default for MenuToolButton {
1336    fn default() -> Self {
1337        glib::object::Object::new::<Self>()
1338    }
1339}
1340
1341// rustdoc-stripper-ignore-next
1342/// A [builder-pattern] type to construct [`MenuToolButton`] objects.
1343///
1344/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1345#[must_use = "The builder must be built to be used"]
1346pub struct MenuToolButtonBuilder {
1347    builder: glib::object::ObjectBuilder<'static, MenuToolButton>,
1348}
1349
1350impl MenuToolButtonBuilder {
1351    fn new() -> Self {
1352        Self {
1353            builder: glib::object::Object::builder(),
1354        }
1355    }
1356
1357    pub fn menu(self, menu: &impl IsA<Menu>) -> Self {
1358        Self {
1359            builder: self.builder.property("menu", menu.clone().upcast()),
1360        }
1361    }
1362
1363    /// The name of the themed icon displayed on the item.
1364    /// This property only has an effect if not overridden by
1365    /// [`label-widget`][struct@crate::ToolButton#label-widget], [`icon-widget`][struct@crate::ToolButton#icon-widget] or
1366    /// [`stock-id`][struct@crate::ToolButton#stock-id] properties.
1367    pub fn icon_name(self, icon_name: impl Into<glib::GString>) -> Self {
1368        Self {
1369            builder: self.builder.property("icon-name", icon_name.into()),
1370        }
1371    }
1372
1373    pub fn icon_widget(self, icon_widget: &impl IsA<Widget>) -> Self {
1374        Self {
1375            builder: self
1376                .builder
1377                .property("icon-widget", icon_widget.clone().upcast()),
1378        }
1379    }
1380
1381    pub fn label(self, label: impl Into<glib::GString>) -> Self {
1382        Self {
1383            builder: self.builder.property("label", label.into()),
1384        }
1385    }
1386
1387    pub fn label_widget(self, label_widget: &impl IsA<Widget>) -> Self {
1388        Self {
1389            builder: self
1390                .builder
1391                .property("label-widget", label_widget.clone().upcast()),
1392        }
1393    }
1394
1395    pub fn use_underline(self, use_underline: bool) -> Self {
1396        Self {
1397            builder: self.builder.property("use-underline", use_underline),
1398        }
1399    }
1400
1401    pub fn is_important(self, is_important: bool) -> Self {
1402        Self {
1403            builder: self.builder.property("is-important", is_important),
1404        }
1405    }
1406
1407    pub fn visible_horizontal(self, visible_horizontal: bool) -> Self {
1408        Self {
1409            builder: self
1410                .builder
1411                .property("visible-horizontal", visible_horizontal),
1412        }
1413    }
1414
1415    pub fn visible_vertical(self, visible_vertical: bool) -> Self {
1416        Self {
1417            builder: self.builder.property("visible-vertical", visible_vertical),
1418        }
1419    }
1420
1421    pub fn border_width(self, border_width: u32) -> Self {
1422        Self {
1423            builder: self.builder.property("border-width", border_width),
1424        }
1425    }
1426
1427    pub fn child(self, child: &impl IsA<Widget>) -> Self {
1428        Self {
1429            builder: self.builder.property("child", child.clone().upcast()),
1430        }
1431    }
1432
1433    pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
1434        Self {
1435            builder: self.builder.property("resize-mode", resize_mode),
1436        }
1437    }
1438
1439    pub fn app_paintable(self, app_paintable: bool) -> Self {
1440        Self {
1441            builder: self.builder.property("app-paintable", app_paintable),
1442        }
1443    }
1444
1445    pub fn can_default(self, can_default: bool) -> Self {
1446        Self {
1447            builder: self.builder.property("can-default", can_default),
1448        }
1449    }
1450
1451    pub fn can_focus(self, can_focus: bool) -> Self {
1452        Self {
1453            builder: self.builder.property("can-focus", can_focus),
1454        }
1455    }
1456
1457    pub fn events(self, events: gdk::EventMask) -> Self {
1458        Self {
1459            builder: self.builder.property("events", events),
1460        }
1461    }
1462
1463    /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1464    pub fn expand(self, expand: bool) -> Self {
1465        Self {
1466            builder: self.builder.property("expand", expand),
1467        }
1468    }
1469
1470    /// Whether the widget should grab focus when it is clicked with the mouse.
1471    ///
1472    /// This property is only relevant for widgets that can take focus.
1473    ///
1474    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1475    /// GtkComboBox) implemented this property individually.
1476    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1477        Self {
1478            builder: self.builder.property("focus-on-click", focus_on_click),
1479        }
1480    }
1481
1482    /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1483    pub fn halign(self, halign: Align) -> Self {
1484        Self {
1485            builder: self.builder.property("halign", halign),
1486        }
1487    }
1488
1489    pub fn has_default(self, has_default: bool) -> Self {
1490        Self {
1491            builder: self.builder.property("has-default", has_default),
1492        }
1493    }
1494
1495    pub fn has_focus(self, has_focus: bool) -> Self {
1496        Self {
1497            builder: self.builder.property("has-focus", has_focus),
1498        }
1499    }
1500
1501    /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1502    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1503    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1504    /// whether it will provide a tooltip or not.
1505    ///
1506    /// Note that setting this property to [`true`] for the first time will change
1507    /// the event masks of the GdkWindows of this widget to include leave-notify
1508    /// and motion-notify events. This cannot and will not be undone when the
1509    /// property is set to [`false`] again.
1510    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1511        Self {
1512            builder: self.builder.property("has-tooltip", has_tooltip),
1513        }
1514    }
1515
1516    pub fn height_request(self, height_request: i32) -> Self {
1517        Self {
1518            builder: self.builder.property("height-request", height_request),
1519        }
1520    }
1521
1522    /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1523    pub fn hexpand(self, hexpand: bool) -> Self {
1524        Self {
1525            builder: self.builder.property("hexpand", hexpand),
1526        }
1527    }
1528
1529    /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1530    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1531        Self {
1532            builder: self.builder.property("hexpand-set", hexpand_set),
1533        }
1534    }
1535
1536    pub fn is_focus(self, is_focus: bool) -> Self {
1537        Self {
1538            builder: self.builder.property("is-focus", is_focus),
1539        }
1540    }
1541
1542    /// Sets all four sides' margin at once. If read, returns max
1543    /// margin on any side.
1544    pub fn margin(self, margin: i32) -> Self {
1545        Self {
1546            builder: self.builder.property("margin", margin),
1547        }
1548    }
1549
1550    /// Margin on bottom side of widget.
1551    ///
1552    /// This property adds margin outside of the widget's normal size
1553    /// request, the margin will be added in addition to the size from
1554    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1555    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1556        Self {
1557            builder: self.builder.property("margin-bottom", margin_bottom),
1558        }
1559    }
1560
1561    /// Margin on end of widget, horizontally. This property supports
1562    /// left-to-right and right-to-left text directions.
1563    ///
1564    /// This property adds margin outside of the widget's normal size
1565    /// request, the margin will be added in addition to the size from
1566    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1567    pub fn margin_end(self, margin_end: i32) -> Self {
1568        Self {
1569            builder: self.builder.property("margin-end", margin_end),
1570        }
1571    }
1572
1573    /// Margin on start of widget, horizontally. This property supports
1574    /// left-to-right and right-to-left text directions.
1575    ///
1576    /// This property adds margin outside of the widget's normal size
1577    /// request, the margin will be added in addition to the size from
1578    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1579    pub fn margin_start(self, margin_start: i32) -> Self {
1580        Self {
1581            builder: self.builder.property("margin-start", margin_start),
1582        }
1583    }
1584
1585    /// Margin on top side of widget.
1586    ///
1587    /// This property adds margin outside of the widget's normal size
1588    /// request, the margin will be added in addition to the size from
1589    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1590    pub fn margin_top(self, margin_top: i32) -> Self {
1591        Self {
1592            builder: self.builder.property("margin-top", margin_top),
1593        }
1594    }
1595
1596    pub fn name(self, name: impl Into<glib::GString>) -> Self {
1597        Self {
1598            builder: self.builder.property("name", name.into()),
1599        }
1600    }
1601
1602    pub fn no_show_all(self, no_show_all: bool) -> Self {
1603        Self {
1604            builder: self.builder.property("no-show-all", no_show_all),
1605        }
1606    }
1607
1608    /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1609    /// more details about window opacity.
1610    ///
1611    /// Before 3.8 this was only available in GtkWindow
1612    pub fn opacity(self, opacity: f64) -> Self {
1613        Self {
1614            builder: self.builder.property("opacity", opacity),
1615        }
1616    }
1617
1618    pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1619        Self {
1620            builder: self.builder.property("parent", parent.clone().upcast()),
1621        }
1622    }
1623
1624    pub fn receives_default(self, receives_default: bool) -> Self {
1625        Self {
1626            builder: self.builder.property("receives-default", receives_default),
1627        }
1628    }
1629
1630    pub fn sensitive(self, sensitive: bool) -> Self {
1631        Self {
1632            builder: self.builder.property("sensitive", sensitive),
1633        }
1634    }
1635
1636    /// Sets the text of tooltip to be the given string, which is marked up
1637    /// with the [Pango text markup language][PangoMarkupFormat].
1638    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1639    ///
1640    /// This is a convenience property which will take care of getting the
1641    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1642    /// will automatically be set to [`true`] and there will be taken care of
1643    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1644    ///
1645    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1646    /// are set, the last one wins.
1647    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1648        Self {
1649            builder: self
1650                .builder
1651                .property("tooltip-markup", tooltip_markup.into()),
1652        }
1653    }
1654
1655    /// Sets the text of tooltip to be the given string.
1656    ///
1657    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1658    ///
1659    /// This is a convenience property which will take care of getting the
1660    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1661    /// will automatically be set to [`true`] and there will be taken care of
1662    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1663    ///
1664    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1665    /// are set, the last one wins.
1666    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1667        Self {
1668            builder: self.builder.property("tooltip-text", tooltip_text.into()),
1669        }
1670    }
1671
1672    /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1673    pub fn valign(self, valign: Align) -> Self {
1674        Self {
1675            builder: self.builder.property("valign", valign),
1676        }
1677    }
1678
1679    /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1680    pub fn vexpand(self, vexpand: bool) -> Self {
1681        Self {
1682            builder: self.builder.property("vexpand", vexpand),
1683        }
1684    }
1685
1686    /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1687    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1688        Self {
1689            builder: self.builder.property("vexpand-set", vexpand_set),
1690        }
1691    }
1692
1693    pub fn visible(self, visible: bool) -> Self {
1694        Self {
1695            builder: self.builder.property("visible", visible),
1696        }
1697    }
1698
1699    pub fn width_request(self, width_request: i32) -> Self {
1700        Self {
1701            builder: self.builder.property("width-request", width_request),
1702        }
1703    }
1704
1705    pub fn action_name(self, action_name: impl Into<glib::GString>) -> Self {
1706        Self {
1707            builder: self.builder.property("action-name", action_name.into()),
1708        }
1709    }
1710
1711    pub fn action_target(self, action_target: &glib::Variant) -> Self {
1712        Self {
1713            builder: self
1714                .builder
1715                .property("action-target", action_target.clone()),
1716        }
1717    }
1718
1719    // rustdoc-stripper-ignore-next
1720    /// Build the [`MenuToolButton`].
1721    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1722    pub fn build(self) -> MenuToolButton {
1723        self.builder.build()
1724    }
1725}
1726
1727mod sealed {
1728    pub trait Sealed {}
1729    impl<T: super::IsA<super::MenuToolButton>> Sealed for T {}
1730}
1731
1732/// Trait containing all [`struct@MenuToolButton`] methods.
1733///
1734/// # Implementors
1735///
1736/// [`MenuToolButton`][struct@crate::MenuToolButton]
1737pub trait MenuToolButtonExt: IsA<MenuToolButton> + sealed::Sealed + 'static {
1738    /// Gets the [`Menu`][crate::Menu] associated with [`MenuToolButton`][crate::MenuToolButton].
1739    ///
1740    /// # Returns
1741    ///
1742    /// the [`Menu`][crate::Menu] associated
1743    ///  with [`MenuToolButton`][crate::MenuToolButton]
1744    #[doc(alias = "gtk_menu_tool_button_get_menu")]
1745    #[doc(alias = "get_menu")]
1746    fn menu(&self) -> Option<Widget> {
1747        unsafe {
1748            from_glib_none(ffi::gtk_menu_tool_button_get_menu(
1749                self.as_ref().to_glib_none().0,
1750            ))
1751        }
1752    }
1753
1754    /// Sets the tooltip markup text to be used as tooltip for the arrow button
1755    /// which pops up the menu. See [`ToolItemExt::set_tooltip_text()`][crate::prelude::ToolItemExt::set_tooltip_text()] for setting
1756    /// a tooltip on the whole [`MenuToolButton`][crate::MenuToolButton].
1757    /// ## `markup`
1758    /// markup text to be used as tooltip text for button’s arrow button
1759    #[doc(alias = "gtk_menu_tool_button_set_arrow_tooltip_markup")]
1760    fn set_arrow_tooltip_markup(&self, markup: &str) {
1761        unsafe {
1762            ffi::gtk_menu_tool_button_set_arrow_tooltip_markup(
1763                self.as_ref().to_glib_none().0,
1764                markup.to_glib_none().0,
1765            );
1766        }
1767    }
1768
1769    /// Sets the tooltip text to be used as tooltip for the arrow button which
1770    /// pops up the menu. See [`ToolItemExt::set_tooltip_text()`][crate::prelude::ToolItemExt::set_tooltip_text()] for setting a tooltip
1771    /// on the whole [`MenuToolButton`][crate::MenuToolButton].
1772    /// ## `text`
1773    /// text to be used as tooltip text for button’s arrow button
1774    #[doc(alias = "gtk_menu_tool_button_set_arrow_tooltip_text")]
1775    fn set_arrow_tooltip_text(&self, text: &str) {
1776        unsafe {
1777            ffi::gtk_menu_tool_button_set_arrow_tooltip_text(
1778                self.as_ref().to_glib_none().0,
1779                text.to_glib_none().0,
1780            );
1781        }
1782    }
1783
1784    /// Sets the [`Menu`][crate::Menu] that is popped up when the user clicks on the arrow.
1785    /// If `menu` is NULL, the arrow button becomes insensitive.
1786    /// ## `menu`
1787    /// the [`Menu`][crate::Menu] associated with [`MenuToolButton`][crate::MenuToolButton]
1788    #[doc(alias = "gtk_menu_tool_button_set_menu")]
1789    fn set_menu(&self, menu: &impl IsA<Widget>) {
1790        unsafe {
1791            ffi::gtk_menu_tool_button_set_menu(
1792                self.as_ref().to_glib_none().0,
1793                menu.as_ref().to_glib_none().0,
1794            );
1795        }
1796    }
1797
1798    /// The ::show-menu signal is emitted before the menu is shown.
1799    ///
1800    /// It can be used to populate the menu on demand, using
1801    /// [`set_menu()`][Self::set_menu()].
1802    ///
1803    /// Note that even if you populate the menu dynamically in this way,
1804    /// you must set an empty menu on the [`MenuToolButton`][crate::MenuToolButton] beforehand,
1805    /// since the arrow is made insensitive if the menu is not set.
1806    #[doc(alias = "show-menu")]
1807    fn connect_show_menu<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1808        unsafe extern "C" fn show_menu_trampoline<P: IsA<MenuToolButton>, F: Fn(&P) + 'static>(
1809            this: *mut ffi::GtkMenuToolButton,
1810            f: glib::ffi::gpointer,
1811        ) {
1812            let f: &F = &*(f as *const F);
1813            f(MenuToolButton::from_glib_borrow(this).unsafe_cast_ref())
1814        }
1815        unsafe {
1816            let f: Box_<F> = Box_::new(f);
1817            connect_raw(
1818                self.as_ptr() as *mut _,
1819                b"show-menu\0".as_ptr() as *const _,
1820                Some(transmute::<_, unsafe extern "C" fn()>(
1821                    show_menu_trampoline::<Self, F> as *const (),
1822                )),
1823                Box_::into_raw(f),
1824            )
1825        }
1826    }
1827
1828    #[doc(alias = "menu")]
1829    fn connect_menu_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1830        unsafe extern "C" fn notify_menu_trampoline<P: IsA<MenuToolButton>, F: Fn(&P) + 'static>(
1831            this: *mut ffi::GtkMenuToolButton,
1832            _param_spec: glib::ffi::gpointer,
1833            f: glib::ffi::gpointer,
1834        ) {
1835            let f: &F = &*(f as *const F);
1836            f(MenuToolButton::from_glib_borrow(this).unsafe_cast_ref())
1837        }
1838        unsafe {
1839            let f: Box_<F> = Box_::new(f);
1840            connect_raw(
1841                self.as_ptr() as *mut _,
1842                b"notify::menu\0".as_ptr() as *const _,
1843                Some(transmute::<_, unsafe extern "C" fn()>(
1844                    notify_menu_trampoline::<Self, F> as *const (),
1845                )),
1846                Box_::into_raw(f),
1847            )
1848        }
1849    }
1850}
1851
1852impl<O: IsA<MenuToolButton>> MenuToolButtonExt for O {}
1853
1854impl fmt::Display for MenuToolButton {
1855    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1856        f.write_str("MenuToolButton")
1857    }
1858}