Skip to main content

gtk/auto/
tool_item.rs

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