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