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 gdk;
6use glib::object::Cast;
7use glib::object::IsA;
8use glib::signal::connect_raw;
9use glib::signal::SignalHandlerId;
10use glib::translate::*;
11use glib::StaticType;
12use glib::ToValue;
13use glib::Value;
14use glib_sys;
15use gobject_sys;
16use gtk_sys;
17use std::boxed::Box as Box_;
18use std::fmt;
19use std::mem::transmute;
20use Align;
21use Buildable;
22use Container;
23use DestDefaults;
24use IconSize;
25use Orientable;
26use ResizeMode;
27use Scrollable;
28use SelectionData;
29use TargetEntry;
30use ToolItem;
31use ToolItemGroup;
32use ToolPaletteDragTargets;
33use ToolbarStyle;
34use Widget;
35
36glib_wrapper! {
37    pub struct ToolPalette(Object<gtk_sys::GtkToolPalette, gtk_sys::GtkToolPaletteClass, ToolPaletteClass>) @extends Container, Widget, @implements Buildable, Orientable, Scrollable;
38
39    match fn {
40        get_type => || gtk_sys::gtk_tool_palette_get_type(),
41    }
42}
43
44impl ToolPalette {
45    pub fn new() -> ToolPalette {
46        assert_initialized_main_thread!();
47        unsafe { Widget::from_glib_none(gtk_sys::gtk_tool_palette_new()).unsafe_cast() }
48    }
49
50    pub fn get_drag_target_group() -> Option<TargetEntry> {
51        assert_initialized_main_thread!();
52        unsafe { from_glib_none(gtk_sys::gtk_tool_palette_get_drag_target_group()) }
53    }
54
55    pub fn get_drag_target_item() -> Option<TargetEntry> {
56        assert_initialized_main_thread!();
57        unsafe { from_glib_none(gtk_sys::gtk_tool_palette_get_drag_target_item()) }
58    }
59}
60
61impl Default for ToolPalette {
62    fn default() -> Self {
63        Self::new()
64    }
65}
66
67pub struct ToolPaletteBuilder {
68    icon_size: Option<IconSize>,
69    icon_size_set: Option<bool>,
70    toolbar_style: Option<ToolbarStyle>,
71    border_width: Option<u32>,
72    child: Option<Widget>,
73    resize_mode: Option<ResizeMode>,
74    app_paintable: Option<bool>,
75    can_default: Option<bool>,
76    can_focus: Option<bool>,
77    events: Option<gdk::EventMask>,
78    expand: Option<bool>,
79    #[cfg(any(feature = "v3_20", feature = "dox"))]
80    focus_on_click: Option<bool>,
81    halign: Option<Align>,
82    has_default: Option<bool>,
83    has_focus: Option<bool>,
84    has_tooltip: Option<bool>,
85    height_request: Option<i32>,
86    hexpand: Option<bool>,
87    hexpand_set: Option<bool>,
88    is_focus: Option<bool>,
89    margin: Option<i32>,
90    margin_bottom: Option<i32>,
91    margin_end: Option<i32>,
92    margin_start: Option<i32>,
93    margin_top: Option<i32>,
94    name: Option<String>,
95    no_show_all: Option<bool>,
96    opacity: Option<f64>,
97    parent: Option<Container>,
98    receives_default: Option<bool>,
99    sensitive: Option<bool>,
100    //style: /*Unknown type*/,
101    tooltip_markup: Option<String>,
102    tooltip_text: Option<String>,
103    valign: Option<Align>,
104    vexpand: Option<bool>,
105    vexpand_set: Option<bool>,
106    visible: Option<bool>,
107    width_request: Option<i32>,
108}
109
110impl ToolPaletteBuilder {
111    pub fn new() -> Self {
112        Self {
113            icon_size: None,
114            icon_size_set: None,
115            toolbar_style: None,
116            border_width: None,
117            child: None,
118            resize_mode: None,
119            app_paintable: None,
120            can_default: None,
121            can_focus: None,
122            events: None,
123            expand: None,
124            #[cfg(any(feature = "v3_20", feature = "dox"))]
125            focus_on_click: None,
126            halign: None,
127            has_default: None,
128            has_focus: None,
129            has_tooltip: None,
130            height_request: None,
131            hexpand: None,
132            hexpand_set: None,
133            is_focus: None,
134            margin: None,
135            margin_bottom: None,
136            margin_end: None,
137            margin_start: None,
138            margin_top: None,
139            name: None,
140            no_show_all: None,
141            opacity: None,
142            parent: None,
143            receives_default: None,
144            sensitive: None,
145            tooltip_markup: None,
146            tooltip_text: None,
147            valign: None,
148            vexpand: None,
149            vexpand_set: None,
150            visible: None,
151            width_request: None,
152        }
153    }
154
155    pub fn build(self) -> ToolPalette {
156        let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
157        if let Some(ref icon_size) = self.icon_size {
158            properties.push(("icon-size", icon_size));
159        }
160        if let Some(ref icon_size_set) = self.icon_size_set {
161            properties.push(("icon-size-set", icon_size_set));
162        }
163        if let Some(ref toolbar_style) = self.toolbar_style {
164            properties.push(("toolbar-style", toolbar_style));
165        }
166        if let Some(ref border_width) = self.border_width {
167            properties.push(("border-width", border_width));
168        }
169        if let Some(ref child) = self.child {
170            properties.push(("child", child));
171        }
172        if let Some(ref resize_mode) = self.resize_mode {
173            properties.push(("resize-mode", resize_mode));
174        }
175        if let Some(ref app_paintable) = self.app_paintable {
176            properties.push(("app-paintable", app_paintable));
177        }
178        if let Some(ref can_default) = self.can_default {
179            properties.push(("can-default", can_default));
180        }
181        if let Some(ref can_focus) = self.can_focus {
182            properties.push(("can-focus", can_focus));
183        }
184        if let Some(ref events) = self.events {
185            properties.push(("events", events));
186        }
187        if let Some(ref expand) = self.expand {
188            properties.push(("expand", expand));
189        }
190        #[cfg(any(feature = "v3_20", feature = "dox"))]
191        {
192            if let Some(ref focus_on_click) = self.focus_on_click {
193                properties.push(("focus-on-click", focus_on_click));
194            }
195        }
196        if let Some(ref halign) = self.halign {
197            properties.push(("halign", halign));
198        }
199        if let Some(ref has_default) = self.has_default {
200            properties.push(("has-default", has_default));
201        }
202        if let Some(ref has_focus) = self.has_focus {
203            properties.push(("has-focus", has_focus));
204        }
205        if let Some(ref has_tooltip) = self.has_tooltip {
206            properties.push(("has-tooltip", has_tooltip));
207        }
208        if let Some(ref height_request) = self.height_request {
209            properties.push(("height-request", height_request));
210        }
211        if let Some(ref hexpand) = self.hexpand {
212            properties.push(("hexpand", hexpand));
213        }
214        if let Some(ref hexpand_set) = self.hexpand_set {
215            properties.push(("hexpand-set", hexpand_set));
216        }
217        if let Some(ref is_focus) = self.is_focus {
218            properties.push(("is-focus", is_focus));
219        }
220        if let Some(ref margin) = self.margin {
221            properties.push(("margin", margin));
222        }
223        if let Some(ref margin_bottom) = self.margin_bottom {
224            properties.push(("margin-bottom", margin_bottom));
225        }
226        if let Some(ref margin_end) = self.margin_end {
227            properties.push(("margin-end", margin_end));
228        }
229        if let Some(ref margin_start) = self.margin_start {
230            properties.push(("margin-start", margin_start));
231        }
232        if let Some(ref margin_top) = self.margin_top {
233            properties.push(("margin-top", margin_top));
234        }
235        if let Some(ref name) = self.name {
236            properties.push(("name", name));
237        }
238        if let Some(ref no_show_all) = self.no_show_all {
239            properties.push(("no-show-all", no_show_all));
240        }
241        if let Some(ref opacity) = self.opacity {
242            properties.push(("opacity", opacity));
243        }
244        if let Some(ref parent) = self.parent {
245            properties.push(("parent", parent));
246        }
247        if let Some(ref receives_default) = self.receives_default {
248            properties.push(("receives-default", receives_default));
249        }
250        if let Some(ref sensitive) = self.sensitive {
251            properties.push(("sensitive", sensitive));
252        }
253        if let Some(ref tooltip_markup) = self.tooltip_markup {
254            properties.push(("tooltip-markup", tooltip_markup));
255        }
256        if let Some(ref tooltip_text) = self.tooltip_text {
257            properties.push(("tooltip-text", tooltip_text));
258        }
259        if let Some(ref valign) = self.valign {
260            properties.push(("valign", valign));
261        }
262        if let Some(ref vexpand) = self.vexpand {
263            properties.push(("vexpand", vexpand));
264        }
265        if let Some(ref vexpand_set) = self.vexpand_set {
266            properties.push(("vexpand-set", vexpand_set));
267        }
268        if let Some(ref visible) = self.visible {
269            properties.push(("visible", visible));
270        }
271        if let Some(ref width_request) = self.width_request {
272            properties.push(("width-request", width_request));
273        }
274        glib::Object::new(ToolPalette::static_type(), &properties)
275            .expect("object new")
276            .downcast()
277            .expect("downcast")
278    }
279
280    pub fn icon_size(mut self, icon_size: IconSize) -> Self {
281        self.icon_size = Some(icon_size);
282        self
283    }
284
285    pub fn icon_size_set(mut self, icon_size_set: bool) -> Self {
286        self.icon_size_set = Some(icon_size_set);
287        self
288    }
289
290    pub fn toolbar_style(mut self, toolbar_style: ToolbarStyle) -> Self {
291        self.toolbar_style = Some(toolbar_style);
292        self
293    }
294
295    pub fn border_width(mut self, border_width: u32) -> Self {
296        self.border_width = Some(border_width);
297        self
298    }
299
300    pub fn child(mut self, child: &Widget) -> Self {
301        self.child = Some(child.clone());
302        self
303    }
304
305    pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self {
306        self.resize_mode = Some(resize_mode);
307        self
308    }
309
310    pub fn app_paintable(mut self, app_paintable: bool) -> Self {
311        self.app_paintable = Some(app_paintable);
312        self
313    }
314
315    pub fn can_default(mut self, can_default: bool) -> Self {
316        self.can_default = Some(can_default);
317        self
318    }
319
320    pub fn can_focus(mut self, can_focus: bool) -> Self {
321        self.can_focus = Some(can_focus);
322        self
323    }
324
325    pub fn events(mut self, events: gdk::EventMask) -> Self {
326        self.events = Some(events);
327        self
328    }
329
330    pub fn expand(mut self, expand: bool) -> Self {
331        self.expand = Some(expand);
332        self
333    }
334
335    #[cfg(any(feature = "v3_20", feature = "dox"))]
336    pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
337        self.focus_on_click = Some(focus_on_click);
338        self
339    }
340
341    pub fn halign(mut self, halign: Align) -> Self {
342        self.halign = Some(halign);
343        self
344    }
345
346    pub fn has_default(mut self, has_default: bool) -> Self {
347        self.has_default = Some(has_default);
348        self
349    }
350
351    pub fn has_focus(mut self, has_focus: bool) -> Self {
352        self.has_focus = Some(has_focus);
353        self
354    }
355
356    pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
357        self.has_tooltip = Some(has_tooltip);
358        self
359    }
360
361    pub fn height_request(mut self, height_request: i32) -> Self {
362        self.height_request = Some(height_request);
363        self
364    }
365
366    pub fn hexpand(mut self, hexpand: bool) -> Self {
367        self.hexpand = Some(hexpand);
368        self
369    }
370
371    pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
372        self.hexpand_set = Some(hexpand_set);
373        self
374    }
375
376    pub fn is_focus(mut self, is_focus: bool) -> Self {
377        self.is_focus = Some(is_focus);
378        self
379    }
380
381    pub fn margin(mut self, margin: i32) -> Self {
382        self.margin = Some(margin);
383        self
384    }
385
386    pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
387        self.margin_bottom = Some(margin_bottom);
388        self
389    }
390
391    pub fn margin_end(mut self, margin_end: i32) -> Self {
392        self.margin_end = Some(margin_end);
393        self
394    }
395
396    pub fn margin_start(mut self, margin_start: i32) -> Self {
397        self.margin_start = Some(margin_start);
398        self
399    }
400
401    pub fn margin_top(mut self, margin_top: i32) -> Self {
402        self.margin_top = Some(margin_top);
403        self
404    }
405
406    pub fn name(mut self, name: &str) -> Self {
407        self.name = Some(name.to_string());
408        self
409    }
410
411    pub fn no_show_all(mut self, no_show_all: bool) -> Self {
412        self.no_show_all = Some(no_show_all);
413        self
414    }
415
416    pub fn opacity(mut self, opacity: f64) -> Self {
417        self.opacity = Some(opacity);
418        self
419    }
420
421    pub fn parent(mut self, parent: &Container) -> Self {
422        self.parent = Some(parent.clone());
423        self
424    }
425
426    pub fn receives_default(mut self, receives_default: bool) -> Self {
427        self.receives_default = Some(receives_default);
428        self
429    }
430
431    pub fn sensitive(mut self, sensitive: bool) -> Self {
432        self.sensitive = Some(sensitive);
433        self
434    }
435
436    pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
437        self.tooltip_markup = Some(tooltip_markup.to_string());
438        self
439    }
440
441    pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
442        self.tooltip_text = Some(tooltip_text.to_string());
443        self
444    }
445
446    pub fn valign(mut self, valign: Align) -> Self {
447        self.valign = Some(valign);
448        self
449    }
450
451    pub fn vexpand(mut self, vexpand: bool) -> Self {
452        self.vexpand = Some(vexpand);
453        self
454    }
455
456    pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
457        self.vexpand_set = Some(vexpand_set);
458        self
459    }
460
461    pub fn visible(mut self, visible: bool) -> Self {
462        self.visible = Some(visible);
463        self
464    }
465
466    pub fn width_request(mut self, width_request: i32) -> Self {
467        self.width_request = Some(width_request);
468        self
469    }
470}
471
472pub const NONE_TOOL_PALETTE: Option<&ToolPalette> = None;
473
474pub trait ToolPaletteExt: 'static {
475    fn add_drag_dest<P: IsA<Widget>>(
476        &self,
477        widget: &P,
478        flags: DestDefaults,
479        targets: ToolPaletteDragTargets,
480        actions: gdk::DragAction,
481    );
482
483    fn get_drag_item(&self, selection: &SelectionData) -> Option<Widget>;
484
485    fn get_drop_group(&self, x: i32, y: i32) -> Option<ToolItemGroup>;
486
487    fn get_drop_item(&self, x: i32, y: i32) -> Option<ToolItem>;
488
489    fn get_exclusive<P: IsA<ToolItemGroup>>(&self, group: &P) -> bool;
490
491    fn get_expand<P: IsA<ToolItemGroup>>(&self, group: &P) -> bool;
492
493    fn get_group_position<P: IsA<ToolItemGroup>>(&self, group: &P) -> i32;
494
495    fn get_icon_size(&self) -> IconSize;
496
497    fn get_style(&self) -> ToolbarStyle;
498
499    fn set_drag_source(&self, targets: ToolPaletteDragTargets);
500
501    fn set_exclusive<P: IsA<ToolItemGroup>>(&self, group: &P, exclusive: bool);
502
503    fn set_expand<P: IsA<ToolItemGroup>>(&self, group: &P, expand: bool);
504
505    fn set_group_position<P: IsA<ToolItemGroup>>(&self, group: &P, position: i32);
506
507    fn set_icon_size(&self, icon_size: IconSize);
508
509    fn set_style(&self, style: ToolbarStyle);
510
511    fn unset_icon_size(&self);
512
513    fn unset_style(&self);
514
515    fn get_property_icon_size_set(&self) -> bool;
516
517    fn set_property_icon_size_set(&self, icon_size_set: bool);
518
519    fn get_property_toolbar_style(&self) -> ToolbarStyle;
520
521    fn set_property_toolbar_style(&self, toolbar_style: ToolbarStyle);
522
523    fn connect_property_icon_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
524
525    fn connect_property_icon_size_set_notify<F: Fn(&Self) + 'static>(
526        &self,
527        f: F,
528    ) -> SignalHandlerId;
529
530    fn connect_property_toolbar_style_notify<F: Fn(&Self) + 'static>(
531        &self,
532        f: F,
533    ) -> SignalHandlerId;
534}
535
536impl<O: IsA<ToolPalette>> ToolPaletteExt for O {
537    fn add_drag_dest<P: IsA<Widget>>(
538        &self,
539        widget: &P,
540        flags: DestDefaults,
541        targets: ToolPaletteDragTargets,
542        actions: gdk::DragAction,
543    ) {
544        unsafe {
545            gtk_sys::gtk_tool_palette_add_drag_dest(
546                self.as_ref().to_glib_none().0,
547                widget.as_ref().to_glib_none().0,
548                flags.to_glib(),
549                targets.to_glib(),
550                actions.to_glib(),
551            );
552        }
553    }
554
555    fn get_drag_item(&self, selection: &SelectionData) -> Option<Widget> {
556        unsafe {
557            from_glib_none(gtk_sys::gtk_tool_palette_get_drag_item(
558                self.as_ref().to_glib_none().0,
559                selection.to_glib_none().0,
560            ))
561        }
562    }
563
564    fn get_drop_group(&self, x: i32, y: i32) -> Option<ToolItemGroup> {
565        unsafe {
566            from_glib_none(gtk_sys::gtk_tool_palette_get_drop_group(
567                self.as_ref().to_glib_none().0,
568                x,
569                y,
570            ))
571        }
572    }
573
574    fn get_drop_item(&self, x: i32, y: i32) -> Option<ToolItem> {
575        unsafe {
576            from_glib_none(gtk_sys::gtk_tool_palette_get_drop_item(
577                self.as_ref().to_glib_none().0,
578                x,
579                y,
580            ))
581        }
582    }
583
584    fn get_exclusive<P: IsA<ToolItemGroup>>(&self, group: &P) -> bool {
585        unsafe {
586            from_glib(gtk_sys::gtk_tool_palette_get_exclusive(
587                self.as_ref().to_glib_none().0,
588                group.as_ref().to_glib_none().0,
589            ))
590        }
591    }
592
593    fn get_expand<P: IsA<ToolItemGroup>>(&self, group: &P) -> bool {
594        unsafe {
595            from_glib(gtk_sys::gtk_tool_palette_get_expand(
596                self.as_ref().to_glib_none().0,
597                group.as_ref().to_glib_none().0,
598            ))
599        }
600    }
601
602    fn get_group_position<P: IsA<ToolItemGroup>>(&self, group: &P) -> i32 {
603        unsafe {
604            gtk_sys::gtk_tool_palette_get_group_position(
605                self.as_ref().to_glib_none().0,
606                group.as_ref().to_glib_none().0,
607            )
608        }
609    }
610
611    fn get_icon_size(&self) -> IconSize {
612        unsafe {
613            from_glib(gtk_sys::gtk_tool_palette_get_icon_size(
614                self.as_ref().to_glib_none().0,
615            ))
616        }
617    }
618
619    fn get_style(&self) -> ToolbarStyle {
620        unsafe {
621            from_glib(gtk_sys::gtk_tool_palette_get_style(
622                self.as_ref().to_glib_none().0,
623            ))
624        }
625    }
626
627    fn set_drag_source(&self, targets: ToolPaletteDragTargets) {
628        unsafe {
629            gtk_sys::gtk_tool_palette_set_drag_source(
630                self.as_ref().to_glib_none().0,
631                targets.to_glib(),
632            );
633        }
634    }
635
636    fn set_exclusive<P: IsA<ToolItemGroup>>(&self, group: &P, exclusive: bool) {
637        unsafe {
638            gtk_sys::gtk_tool_palette_set_exclusive(
639                self.as_ref().to_glib_none().0,
640                group.as_ref().to_glib_none().0,
641                exclusive.to_glib(),
642            );
643        }
644    }
645
646    fn set_expand<P: IsA<ToolItemGroup>>(&self, group: &P, expand: bool) {
647        unsafe {
648            gtk_sys::gtk_tool_palette_set_expand(
649                self.as_ref().to_glib_none().0,
650                group.as_ref().to_glib_none().0,
651                expand.to_glib(),
652            );
653        }
654    }
655
656    fn set_group_position<P: IsA<ToolItemGroup>>(&self, group: &P, position: i32) {
657        unsafe {
658            gtk_sys::gtk_tool_palette_set_group_position(
659                self.as_ref().to_glib_none().0,
660                group.as_ref().to_glib_none().0,
661                position,
662            );
663        }
664    }
665
666    fn set_icon_size(&self, icon_size: IconSize) {
667        unsafe {
668            gtk_sys::gtk_tool_palette_set_icon_size(
669                self.as_ref().to_glib_none().0,
670                icon_size.to_glib(),
671            );
672        }
673    }
674
675    fn set_style(&self, style: ToolbarStyle) {
676        unsafe {
677            gtk_sys::gtk_tool_palette_set_style(self.as_ref().to_glib_none().0, style.to_glib());
678        }
679    }
680
681    fn unset_icon_size(&self) {
682        unsafe {
683            gtk_sys::gtk_tool_palette_unset_icon_size(self.as_ref().to_glib_none().0);
684        }
685    }
686
687    fn unset_style(&self) {
688        unsafe {
689            gtk_sys::gtk_tool_palette_unset_style(self.as_ref().to_glib_none().0);
690        }
691    }
692
693    fn get_property_icon_size_set(&self) -> bool {
694        unsafe {
695            let mut value = Value::from_type(<bool as StaticType>::static_type());
696            gobject_sys::g_object_get_property(
697                self.to_glib_none().0 as *mut gobject_sys::GObject,
698                b"icon-size-set\0".as_ptr() as *const _,
699                value.to_glib_none_mut().0,
700            );
701            value.get().unwrap()
702        }
703    }
704
705    fn set_property_icon_size_set(&self, icon_size_set: bool) {
706        unsafe {
707            gobject_sys::g_object_set_property(
708                self.to_glib_none().0 as *mut gobject_sys::GObject,
709                b"icon-size-set\0".as_ptr() as *const _,
710                Value::from(&icon_size_set).to_glib_none().0,
711            );
712        }
713    }
714
715    fn get_property_toolbar_style(&self) -> ToolbarStyle {
716        unsafe {
717            let mut value = Value::from_type(<ToolbarStyle as StaticType>::static_type());
718            gobject_sys::g_object_get_property(
719                self.to_glib_none().0 as *mut gobject_sys::GObject,
720                b"toolbar-style\0".as_ptr() as *const _,
721                value.to_glib_none_mut().0,
722            );
723            value.get().unwrap()
724        }
725    }
726
727    fn set_property_toolbar_style(&self, toolbar_style: ToolbarStyle) {
728        unsafe {
729            gobject_sys::g_object_set_property(
730                self.to_glib_none().0 as *mut gobject_sys::GObject,
731                b"toolbar-style\0".as_ptr() as *const _,
732                Value::from(&toolbar_style).to_glib_none().0,
733            );
734        }
735    }
736
737    fn connect_property_icon_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
738        unsafe extern "C" fn notify_icon_size_trampoline<P, F: Fn(&P) + 'static>(
739            this: *mut gtk_sys::GtkToolPalette,
740            _param_spec: glib_sys::gpointer,
741            f: glib_sys::gpointer,
742        ) where
743            P: IsA<ToolPalette>,
744        {
745            let f: &F = &*(f as *const F);
746            f(&ToolPalette::from_glib_borrow(this).unsafe_cast())
747        }
748        unsafe {
749            let f: Box_<F> = Box_::new(f);
750            connect_raw(
751                self.as_ptr() as *mut _,
752                b"notify::icon-size\0".as_ptr() as *const _,
753                Some(transmute(notify_icon_size_trampoline::<Self, F> as usize)),
754                Box_::into_raw(f),
755            )
756        }
757    }
758
759    fn connect_property_icon_size_set_notify<F: Fn(&Self) + 'static>(
760        &self,
761        f: F,
762    ) -> SignalHandlerId {
763        unsafe extern "C" fn notify_icon_size_set_trampoline<P, F: Fn(&P) + 'static>(
764            this: *mut gtk_sys::GtkToolPalette,
765            _param_spec: glib_sys::gpointer,
766            f: glib_sys::gpointer,
767        ) where
768            P: IsA<ToolPalette>,
769        {
770            let f: &F = &*(f as *const F);
771            f(&ToolPalette::from_glib_borrow(this).unsafe_cast())
772        }
773        unsafe {
774            let f: Box_<F> = Box_::new(f);
775            connect_raw(
776                self.as_ptr() as *mut _,
777                b"notify::icon-size-set\0".as_ptr() as *const _,
778                Some(transmute(
779                    notify_icon_size_set_trampoline::<Self, F> as usize,
780                )),
781                Box_::into_raw(f),
782            )
783        }
784    }
785
786    fn connect_property_toolbar_style_notify<F: Fn(&Self) + 'static>(
787        &self,
788        f: F,
789    ) -> SignalHandlerId {
790        unsafe extern "C" fn notify_toolbar_style_trampoline<P, F: Fn(&P) + 'static>(
791            this: *mut gtk_sys::GtkToolPalette,
792            _param_spec: glib_sys::gpointer,
793            f: glib_sys::gpointer,
794        ) where
795            P: IsA<ToolPalette>,
796        {
797            let f: &F = &*(f as *const F);
798            f(&ToolPalette::from_glib_borrow(this).unsafe_cast())
799        }
800        unsafe {
801            let f: Box_<F> = Box_::new(f);
802            connect_raw(
803                self.as_ptr() as *mut _,
804                b"notify::toolbar-style\0".as_ptr() as *const _,
805                Some(transmute(
806                    notify_toolbar_style_trampoline::<Self, F> as usize,
807                )),
808                Box_::into_raw(f),
809            )
810        }
811    }
812}
813
814impl fmt::Display for ToolPalette {
815    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
816        write!(f, "ToolPalette")
817    }
818}