Skip to main content

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