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