Skip to main content

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