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