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,
9};
10use glib::{
11    prelude::*,
12    signal::{connect_raw, SignalHandlerId},
13    translate::*,
14};
15use std::{boxed::Box as Box_, fmt, mem::transmute};
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 | Writeable
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 | Writeable
114    ///
115    ///
116    /// #### `toolbar-style`
117    ///  The style of items in the tool palette.
118    ///
119    /// Readable | Writeable
120    /// <details><summary><h4>Container</h4></summary>
121    ///
122    ///
123    /// #### `border-width`
124    ///  Readable | Writeable
125    ///
126    ///
127    /// #### `child`
128    ///  Writeable
129    ///
130    ///
131    /// #### `resize-mode`
132    ///  Readable | Writeable
133    /// </details>
134    /// <details><summary><h4>Widget</h4></summary>
135    ///
136    ///
137    /// #### `app-paintable`
138    ///  Readable | Writeable
139    ///
140    ///
141    /// #### `can-default`
142    ///  Readable | Writeable
143    ///
144    ///
145    /// #### `can-focus`
146    ///  Readable | Writeable
147    ///
148    ///
149    /// #### `composite-child`
150    ///  Readable
151    ///
152    ///
153    /// #### `double-buffered`
154    ///  Whether the widget is double buffered.
155    ///
156    /// Readable | Writeable
157    ///
158    ///
159    /// #### `events`
160    ///  Readable | Writeable
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 | Writeable
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 | Writeable
178    ///
179    ///
180    /// #### `halign`
181    ///  How to distribute horizontal space if widget gets extra space, see [`Align`][crate::Align]
182    ///
183    /// Readable | Writeable
184    ///
185    ///
186    /// #### `has-default`
187    ///  Readable | Writeable
188    ///
189    ///
190    /// #### `has-focus`
191    ///  Readable | Writeable
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 | Writeable
206    ///
207    ///
208    /// #### `height-request`
209    ///  Readable | Writeable
210    ///
211    ///
212    /// #### `hexpand`
213    ///  Whether to expand horizontally. See [`WidgetExt::set_hexpand()`][crate::prelude::WidgetExt::set_hexpand()].
214    ///
215    /// Readable | Writeable
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 | Writeable
222    ///
223    ///
224    /// #### `is-focus`
225    ///  Readable | Writeable
226    ///
227    ///
228    /// #### `margin`
229    ///  Sets all four sides' margin at once. If read, returns max
230    /// margin on any side.
231    ///
232    /// Readable | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
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 | Writeable
295    ///
296    ///
297    /// #### `name`
298    ///  Readable | Writeable
299    ///
300    ///
301    /// #### `no-show-all`
302    ///  Readable | Writeable
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 | Writeable
312    ///
313    ///
314    /// #### `parent`
315    ///  Readable | Writeable
316    ///
317    ///
318    /// #### `receives-default`
319    ///  Readable | Writeable
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 | Writeable
331    ///
332    ///
333    /// #### `style`
334    ///  The style of the widget, which contains information about how it will look (colors, etc).
335    ///
336    /// Readable | Writeable
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 | Writeable
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 | Writeable
369    ///
370    ///
371    /// #### `valign`
372    ///  How to distribute vertical space if widget gets extra space, see [`Align`][crate::Align]
373    ///
374    /// Readable | Writeable
375    ///
376    ///
377    /// #### `vexpand`
378    ///  Whether to expand vertically. See [`WidgetExt::set_vexpand()`][crate::prelude::WidgetExt::set_vexpand()].
379    ///
380    /// Readable | Writeable
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 | Writeable
387    ///
388    ///
389    /// #### `visible`
390    ///  Readable | Writeable
391    ///
392    ///
393    /// #### `width-request`
394    ///  Readable | Writeable
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 | Writeable
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 | Writeable | 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 | Writeable
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 | Writeable | 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 | Writeable
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        self.builder.build()
879    }
880}
881
882mod sealed {
883    pub trait Sealed {}
884    impl<T: super::IsA<super::ToolPalette>> Sealed for T {}
885}
886
887/// Trait containing all [`struct@ToolPalette`] methods.
888///
889/// # Implementors
890///
891/// [`ToolPalette`][struct@crate::ToolPalette]
892pub trait ToolPaletteExt: IsA<ToolPalette> + sealed::Sealed + 'static {
893    /// Sets `self` as drag source (see [`set_drag_source()`][Self::set_drag_source()])
894    /// and sets `widget` as a drag destination for drags from `self`.
895    /// See [`WidgetExtManual::drag_dest_set()`][crate::prelude::WidgetExtManual::drag_dest_set()].
896    /// ## `widget`
897    /// a [`Widget`][crate::Widget] which should be a drag destination for `self`
898    /// ## `flags`
899    /// the flags that specify what actions GTK+ should take for drops
900    ///  on that widget
901    /// ## `targets`
902    /// the [`ToolPaletteDragTargets`][crate::ToolPaletteDragTargets] which the widget
903    ///  should support
904    /// ## `actions`
905    /// the `GdkDragActions` which the widget should suppport
906    #[doc(alias = "gtk_tool_palette_add_drag_dest")]
907    fn add_drag_dest(
908        &self,
909        widget: &impl IsA<Widget>,
910        flags: DestDefaults,
911        targets: ToolPaletteDragTargets,
912        actions: gdk::DragAction,
913    ) {
914        unsafe {
915            ffi::gtk_tool_palette_add_drag_dest(
916                self.as_ref().to_glib_none().0,
917                widget.as_ref().to_glib_none().0,
918                flags.into_glib(),
919                targets.into_glib(),
920                actions.into_glib(),
921            );
922        }
923    }
924
925    /// Get the dragged item from the selection.
926    /// This could be a [`ToolItem`][crate::ToolItem] or a [`ToolItemGroup`][crate::ToolItemGroup].
927    /// ## `selection`
928    /// a [`SelectionData`][crate::SelectionData]
929    ///
930    /// # Returns
931    ///
932    /// the dragged item in selection
933    #[doc(alias = "gtk_tool_palette_get_drag_item")]
934    #[doc(alias = "get_drag_item")]
935    fn drag_item(&self, selection: &SelectionData) -> Option<Widget> {
936        unsafe {
937            from_glib_none(ffi::gtk_tool_palette_get_drag_item(
938                self.as_ref().to_glib_none().0,
939                selection.to_glib_none().0,
940            ))
941        }
942    }
943
944    /// Gets the group at position (x, y).
945    /// ## `x`
946    /// the x position
947    /// ## `y`
948    /// the y position
949    ///
950    /// # Returns
951    ///
952    /// the [`ToolItemGroup`][crate::ToolItemGroup] at position
953    /// or [`None`] if there is no such group
954    #[doc(alias = "gtk_tool_palette_get_drop_group")]
955    #[doc(alias = "get_drop_group")]
956    fn drop_group(&self, x: i32, y: i32) -> Option<ToolItemGroup> {
957        unsafe {
958            from_glib_none(ffi::gtk_tool_palette_get_drop_group(
959                self.as_ref().to_glib_none().0,
960                x,
961                y,
962            ))
963        }
964    }
965
966    /// Gets the item at position (x, y).
967    /// See [`drop_group()`][Self::drop_group()].
968    /// ## `x`
969    /// the x position
970    /// ## `y`
971    /// the y position
972    ///
973    /// # Returns
974    ///
975    /// the [`ToolItem`][crate::ToolItem] at position or [`None`] if there is no such item
976    #[doc(alias = "gtk_tool_palette_get_drop_item")]
977    #[doc(alias = "get_drop_item")]
978    fn drop_item(&self, x: i32, y: i32) -> Option<ToolItem> {
979        unsafe {
980            from_glib_none(ffi::gtk_tool_palette_get_drop_item(
981                self.as_ref().to_glib_none().0,
982                x,
983                y,
984            ))
985        }
986    }
987
988    /// Gets whether `group` is exclusive or not.
989    /// See [`set_exclusive()`][Self::set_exclusive()].
990    /// ## `group`
991    /// a [`ToolItemGroup`][crate::ToolItemGroup] which is a child of palette
992    ///
993    /// # Returns
994    ///
995    /// [`true`] if `group` is exclusive
996    #[doc(alias = "gtk_tool_palette_get_exclusive")]
997    #[doc(alias = "get_exclusive")]
998    fn is_exclusive(&self, group: &impl IsA<ToolItemGroup>) -> bool {
999        unsafe {
1000            from_glib(ffi::gtk_tool_palette_get_exclusive(
1001                self.as_ref().to_glib_none().0,
1002                group.as_ref().to_glib_none().0,
1003            ))
1004        }
1005    }
1006
1007    /// Gets whether group should be given extra space.
1008    /// See [`set_expand()`][Self::set_expand()].
1009    /// ## `group`
1010    /// a [`ToolItemGroup`][crate::ToolItemGroup] which is a child of palette
1011    ///
1012    /// # Returns
1013    ///
1014    /// [`true`] if group should be given extra space, [`false`] otherwise
1015    #[doc(alias = "gtk_tool_palette_get_expand")]
1016    #[doc(alias = "get_expand")]
1017    fn expands(&self, group: &impl IsA<ToolItemGroup>) -> bool {
1018        unsafe {
1019            from_glib(ffi::gtk_tool_palette_get_expand(
1020                self.as_ref().to_glib_none().0,
1021                group.as_ref().to_glib_none().0,
1022            ))
1023        }
1024    }
1025
1026    /// Gets the position of `group` in `self` as index.
1027    /// See [`set_group_position()`][Self::set_group_position()].
1028    /// ## `group`
1029    /// a [`ToolItemGroup`][crate::ToolItemGroup]
1030    ///
1031    /// # Returns
1032    ///
1033    /// the index of group or -1 if `group` is not a child of `self`
1034    #[doc(alias = "gtk_tool_palette_get_group_position")]
1035    #[doc(alias = "get_group_position")]
1036    fn group_position(&self, group: &impl IsA<ToolItemGroup>) -> i32 {
1037        unsafe {
1038            ffi::gtk_tool_palette_get_group_position(
1039                self.as_ref().to_glib_none().0,
1040                group.as_ref().to_glib_none().0,
1041            )
1042        }
1043    }
1044
1045    /// Gets the size of icons in the tool palette.
1046    /// See [`set_icon_size()`][Self::set_icon_size()].
1047    ///
1048    /// # Returns
1049    ///
1050    /// the [`IconSize`][crate::IconSize] of icons in the tool palette
1051    #[doc(alias = "gtk_tool_palette_get_icon_size")]
1052    #[doc(alias = "get_icon_size")]
1053    fn icon_size(&self) -> IconSize {
1054        unsafe {
1055            from_glib(ffi::gtk_tool_palette_get_icon_size(
1056                self.as_ref().to_glib_none().0,
1057            ))
1058        }
1059    }
1060
1061    /// Gets the style (icons, text or both) of items in the tool palette.
1062    ///
1063    /// # Returns
1064    ///
1065    /// the [`ToolbarStyle`][crate::ToolbarStyle] of items in the tool palette.
1066    #[doc(alias = "gtk_tool_palette_get_style")]
1067    #[doc(alias = "get_style")]
1068    fn style(&self) -> ToolbarStyle {
1069        unsafe {
1070            from_glib(ffi::gtk_tool_palette_get_style(
1071                self.as_ref().to_glib_none().0,
1072            ))
1073        }
1074    }
1075
1076    /// Sets the tool palette as a drag source.
1077    /// Enables all groups and items in the tool palette as drag sources
1078    /// on button 1 and button 3 press with copy and move actions.
1079    /// See [`WidgetExtManual::drag_source_set()`][crate::prelude::WidgetExtManual::drag_source_set()].
1080    /// ## `targets`
1081    /// the [`ToolPaletteDragTargets`][crate::ToolPaletteDragTargets]
1082    ///  which the widget should support
1083    #[doc(alias = "gtk_tool_palette_set_drag_source")]
1084    fn set_drag_source(&self, targets: ToolPaletteDragTargets) {
1085        unsafe {
1086            ffi::gtk_tool_palette_set_drag_source(
1087                self.as_ref().to_glib_none().0,
1088                targets.into_glib(),
1089            );
1090        }
1091    }
1092
1093    /// Sets whether the group should be exclusive or not.
1094    /// If an exclusive group is expanded all other groups are collapsed.
1095    /// ## `group`
1096    /// a [`ToolItemGroup`][crate::ToolItemGroup] which is a child of palette
1097    /// ## `exclusive`
1098    /// whether the group should be exclusive or not
1099    #[doc(alias = "gtk_tool_palette_set_exclusive")]
1100    fn set_exclusive(&self, group: &impl IsA<ToolItemGroup>, exclusive: bool) {
1101        unsafe {
1102            ffi::gtk_tool_palette_set_exclusive(
1103                self.as_ref().to_glib_none().0,
1104                group.as_ref().to_glib_none().0,
1105                exclusive.into_glib(),
1106            );
1107        }
1108    }
1109
1110    /// Sets whether the group should be given extra space.
1111    /// ## `group`
1112    /// a [`ToolItemGroup`][crate::ToolItemGroup] which is a child of palette
1113    /// ## `expand`
1114    /// whether the group should be given extra space
1115    #[doc(alias = "gtk_tool_palette_set_expand")]
1116    fn set_expand(&self, group: &impl IsA<ToolItemGroup>, expand: bool) {
1117        unsafe {
1118            ffi::gtk_tool_palette_set_expand(
1119                self.as_ref().to_glib_none().0,
1120                group.as_ref().to_glib_none().0,
1121                expand.into_glib(),
1122            );
1123        }
1124    }
1125
1126    /// Sets the position of the group as an index of the tool palette.
1127    /// If position is 0 the group will become the first child, if position is
1128    /// -1 it will become the last child.
1129    /// ## `group`
1130    /// a [`ToolItemGroup`][crate::ToolItemGroup] which is a child of palette
1131    /// ## `position`
1132    /// a new index for group
1133    #[doc(alias = "gtk_tool_palette_set_group_position")]
1134    fn set_group_position(&self, group: &impl IsA<ToolItemGroup>, position: i32) {
1135        unsafe {
1136            ffi::gtk_tool_palette_set_group_position(
1137                self.as_ref().to_glib_none().0,
1138                group.as_ref().to_glib_none().0,
1139                position,
1140            );
1141        }
1142    }
1143
1144    /// Sets the size of icons in the tool palette.
1145    /// ## `icon_size`
1146    /// the [`IconSize`][crate::IconSize] that icons in the tool
1147    ///  palette shall have
1148    #[doc(alias = "gtk_tool_palette_set_icon_size")]
1149    fn set_icon_size(&self, icon_size: IconSize) {
1150        unsafe {
1151            ffi::gtk_tool_palette_set_icon_size(
1152                self.as_ref().to_glib_none().0,
1153                icon_size.into_glib(),
1154            );
1155        }
1156    }
1157
1158    /// Sets the style (text, icons or both) of items in the tool palette.
1159    /// ## `style`
1160    /// the [`ToolbarStyle`][crate::ToolbarStyle] that items in the tool palette shall have
1161    #[doc(alias = "gtk_tool_palette_set_style")]
1162    fn set_style(&self, style: ToolbarStyle) {
1163        unsafe {
1164            ffi::gtk_tool_palette_set_style(self.as_ref().to_glib_none().0, style.into_glib());
1165        }
1166    }
1167
1168    /// Unsets the tool palette icon size set with [`set_icon_size()`][Self::set_icon_size()],
1169    /// so that user preferences will be used to determine the icon size.
1170    #[doc(alias = "gtk_tool_palette_unset_icon_size")]
1171    fn unset_icon_size(&self) {
1172        unsafe {
1173            ffi::gtk_tool_palette_unset_icon_size(self.as_ref().to_glib_none().0);
1174        }
1175    }
1176
1177    /// Unsets a toolbar style set with [`set_style()`][Self::set_style()],
1178    /// so that user preferences will be used to determine the toolbar style.
1179    #[doc(alias = "gtk_tool_palette_unset_style")]
1180    fn unset_style(&self) {
1181        unsafe {
1182            ffi::gtk_tool_palette_unset_style(self.as_ref().to_glib_none().0);
1183        }
1184    }
1185
1186    /// Is [`true`] if the [`icon-size`][struct@crate::ToolPalette#icon-size] property has been set.
1187    #[doc(alias = "icon-size-set")]
1188    fn is_icon_size_set(&self) -> bool {
1189        ObjectExt::property(self.as_ref(), "icon-size-set")
1190    }
1191
1192    /// Is [`true`] if the [`icon-size`][struct@crate::ToolPalette#icon-size] property has been set.
1193    #[doc(alias = "icon-size-set")]
1194    fn set_icon_size_set(&self, icon_size_set: bool) {
1195        ObjectExt::set_property(self.as_ref(), "icon-size-set", icon_size_set)
1196    }
1197
1198    /// The style of items in the tool palette.
1199    #[doc(alias = "toolbar-style")]
1200    fn toolbar_style(&self) -> ToolbarStyle {
1201        ObjectExt::property(self.as_ref(), "toolbar-style")
1202    }
1203
1204    /// The style of items in the tool palette.
1205    #[doc(alias = "toolbar-style")]
1206    fn set_toolbar_style(&self, toolbar_style: ToolbarStyle) {
1207        ObjectExt::set_property(self.as_ref(), "toolbar-style", toolbar_style)
1208    }
1209
1210    #[doc(alias = "icon-size")]
1211    fn connect_icon_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1212        unsafe extern "C" fn notify_icon_size_trampoline<
1213            P: IsA<ToolPalette>,
1214            F: Fn(&P) + 'static,
1215        >(
1216            this: *mut ffi::GtkToolPalette,
1217            _param_spec: glib::ffi::gpointer,
1218            f: glib::ffi::gpointer,
1219        ) {
1220            let f: &F = &*(f as *const F);
1221            f(ToolPalette::from_glib_borrow(this).unsafe_cast_ref())
1222        }
1223        unsafe {
1224            let f: Box_<F> = Box_::new(f);
1225            connect_raw(
1226                self.as_ptr() as *mut _,
1227                b"notify::icon-size\0".as_ptr() as *const _,
1228                Some(transmute::<_, 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            let f: &F = &*(f as *const F);
1247            f(ToolPalette::from_glib_borrow(this).unsafe_cast_ref())
1248        }
1249        unsafe {
1250            let f: Box_<F> = Box_::new(f);
1251            connect_raw(
1252                self.as_ptr() as *mut _,
1253                b"notify::icon-size-set\0".as_ptr() as *const _,
1254                Some(transmute::<_, unsafe extern "C" fn()>(
1255                    notify_icon_size_set_trampoline::<Self, F> as *const (),
1256                )),
1257                Box_::into_raw(f),
1258            )
1259        }
1260    }
1261
1262    #[doc(alias = "toolbar-style")]
1263    fn connect_toolbar_style_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1264        unsafe extern "C" fn notify_toolbar_style_trampoline<
1265            P: IsA<ToolPalette>,
1266            F: Fn(&P) + 'static,
1267        >(
1268            this: *mut ffi::GtkToolPalette,
1269            _param_spec: glib::ffi::gpointer,
1270            f: glib::ffi::gpointer,
1271        ) {
1272            let f: &F = &*(f as *const F);
1273            f(ToolPalette::from_glib_borrow(this).unsafe_cast_ref())
1274        }
1275        unsafe {
1276            let f: Box_<F> = Box_::new(f);
1277            connect_raw(
1278                self.as_ptr() as *mut _,
1279                b"notify::toolbar-style\0".as_ptr() as *const _,
1280                Some(transmute::<_, unsafe extern "C" fn()>(
1281                    notify_toolbar_style_trampoline::<Self, F> as *const (),
1282                )),
1283                Box_::into_raw(f),
1284            )
1285        }
1286    }
1287}
1288
1289impl<O: IsA<ToolPalette>> ToolPaletteExt for O {}
1290
1291impl fmt::Display for ToolPalette {
1292    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1293        f.write_str("ToolPalette")
1294    }
1295}