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