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 /// format == 8))
560 /// {
561 /// GdkDragAction action;
562 ///
563 /// // handle data here
564 ///
565 /// action = gdk_drag_context_get_selected_action (context);
566 /// if (action == GDK_ACTION_ASK)
567 /// {
568 /// GtkWidget *dialog;
569 /// gint response;
570 ///
571 /// dialog = gtk_message_dialog_new (NULL,
572 /// GTK_DIALOG_MODAL |
573 /// GTK_DIALOG_DESTROY_WITH_PARENT,
574 /// GTK_MESSAGE_INFO,
575 /// GTK_BUTTONS_YES_NO,
576 /// "Move the data ?\n");
577 /// response = gtk_dialog_run (GTK_DIALOG (dialog));
578 /// gtk_widget_destroy (dialog);
579 ///
580 /// if (response == GTK_RESPONSE_YES)
581 /// action = GDK_ACTION_MOVE;
582 /// else
583 /// action = GDK_ACTION_COPY;
584 /// }
585 ///
586 /// gtk_drag_finish (context, TRUE, action == GDK_ACTION_MOVE, time);
587 /// }
588 /// else
589 /// gtk_drag_finish (context, FALSE, FALSE, time);
590 /// }
591 /// ]|
592 ///
593 ///
594 ///
595 ///
596 /// #### `drag-drop`
597 /// The ::drag-drop signal is emitted on the drop site when the user drops
598 /// the data onto the widget. The signal handler must determine whether
599 /// the cursor position is in a drop zone or not. If it is not in a drop
600 /// zone, it returns [`false`] and no further processing is necessary.
601 /// Otherwise, the handler returns [`true`]. In this case, the handler must
602 /// ensure that `gtk_drag_finish()` is called to let the source know that
603 /// the drop is done. The call to `gtk_drag_finish()` can be done either
604 /// directly or in a [`drag-data-received`][struct@crate::Widget#drag-data-received] handler which gets
605 /// triggered by calling [`WidgetExt::drag_get_data()`][crate::prelude::WidgetExt::drag_get_data()] to receive the data for one
606 /// or more of the supported targets.
607 ///
608 ///
609 ///
610 ///
611 /// #### `drag-end`
612 /// The ::drag-end signal is emitted on the drag source when a drag is
613 /// finished. A typical reason to connect to this signal is to undo
614 /// things done in [`drag-begin`][struct@crate::Widget#drag-begin].
615 ///
616 ///
617 ///
618 ///
619 /// #### `drag-failed`
620 /// The ::drag-failed signal is emitted on the drag source when a drag has
621 /// failed. The signal handler may hook custom code to handle a failed DnD
622 /// operation based on the type of error, it returns [`true`] is the failure has
623 /// been already handled (not showing the default "drag operation failed"
624 /// animation), otherwise it returns [`false`].
625 ///
626 ///
627 ///
628 ///
629 /// #### `drag-leave`
630 /// The ::drag-leave signal is emitted on the drop site when the cursor
631 /// leaves the widget. A typical reason to connect to this signal is to
632 /// undo things done in [`drag-motion`][struct@crate::Widget#drag-motion], e.g. undo highlighting
633 /// with [`WidgetExt::drag_unhighlight()`][crate::prelude::WidgetExt::drag_unhighlight()].
634 ///
635 ///
636 /// Likewise, the [`drag-leave`][struct@crate::Widget#drag-leave] signal is also emitted before the
637 /// ::drag-drop signal, for instance to allow cleaning up of a preview item
638 /// created in the [`drag-motion`][struct@crate::Widget#drag-motion] signal handler.
639 ///
640 ///
641 ///
642 ///
643 /// #### `drag-motion`
644 /// suggested_action,
645 /// time);
646 /// }
647 /// else
648 /// {
649 /// // accept the drop
650 /// }
651 /// }
652 /// ]|
653 ///
654 ///
655 ///
656 ///
657 /// #### `draw`
658 /// This signal is emitted when a widget is supposed to render itself.
659 /// The `widget`'s top left corner must be painted at the origin of
660 /// the passed in context and be sized to the values returned by
661 /// [`WidgetExt::allocated_width()`][crate::prelude::WidgetExt::allocated_width()] and
662 /// [`WidgetExt::allocated_height()`][crate::prelude::WidgetExt::allocated_height()].
663 ///
664 /// Signal handlers connected to this signal can modify the cairo
665 /// context passed as `cr` in any way they like and don't need to
666 /// restore it. The signal emission takes care of calling `cairo_save()`
667 /// before and `cairo_restore()` after invoking the handler.
668 ///
669 /// The signal handler will get a `cr` with a clip region already set to the
670 /// widget's dirty region, i.e. to the area that needs repainting. Complicated
671 /// widgets that want to avoid redrawing themselves completely can get the full
672 /// extents of the clip region with `gdk_cairo_get_clip_rectangle()`, or they can
673 /// get a finer-grained representation of the dirty region with
674 /// `cairo_copy_clip_rectangle_list()`.
675 ///
676 ///
677 ///
678 ///
679 /// #### `enter-notify-event`
680 /// The ::enter-notify-event will be emitted when the pointer enters
681 /// the `widget`'s window.
682 ///
683 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
684 /// to enable the [`gdk::EventMask::ENTER_NOTIFY_MASK`][crate::gdk::EventMask::ENTER_NOTIFY_MASK] mask.
685 ///
686 /// This signal will be sent to the grab widget if there is one.
687 ///
688 ///
689 ///
690 ///
691 /// #### `event`
692 /// The GTK+ main loop will emit three signals for each GDK event delivered
693 /// to a widget: one generic ::event signal, another, more specific,
694 /// signal that matches the type of event delivered (e.g.
695 /// [`key-press-event`][struct@crate::Widget#key-press-event]) and finally a generic
696 /// [`event-after`][struct@crate::Widget#event-after] signal.
697 ///
698 ///
699 ///
700 ///
701 /// #### `event-after`
702 /// After the emission of the [`event`][struct@crate::Widget#event] signal and (optionally)
703 /// the second more specific signal, ::event-after will be emitted
704 /// regardless of the previous two signals handlers return values.
705 ///
706 ///
707 ///
708 ///
709 /// #### `focus`
710 ///
711 ///
712 ///
713 /// #### `focus-in-event`
714 /// The ::focus-in-event signal will be emitted when the keyboard focus
715 /// enters the `widget`'s window.
716 ///
717 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
718 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
719 ///
720 ///
721 ///
722 ///
723 /// #### `focus-out-event`
724 /// The ::focus-out-event signal will be emitted when the keyboard focus
725 /// leaves the `widget`'s window.
726 ///
727 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
728 /// to enable the [`gdk::EventMask::FOCUS_CHANGE_MASK`][crate::gdk::EventMask::FOCUS_CHANGE_MASK] mask.
729 ///
730 ///
731 ///
732 ///
733 /// #### `grab-broken-event`
734 /// Emitted when a pointer or keyboard grab on a window belonging
735 /// to `widget` gets broken.
736 ///
737 /// On X11, this happens when the grab window becomes unviewable
738 /// (i.e. it or one of its ancestors is unmapped), or if the same
739 /// application grabs the pointer or keyboard again.
740 ///
741 ///
742 ///
743 ///
744 /// #### `grab-focus`
745 /// Action
746 ///
747 ///
748 /// #### `grab-notify`
749 /// The ::grab-notify signal is emitted when a widget becomes
750 /// shadowed by a GTK+ grab (not a pointer or keyboard grab) on
751 /// another widget, or when it becomes unshadowed due to a grab
752 /// being removed.
753 ///
754 /// A widget is shadowed by a [`WidgetExt::grab_add()`][crate::prelude::WidgetExt::grab_add()] when the topmost
755 /// grab widget in the grab stack of its window group is not
756 /// its ancestor.
757 ///
758 ///
759 ///
760 ///
761 /// #### `hide`
762 /// The ::hide signal is emitted when `widget` is hidden, for example with
763 /// [`WidgetExt::hide()`][crate::prelude::WidgetExt::hide()].
764 ///
765 ///
766 ///
767 ///
768 /// #### `hierarchy-changed`
769 /// The ::hierarchy-changed signal is emitted when the
770 /// anchored state of a widget changes. A widget is
771 /// “anchored” when its toplevel
772 /// ancestor is a [`Window`][crate::Window]. This signal is emitted when
773 /// a widget changes from un-anchored to anchored or vice-versa.
774 ///
775 ///
776 ///
777 ///
778 /// #### `key-press-event`
779 /// The ::key-press-event signal is emitted when a key is pressed. The signal
780 /// emission will reoccur at the key-repeat rate when the key is kept pressed.
781 ///
782 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
783 /// to enable the [`gdk::EventMask::KEY_PRESS_MASK`][crate::gdk::EventMask::KEY_PRESS_MASK] mask.
784 ///
785 /// This signal will be sent to the grab widget if there is one.
786 ///
787 ///
788 ///
789 ///
790 /// #### `key-release-event`
791 /// The ::key-release-event signal is emitted when a key is released.
792 ///
793 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
794 /// to enable the [`gdk::EventMask::KEY_RELEASE_MASK`][crate::gdk::EventMask::KEY_RELEASE_MASK] mask.
795 ///
796 /// This signal will be sent to the grab widget if there is one.
797 ///
798 ///
799 ///
800 ///
801 /// #### `keynav-failed`
802 /// Gets emitted if keyboard navigation fails.
803 /// See [`WidgetExt::keynav_failed()`][crate::prelude::WidgetExt::keynav_failed()] for details.
804 ///
805 ///
806 ///
807 ///
808 /// #### `leave-notify-event`
809 /// The ::leave-notify-event will be emitted when the pointer leaves
810 /// the `widget`'s window.
811 ///
812 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
813 /// to enable the [`gdk::EventMask::LEAVE_NOTIFY_MASK`][crate::gdk::EventMask::LEAVE_NOTIFY_MASK] mask.
814 ///
815 /// This signal will be sent to the grab widget if there is one.
816 ///
817 ///
818 ///
819 ///
820 /// #### `map`
821 /// The ::map signal is emitted when `widget` is going to be mapped, that is
822 /// when the widget is visible (which is controlled with
823 /// [`WidgetExt::set_visible()`][crate::prelude::WidgetExt::set_visible()]) and all its parents up to the toplevel widget
824 /// are also visible. Once the map has occurred, [`map-event`][struct@crate::Widget#map-event] will
825 /// be emitted.
826 ///
827 /// The ::map signal can be used to determine whether a widget will be drawn,
828 /// for instance it can resume an animation that was stopped during the
829 /// emission of [`unmap`][struct@crate::Widget#unmap].
830 ///
831 ///
832 ///
833 ///
834 /// #### `map-event`
835 /// The ::map-event signal will be emitted when the `widget`'s window is
836 /// mapped. A window is mapped when it becomes visible on the screen.
837 ///
838 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
839 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
840 /// automatically for all new windows.
841 ///
842 ///
843 ///
844 ///
845 /// #### `mnemonic-activate`
846 /// The default handler for this signal activates `widget` if `group_cycling`
847 /// is [`false`], or just makes `widget` grab focus if `group_cycling` is [`true`].
848 ///
849 ///
850 ///
851 ///
852 /// #### `motion-notify-event`
853 /// The ::motion-notify-event signal is emitted when the pointer moves
854 /// over the widget's [`gdk::Window`][crate::gdk::Window].
855 ///
856 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget
857 /// needs to enable the [`gdk::EventMask::POINTER_MOTION_MASK`][crate::gdk::EventMask::POINTER_MOTION_MASK] mask.
858 ///
859 /// This signal will be sent to the grab widget if there is one.
860 ///
861 ///
862 ///
863 ///
864 /// #### `move-focus`
865 /// Action
866 ///
867 ///
868 /// #### `parent-set`
869 /// The ::parent-set signal is emitted when a new parent
870 /// has been set on a widget.
871 ///
872 ///
873 ///
874 ///
875 /// #### `popup-menu`
876 /// This signal gets emitted whenever a widget should pop up a context
877 /// menu. This usually happens through the standard key binding mechanism;
878 /// by pressing a certain key while a widget is focused, the user can cause
879 /// the widget to pop up a menu. For example, the [`Entry`][crate::Entry] widget creates
880 /// a menu with clipboard commands. See the
881 /// [Popup Menu Migration Checklist][checklist-popup-menu]
882 /// for an example of how to use this signal.
883 ///
884 /// Action
885 ///
886 ///
887 /// #### `property-notify-event`
888 /// The ::property-notify-event signal will be emitted when a property on
889 /// the `widget`'s window has been changed or deleted.
890 ///
891 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
892 /// to enable the [`gdk::EventMask::PROPERTY_CHANGE_MASK`][crate::gdk::EventMask::PROPERTY_CHANGE_MASK] mask.
893 ///
894 ///
895 ///
896 ///
897 /// #### `proximity-in-event`
898 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
899 /// to enable the [`gdk::EventMask::PROXIMITY_IN_MASK`][crate::gdk::EventMask::PROXIMITY_IN_MASK] mask.
900 ///
901 /// This signal will be sent to the grab widget if there is one.
902 ///
903 ///
904 ///
905 ///
906 /// #### `proximity-out-event`
907 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
908 /// to enable the [`gdk::EventMask::PROXIMITY_OUT_MASK`][crate::gdk::EventMask::PROXIMITY_OUT_MASK] mask.
909 ///
910 /// This signal will be sent to the grab widget if there is one.
911 ///
912 ///
913 ///
914 ///
915 /// #### `query-tooltip`
916 /// Emitted when [`has-tooltip`][struct@crate::Widget#has-tooltip] is [`true`] and the hover timeout
917 /// has expired with the cursor hovering "above" `widget`; or emitted when `widget` got
918 /// focus in keyboard mode.
919 ///
920 /// Using the given coordinates, the signal handler should determine
921 /// whether a tooltip should be shown for `widget`. If this is the case
922 /// [`true`] should be returned, [`false`] otherwise. Note that if
923 /// `keyboard_mode` is [`true`], the values of `x` and `y` are undefined and
924 /// should not be used.
925 ///
926 /// The signal handler is free to manipulate `tooltip` with the therefore
927 /// destined function calls.
928 ///
929 ///
930 ///
931 ///
932 /// #### `realize`
933 /// The ::realize signal is emitted when `widget` is associated with a
934 /// [`gdk::Window`][crate::gdk::Window], which means that [`WidgetExt::realize()`][crate::prelude::WidgetExt::realize()] has been called or the
935 /// widget has been mapped (that is, it is going to be drawn).
936 ///
937 ///
938 ///
939 ///
940 /// #### `screen-changed`
941 /// The ::screen-changed signal gets emitted when the
942 /// screen of a widget has changed.
943 ///
944 ///
945 ///
946 ///
947 /// #### `scroll-event`
948 /// The ::scroll-event signal is emitted when a button in the 4 to 7
949 /// range is pressed. Wheel mice are usually configured to generate
950 /// button press events for buttons 4 and 5 when the wheel is turned.
951 ///
952 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
953 /// to enable the [`gdk::EventMask::SCROLL_MASK`][crate::gdk::EventMask::SCROLL_MASK] mask.
954 ///
955 /// This signal will be sent to the grab widget if there is one.
956 ///
957 ///
958 ///
959 ///
960 /// #### `selection-clear-event`
961 /// The ::selection-clear-event signal will be emitted when the
962 /// the `widget`'s window has lost ownership of a selection.
963 ///
964 ///
965 ///
966 ///
967 /// #### `selection-get`
968 ///
969 ///
970 ///
971 /// #### `selection-notify-event`
972 ///
973 ///
974 ///
975 /// #### `selection-received`
976 ///
977 ///
978 ///
979 /// #### `selection-request-event`
980 /// The ::selection-request-event signal will be emitted when
981 /// another client requests ownership of the selection owned by
982 /// the `widget`'s window.
983 ///
984 ///
985 ///
986 ///
987 /// #### `show`
988 /// The ::show signal is emitted when `widget` is shown, for example with
989 /// [`WidgetExt::show()`][crate::prelude::WidgetExt::show()].
990 ///
991 ///
992 ///
993 ///
994 /// #### `show-help`
995 /// Action
996 ///
997 ///
998 /// #### `size-allocate`
999 ///
1000 ///
1001 ///
1002 /// #### `state-changed`
1003 /// The ::state-changed signal is emitted when the widget state changes.
1004 /// See `gtk_widget_get_state()`.
1005 ///
1006 ///
1007 ///
1008 ///
1009 /// #### `state-flags-changed`
1010 /// The ::state-flags-changed signal is emitted when the widget state
1011 /// changes, see [`WidgetExt::state_flags()`][crate::prelude::WidgetExt::state_flags()].
1012 ///
1013 ///
1014 ///
1015 ///
1016 /// #### `style-set`
1017 /// The ::style-set signal is emitted when a new style has been set
1018 /// on a widget. Note that style-modifying functions like
1019 /// `gtk_widget_modify_base()` also cause this signal to be emitted.
1020 ///
1021 /// Note that this signal is emitted for changes to the deprecated
1022 /// `GtkStyle`. To track changes to the [`StyleContext`][crate::StyleContext] associated
1023 /// with a widget, use the [`style-updated`][struct@crate::Widget#style-updated] signal.
1024 ///
1025 ///
1026 ///
1027 ///
1028 /// #### `style-updated`
1029 /// The ::style-updated signal is a convenience signal that is emitted when the
1030 /// [`changed`][struct@crate::StyleContext#changed] signal is emitted on the `widget`'s associated
1031 /// [`StyleContext`][crate::StyleContext] as returned by [`WidgetExt::style_context()`][crate::prelude::WidgetExt::style_context()].
1032 ///
1033 /// Note that style-modifying functions like `gtk_widget_override_color()` also
1034 /// cause this signal to be emitted.
1035 ///
1036 ///
1037 ///
1038 ///
1039 /// #### `touch-event`
1040 ///
1041 ///
1042 ///
1043 /// #### `unmap`
1044 /// The ::unmap signal is emitted when `widget` is going to be unmapped, which
1045 /// means that either it or any of its parents up to the toplevel widget have
1046 /// been set as hidden.
1047 ///
1048 /// As ::unmap indicates that a widget will not be shown any longer, it can be
1049 /// used to, for example, stop an animation on the widget.
1050 ///
1051 ///
1052 ///
1053 ///
1054 /// #### `unmap-event`
1055 /// The ::unmap-event signal will be emitted when the `widget`'s window is
1056 /// unmapped. A window is unmapped when it becomes invisible on the screen.
1057 ///
1058 /// To receive this signal, the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1059 /// to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable this mask
1060 /// automatically for all new windows.
1061 ///
1062 ///
1063 ///
1064 ///
1065 /// #### `unrealize`
1066 /// The ::unrealize signal is emitted when the [`gdk::Window`][crate::gdk::Window] associated with
1067 /// `widget` is destroyed, which means that [`WidgetExt::unrealize()`][crate::prelude::WidgetExt::unrealize()] has been
1068 /// called or the widget has been unmapped (that is, it is going to be
1069 /// hidden).
1070 ///
1071 ///
1072 ///
1073 ///
1074 /// #### `visibility-notify-event`
1075 /// The ::visibility-notify-event will be emitted when the `widget`'s
1076 /// window is obscured or unobscured.
1077 ///
1078 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget needs
1079 /// to enable the [`gdk::EventMask::VISIBILITY_NOTIFY_MASK`][crate::gdk::EventMask::VISIBILITY_NOTIFY_MASK] mask.
1080 ///
1081 ///
1082 ///
1083 ///
1084 /// #### `window-state-event`
1085 /// The ::window-state-event will be emitted when the state of the
1086 /// toplevel window associated to the `widget` changes.
1087 ///
1088 /// To receive this signal the [`gdk::Window`][crate::gdk::Window] associated to the widget
1089 /// needs to enable the [`gdk::EventMask::STRUCTURE_MASK`][crate::gdk::EventMask::STRUCTURE_MASK] mask. GDK will enable
1090 /// this mask automatically for all new windows.
1091 ///
1092 ///
1093 /// </details>
1094 ///
1095 /// # Implements
1096 ///
1097 /// [`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]
1098 #[doc(alias = "GtkToolbar")]
1099 pub struct Toolbar(Object<ffi::GtkToolbar, ffi::GtkToolbarClass>) @extends Container, Widget, @implements Buildable, Orientable, ToolShell;
1100
1101 match fn {
1102 type_ => || ffi::gtk_toolbar_get_type(),
1103 }
1104}
1105
1106impl Toolbar {
1107 pub const NONE: Option<&'static Toolbar> = None;
1108
1109 /// Creates a new toolbar.
1110 ///
1111 /// # Returns
1112 ///
1113 /// the newly-created toolbar.
1114 #[doc(alias = "gtk_toolbar_new")]
1115 pub fn new() -> Toolbar {
1116 assert_initialized_main_thread!();
1117 unsafe { Widget::from_glib_none(ffi::gtk_toolbar_new()).unsafe_cast() }
1118 }
1119
1120 // rustdoc-stripper-ignore-next
1121 /// Creates a new builder-pattern struct instance to construct [`Toolbar`] objects.
1122 ///
1123 /// This method returns an instance of [`ToolbarBuilder`](crate::builders::ToolbarBuilder) which can be used to create [`Toolbar`] objects.
1124 pub fn builder() -> ToolbarBuilder {
1125 ToolbarBuilder::new()
1126 }
1127}
1128
1129impl Default for Toolbar {
1130 fn default() -> Self {
1131 Self::new()
1132 }
1133}
1134
1135// rustdoc-stripper-ignore-next
1136/// A [builder-pattern] type to construct [`Toolbar`] objects.
1137///
1138/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
1139#[must_use = "The builder must be built to be used"]
1140pub struct ToolbarBuilder {
1141 builder: glib::object::ObjectBuilder<'static, Toolbar>,
1142}
1143
1144impl ToolbarBuilder {
1145 fn new() -> Self {
1146 Self {
1147 builder: glib::object::Object::builder(),
1148 }
1149 }
1150
1151 /// The size of the icons in a toolbar is normally determined by
1152 /// the toolbar-icon-size setting. When this property is set, it
1153 /// overrides the setting.
1154 ///
1155 /// This should only be used for special-purpose toolbars, normal
1156 /// application toolbars should respect the user preferences for the
1157 /// size of icons.
1158 pub fn icon_size(self, icon_size: IconSize) -> Self {
1159 Self {
1160 builder: self.builder.property("icon-size", icon_size),
1161 }
1162 }
1163
1164 /// Is [`true`] if the icon-size property has been set.
1165 pub fn icon_size_set(self, icon_size_set: bool) -> Self {
1166 Self {
1167 builder: self.builder.property("icon-size-set", icon_size_set),
1168 }
1169 }
1170
1171 pub fn show_arrow(self, show_arrow: bool) -> Self {
1172 Self {
1173 builder: self.builder.property("show-arrow", show_arrow),
1174 }
1175 }
1176
1177 pub fn toolbar_style(self, toolbar_style: ToolbarStyle) -> Self {
1178 Self {
1179 builder: self.builder.property("toolbar-style", toolbar_style),
1180 }
1181 }
1182
1183 pub fn border_width(self, border_width: u32) -> Self {
1184 Self {
1185 builder: self.builder.property("border-width", border_width),
1186 }
1187 }
1188
1189 pub fn child(self, child: &impl IsA<Widget>) -> Self {
1190 Self {
1191 builder: self.builder.property("child", child.clone().upcast()),
1192 }
1193 }
1194
1195 pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
1196 Self {
1197 builder: self.builder.property("resize-mode", resize_mode),
1198 }
1199 }
1200
1201 pub fn app_paintable(self, app_paintable: bool) -> Self {
1202 Self {
1203 builder: self.builder.property("app-paintable", app_paintable),
1204 }
1205 }
1206
1207 pub fn can_default(self, can_default: bool) -> Self {
1208 Self {
1209 builder: self.builder.property("can-default", can_default),
1210 }
1211 }
1212
1213 pub fn can_focus(self, can_focus: bool) -> Self {
1214 Self {
1215 builder: self.builder.property("can-focus", can_focus),
1216 }
1217 }
1218
1219 pub fn events(self, events: gdk::EventMask) -> Self {
1220 Self {
1221 builder: self.builder.property("events", events),
1222 }
1223 }
1224
1225 /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
1226 pub fn expand(self, expand: bool) -> Self {
1227 Self {
1228 builder: self.builder.property("expand", expand),
1229 }
1230 }
1231
1232 /// Whether the widget should grab focus when it is clicked with the mouse.
1233 ///
1234 /// This property is only relevant for widgets that can take focus.
1235 ///
1236 /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
1237 /// GtkComboBox) implemented this property individually.
1238 pub fn focus_on_click(self, focus_on_click: bool) -> Self {
1239 Self {
1240 builder: self.builder.property("focus-on-click", focus_on_click),
1241 }
1242 }
1243
1244 /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
1245 pub fn halign(self, halign: Align) -> Self {
1246 Self {
1247 builder: self.builder.property("halign", halign),
1248 }
1249 }
1250
1251 pub fn has_default(self, has_default: bool) -> Self {
1252 Self {
1253 builder: self.builder.property("has-default", has_default),
1254 }
1255 }
1256
1257 pub fn has_focus(self, has_focus: bool) -> Self {
1258 Self {
1259 builder: self.builder.property("has-focus", has_focus),
1260 }
1261 }
1262
1263 /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
1264 /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
1265 /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
1266 /// whether it will provide a tooltip or not.
1267 ///
1268 /// Note that setting this property to [`true`] for the first time will change
1269 /// the event masks of the GdkWindows of this widget to include leave-notify
1270 /// and motion-notify events. This cannot and will not be undone when the
1271 /// property is set to [`false`] again.
1272 pub fn has_tooltip(self, has_tooltip: bool) -> Self {
1273 Self {
1274 builder: self.builder.property("has-tooltip", has_tooltip),
1275 }
1276 }
1277
1278 pub fn height_request(self, height_request: i32) -> Self {
1279 Self {
1280 builder: self.builder.property("height-request", height_request),
1281 }
1282 }
1283
1284 /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
1285 pub fn hexpand(self, hexpand: bool) -> Self {
1286 Self {
1287 builder: self.builder.property("hexpand", hexpand),
1288 }
1289 }
1290
1291 /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
1292 pub fn hexpand_set(self, hexpand_set: bool) -> Self {
1293 Self {
1294 builder: self.builder.property("hexpand-set", hexpand_set),
1295 }
1296 }
1297
1298 pub fn is_focus(self, is_focus: bool) -> Self {
1299 Self {
1300 builder: self.builder.property("is-focus", is_focus),
1301 }
1302 }
1303
1304 /// Sets all four sides' margin at once. If read, returns max
1305 /// margin on any side.
1306 pub fn margin(self, margin: i32) -> Self {
1307 Self {
1308 builder: self.builder.property("margin", margin),
1309 }
1310 }
1311
1312 /// Margin on bottom side of widget.
1313 ///
1314 /// This property adds margin outside of the widget's normal size
1315 /// request, the margin will be added in addition to the size from
1316 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1317 pub fn margin_bottom(self, margin_bottom: i32) -> Self {
1318 Self {
1319 builder: self.builder.property("margin-bottom", margin_bottom),
1320 }
1321 }
1322
1323 /// Margin on end of widget, horizontally. This property supports
1324 /// left-to-right and right-to-left text directions.
1325 ///
1326 /// This property adds margin outside of the widget's normal size
1327 /// request, the margin will be added in addition to the size from
1328 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1329 pub fn margin_end(self, margin_end: i32) -> Self {
1330 Self {
1331 builder: self.builder.property("margin-end", margin_end),
1332 }
1333 }
1334
1335 /// Margin on start of widget, horizontally. This property supports
1336 /// left-to-right and right-to-left text directions.
1337 ///
1338 /// This property adds margin outside of the widget's normal size
1339 /// request, the margin will be added in addition to the size from
1340 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1341 pub fn margin_start(self, margin_start: i32) -> Self {
1342 Self {
1343 builder: self.builder.property("margin-start", margin_start),
1344 }
1345 }
1346
1347 /// Margin on top side of widget.
1348 ///
1349 /// This property adds margin outside of the widget's normal size
1350 /// request, the margin will be added in addition to the size from
1351 /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
1352 pub fn margin_top(self, margin_top: i32) -> Self {
1353 Self {
1354 builder: self.builder.property("margin-top", margin_top),
1355 }
1356 }
1357
1358 pub fn name(self, name: impl Into<glib::GString>) -> Self {
1359 Self {
1360 builder: self.builder.property("name", name.into()),
1361 }
1362 }
1363
1364 pub fn no_show_all(self, no_show_all: bool) -> Self {
1365 Self {
1366 builder: self.builder.property("no-show-all", no_show_all),
1367 }
1368 }
1369
1370 /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
1371 /// more details about window opacity.
1372 ///
1373 /// Before 3.8 this was only available in GtkWindow
1374 pub fn opacity(self, opacity: f64) -> Self {
1375 Self {
1376 builder: self.builder.property("opacity", opacity),
1377 }
1378 }
1379
1380 pub fn parent(self, parent: &impl IsA<Container>) -> Self {
1381 Self {
1382 builder: self.builder.property("parent", parent.clone().upcast()),
1383 }
1384 }
1385
1386 pub fn receives_default(self, receives_default: bool) -> Self {
1387 Self {
1388 builder: self.builder.property("receives-default", receives_default),
1389 }
1390 }
1391
1392 pub fn sensitive(self, sensitive: bool) -> Self {
1393 Self {
1394 builder: self.builder.property("sensitive", sensitive),
1395 }
1396 }
1397
1398 /// Sets the text of tooltip to be the given string, which is marked up
1399 /// with the [Pango text markup language][PangoMarkupFormat].
1400 /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
1401 ///
1402 /// This is a convenience property which will take care of getting the
1403 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1404 /// will automatically be set to [`true`] and there will be taken care of
1405 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1406 ///
1407 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1408 /// are set, the last one wins.
1409 pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
1410 Self {
1411 builder: self
1412 .builder
1413 .property("tooltip-markup", tooltip_markup.into()),
1414 }
1415 }
1416
1417 /// Sets the text of tooltip to be the given string.
1418 ///
1419 /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
1420 ///
1421 /// This is a convenience property which will take care of getting the
1422 /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
1423 /// will automatically be set to [`true`] and there will be taken care of
1424 /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
1425 ///
1426 /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
1427 /// are set, the last one wins.
1428 pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
1429 Self {
1430 builder: self.builder.property("tooltip-text", tooltip_text.into()),
1431 }
1432 }
1433
1434 /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
1435 pub fn valign(self, valign: Align) -> Self {
1436 Self {
1437 builder: self.builder.property("valign", valign),
1438 }
1439 }
1440
1441 /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
1442 pub fn vexpand(self, vexpand: bool) -> Self {
1443 Self {
1444 builder: self.builder.property("vexpand", vexpand),
1445 }
1446 }
1447
1448 /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
1449 pub fn vexpand_set(self, vexpand_set: bool) -> Self {
1450 Self {
1451 builder: self.builder.property("vexpand-set", vexpand_set),
1452 }
1453 }
1454
1455 pub fn visible(self, visible: bool) -> Self {
1456 Self {
1457 builder: self.builder.property("visible", visible),
1458 }
1459 }
1460
1461 pub fn width_request(self, width_request: i32) -> Self {
1462 Self {
1463 builder: self.builder.property("width-request", width_request),
1464 }
1465 }
1466
1467 /// The orientation of the orientable.
1468 pub fn orientation(self, orientation: Orientation) -> Self {
1469 Self {
1470 builder: self.builder.property("orientation", orientation),
1471 }
1472 }
1473
1474 // rustdoc-stripper-ignore-next
1475 /// Build the [`Toolbar`].
1476 #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
1477 pub fn build(self) -> Toolbar {
1478 assert_initialized_main_thread!();
1479 self.builder.build()
1480 }
1481}
1482
1483/// Trait containing all [`struct@Toolbar`] methods.
1484///
1485/// # Implementors
1486///
1487/// [`Toolbar`][struct@crate::Toolbar]
1488pub trait ToolbarExt: IsA<Toolbar> + 'static {
1489 /// Returns the position corresponding to the indicated point on
1490 /// `self`. This is useful when dragging items to the toolbar:
1491 /// this function returns the position a new item should be
1492 /// inserted.
1493 ///
1494 /// `x` and `y` are in `self` coordinates.
1495 /// ## `x`
1496 /// x coordinate of a point on the toolbar
1497 /// ## `y`
1498 /// y coordinate of a point on the toolbar
1499 ///
1500 /// # Returns
1501 ///
1502 /// The position corresponding to the point (`x`, `y`) on the toolbar.
1503 #[doc(alias = "gtk_toolbar_get_drop_index")]
1504 #[doc(alias = "get_drop_index")]
1505 fn drop_index(&self, x: i32, y: i32) -> i32 {
1506 unsafe { ffi::gtk_toolbar_get_drop_index(self.as_ref().to_glib_none().0, x, y) }
1507 }
1508
1509 /// Retrieves the icon size for the toolbar. See [`set_icon_size()`][Self::set_icon_size()].
1510 ///
1511 /// # Returns
1512 ///
1513 /// the current icon size for the icons on the toolbar.
1514 #[doc(alias = "gtk_toolbar_get_icon_size")]
1515 #[doc(alias = "get_icon_size")]
1516 #[doc(alias = "icon-size")]
1517 fn icon_size(&self) -> IconSize {
1518 unsafe {
1519 from_glib(ffi::gtk_toolbar_get_icon_size(
1520 self.as_ref().to_glib_none().0,
1521 ))
1522 }
1523 }
1524
1525 /// Returns the position of `item` on the toolbar, starting from 0.
1526 /// It is an error if `item` is not a child of the toolbar.
1527 /// ## `item`
1528 /// a [`ToolItem`][crate::ToolItem] that is a child of `self`
1529 ///
1530 /// # Returns
1531 ///
1532 /// the position of item on the toolbar.
1533 #[doc(alias = "gtk_toolbar_get_item_index")]
1534 #[doc(alias = "get_item_index")]
1535 fn item_index(&self, item: &impl IsA<ToolItem>) -> i32 {
1536 unsafe {
1537 ffi::gtk_toolbar_get_item_index(
1538 self.as_ref().to_glib_none().0,
1539 item.as_ref().to_glib_none().0,
1540 )
1541 }
1542 }
1543
1544 /// Returns the number of items on the toolbar.
1545 ///
1546 /// # Returns
1547 ///
1548 /// the number of items on the toolbar
1549 #[doc(alias = "gtk_toolbar_get_n_items")]
1550 #[doc(alias = "get_n_items")]
1551 fn n_items(&self) -> i32 {
1552 unsafe { ffi::gtk_toolbar_get_n_items(self.as_ref().to_glib_none().0) }
1553 }
1554
1555 /// Returns the `n`'th item on `self`, or [`None`] if the
1556 /// toolbar does not contain an `n`'th item.
1557 /// ## `n`
1558 /// A position on the toolbar
1559 ///
1560 /// # Returns
1561 ///
1562 /// The `n`'th [`ToolItem`][crate::ToolItem] on `self`,
1563 /// or [`None`] if there isn’t an `n`'th item.
1564 #[doc(alias = "gtk_toolbar_get_nth_item")]
1565 #[doc(alias = "get_nth_item")]
1566 fn nth_item(&self, n: i32) -> Option<ToolItem> {
1567 unsafe {
1568 from_glib_none(ffi::gtk_toolbar_get_nth_item(
1569 self.as_ref().to_glib_none().0,
1570 n,
1571 ))
1572 }
1573 }
1574
1575 /// Returns the relief style of buttons on `self`. See
1576 /// [`ButtonExt::set_relief()`][crate::prelude::ButtonExt::set_relief()].
1577 ///
1578 /// # Returns
1579 ///
1580 /// The relief style of buttons on `self`.
1581 #[doc(alias = "gtk_toolbar_get_relief_style")]
1582 #[doc(alias = "get_relief_style")]
1583 fn relief_style(&self) -> ReliefStyle {
1584 unsafe {
1585 from_glib(ffi::gtk_toolbar_get_relief_style(
1586 self.as_ref().to_glib_none().0,
1587 ))
1588 }
1589 }
1590
1591 /// Returns whether the toolbar has an overflow menu.
1592 /// See [`set_show_arrow()`][Self::set_show_arrow()].
1593 ///
1594 /// # Returns
1595 ///
1596 /// [`true`] if the toolbar has an overflow menu.
1597 #[doc(alias = "gtk_toolbar_get_show_arrow")]
1598 #[doc(alias = "get_show_arrow")]
1599 #[doc(alias = "show-arrow")]
1600 fn shows_arrow(&self) -> bool {
1601 unsafe {
1602 from_glib(ffi::gtk_toolbar_get_show_arrow(
1603 self.as_ref().to_glib_none().0,
1604 ))
1605 }
1606 }
1607
1608 /// Retrieves whether the toolbar has text, icons, or both . See
1609 /// [`set_style()`][Self::set_style()].
1610 ///
1611 /// # Returns
1612 ///
1613 /// the current style of `self`
1614 #[doc(alias = "gtk_toolbar_get_style")]
1615 #[doc(alias = "get_style")]
1616 fn style(&self) -> ToolbarStyle {
1617 unsafe { from_glib(ffi::gtk_toolbar_get_style(self.as_ref().to_glib_none().0)) }
1618 }
1619
1620 /// Insert a [`ToolItem`][crate::ToolItem] into the toolbar at position `pos`. If `pos` is
1621 /// 0 the item is prepended to the start of the toolbar. If `pos` is
1622 /// negative, the item is appended to the end of the toolbar.
1623 /// ## `item`
1624 /// a [`ToolItem`][crate::ToolItem]
1625 /// ## `pos`
1626 /// the position of the new item
1627 #[doc(alias = "gtk_toolbar_insert")]
1628 fn insert(&self, item: &impl IsA<ToolItem>, pos: i32) {
1629 unsafe {
1630 ffi::gtk_toolbar_insert(
1631 self.as_ref().to_glib_none().0,
1632 item.as_ref().to_glib_none().0,
1633 pos,
1634 );
1635 }
1636 }
1637
1638 /// Highlights `self` to give an idea of what it would look like
1639 /// if `item` was added to `self` at the position indicated by `index_`.
1640 /// If `item` is [`None`], highlighting is turned off. In that case `index_`
1641 /// is ignored.
1642 ///
1643 /// The `tool_item` passed to this function must not be part of any widget
1644 /// hierarchy. When an item is set as drop highlight item it can not
1645 /// added to any widget hierarchy or used as highlight item for another
1646 /// toolbar.
1647 /// ## `tool_item`
1648 /// a [`ToolItem`][crate::ToolItem], or [`None`] to turn of highlighting
1649 /// ## `index_`
1650 /// a position on `self`
1651 #[doc(alias = "gtk_toolbar_set_drop_highlight_item")]
1652 fn set_drop_highlight_item(&self, tool_item: Option<&impl IsA<ToolItem>>, index_: i32) {
1653 unsafe {
1654 ffi::gtk_toolbar_set_drop_highlight_item(
1655 self.as_ref().to_glib_none().0,
1656 tool_item.map(|p| p.as_ref()).to_glib_none().0,
1657 index_,
1658 );
1659 }
1660 }
1661
1662 /// This function sets the size of stock icons in the toolbar. You
1663 /// can call it both before you add the icons and after they’ve been
1664 /// added. The size you set will override user preferences for the default
1665 /// icon size.
1666 ///
1667 /// This should only be used for special-purpose toolbars, normal
1668 /// application toolbars should respect the user preferences for the
1669 /// size of icons.
1670 /// ## `icon_size`
1671 /// The [`IconSize`][crate::IconSize] that stock icons in the toolbar shall have.
1672 #[doc(alias = "gtk_toolbar_set_icon_size")]
1673 #[doc(alias = "icon-size")]
1674 fn set_icon_size(&self, icon_size: IconSize) {
1675 unsafe {
1676 ffi::gtk_toolbar_set_icon_size(self.as_ref().to_glib_none().0, icon_size.into_glib());
1677 }
1678 }
1679
1680 /// Sets whether to show an overflow menu when `self` isn’t allocated enough
1681 /// size to show all of its items. If [`true`], items which can’t fit in `self`,
1682 /// and which have a proxy menu item set by [`ToolItemExt::set_proxy_menu_item()`][crate::prelude::ToolItemExt::set_proxy_menu_item()]
1683 /// or [`create-menu-proxy`][struct@crate::ToolItem#create-menu-proxy], will be available in an overflow menu,
1684 /// which can be opened by an added arrow button. If [`false`], `self` will
1685 /// request enough size to fit all of its child items without any overflow.
1686 /// ## `show_arrow`
1687 /// Whether to show an overflow menu
1688 #[doc(alias = "gtk_toolbar_set_show_arrow")]
1689 #[doc(alias = "show-arrow")]
1690 fn set_show_arrow(&self, show_arrow: bool) {
1691 unsafe {
1692 ffi::gtk_toolbar_set_show_arrow(self.as_ref().to_glib_none().0, show_arrow.into_glib());
1693 }
1694 }
1695
1696 /// Alters the view of `self` to display either icons only, text only, or both.
1697 /// ## `style`
1698 /// the new style for `self`.
1699 #[doc(alias = "gtk_toolbar_set_style")]
1700 fn set_style(&self, style: ToolbarStyle) {
1701 unsafe {
1702 ffi::gtk_toolbar_set_style(self.as_ref().to_glib_none().0, style.into_glib());
1703 }
1704 }
1705
1706 /// Unsets toolbar icon size set with [`set_icon_size()`][Self::set_icon_size()], so that
1707 /// user preferences will be used to determine the icon size.
1708 #[doc(alias = "gtk_toolbar_unset_icon_size")]
1709 fn unset_icon_size(&self) {
1710 unsafe {
1711 ffi::gtk_toolbar_unset_icon_size(self.as_ref().to_glib_none().0);
1712 }
1713 }
1714
1715 /// Unsets a toolbar style set with [`set_style()`][Self::set_style()], so that
1716 /// user preferences will be used to determine the toolbar style.
1717 #[doc(alias = "gtk_toolbar_unset_style")]
1718 fn unset_style(&self) {
1719 unsafe {
1720 ffi::gtk_toolbar_unset_style(self.as_ref().to_glib_none().0);
1721 }
1722 }
1723
1724 /// Is [`true`] if the icon-size property has been set.
1725 #[doc(alias = "icon-size-set")]
1726 fn is_icon_size_set(&self) -> bool {
1727 ObjectExt::property(self.as_ref(), "icon-size-set")
1728 }
1729
1730 /// Is [`true`] if the icon-size property has been set.
1731 #[doc(alias = "icon-size-set")]
1732 fn set_icon_size_set(&self, icon_size_set: bool) {
1733 ObjectExt::set_property(self.as_ref(), "icon-size-set", icon_size_set)
1734 }
1735
1736 #[doc(alias = "toolbar-style")]
1737 fn toolbar_style(&self) -> ToolbarStyle {
1738 ObjectExt::property(self.as_ref(), "toolbar-style")
1739 }
1740
1741 #[doc(alias = "toolbar-style")]
1742 fn set_toolbar_style(&self, toolbar_style: ToolbarStyle) {
1743 ObjectExt::set_property(self.as_ref(), "toolbar-style", toolbar_style)
1744 }
1745
1746 fn item_expands<T: IsA<crate::Widget>>(&self, item: &T) -> bool {
1747 crate::prelude::ContainerExtManual::child_property(
1748 self.as_ref(),
1749 &item.clone().upcast(),
1750 "expand",
1751 )
1752 }
1753
1754 fn set_item_expand<T: IsA<crate::Widget>>(&self, item: &T, expand: bool) {
1755 crate::prelude::ContainerExtManual::child_set_property(
1756 self.as_ref(),
1757 &item.clone().upcast(),
1758 "expand",
1759 &expand,
1760 )
1761 }
1762
1763 fn item_is_homogeneous<T: IsA<crate::Widget>>(&self, item: &T) -> bool {
1764 crate::prelude::ContainerExtManual::child_property(
1765 self.as_ref(),
1766 &item.clone().upcast(),
1767 "homogeneous",
1768 )
1769 }
1770
1771 fn set_item_homogeneous<T: IsA<crate::Widget>>(&self, item: &T, homogeneous: bool) {
1772 crate::prelude::ContainerExtManual::child_set_property(
1773 self.as_ref(),
1774 &item.clone().upcast(),
1775 "homogeneous",
1776 &homogeneous,
1777 )
1778 }
1779
1780 /// A keybinding signal used internally by GTK+. This signal can't
1781 /// be used in application code
1782 /// ## `focus_home`
1783 /// [`true`] if the first item should be focused
1784 ///
1785 /// # Returns
1786 ///
1787 /// [`true`] if the signal was handled, [`false`] if not
1788 #[doc(alias = "focus-home-or-end")]
1789 fn connect_focus_home_or_end<F: Fn(&Self, bool) -> bool + 'static>(
1790 &self,
1791 f: F,
1792 ) -> SignalHandlerId {
1793 unsafe extern "C" fn focus_home_or_end_trampoline<
1794 P: IsA<Toolbar>,
1795 F: Fn(&P, bool) -> bool + 'static,
1796 >(
1797 this: *mut ffi::GtkToolbar,
1798 focus_home: glib::ffi::gboolean,
1799 f: glib::ffi::gpointer,
1800 ) -> glib::ffi::gboolean {
1801 unsafe {
1802 let f: &F = &*(f as *const F);
1803 f(
1804 Toolbar::from_glib_borrow(this).unsafe_cast_ref(),
1805 from_glib(focus_home),
1806 )
1807 .into_glib()
1808 }
1809 }
1810 unsafe {
1811 let f: Box_<F> = Box_::new(f);
1812 connect_raw(
1813 self.as_ptr() as *mut _,
1814 c"focus-home-or-end".as_ptr(),
1815 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1816 focus_home_or_end_trampoline::<Self, F> as *const (),
1817 )),
1818 Box_::into_raw(f),
1819 )
1820 }
1821 }
1822
1823 fn emit_focus_home_or_end(&self, focus_home: bool) -> bool {
1824 self.emit_by_name("focus-home-or-end", &[&focus_home])
1825 }
1826
1827 /// Emitted when the orientation of the toolbar changes.
1828 /// ## `orientation`
1829 /// the new [`Orientation`][crate::Orientation] of the toolbar
1830 #[doc(alias = "orientation-changed")]
1831 fn connect_orientation_changed<F: Fn(&Self, Orientation) + 'static>(
1832 &self,
1833 f: F,
1834 ) -> SignalHandlerId {
1835 unsafe extern "C" fn orientation_changed_trampoline<
1836 P: IsA<Toolbar>,
1837 F: Fn(&P, Orientation) + 'static,
1838 >(
1839 this: *mut ffi::GtkToolbar,
1840 orientation: ffi::GtkOrientation,
1841 f: glib::ffi::gpointer,
1842 ) {
1843 unsafe {
1844 let f: &F = &*(f as *const F);
1845 f(
1846 Toolbar::from_glib_borrow(this).unsafe_cast_ref(),
1847 from_glib(orientation),
1848 )
1849 }
1850 }
1851 unsafe {
1852 let f: Box_<F> = Box_::new(f);
1853 connect_raw(
1854 self.as_ptr() as *mut _,
1855 c"orientation-changed".as_ptr(),
1856 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1857 orientation_changed_trampoline::<Self, F> as *const (),
1858 )),
1859 Box_::into_raw(f),
1860 )
1861 }
1862 }
1863
1864 /// Emitted when the user right-clicks the toolbar or uses the
1865 /// keybinding to display a popup menu.
1866 ///
1867 /// Application developers should handle this signal if they want
1868 /// to display a context menu on the toolbar. The context-menu should
1869 /// appear at the coordinates given by `x` and `y`. The mouse button
1870 /// number is given by the `button` parameter. If the menu was popped
1871 /// up using the keybaord, `button` is -1.
1872 /// ## `x`
1873 /// the x coordinate of the point where the menu should appear
1874 /// ## `y`
1875 /// the y coordinate of the point where the menu should appear
1876 /// ## `button`
1877 /// the mouse button the user pressed, or -1
1878 ///
1879 /// # Returns
1880 ///
1881 /// return [`true`] if the signal was handled, [`false`] if not
1882 #[doc(alias = "popup-context-menu")]
1883 fn connect_popup_context_menu<F: Fn(&Self, i32, i32, i32) -> glib::Propagation + 'static>(
1884 &self,
1885 f: F,
1886 ) -> SignalHandlerId {
1887 unsafe extern "C" fn popup_context_menu_trampoline<
1888 P: IsA<Toolbar>,
1889 F: Fn(&P, i32, i32, i32) -> glib::Propagation + 'static,
1890 >(
1891 this: *mut ffi::GtkToolbar,
1892 x: std::ffi::c_int,
1893 y: std::ffi::c_int,
1894 button: std::ffi::c_int,
1895 f: glib::ffi::gpointer,
1896 ) -> glib::ffi::gboolean {
1897 unsafe {
1898 let f: &F = &*(f as *const F);
1899 f(
1900 Toolbar::from_glib_borrow(this).unsafe_cast_ref(),
1901 x,
1902 y,
1903 button,
1904 )
1905 .into_glib()
1906 }
1907 }
1908 unsafe {
1909 let f: Box_<F> = Box_::new(f);
1910 connect_raw(
1911 self.as_ptr() as *mut _,
1912 c"popup-context-menu".as_ptr(),
1913 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1914 popup_context_menu_trampoline::<Self, F> as *const (),
1915 )),
1916 Box_::into_raw(f),
1917 )
1918 }
1919 }
1920
1921 /// Emitted when the style of the toolbar changes.
1922 /// ## `style`
1923 /// the new [`ToolbarStyle`][crate::ToolbarStyle] of the toolbar
1924 #[doc(alias = "style-changed")]
1925 fn connect_style_changed<F: Fn(&Self, ToolbarStyle) + 'static>(&self, f: F) -> SignalHandlerId {
1926 unsafe extern "C" fn style_changed_trampoline<
1927 P: IsA<Toolbar>,
1928 F: Fn(&P, ToolbarStyle) + 'static,
1929 >(
1930 this: *mut ffi::GtkToolbar,
1931 style: ffi::GtkToolbarStyle,
1932 f: glib::ffi::gpointer,
1933 ) {
1934 unsafe {
1935 let f: &F = &*(f as *const F);
1936 f(
1937 Toolbar::from_glib_borrow(this).unsafe_cast_ref(),
1938 from_glib(style),
1939 )
1940 }
1941 }
1942 unsafe {
1943 let f: Box_<F> = Box_::new(f);
1944 connect_raw(
1945 self.as_ptr() as *mut _,
1946 c"style-changed".as_ptr(),
1947 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1948 style_changed_trampoline::<Self, F> as *const (),
1949 )),
1950 Box_::into_raw(f),
1951 )
1952 }
1953 }
1954
1955 #[doc(alias = "icon-size")]
1956 fn connect_icon_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1957 unsafe extern "C" fn notify_icon_size_trampoline<P: IsA<Toolbar>, F: Fn(&P) + 'static>(
1958 this: *mut ffi::GtkToolbar,
1959 _param_spec: glib::ffi::gpointer,
1960 f: glib::ffi::gpointer,
1961 ) {
1962 unsafe {
1963 let f: &F = &*(f as *const F);
1964 f(Toolbar::from_glib_borrow(this).unsafe_cast_ref())
1965 }
1966 }
1967 unsafe {
1968 let f: Box_<F> = Box_::new(f);
1969 connect_raw(
1970 self.as_ptr() as *mut _,
1971 c"notify::icon-size".as_ptr(),
1972 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1973 notify_icon_size_trampoline::<Self, F> as *const (),
1974 )),
1975 Box_::into_raw(f),
1976 )
1977 }
1978 }
1979
1980 #[doc(alias = "icon-size-set")]
1981 fn connect_icon_size_set_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1982 unsafe extern "C" fn notify_icon_size_set_trampoline<
1983 P: IsA<Toolbar>,
1984 F: Fn(&P) + 'static,
1985 >(
1986 this: *mut ffi::GtkToolbar,
1987 _param_spec: glib::ffi::gpointer,
1988 f: glib::ffi::gpointer,
1989 ) {
1990 unsafe {
1991 let f: &F = &*(f as *const F);
1992 f(Toolbar::from_glib_borrow(this).unsafe_cast_ref())
1993 }
1994 }
1995 unsafe {
1996 let f: Box_<F> = Box_::new(f);
1997 connect_raw(
1998 self.as_ptr() as *mut _,
1999 c"notify::icon-size-set".as_ptr(),
2000 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2001 notify_icon_size_set_trampoline::<Self, F> as *const (),
2002 )),
2003 Box_::into_raw(f),
2004 )
2005 }
2006 }
2007
2008 #[doc(alias = "show-arrow")]
2009 fn connect_show_arrow_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2010 unsafe extern "C" fn notify_show_arrow_trampoline<P: IsA<Toolbar>, F: Fn(&P) + 'static>(
2011 this: *mut ffi::GtkToolbar,
2012 _param_spec: glib::ffi::gpointer,
2013 f: glib::ffi::gpointer,
2014 ) {
2015 unsafe {
2016 let f: &F = &*(f as *const F);
2017 f(Toolbar::from_glib_borrow(this).unsafe_cast_ref())
2018 }
2019 }
2020 unsafe {
2021 let f: Box_<F> = Box_::new(f);
2022 connect_raw(
2023 self.as_ptr() as *mut _,
2024 c"notify::show-arrow".as_ptr(),
2025 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2026 notify_show_arrow_trampoline::<Self, F> as *const (),
2027 )),
2028 Box_::into_raw(f),
2029 )
2030 }
2031 }
2032
2033 #[doc(alias = "toolbar-style")]
2034 fn connect_toolbar_style_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
2035 unsafe extern "C" fn notify_toolbar_style_trampoline<
2036 P: IsA<Toolbar>,
2037 F: Fn(&P) + 'static,
2038 >(
2039 this: *mut ffi::GtkToolbar,
2040 _param_spec: glib::ffi::gpointer,
2041 f: glib::ffi::gpointer,
2042 ) {
2043 unsafe {
2044 let f: &F = &*(f as *const F);
2045 f(Toolbar::from_glib_borrow(this).unsafe_cast_ref())
2046 }
2047 }
2048 unsafe {
2049 let f: Box_<F> = Box_::new(f);
2050 connect_raw(
2051 self.as_ptr() as *mut _,
2052 c"notify::toolbar-style".as_ptr(),
2053 Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
2054 notify_toolbar_style_trampoline::<Self, F> as *const (),
2055 )),
2056 Box_::into_raw(f),
2057 )
2058 }
2059 }
2060}
2061
2062impl<O: IsA<Toolbar>> ToolbarExt for O {}