Skip to main content

gtk/auto/
tool_palette.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    Adjustment, Align, Buildable, Container, DestDefaults, IconSize, Orientable, Orientation,
7    ResizeMode, Scrollable, ScrollablePolicy, SelectionData, TargetEntry, ToolItem, ToolItemGroup,
8    ToolPaletteDragTargets, ToolbarStyle, Widget, ffi,
9};
10use glib::{
11    prelude::*,
12    signal::{SignalHandlerId, connect_raw},
13    translate::*,
14};
15use std::boxed::Box as Box_;
16
17glib::wrapper! {
18    /// A [`ToolPalette`][crate::ToolPalette] allows you to add `GtkToolItems` to a palette-like
19    /// container with different categories and drag and drop support.
20    ///
21    /// A [`ToolPalette`][crate::ToolPalette] is created with a call to [`new()`][Self::new()].
22    ///
23    /// `GtkToolItems` cannot be added directly to a [`ToolPalette`][crate::ToolPalette] -
24    /// instead they are added to a [`ToolItemGroup`][crate::ToolItemGroup] which can than be added
25    /// to a [`ToolPalette`][crate::ToolPalette]. To add a [`ToolItemGroup`][crate::ToolItemGroup] to a [`ToolPalette`][crate::ToolPalette],
26    /// use [`ContainerExt::add()`][crate::prelude::ContainerExt::add()].
27    ///
28    ///
29    ///
30    /// **⚠️ The following code is in C ⚠️**
31    ///
32    /// ```C
33    /// GtkWidget *palette, *group;
34    /// GtkToolItem *item;
35    ///
36    /// palette = gtk_tool_palette_new ();
37    /// group = gtk_tool_item_group_new (_("Test Category"));
38    /// gtk_container_add (GTK_CONTAINER (palette), group);
39    ///
40    /// item = gtk_tool_button_new (NULL, _("_Open"));
41    /// gtk_tool_button_set_icon_name (GTK_TOOL_BUTTON (item), "document-open");
42    /// gtk_tool_item_group_insert (GTK_TOOL_ITEM_GROUP (group), item, -1);
43    /// ```
44    ///
45    /// The easiest way to use drag and drop with [`ToolPalette`][crate::ToolPalette] is to call
46    /// [`ToolPaletteExt::add_drag_dest()`][crate::prelude::ToolPaletteExt::add_drag_dest()] with the desired drag source `palette`
47    /// and the desired drag target `widget`. Then [`ToolPaletteExt::drag_item()`][crate::prelude::ToolPaletteExt::drag_item()]
48    /// can be used to get the dragged item in the [`drag-data-received`][struct@crate::Widget#drag-data-received]
49    /// signal handler of the drag target.
50    ///
51    ///
52    ///
53    /// **⚠️ The following code is in C ⚠️**
54    ///
55    /// ```C
56    /// static void
57    /// passive_canvas_drag_data_received (GtkWidget        *widget,
58    ///                                    GdkDragContext   *context,
59    ///                                    gint              x,
60    ///                                    gint              y,
61    ///                                    GtkSelectionData *selection,
62    ///                                    guint             info,
63    ///                                    guint             time,
64    ///                                    gpointer          data)
65    /// {
66    ///   GtkWidget *palette;
67    ///   GtkWidget *item;
68    ///
69    ///   // Get the dragged item
70    ///   palette = gtk_widget_get_ancestor (gtk_drag_get_source_widget (context),
71    ///                                      GTK_TYPE_TOOL_PALETTE);
72    ///   if (palette != NULL)
73    ///     item = gtk_tool_palette_get_drag_item (GTK_TOOL_PALETTE (palette),
74    ///                                            selection);
75    ///
76    ///   // Do something with item
77    /// }
78    ///
79    /// GtkWidget *target, palette;
80    ///
81    /// palette = gtk_tool_palette_new ();
82    /// target = gtk_drawing_area_new ();
83    ///
84    /// g_signal_connect (G_OBJECT (target), "drag-data-received",
85    ///                   G_CALLBACK (passive_canvas_drag_data_received), NULL);
86    /// gtk_tool_palette_add_drag_dest (GTK_TOOL_PALETTE (palette), target,
87    ///                                 GTK_DEST_DEFAULT_ALL,
88    ///                                 GTK_TOOL_PALETTE_DRAG_ITEMS,
89    ///                                 GDK_ACTION_COPY);
90    /// ```
91    ///
92    /// # CSS nodes
93    ///
94    /// GtkToolPalette has a single CSS node named toolpalette.
95    ///
96    /// ## Properties
97    ///
98    ///
99    /// #### `icon-size`
100    ///  The size of the icons in a tool palette. When this property is set,
101    /// it overrides the default setting.
102    ///
103    /// This should only be used for special-purpose tool palettes, normal
104    /// application tool palettes should respect the user preferences for the
105    /// size of icons.
106    ///
107    /// Readable | Writable
108    ///
109    ///
110    /// #### `icon-size-set`
111    ///  Is [`true`] if the [`icon-size`][struct@crate::ToolPalette#icon-size] property has been set.
112    ///
113    /// Readable | Writable
114    ///
115    ///
116    /// #### `toolbar-style`
117    ///  The style of items in the tool palette.
118    ///
119    /// Readable | Writable
120    /// <details><summary><h4>Container</h4></summary>
121    ///
122    ///
123    /// #### `border-width`
124    ///  Readable | Writable
125    ///
126    ///
127    /// #### `child`
128    ///  Writable
129    ///
130    ///
131    /// #### `resize-mode`
132    ///  Readable | Writable
133    /// </details>
134    /// <details><summary><h4>Widget</h4></summary>
135    ///
136    ///
137    /// #### `app-paintable`
138    ///  Readable | Writable
139    ///
140    ///
141    /// #### `can-default`
142    ///  Readable | Writable
143    ///
144    ///
145    /// #### `can-focus`
146    ///  Readable | Writable
147    ///
148    ///
149    /// #### `composite-child`
150    ///  Readable
151    ///
152    ///
153    /// #### `double-buffered`
154    ///  Whether the widget is double buffered.
155    ///
156    /// Readable | Writable
157    ///
158    ///
159    /// #### `events`
160    ///  Readable | Writable
161    ///
162    ///
163    /// #### `expand`
164    ///  Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
165    ///
166    /// Readable | Writable
167    ///
168    ///
169    /// #### `focus-on-click`
170    ///  Whether the widget should grab focus when it is clicked with the mouse.
171    ///
172    /// This property is only relevant for widgets that can take focus.
173    ///
174    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
175    /// GtkComboBox) implemented this property individually.
176    ///
177    /// Readable | Writable
178    ///
179    ///
180    /// #### `halign`
181    ///  How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
182    ///
183    /// Readable | Writable
184    ///
185    ///
186    /// #### `has-default`
187    ///  Readable | Writable
188    ///
189    ///
190    /// #### `has-focus`
191    ///  Readable | Writable
192    ///
193    ///
194    /// #### `has-tooltip`
195    ///  Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
196    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
197    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
198    /// whether it will provide a tooltip or not.
199    ///
200    /// Note that setting this property to [`true`] for the first time will change
201    /// the event masks of the GdkWindows of this widget to include leave-notify
202    /// and motion-notify events. This cannot and will not be undone when the
203    /// property is set to [`false`] again.
204    ///
205    /// Readable | Writable
206    ///
207    ///
208    /// #### `height-request`
209    ///  Readable | Writable
210    ///
211    ///
212    /// #### `hexpand`
213    ///  Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
214    ///
215    /// Readable | Writable
216    ///
217    ///
218    /// #### `hexpand-set`
219    ///  Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
220    ///
221    /// Readable | Writable
222    ///
223    ///
224    /// #### `is-focus`
225    ///  Readable | Writable
226    ///
227    ///
228    /// #### `margin`
229    ///  Sets all four sides' margin at once. If read, returns max
230    /// margin on any side.
231    ///
232    /// Readable | Writable
233    ///
234    ///
235    /// #### `margin-bottom`
236    ///  Margin on bottom side of widget.
237    ///
238    /// This property adds margin outside of the widget's normal size
239    /// request, the margin will be added in addition to the size from
240    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
241    ///
242    /// Readable | Writable
243    ///
244    ///
245    /// #### `margin-end`
246    ///  Margin on end of widget, horizontally. This property supports
247    /// left-to-right and right-to-left text directions.
248    ///
249    /// This property adds margin outside of the widget's normal size
250    /// request, the margin will be added in addition to the size from
251    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
252    ///
253    /// Readable | Writable
254    ///
255    ///
256    /// #### `margin-left`
257    ///  Margin on left side of widget.
258    ///
259    /// This property adds margin outside of the widget's normal size
260    /// request, the margin will be added in addition to the size from
261    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
262    ///
263    /// Readable | Writable
264    ///
265    ///
266    /// #### `margin-right`
267    ///  Margin on right side of widget.
268    ///
269    /// This property adds margin outside of the widget's normal size
270    /// request, the margin will be added in addition to the size from
271    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
272    ///
273    /// Readable | Writable
274    ///
275    ///
276    /// #### `margin-start`
277    ///  Margin on start of widget, horizontally. This property supports
278    /// left-to-right and right-to-left text directions.
279    ///
280    /// This property adds margin outside of the widget's normal size
281    /// request, the margin will be added in addition to the size from
282    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
283    ///
284    /// Readable | Writable
285    ///
286    ///
287    /// #### `margin-top`
288    ///  Margin on top side of widget.
289    ///
290    /// This property adds margin outside of the widget's normal size
291    /// request, the margin will be added in addition to the size from
292    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
293    ///
294    /// Readable | Writable
295    ///
296    ///
297    /// #### `name`
298    ///  Readable | Writable
299    ///
300    ///
301    /// #### `no-show-all`
302    ///  Readable | Writable
303    ///
304    ///
305    /// #### `opacity`
306    ///  The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
307    /// more details about window opacity.
308    ///
309    /// Before 3.8 this was only available in GtkWindow
310    ///
311    /// Readable | Writable
312    ///
313    ///
314    /// #### `parent`
315    ///  Readable | Writable
316    ///
317    ///
318    /// #### `receives-default`
319    ///  Readable | Writable
320    ///
321    ///
322    /// #### `scale-factor`
323    ///  The scale factor of the widget. See [`WidgetExt::scale_factor()`][crate::prelude::WidgetExt::scale_factor()] for
324    /// more details about widget scaling.
325    ///
326    /// Readable
327    ///
328    ///
329    /// #### `sensitive`
330    ///  Readable | Writable
331    ///
332    ///
333    /// #### `style`
334    ///  The style of the widget, which contains information about how it will look (colors, etc).
335    ///
336    /// Readable | Writable
337    ///
338    ///
339    /// #### `tooltip-markup`
340    ///  Sets the text of tooltip to be the given string, which is marked up
341    /// with the [Pango text markup language][PangoMarkupFormat].
342    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
343    ///
344    /// This is a convenience property which will take care of getting the
345    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
346    /// will automatically be set to [`true`] and there will be taken care of
347    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
348    ///
349    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
350    /// are set, the last one wins.
351    ///
352    /// Readable | Writable
353    ///
354    ///
355    /// #### `tooltip-text`
356    ///  Sets the text of tooltip to be the given string.
357    ///
358    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
359    ///
360    /// This is a convenience property which will take care of getting the
361    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
362    /// will automatically be set to [`true`] and there will be taken care of
363    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
364    ///
365    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
366    /// are set, the last one wins.
367    ///
368    /// Readable | Writable
369    ///
370    ///
371    /// #### `valign`
372    ///  How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
373    ///
374    /// Readable | Writable
375    ///
376    ///
377    /// #### `vexpand`
378    ///  Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
379    ///
380    /// Readable | Writable
381    ///
382    ///
383    /// #### `vexpand-set`
384    ///  Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
385    ///
386    /// Readable | Writable
387    ///
388    ///
389    /// #### `visible`
390    ///  Readable | Writable
391    ///
392    ///
393    /// #### `width-request`
394    ///  Readable | Writable
395    ///
396    ///
397    /// #### `window`
398    ///  The widget's window if it is realized, [`None`] otherwise.
399    ///
400    /// Readable
401    /// </details>
402    /// <details><summary><h4>Orientable</h4></summary>
403    ///
404    ///
405    /// #### `orientation`
406    ///  The orientation of the orientable.
407    ///
408    /// Readable | Writable
409    /// </details>
410    /// <details><summary><h4>Scrollable</h4></summary>
411    ///
412    ///
413    /// #### `hadjustment`
414    ///  Horizontal [`Adjustment`][crate::Adjustment] of the scrollable widget. This adjustment is
415    /// shared between the scrollable widget and its parent.
416    ///
417    /// Readable | Writable | Construct
418    ///
419    ///
420    /// #### `hscroll-policy`
421    ///  Determines whether horizontal scrolling should start once the scrollable
422    /// widget is allocated less than its minimum width or less than its natural width.
423    ///
424    /// Readable | Writable
425    ///
426    ///
427    /// #### `vadjustment`
428    ///  Verical [`Adjustment`][crate::Adjustment] of the scrollable widget. This adjustment is shared
429    /// between the scrollable widget and its parent.
430    ///
431    /// Readable | Writable | Construct
432    ///
433    ///
434    /// #### `vscroll-policy`
435    ///  Determines whether vertical scrolling should start once the scrollable
436    /// widget is allocated less than its minimum height or less than its natural height.
437    ///
438    /// Readable | Writable
439    /// </details>
440    ///
441    /// # Implements
442    ///
443    /// [`ToolPaletteExt`][trait@crate::prelude::ToolPaletteExt], [`ContainerExt`][trait@crate::prelude::ContainerExt], [`WidgetExt`][trait@crate::prelude::WidgetExt], [`trait@glib::ObjectExt`], [`BuildableExt`][trait@crate::prelude::BuildableExt], [`OrientableExt`][trait@crate::prelude::OrientableExt], [`ScrollableExt`][trait@crate::prelude::ScrollableExt], [`ContainerExtManual`][trait@crate::prelude::ContainerExtManual], [`WidgetExtManual`][trait@crate::prelude::WidgetExtManual], [`BuildableExtManual`][trait@crate::prelude::BuildableExtManual]
444    #[doc(alias = "GtkToolPalette")]
445    pub struct ToolPalette(Object<ffi::GtkToolPalette, ffi::GtkToolPaletteClass>) @extends Container, Widget, @implements Buildable, Orientable, Scrollable;
446
447    match fn {
448        type_ => || ffi::gtk_tool_palette_get_type(),
449    }
450}
451
452impl ToolPalette {
453    pub const NONE: Option<&'static ToolPalette> = None;
454
455    /// Creates a new tool palette.
456    ///
457    /// # Returns
458    ///
459    /// a new [`ToolPalette`][crate::ToolPalette]
460    #[doc(alias = "gtk_tool_palette_new")]
461    pub fn new() -> ToolPalette {
462        assert_initialized_main_thread!();
463        unsafe { Widget::from_glib_none(ffi::gtk_tool_palette_new()).unsafe_cast() }
464    }
465
466    // rustdoc-stripper-ignore-next
467    /// Creates a new builder-pattern struct instance to construct [`ToolPalette`] objects.
468    ///
469    /// This method returns an instance of [`ToolPaletteBuilder`](crate::builders::ToolPaletteBuilder) which can be used to create [`ToolPalette`] objects.
470    pub fn builder() -> ToolPaletteBuilder {
471        ToolPaletteBuilder::new()
472    }
473
474    /// Get the target entry for a dragged [`ToolItemGroup`][crate::ToolItemGroup].
475    ///
476    /// # Returns
477    ///
478    /// the [`TargetEntry`][crate::TargetEntry] for a dragged group
479    #[doc(alias = "gtk_tool_palette_get_drag_target_group")]
480    #[doc(alias = "get_drag_target_group")]
481    pub fn drag_target_group() -> Option<TargetEntry> {
482        assert_initialized_main_thread!();
483        unsafe { from_glib_none(ffi::gtk_tool_palette_get_drag_target_group()) }
484    }
485
486    /// Gets the target entry for a dragged [`ToolItem`][crate::ToolItem].
487    ///
488    /// # Returns
489    ///
490    /// the [`TargetEntry`][crate::TargetEntry] for a dragged item.
491    #[doc(alias = "gtk_tool_palette_get_drag_target_item")]
492    #[doc(alias = "get_drag_target_item")]
493    pub fn drag_target_item() -> Option<TargetEntry> {
494        assert_initialized_main_thread!();
495        unsafe { from_glib_none(ffi::gtk_tool_palette_get_drag_target_item()) }
496    }
497}
498
499impl Default for ToolPalette {
500    fn default() -> Self {
501        Self::new()
502    }
503}
504
505// rustdoc-stripper-ignore-next
506/// A [builder-pattern] type to construct [`ToolPalette`] objects.
507///
508/// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
509#[must_use = "The builder must be built to be used"]
510pub struct ToolPaletteBuilder {
511    builder: glib::object::ObjectBuilder<'static, ToolPalette>,
512}
513
514impl ToolPaletteBuilder {
515    fn new() -> Self {
516        Self {
517            builder: glib::object::Object::builder(),
518        }
519    }
520
521    /// The size of the icons in a tool palette. When this property is set,
522    /// it overrides the default setting.
523    ///
524    /// This should only be used for special-purpose tool palettes, normal
525    /// application tool palettes should respect the user preferences for the
526    /// size of icons.
527    pub fn icon_size(self, icon_size: IconSize) -> Self {
528        Self {
529            builder: self.builder.property("icon-size", icon_size),
530        }
531    }
532
533    /// Is [`true`] if the [`icon-size`][struct@crate::ToolPalette#icon-size] property has been set.
534    pub fn icon_size_set(self, icon_size_set: bool) -> Self {
535        Self {
536            builder: self.builder.property("icon-size-set", icon_size_set),
537        }
538    }
539
540    /// The style of items in the tool palette.
541    pub fn toolbar_style(self, toolbar_style: ToolbarStyle) -> Self {
542        Self {
543            builder: self.builder.property("toolbar-style", toolbar_style),
544        }
545    }
546
547    pub fn border_width(self, border_width: u32) -> Self {
548        Self {
549            builder: self.builder.property("border-width", border_width),
550        }
551    }
552
553    pub fn child(self, child: &impl IsA<Widget>) -> Self {
554        Self {
555            builder: self.builder.property("child", child.clone().upcast()),
556        }
557    }
558
559    pub fn resize_mode(self, resize_mode: ResizeMode) -> Self {
560        Self {
561            builder: self.builder.property("resize-mode", resize_mode),
562        }
563    }
564
565    pub fn app_paintable(self, app_paintable: bool) -> Self {
566        Self {
567            builder: self.builder.property("app-paintable", app_paintable),
568        }
569    }
570
571    pub fn can_default(self, can_default: bool) -> Self {
572        Self {
573            builder: self.builder.property("can-default", can_default),
574        }
575    }
576
577    pub fn can_focus(self, can_focus: bool) -> Self {
578        Self {
579            builder: self.builder.property("can-focus", can_focus),
580        }
581    }
582
583    pub fn events(self, events: gdk::EventMask) -> Self {
584        Self {
585            builder: self.builder.property("events", events),
586        }
587    }
588
589    /// Whether to expand in both directions. Setting this sets both [`hexpand`][struct@crate::Widget#hexpand] and [`vexpand`][struct@crate::Widget#vexpand]
590    pub fn expand(self, expand: bool) -> Self {
591        Self {
592            builder: self.builder.property("expand", expand),
593        }
594    }
595
596    /// Whether the widget should grab focus when it is clicked with the mouse.
597    ///
598    /// This property is only relevant for widgets that can take focus.
599    ///
600    /// Before 3.20, several widgets (GtkButton, GtkFileChooserButton,
601    /// GtkComboBox) implemented this property individually.
602    pub fn focus_on_click(self, focus_on_click: bool) -> Self {
603        Self {
604            builder: self.builder.property("focus-on-click", focus_on_click),
605        }
606    }
607
608    /// How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
609    pub fn halign(self, halign: Align) -> Self {
610        Self {
611            builder: self.builder.property("halign", halign),
612        }
613    }
614
615    pub fn has_default(self, has_default: bool) -> Self {
616        Self {
617            builder: self.builder.property("has-default", has_default),
618        }
619    }
620
621    pub fn has_focus(self, has_focus: bool) -> Self {
622        Self {
623            builder: self.builder.property("has-focus", has_focus),
624        }
625    }
626
627    /// Enables or disables the emission of [`query-tooltip`][struct@crate::Widget#query-tooltip] on `widget`.
628    /// A value of [`true`] indicates that `widget` can have a tooltip, in this case
629    /// the widget will be queried using [`query-tooltip`][struct@crate::Widget#query-tooltip] to determine
630    /// whether it will provide a tooltip or not.
631    ///
632    /// Note that setting this property to [`true`] for the first time will change
633    /// the event masks of the GdkWindows of this widget to include leave-notify
634    /// and motion-notify events. This cannot and will not be undone when the
635    /// property is set to [`false`] again.
636    pub fn has_tooltip(self, has_tooltip: bool) -> Self {
637        Self {
638            builder: self.builder.property("has-tooltip", has_tooltip),
639        }
640    }
641
642    pub fn height_request(self, height_request: i32) -> Self {
643        Self {
644            builder: self.builder.property("height-request", height_request),
645        }
646    }
647
648    /// Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
649    pub fn hexpand(self, hexpand: bool) -> Self {
650        Self {
651            builder: self.builder.property("hexpand", hexpand),
652        }
653    }
654
655    /// Whether to use the [`hexpand`][struct@crate::Widget#hexpand] property. See [`WidgetExt::is_hexpand_set()`][crate::prelude::WidgetExt::is_hexpand_set()].
656    pub fn hexpand_set(self, hexpand_set: bool) -> Self {
657        Self {
658            builder: self.builder.property("hexpand-set", hexpand_set),
659        }
660    }
661
662    pub fn is_focus(self, is_focus: bool) -> Self {
663        Self {
664            builder: self.builder.property("is-focus", is_focus),
665        }
666    }
667
668    /// Sets all four sides' margin at once. If read, returns max
669    /// margin on any side.
670    pub fn margin(self, margin: i32) -> Self {
671        Self {
672            builder: self.builder.property("margin", margin),
673        }
674    }
675
676    /// Margin on bottom side of widget.
677    ///
678    /// This property adds margin outside of the widget's normal size
679    /// request, the margin will be added in addition to the size from
680    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
681    pub fn margin_bottom(self, margin_bottom: i32) -> Self {
682        Self {
683            builder: self.builder.property("margin-bottom", margin_bottom),
684        }
685    }
686
687    /// Margin on end of widget, horizontally. This property supports
688    /// left-to-right and right-to-left text directions.
689    ///
690    /// This property adds margin outside of the widget's normal size
691    /// request, the margin will be added in addition to the size from
692    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
693    pub fn margin_end(self, margin_end: i32) -> Self {
694        Self {
695            builder: self.builder.property("margin-end", margin_end),
696        }
697    }
698
699    /// Margin on start of widget, horizontally. This property supports
700    /// left-to-right and right-to-left text directions.
701    ///
702    /// This property adds margin outside of the widget's normal size
703    /// request, the margin will be added in addition to the size from
704    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
705    pub fn margin_start(self, margin_start: i32) -> Self {
706        Self {
707            builder: self.builder.property("margin-start", margin_start),
708        }
709    }
710
711    /// Margin on top side of widget.
712    ///
713    /// This property adds margin outside of the widget's normal size
714    /// request, the margin will be added in addition to the size from
715    /// [`WidgetExt::set_size_request()`][crate::prelude::WidgetExt::set_size_request()] for example.
716    pub fn margin_top(self, margin_top: i32) -> Self {
717        Self {
718            builder: self.builder.property("margin-top", margin_top),
719        }
720    }
721
722    pub fn name(self, name: impl Into<glib::GString>) -> Self {
723        Self {
724            builder: self.builder.property("name", name.into()),
725        }
726    }
727
728    pub fn no_show_all(self, no_show_all: bool) -> Self {
729        Self {
730            builder: self.builder.property("no-show-all", no_show_all),
731        }
732    }
733
734    /// The requested opacity of the widget. See [`WidgetExt::set_opacity()`][crate::prelude::WidgetExt::set_opacity()] for
735    /// more details about window opacity.
736    ///
737    /// Before 3.8 this was only available in GtkWindow
738    pub fn opacity(self, opacity: f64) -> Self {
739        Self {
740            builder: self.builder.property("opacity", opacity),
741        }
742    }
743
744    pub fn parent(self, parent: &impl IsA<Container>) -> Self {
745        Self {
746            builder: self.builder.property("parent", parent.clone().upcast()),
747        }
748    }
749
750    pub fn receives_default(self, receives_default: bool) -> Self {
751        Self {
752            builder: self.builder.property("receives-default", receives_default),
753        }
754    }
755
756    pub fn sensitive(self, sensitive: bool) -> Self {
757        Self {
758            builder: self.builder.property("sensitive", sensitive),
759        }
760    }
761
762    /// Sets the text of tooltip to be the given string, which is marked up
763    /// with the [Pango text markup language][PangoMarkupFormat].
764    /// Also see [`Tooltip::set_markup()`][crate::Tooltip::set_markup()].
765    ///
766    /// This is a convenience property which will take care of getting the
767    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
768    /// will automatically be set to [`true`] and there will be taken care of
769    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
770    ///
771    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
772    /// are set, the last one wins.
773    pub fn tooltip_markup(self, tooltip_markup: impl Into<glib::GString>) -> Self {
774        Self {
775            builder: self
776                .builder
777                .property("tooltip-markup", tooltip_markup.into()),
778        }
779    }
780
781    /// Sets the text of tooltip to be the given string.
782    ///
783    /// Also see [`Tooltip::set_text()`][crate::Tooltip::set_text()].
784    ///
785    /// This is a convenience property which will take care of getting the
786    /// tooltip shown if the given string is not [`None`]: [`has-tooltip`][struct@crate::Widget#has-tooltip]
787    /// will automatically be set to [`true`] and there will be taken care of
788    /// [`query-tooltip`][struct@crate::Widget#query-tooltip] in the default signal handler.
789    ///
790    /// Note that if both [`tooltip-text`][struct@crate::Widget#tooltip-text] and [`tooltip-markup`][struct@crate::Widget#tooltip-markup]
791    /// are set, the last one wins.
792    pub fn tooltip_text(self, tooltip_text: impl Into<glib::GString>) -> Self {
793        Self {
794            builder: self.builder.property("tooltip-text", tooltip_text.into()),
795        }
796    }
797
798    /// How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
799    pub fn valign(self, valign: Align) -> Self {
800        Self {
801            builder: self.builder.property("valign", valign),
802        }
803    }
804
805    /// Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
806    pub fn vexpand(self, vexpand: bool) -> Self {
807        Self {
808            builder: self.builder.property("vexpand", vexpand),
809        }
810    }
811
812    /// Whether to use the [`vexpand`][struct@crate::Widget#vexpand] property. See [`WidgetExt::is_vexpand_set()`][crate::prelude::WidgetExt::is_vexpand_set()].
813    pub fn vexpand_set(self, vexpand_set: bool) -> Self {
814        Self {
815            builder: self.builder.property("vexpand-set", vexpand_set),
816        }
817    }
818
819    pub fn visible(self, visible: bool) -> Self {
820        Self {
821            builder: self.builder.property("visible", visible),
822        }
823    }
824
825    pub fn width_request(self, width_request: i32) -> Self {
826        Self {
827            builder: self.builder.property("width-request", width_request),
828        }
829    }
830
831    /// The orientation of the orientable.
832    pub fn orientation(self, orientation: Orientation) -> Self {
833        Self {
834            builder: self.builder.property("orientation", orientation),
835        }
836    }
837
838    /// Horizontal [`Adjustment`][crate::Adjustment] of the scrollable widget. This adjustment is
839    /// shared between the scrollable widget and its parent.
840    pub fn hadjustment(self, hadjustment: &impl IsA<Adjustment>) -> Self {
841        Self {
842            builder: self
843                .builder
844                .property("hadjustment", hadjustment.clone().upcast()),
845        }
846    }
847
848    /// Determines whether horizontal scrolling should start once the scrollable
849    /// widget is allocated less than its minimum width or less than its natural width.
850    pub fn hscroll_policy(self, hscroll_policy: ScrollablePolicy) -> Self {
851        Self {
852            builder: self.builder.property("hscroll-policy", hscroll_policy),
853        }
854    }
855
856    /// Verical [`Adjustment`][crate::Adjustment] of the scrollable widget. This adjustment is shared
857    /// between the scrollable widget and its parent.
858    pub fn vadjustment(self, vadjustment: &impl IsA<Adjustment>) -> Self {
859        Self {
860            builder: self
861                .builder
862                .property("vadjustment", vadjustment.clone().upcast()),
863        }
864    }
865
866    /// Determines whether vertical scrolling should start once the scrollable
867    /// widget is allocated less than its minimum height or less than its natural height.
868    pub fn vscroll_policy(self, vscroll_policy: ScrollablePolicy) -> Self {
869        Self {
870            builder: self.builder.property("vscroll-policy", vscroll_policy),
871        }
872    }
873
874    // rustdoc-stripper-ignore-next
875    /// Build the [`ToolPalette`].
876    #[must_use = "Building the object from the builder is usually expensive and is not expected to have side effects"]
877    pub fn build(self) -> ToolPalette {
878        assert_initialized_main_thread!();
879        self.builder.build()
880    }
881}
882
883/// Trait containing all [`struct@ToolPalette`] methods.
884///
885/// # Implementors
886///
887/// [`ToolPalette`][struct@crate::ToolPalette]
888pub trait ToolPaletteExt: IsA<ToolPalette> + 'static {
889    /// Sets `self` as drag source (see [`set_drag_source()`][Self::set_drag_source()])
890    /// and sets `widget` as a drag destination for drags from `self`.
891    /// See [`WidgetExtManual::drag_dest_set()`][crate::prelude::WidgetExtManual::drag_dest_set()].
892    /// ## `widget`
893    /// a [`Widget`][crate::Widget] which should be a drag destination for `self`
894    /// ## `flags`
895    /// the flags that specify what actions GTK+ should take for drops
896    ///  on that widget
897    /// ## `targets`
898    /// the [`ToolPaletteDragTargets`][crate::ToolPaletteDragTargets] which the widget
899    ///  should support
900    /// ## `actions`
901    /// the `GdkDragActions` which the widget should suppport
902    #[doc(alias = "gtk_tool_palette_add_drag_dest")]
903    fn add_drag_dest(
904        &self,
905        widget: &impl IsA<Widget>,
906        flags: DestDefaults,
907        targets: ToolPaletteDragTargets,
908        actions: gdk::DragAction,
909    ) {
910        unsafe {
911            ffi::gtk_tool_palette_add_drag_dest(
912                self.as_ref().to_glib_none().0,
913                widget.as_ref().to_glib_none().0,
914                flags.into_glib(),
915                targets.into_glib(),
916                actions.into_glib(),
917            );
918        }
919    }
920
921    /// Get the dragged item from the selection.
922    /// This could be a [`ToolItem`][crate::ToolItem] or a [`ToolItemGroup`][crate::ToolItemGroup].
923    /// ## `selection`
924    /// a [`SelectionData`][crate::SelectionData]
925    ///
926    /// # Returns
927    ///
928    /// the dragged item in selection
929    #[doc(alias = "gtk_tool_palette_get_drag_item")]
930    #[doc(alias = "get_drag_item")]
931    fn drag_item(&self, selection: &SelectionData) -> Option<Widget> {
932        unsafe {
933            from_glib_none(ffi::gtk_tool_palette_get_drag_item(
934                self.as_ref().to_glib_none().0,
935                selection.to_glib_none().0,
936            ))
937        }
938    }
939
940    /// Gets the group at position (x, y).
941    /// ## `x`
942    /// the x position
943    /// ## `y`
944    /// the y position
945    ///
946    /// # Returns
947    ///
948    /// the [`ToolItemGroup`][crate::ToolItemGroup] at position
949    /// or [`None`] if there is no such group
950    #[doc(alias = "gtk_tool_palette_get_drop_group")]
951    #[doc(alias = "get_drop_group")]
952    fn drop_group(&self, x: i32, y: i32) -> Option<ToolItemGroup> {
953        unsafe {
954            from_glib_none(ffi::gtk_tool_palette_get_drop_group(
955                self.as_ref().to_glib_none().0,
956                x,
957                y,
958            ))
959        }
960    }
961
962    /// Gets the item at position (x, y).
963    /// See [`drop_group()`][Self::drop_group()].
964    /// ## `x`
965    /// the x position
966    /// ## `y`
967    /// the y position
968    ///
969    /// # Returns
970    ///
971    /// the [`ToolItem`][crate::ToolItem] at position or [`None`] if there is no such item
972    #[doc(alias = "gtk_tool_palette_get_drop_item")]
973    #[doc(alias = "get_drop_item")]
974    fn drop_item(&self, x: i32, y: i32) -> Option<ToolItem> {
975        unsafe {
976            from_glib_none(ffi::gtk_tool_palette_get_drop_item(
977                self.as_ref().to_glib_none().0,
978                x,
979                y,
980            ))
981        }
982    }
983
984    /// Gets whether `group` is exclusive or not.
985    /// See [`set_exclusive()`][Self::set_exclusive()].
986    /// ## `group`
987    /// a [`ToolItemGroup`][crate::ToolItemGroup] which is a child of palette
988    ///
989    /// # Returns
990    ///
991    /// [`true`] if `group` is exclusive
992    #[doc(alias = "gtk_tool_palette_get_exclusive")]
993    #[doc(alias = "get_exclusive")]
994    fn is_exclusive(&self, group: &impl IsA<ToolItemGroup>) -> bool {
995        unsafe {
996            from_glib(ffi::gtk_tool_palette_get_exclusive(
997                self.as_ref().to_glib_none().0,
998                group.as_ref().to_glib_none().0,
999            ))
1000        }
1001    }
1002
1003    /// Gets whether group should be given extra space.
1004    /// See [`set_expand()`][Self::set_expand()].
1005    /// ## `group`
1006    /// a [`ToolItemGroup`][crate::ToolItemGroup] which is a child of palette
1007    ///
1008    /// # Returns
1009    ///
1010    /// [`true`] if group should be given extra space, [`false`] otherwise
1011    #[doc(alias = "gtk_tool_palette_get_expand")]
1012    #[doc(alias = "get_expand")]
1013    fn expands(&self, group: &impl IsA<ToolItemGroup>) -> bool {
1014        unsafe {
1015            from_glib(ffi::gtk_tool_palette_get_expand(
1016                self.as_ref().to_glib_none().0,
1017                group.as_ref().to_glib_none().0,
1018            ))
1019        }
1020    }
1021
1022    /// Gets the position of `group` in `self` as index.
1023    /// See [`set_group_position()`][Self::set_group_position()].
1024    /// ## `group`
1025    /// a [`ToolItemGroup`][crate::ToolItemGroup]
1026    ///
1027    /// # Returns
1028    ///
1029    /// the index of group or -1 if `group` is not a child of `self`
1030    #[doc(alias = "gtk_tool_palette_get_group_position")]
1031    #[doc(alias = "get_group_position")]
1032    fn group_position(&self, group: &impl IsA<ToolItemGroup>) -> i32 {
1033        unsafe {
1034            ffi::gtk_tool_palette_get_group_position(
1035                self.as_ref().to_glib_none().0,
1036                group.as_ref().to_glib_none().0,
1037            )
1038        }
1039    }
1040
1041    /// Gets the size of icons in the tool palette.
1042    /// See [`set_icon_size()`][Self::set_icon_size()].
1043    ///
1044    /// # Returns
1045    ///
1046    /// the [`IconSize`][crate::IconSize] of icons in the tool palette
1047    #[doc(alias = "gtk_tool_palette_get_icon_size")]
1048    #[doc(alias = "get_icon_size")]
1049    #[doc(alias = "icon-size")]
1050    fn icon_size(&self) -> IconSize {
1051        unsafe {
1052            from_glib(ffi::gtk_tool_palette_get_icon_size(
1053                self.as_ref().to_glib_none().0,
1054            ))
1055        }
1056    }
1057
1058    /// Gets the style (icons, text or both) of items in the tool palette.
1059    ///
1060    /// # Returns
1061    ///
1062    /// the [`ToolbarStyle`][crate::ToolbarStyle] of items in the tool palette.
1063    #[doc(alias = "gtk_tool_palette_get_style")]
1064    #[doc(alias = "get_style")]
1065    fn style(&self) -> ToolbarStyle {
1066        unsafe {
1067            from_glib(ffi::gtk_tool_palette_get_style(
1068                self.as_ref().to_glib_none().0,
1069            ))
1070        }
1071    }
1072
1073    /// Sets the tool palette as a drag source.
1074    /// Enables all groups and items in the tool palette as drag sources
1075    /// on button 1 and button 3 press with copy and move actions.
1076    /// See [`WidgetExtManual::drag_source_set()`][crate::prelude::WidgetExtManual::drag_source_set()].
1077    /// ## `targets`
1078    /// the [`ToolPaletteDragTargets`][crate::ToolPaletteDragTargets]
1079    ///  which the widget should support
1080    #[doc(alias = "gtk_tool_palette_set_drag_source")]
1081    fn set_drag_source(&self, targets: ToolPaletteDragTargets) {
1082        unsafe {
1083            ffi::gtk_tool_palette_set_drag_source(
1084                self.as_ref().to_glib_none().0,
1085                targets.into_glib(),
1086            );
1087        }
1088    }
1089
1090    /// Sets whether the group should be exclusive or not.
1091    /// If an exclusive group is expanded all other groups are collapsed.
1092    /// ## `group`
1093    /// a [`ToolItemGroup`][crate::ToolItemGroup] which is a child of palette
1094    /// ## `exclusive`
1095    /// whether the group should be exclusive or not
1096    #[doc(alias = "gtk_tool_palette_set_exclusive")]
1097    fn set_exclusive(&self, group: &impl IsA<ToolItemGroup>, exclusive: bool) {
1098        unsafe {
1099            ffi::gtk_tool_palette_set_exclusive(
1100                self.as_ref().to_glib_none().0,
1101                group.as_ref().to_glib_none().0,
1102                exclusive.into_glib(),
1103            );
1104        }
1105    }
1106
1107    /// Sets whether the group should be given extra space.
1108    /// ## `group`
1109    /// a [`ToolItemGroup`][crate::ToolItemGroup] which is a child of palette
1110    /// ## `expand`
1111    /// whether the group should be given extra space
1112    #[doc(alias = "gtk_tool_palette_set_expand")]
1113    fn set_expand(&self, group: &impl IsA<ToolItemGroup>, expand: bool) {
1114        unsafe {
1115            ffi::gtk_tool_palette_set_expand(
1116                self.as_ref().to_glib_none().0,
1117                group.as_ref().to_glib_none().0,
1118                expand.into_glib(),
1119            );
1120        }
1121    }
1122
1123    /// Sets the position of the group as an index of the tool palette.
1124    /// If position is 0 the group will become the first child, if position is
1125    /// -1 it will become the last child.
1126    /// ## `group`
1127    /// a [`ToolItemGroup`][crate::ToolItemGroup] which is a child of palette
1128    /// ## `position`
1129    /// a new index for group
1130    #[doc(alias = "gtk_tool_palette_set_group_position")]
1131    fn set_group_position(&self, group: &impl IsA<ToolItemGroup>, position: i32) {
1132        unsafe {
1133            ffi::gtk_tool_palette_set_group_position(
1134                self.as_ref().to_glib_none().0,
1135                group.as_ref().to_glib_none().0,
1136                position,
1137            );
1138        }
1139    }
1140
1141    /// Sets the size of icons in the tool palette.
1142    /// ## `icon_size`
1143    /// the [`IconSize`][crate::IconSize] that icons in the tool
1144    ///  palette shall have
1145    #[doc(alias = "gtk_tool_palette_set_icon_size")]
1146    #[doc(alias = "icon-size")]
1147    fn set_icon_size(&self, icon_size: IconSize) {
1148        unsafe {
1149            ffi::gtk_tool_palette_set_icon_size(
1150                self.as_ref().to_glib_none().0,
1151                icon_size.into_glib(),
1152            );
1153        }
1154    }
1155
1156    /// Sets the style (text, icons or both) of items in the tool palette.
1157    /// ## `style`
1158    /// the [`ToolbarStyle`][crate::ToolbarStyle] that items in the tool palette shall have
1159    #[doc(alias = "gtk_tool_palette_set_style")]
1160    fn set_style(&self, style: ToolbarStyle) {
1161        unsafe {
1162            ffi::gtk_tool_palette_set_style(self.as_ref().to_glib_none().0, style.into_glib());
1163        }
1164    }
1165
1166    /// Unsets the tool palette icon size set with [`set_icon_size()`][Self::set_icon_size()],
1167    /// so that user preferences will be used to determine the icon size.
1168    #[doc(alias = "gtk_tool_palette_unset_icon_size")]
1169    fn unset_icon_size(&self) {
1170        unsafe {
1171            ffi::gtk_tool_palette_unset_icon_size(self.as_ref().to_glib_none().0);
1172        }
1173    }
1174
1175    /// Unsets a toolbar style set with [`set_style()`][Self::set_style()],
1176    /// so that user preferences will be used to determine the toolbar style.
1177    #[doc(alias = "gtk_tool_palette_unset_style")]
1178    fn unset_style(&self) {
1179        unsafe {
1180            ffi::gtk_tool_palette_unset_style(self.as_ref().to_glib_none().0);
1181        }
1182    }
1183
1184    /// Is [`true`] if the [`icon-size`][struct@crate::ToolPalette#icon-size] property has been set.
1185    #[doc(alias = "icon-size-set")]
1186    fn is_icon_size_set(&self) -> bool {
1187        ObjectExt::property(self.as_ref(), "icon-size-set")
1188    }
1189
1190    /// Is [`true`] if the [`icon-size`][struct@crate::ToolPalette#icon-size] property has been set.
1191    #[doc(alias = "icon-size-set")]
1192    fn set_icon_size_set(&self, icon_size_set: bool) {
1193        ObjectExt::set_property(self.as_ref(), "icon-size-set", icon_size_set)
1194    }
1195
1196    /// The style of items in the tool palette.
1197    #[doc(alias = "toolbar-style")]
1198    fn toolbar_style(&self) -> ToolbarStyle {
1199        ObjectExt::property(self.as_ref(), "toolbar-style")
1200    }
1201
1202    /// The style of items in the tool palette.
1203    #[doc(alias = "toolbar-style")]
1204    fn set_toolbar_style(&self, toolbar_style: ToolbarStyle) {
1205        ObjectExt::set_property(self.as_ref(), "toolbar-style", toolbar_style)
1206    }
1207
1208    #[doc(alias = "icon-size")]
1209    fn connect_icon_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1210        unsafe extern "C" fn notify_icon_size_trampoline<
1211            P: IsA<ToolPalette>,
1212            F: Fn(&P) + 'static,
1213        >(
1214            this: *mut ffi::GtkToolPalette,
1215            _param_spec: glib::ffi::gpointer,
1216            f: glib::ffi::gpointer,
1217        ) {
1218            unsafe {
1219                let f: &F = &*(f as *const F);
1220                f(ToolPalette::from_glib_borrow(this).unsafe_cast_ref())
1221            }
1222        }
1223        unsafe {
1224            let f: Box_<F> = Box_::new(f);
1225            connect_raw(
1226                self.as_ptr() as *mut _,
1227                c"notify::icon-size".as_ptr(),
1228                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1229                    notify_icon_size_trampoline::<Self, F> as *const (),
1230                )),
1231                Box_::into_raw(f),
1232            )
1233        }
1234    }
1235
1236    #[doc(alias = "icon-size-set")]
1237    fn connect_icon_size_set_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1238        unsafe extern "C" fn notify_icon_size_set_trampoline<
1239            P: IsA<ToolPalette>,
1240            F: Fn(&P) + 'static,
1241        >(
1242            this: *mut ffi::GtkToolPalette,
1243            _param_spec: glib::ffi::gpointer,
1244            f: glib::ffi::gpointer,
1245        ) {
1246            unsafe {
1247                let f: &F = &*(f as *const F);
1248                f(ToolPalette::from_glib_borrow(this).unsafe_cast_ref())
1249            }
1250        }
1251        unsafe {
1252            let f: Box_<F> = Box_::new(f);
1253            connect_raw(
1254                self.as_ptr() as *mut _,
1255                c"notify::icon-size-set".as_ptr(),
1256                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1257                    notify_icon_size_set_trampoline::<Self, F> as *const (),
1258                )),
1259                Box_::into_raw(f),
1260            )
1261        }
1262    }
1263
1264    #[doc(alias = "toolbar-style")]
1265    fn connect_toolbar_style_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1266        unsafe extern "C" fn notify_toolbar_style_trampoline<
1267            P: IsA<ToolPalette>,
1268            F: Fn(&P) + 'static,
1269        >(
1270            this: *mut ffi::GtkToolPalette,
1271            _param_spec: glib::ffi::gpointer,
1272            f: glib::ffi::gpointer,
1273        ) {
1274            unsafe {
1275                let f: &F = &*(f as *const F);
1276                f(ToolPalette::from_glib_borrow(this).unsafe_cast_ref())
1277            }
1278        }
1279        unsafe {
1280            let f: Box_<F> = Box_::new(f);
1281            connect_raw(
1282                self.as_ptr() as *mut _,
1283                c"notify::toolbar-style".as_ptr(),
1284                Some(std::mem::transmute::<*const (), unsafe extern "C" fn()>(
1285                    notify_toolbar_style_trampoline::<Self, F> as *const (),
1286                )),
1287                Box_::into_raw(f),
1288            )
1289        }
1290    }
1291}
1292
1293impl<O: IsA<ToolPalette>> ToolPaletteExt for O {}