gtk/auto/
menu.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 gio;
7use glib;
8use glib::object::Cast;
9use glib::object::IsA;
10use glib::object::ObjectExt;
11use glib::signal::connect_raw;
12use glib::signal::SignalHandlerId;
13use glib::translate::*;
14use glib::GString;
15use glib::StaticType;
16use glib::ToValue;
17use glib::Value;
18use glib_sys;
19use gobject_sys;
20use gtk_sys;
21use std::boxed::Box as Box_;
22use std::fmt;
23use std::mem::transmute;
24use AccelGroup;
25use Align;
26use Buildable;
27use Container;
28use MenuItem;
29use MenuShell;
30use ResizeMode;
31use ScrollType;
32use Widget;
33
34glib_wrapper! {
35    pub struct Menu(Object<gtk_sys::GtkMenu, gtk_sys::GtkMenuClass, MenuClass>) @extends MenuShell, Container, Widget, @implements Buildable;
36
37    match fn {
38        get_type => || gtk_sys::gtk_menu_get_type(),
39    }
40}
41
42impl Menu {
43    pub fn new() -> Menu {
44        assert_initialized_main_thread!();
45        unsafe { Widget::from_glib_none(gtk_sys::gtk_menu_new()).unsafe_cast() }
46    }
47
48    pub fn new_from_model<P: IsA<gio::MenuModel>>(model: &P) -> Menu {
49        assert_initialized_main_thread!();
50        unsafe {
51            Widget::from_glib_none(gtk_sys::gtk_menu_new_from_model(
52                model.as_ref().to_glib_none().0,
53            ))
54            .unsafe_cast()
55        }
56    }
57
58    pub fn get_for_attach_widget<P: IsA<Widget>>(widget: &P) -> Vec<Widget> {
59        skip_assert_initialized!();
60        unsafe {
61            FromGlibPtrContainer::from_glib_none(gtk_sys::gtk_menu_get_for_attach_widget(
62                widget.as_ref().to_glib_none().0,
63            ))
64        }
65    }
66}
67
68impl Default for Menu {
69    fn default() -> Self {
70        Self::new()
71    }
72}
73
74pub struct MenuBuilder {
75    accel_group: Option<AccelGroup>,
76    accel_path: Option<String>,
77    active: Option<i32>,
78    #[cfg(any(feature = "v3_22", feature = "dox"))]
79    anchor_hints: Option<gdk::AnchorHints>,
80    attach_widget: Option<Widget>,
81    #[cfg(any(feature = "v3_22", feature = "dox"))]
82    menu_type_hint: Option<gdk::WindowTypeHint>,
83    monitor: Option<i32>,
84    #[cfg(any(feature = "v3_22", feature = "dox"))]
85    rect_anchor_dx: Option<i32>,
86    #[cfg(any(feature = "v3_22", feature = "dox"))]
87    rect_anchor_dy: Option<i32>,
88    reserve_toggle_size: Option<bool>,
89    take_focus: Option<bool>,
90    border_width: Option<u32>,
91    child: Option<Widget>,
92    resize_mode: Option<ResizeMode>,
93    app_paintable: Option<bool>,
94    can_default: Option<bool>,
95    can_focus: Option<bool>,
96    events: Option<gdk::EventMask>,
97    expand: Option<bool>,
98    #[cfg(any(feature = "v3_20", feature = "dox"))]
99    focus_on_click: Option<bool>,
100    halign: Option<Align>,
101    has_default: Option<bool>,
102    has_focus: Option<bool>,
103    has_tooltip: Option<bool>,
104    height_request: Option<i32>,
105    hexpand: Option<bool>,
106    hexpand_set: Option<bool>,
107    is_focus: Option<bool>,
108    margin: Option<i32>,
109    margin_bottom: Option<i32>,
110    margin_end: Option<i32>,
111    margin_start: Option<i32>,
112    margin_top: Option<i32>,
113    name: Option<String>,
114    no_show_all: Option<bool>,
115    opacity: Option<f64>,
116    parent: Option<Container>,
117    receives_default: Option<bool>,
118    sensitive: Option<bool>,
119    //style: /*Unknown type*/,
120    tooltip_markup: Option<String>,
121    tooltip_text: Option<String>,
122    valign: Option<Align>,
123    vexpand: Option<bool>,
124    vexpand_set: Option<bool>,
125    visible: Option<bool>,
126    width_request: Option<i32>,
127}
128
129impl MenuBuilder {
130    pub fn new() -> Self {
131        Self {
132            accel_group: None,
133            accel_path: None,
134            active: None,
135            #[cfg(any(feature = "v3_22", feature = "dox"))]
136            anchor_hints: None,
137            attach_widget: None,
138            #[cfg(any(feature = "v3_22", feature = "dox"))]
139            menu_type_hint: None,
140            monitor: None,
141            #[cfg(any(feature = "v3_22", feature = "dox"))]
142            rect_anchor_dx: None,
143            #[cfg(any(feature = "v3_22", feature = "dox"))]
144            rect_anchor_dy: None,
145            reserve_toggle_size: None,
146            take_focus: None,
147            border_width: None,
148            child: None,
149            resize_mode: None,
150            app_paintable: None,
151            can_default: None,
152            can_focus: None,
153            events: None,
154            expand: None,
155            #[cfg(any(feature = "v3_20", feature = "dox"))]
156            focus_on_click: None,
157            halign: None,
158            has_default: None,
159            has_focus: None,
160            has_tooltip: None,
161            height_request: None,
162            hexpand: None,
163            hexpand_set: None,
164            is_focus: None,
165            margin: None,
166            margin_bottom: None,
167            margin_end: None,
168            margin_start: None,
169            margin_top: None,
170            name: None,
171            no_show_all: None,
172            opacity: None,
173            parent: None,
174            receives_default: None,
175            sensitive: None,
176            tooltip_markup: None,
177            tooltip_text: None,
178            valign: None,
179            vexpand: None,
180            vexpand_set: None,
181            visible: None,
182            width_request: None,
183        }
184    }
185
186    pub fn build(self) -> Menu {
187        let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
188        if let Some(ref accel_group) = self.accel_group {
189            properties.push(("accel-group", accel_group));
190        }
191        if let Some(ref accel_path) = self.accel_path {
192            properties.push(("accel-path", accel_path));
193        }
194        if let Some(ref active) = self.active {
195            properties.push(("active", active));
196        }
197        #[cfg(any(feature = "v3_22", feature = "dox"))]
198        {
199            if let Some(ref anchor_hints) = self.anchor_hints {
200                properties.push(("anchor-hints", anchor_hints));
201            }
202        }
203        if let Some(ref attach_widget) = self.attach_widget {
204            properties.push(("attach-widget", attach_widget));
205        }
206        #[cfg(any(feature = "v3_22", feature = "dox"))]
207        {
208            if let Some(ref menu_type_hint) = self.menu_type_hint {
209                properties.push(("menu-type-hint", menu_type_hint));
210            }
211        }
212        if let Some(ref monitor) = self.monitor {
213            properties.push(("monitor", monitor));
214        }
215        #[cfg(any(feature = "v3_22", feature = "dox"))]
216        {
217            if let Some(ref rect_anchor_dx) = self.rect_anchor_dx {
218                properties.push(("rect-anchor-dx", rect_anchor_dx));
219            }
220        }
221        #[cfg(any(feature = "v3_22", feature = "dox"))]
222        {
223            if let Some(ref rect_anchor_dy) = self.rect_anchor_dy {
224                properties.push(("rect-anchor-dy", rect_anchor_dy));
225            }
226        }
227        if let Some(ref reserve_toggle_size) = self.reserve_toggle_size {
228            properties.push(("reserve-toggle-size", reserve_toggle_size));
229        }
230        if let Some(ref take_focus) = self.take_focus {
231            properties.push(("take-focus", take_focus));
232        }
233        if let Some(ref border_width) = self.border_width {
234            properties.push(("border-width", border_width));
235        }
236        if let Some(ref child) = self.child {
237            properties.push(("child", child));
238        }
239        if let Some(ref resize_mode) = self.resize_mode {
240            properties.push(("resize-mode", resize_mode));
241        }
242        if let Some(ref app_paintable) = self.app_paintable {
243            properties.push(("app-paintable", app_paintable));
244        }
245        if let Some(ref can_default) = self.can_default {
246            properties.push(("can-default", can_default));
247        }
248        if let Some(ref can_focus) = self.can_focus {
249            properties.push(("can-focus", can_focus));
250        }
251        if let Some(ref events) = self.events {
252            properties.push(("events", events));
253        }
254        if let Some(ref expand) = self.expand {
255            properties.push(("expand", expand));
256        }
257        #[cfg(any(feature = "v3_20", feature = "dox"))]
258        {
259            if let Some(ref focus_on_click) = self.focus_on_click {
260                properties.push(("focus-on-click", focus_on_click));
261            }
262        }
263        if let Some(ref halign) = self.halign {
264            properties.push(("halign", halign));
265        }
266        if let Some(ref has_default) = self.has_default {
267            properties.push(("has-default", has_default));
268        }
269        if let Some(ref has_focus) = self.has_focus {
270            properties.push(("has-focus", has_focus));
271        }
272        if let Some(ref has_tooltip) = self.has_tooltip {
273            properties.push(("has-tooltip", has_tooltip));
274        }
275        if let Some(ref height_request) = self.height_request {
276            properties.push(("height-request", height_request));
277        }
278        if let Some(ref hexpand) = self.hexpand {
279            properties.push(("hexpand", hexpand));
280        }
281        if let Some(ref hexpand_set) = self.hexpand_set {
282            properties.push(("hexpand-set", hexpand_set));
283        }
284        if let Some(ref is_focus) = self.is_focus {
285            properties.push(("is-focus", is_focus));
286        }
287        if let Some(ref margin) = self.margin {
288            properties.push(("margin", margin));
289        }
290        if let Some(ref margin_bottom) = self.margin_bottom {
291            properties.push(("margin-bottom", margin_bottom));
292        }
293        if let Some(ref margin_end) = self.margin_end {
294            properties.push(("margin-end", margin_end));
295        }
296        if let Some(ref margin_start) = self.margin_start {
297            properties.push(("margin-start", margin_start));
298        }
299        if let Some(ref margin_top) = self.margin_top {
300            properties.push(("margin-top", margin_top));
301        }
302        if let Some(ref name) = self.name {
303            properties.push(("name", name));
304        }
305        if let Some(ref no_show_all) = self.no_show_all {
306            properties.push(("no-show-all", no_show_all));
307        }
308        if let Some(ref opacity) = self.opacity {
309            properties.push(("opacity", opacity));
310        }
311        if let Some(ref parent) = self.parent {
312            properties.push(("parent", parent));
313        }
314        if let Some(ref receives_default) = self.receives_default {
315            properties.push(("receives-default", receives_default));
316        }
317        if let Some(ref sensitive) = self.sensitive {
318            properties.push(("sensitive", sensitive));
319        }
320        if let Some(ref tooltip_markup) = self.tooltip_markup {
321            properties.push(("tooltip-markup", tooltip_markup));
322        }
323        if let Some(ref tooltip_text) = self.tooltip_text {
324            properties.push(("tooltip-text", tooltip_text));
325        }
326        if let Some(ref valign) = self.valign {
327            properties.push(("valign", valign));
328        }
329        if let Some(ref vexpand) = self.vexpand {
330            properties.push(("vexpand", vexpand));
331        }
332        if let Some(ref vexpand_set) = self.vexpand_set {
333            properties.push(("vexpand-set", vexpand_set));
334        }
335        if let Some(ref visible) = self.visible {
336            properties.push(("visible", visible));
337        }
338        if let Some(ref width_request) = self.width_request {
339            properties.push(("width-request", width_request));
340        }
341        glib::Object::new(Menu::static_type(), &properties)
342            .expect("object new")
343            .downcast()
344            .expect("downcast")
345    }
346
347    pub fn accel_group(mut self, accel_group: &AccelGroup) -> Self {
348        self.accel_group = Some(accel_group.clone());
349        self
350    }
351
352    pub fn accel_path(mut self, accel_path: &str) -> Self {
353        self.accel_path = Some(accel_path.to_string());
354        self
355    }
356
357    pub fn active(mut self, active: i32) -> Self {
358        self.active = Some(active);
359        self
360    }
361
362    #[cfg(any(feature = "v3_22", feature = "dox"))]
363    pub fn anchor_hints(mut self, anchor_hints: gdk::AnchorHints) -> Self {
364        self.anchor_hints = Some(anchor_hints);
365        self
366    }
367
368    pub fn attach_widget(mut self, attach_widget: &Widget) -> Self {
369        self.attach_widget = Some(attach_widget.clone());
370        self
371    }
372
373    #[cfg(any(feature = "v3_22", feature = "dox"))]
374    pub fn menu_type_hint(mut self, menu_type_hint: gdk::WindowTypeHint) -> Self {
375        self.menu_type_hint = Some(menu_type_hint);
376        self
377    }
378
379    pub fn monitor(mut self, monitor: i32) -> Self {
380        self.monitor = Some(monitor);
381        self
382    }
383
384    #[cfg(any(feature = "v3_22", feature = "dox"))]
385    pub fn rect_anchor_dx(mut self, rect_anchor_dx: i32) -> Self {
386        self.rect_anchor_dx = Some(rect_anchor_dx);
387        self
388    }
389
390    #[cfg(any(feature = "v3_22", feature = "dox"))]
391    pub fn rect_anchor_dy(mut self, rect_anchor_dy: i32) -> Self {
392        self.rect_anchor_dy = Some(rect_anchor_dy);
393        self
394    }
395
396    pub fn reserve_toggle_size(mut self, reserve_toggle_size: bool) -> Self {
397        self.reserve_toggle_size = Some(reserve_toggle_size);
398        self
399    }
400
401    pub fn take_focus(mut self, take_focus: bool) -> Self {
402        self.take_focus = Some(take_focus);
403        self
404    }
405
406    pub fn border_width(mut self, border_width: u32) -> Self {
407        self.border_width = Some(border_width);
408        self
409    }
410
411    pub fn child(mut self, child: &Widget) -> Self {
412        self.child = Some(child.clone());
413        self
414    }
415
416    pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self {
417        self.resize_mode = Some(resize_mode);
418        self
419    }
420
421    pub fn app_paintable(mut self, app_paintable: bool) -> Self {
422        self.app_paintable = Some(app_paintable);
423        self
424    }
425
426    pub fn can_default(mut self, can_default: bool) -> Self {
427        self.can_default = Some(can_default);
428        self
429    }
430
431    pub fn can_focus(mut self, can_focus: bool) -> Self {
432        self.can_focus = Some(can_focus);
433        self
434    }
435
436    pub fn events(mut self, events: gdk::EventMask) -> Self {
437        self.events = Some(events);
438        self
439    }
440
441    pub fn expand(mut self, expand: bool) -> Self {
442        self.expand = Some(expand);
443        self
444    }
445
446    #[cfg(any(feature = "v3_20", feature = "dox"))]
447    pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
448        self.focus_on_click = Some(focus_on_click);
449        self
450    }
451
452    pub fn halign(mut self, halign: Align) -> Self {
453        self.halign = Some(halign);
454        self
455    }
456
457    pub fn has_default(mut self, has_default: bool) -> Self {
458        self.has_default = Some(has_default);
459        self
460    }
461
462    pub fn has_focus(mut self, has_focus: bool) -> Self {
463        self.has_focus = Some(has_focus);
464        self
465    }
466
467    pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
468        self.has_tooltip = Some(has_tooltip);
469        self
470    }
471
472    pub fn height_request(mut self, height_request: i32) -> Self {
473        self.height_request = Some(height_request);
474        self
475    }
476
477    pub fn hexpand(mut self, hexpand: bool) -> Self {
478        self.hexpand = Some(hexpand);
479        self
480    }
481
482    pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
483        self.hexpand_set = Some(hexpand_set);
484        self
485    }
486
487    pub fn is_focus(mut self, is_focus: bool) -> Self {
488        self.is_focus = Some(is_focus);
489        self
490    }
491
492    pub fn margin(mut self, margin: i32) -> Self {
493        self.margin = Some(margin);
494        self
495    }
496
497    pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
498        self.margin_bottom = Some(margin_bottom);
499        self
500    }
501
502    pub fn margin_end(mut self, margin_end: i32) -> Self {
503        self.margin_end = Some(margin_end);
504        self
505    }
506
507    pub fn margin_start(mut self, margin_start: i32) -> Self {
508        self.margin_start = Some(margin_start);
509        self
510    }
511
512    pub fn margin_top(mut self, margin_top: i32) -> Self {
513        self.margin_top = Some(margin_top);
514        self
515    }
516
517    pub fn name(mut self, name: &str) -> Self {
518        self.name = Some(name.to_string());
519        self
520    }
521
522    pub fn no_show_all(mut self, no_show_all: bool) -> Self {
523        self.no_show_all = Some(no_show_all);
524        self
525    }
526
527    pub fn opacity(mut self, opacity: f64) -> Self {
528        self.opacity = Some(opacity);
529        self
530    }
531
532    pub fn parent(mut self, parent: &Container) -> Self {
533        self.parent = Some(parent.clone());
534        self
535    }
536
537    pub fn receives_default(mut self, receives_default: bool) -> Self {
538        self.receives_default = Some(receives_default);
539        self
540    }
541
542    pub fn sensitive(mut self, sensitive: bool) -> Self {
543        self.sensitive = Some(sensitive);
544        self
545    }
546
547    pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
548        self.tooltip_markup = Some(tooltip_markup.to_string());
549        self
550    }
551
552    pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
553        self.tooltip_text = Some(tooltip_text.to_string());
554        self
555    }
556
557    pub fn valign(mut self, valign: Align) -> Self {
558        self.valign = Some(valign);
559        self
560    }
561
562    pub fn vexpand(mut self, vexpand: bool) -> Self {
563        self.vexpand = Some(vexpand);
564        self
565    }
566
567    pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
568        self.vexpand_set = Some(vexpand_set);
569        self
570    }
571
572    pub fn visible(mut self, visible: bool) -> Self {
573        self.visible = Some(visible);
574        self
575    }
576
577    pub fn width_request(mut self, width_request: i32) -> Self {
578        self.width_request = Some(width_request);
579        self
580    }
581}
582
583pub const NONE_MENU: Option<&Menu> = None;
584
585pub trait GtkMenuExt: 'static {
586    fn attach<P: IsA<Widget>>(
587        &self,
588        child: &P,
589        left_attach: u32,
590        right_attach: u32,
591        top_attach: u32,
592        bottom_attach: u32,
593    );
594
595    //fn attach_to_widget<P: IsA<Widget>>(&self, attach_widget: &P, detacher: Option<Box<dyn FnOnce(&Widget, &Menu) + 'static>>);
596
597    fn detach(&self);
598
599    fn get_accel_group(&self) -> Option<AccelGroup>;
600
601    fn get_accel_path(&self) -> Option<GString>;
602
603    fn get_active(&self) -> Option<Widget>;
604
605    fn get_attach_widget(&self) -> Option<Widget>;
606
607    fn get_monitor(&self) -> i32;
608
609    fn get_reserve_toggle_size(&self) -> bool;
610
611    #[cfg(any(feature = "v3_22", feature = "dox"))]
612    fn place_on_monitor(&self, monitor: &gdk::Monitor);
613
614    fn popdown(&self);
615
616    //#[cfg_attr(feature = "v3_22", deprecated)]
617    //fn popup<P: IsA<Widget>, Q: IsA<Widget>>(&self, parent_menu_shell: Option<&P>, parent_menu_item: Option<&Q>, func: Option<Box<dyn FnOnce(&Menu, i32, i32, bool) + 'static>>, button: u32, activate_time: u32);
618
619    #[cfg(any(feature = "v3_22", feature = "dox"))]
620    fn popup_at_pointer(&self, trigger_event: Option<&gdk::Event>);
621
622    #[cfg(any(feature = "v3_22", feature = "dox"))]
623    fn popup_at_rect<P: IsA<gdk::Window>>(
624        &self,
625        rect_window: &P,
626        rect: &gdk::Rectangle,
627        rect_anchor: gdk::Gravity,
628        menu_anchor: gdk::Gravity,
629        trigger_event: Option<&gdk::Event>,
630    );
631
632    #[cfg(any(feature = "v3_22", feature = "dox"))]
633    fn popup_at_widget<P: IsA<Widget>>(
634        &self,
635        widget: &P,
636        widget_anchor: gdk::Gravity,
637        menu_anchor: gdk::Gravity,
638        trigger_event: Option<&gdk::Event>,
639    );
640
641    //#[cfg_attr(feature = "v3_22", deprecated)]
642    //fn popup_for_device<P: IsA<Widget>, Q: IsA<Widget>>(&self, device: Option<&gdk::Device>, parent_menu_shell: Option<&P>, parent_menu_item: Option<&Q>, func: Option<Box<dyn Fn(&Menu, i32, i32, bool) + 'static>>, button: u32, activate_time: u32);
643
644    fn reorder_child<P: IsA<Widget>>(&self, child: &P, position: i32);
645
646    fn reposition(&self);
647
648    fn set_accel_group<P: IsA<AccelGroup>>(&self, accel_group: Option<&P>);
649
650    fn set_accel_path(&self, accel_path: Option<&str>);
651
652    fn set_active(&self, index: u32);
653
654    fn set_monitor(&self, monitor_num: i32);
655
656    fn set_reserve_toggle_size(&self, reserve_toggle_size: bool);
657
658    fn set_screen(&self, screen: Option<&gdk::Screen>);
659
660    #[cfg(any(feature = "v3_22", feature = "dox"))]
661    fn get_property_anchor_hints(&self) -> gdk::AnchorHints;
662
663    #[cfg(any(feature = "v3_22", feature = "dox"))]
664    fn set_property_anchor_hints(&self, anchor_hints: gdk::AnchorHints);
665
666    fn set_property_attach_widget(&self, attach_widget: Option<&Widget>);
667
668    #[cfg(any(feature = "v3_22", feature = "dox"))]
669    fn get_property_menu_type_hint(&self) -> gdk::WindowTypeHint;
670
671    #[cfg(any(feature = "v3_22", feature = "dox"))]
672    fn set_property_menu_type_hint(&self, menu_type_hint: gdk::WindowTypeHint);
673
674    #[cfg(any(feature = "v3_22", feature = "dox"))]
675    fn get_property_rect_anchor_dx(&self) -> i32;
676
677    #[cfg(any(feature = "v3_22", feature = "dox"))]
678    fn set_property_rect_anchor_dx(&self, rect_anchor_dx: i32);
679
680    #[cfg(any(feature = "v3_22", feature = "dox"))]
681    fn get_property_rect_anchor_dy(&self) -> i32;
682
683    #[cfg(any(feature = "v3_22", feature = "dox"))]
684    fn set_property_rect_anchor_dy(&self, rect_anchor_dy: i32);
685
686    fn get_item_bottom_attach<T: IsA<MenuItem>>(&self, item: &T) -> i32;
687
688    fn set_item_bottom_attach<T: IsA<MenuItem>>(&self, item: &T, bottom_attach: i32);
689
690    fn get_item_left_attach<T: IsA<MenuItem>>(&self, item: &T) -> i32;
691
692    fn set_item_left_attach<T: IsA<MenuItem>>(&self, item: &T, left_attach: i32);
693
694    fn get_item_right_attach<T: IsA<MenuItem>>(&self, item: &T) -> i32;
695
696    fn set_item_right_attach<T: IsA<MenuItem>>(&self, item: &T, right_attach: i32);
697
698    fn get_item_top_attach<T: IsA<MenuItem>>(&self, item: &T) -> i32;
699
700    fn set_item_top_attach<T: IsA<MenuItem>>(&self, item: &T, top_attach: i32);
701
702    fn connect_move_scroll<F: Fn(&Self, ScrollType) + 'static>(&self, f: F) -> SignalHandlerId;
703
704    fn emit_move_scroll(&self, scroll_type: ScrollType);
705
706    //#[cfg(any(feature = "v3_22", feature = "dox"))]
707    //fn connect_popped_up<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId;
708
709    fn connect_property_accel_group_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
710
711    fn connect_property_accel_path_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
712
713    fn connect_property_active_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
714
715    #[cfg(any(feature = "v3_22", feature = "dox"))]
716    fn connect_property_anchor_hints_notify<F: Fn(&Self) + 'static>(&self, f: F)
717        -> SignalHandlerId;
718
719    fn connect_property_attach_widget_notify<F: Fn(&Self) + 'static>(
720        &self,
721        f: F,
722    ) -> SignalHandlerId;
723
724    #[cfg(any(feature = "v3_22", feature = "dox"))]
725    fn connect_property_menu_type_hint_notify<F: Fn(&Self) + 'static>(
726        &self,
727        f: F,
728    ) -> SignalHandlerId;
729
730    fn connect_property_monitor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
731
732    #[cfg(any(feature = "v3_22", feature = "dox"))]
733    fn connect_property_rect_anchor_dx_notify<F: Fn(&Self) + 'static>(
734        &self,
735        f: F,
736    ) -> SignalHandlerId;
737
738    #[cfg(any(feature = "v3_22", feature = "dox"))]
739    fn connect_property_rect_anchor_dy_notify<F: Fn(&Self) + 'static>(
740        &self,
741        f: F,
742    ) -> SignalHandlerId;
743
744    fn connect_property_reserve_toggle_size_notify<F: Fn(&Self) + 'static>(
745        &self,
746        f: F,
747    ) -> SignalHandlerId;
748}
749
750impl<O: IsA<Menu>> GtkMenuExt for O {
751    fn attach<P: IsA<Widget>>(
752        &self,
753        child: &P,
754        left_attach: u32,
755        right_attach: u32,
756        top_attach: u32,
757        bottom_attach: u32,
758    ) {
759        unsafe {
760            gtk_sys::gtk_menu_attach(
761                self.as_ref().to_glib_none().0,
762                child.as_ref().to_glib_none().0,
763                left_attach,
764                right_attach,
765                top_attach,
766                bottom_attach,
767            );
768        }
769    }
770
771    //fn attach_to_widget<P: IsA<Widget>>(&self, attach_widget: &P, detacher: Option<Box<dyn FnOnce(&Widget, &Menu) + 'static>>) {
772    //    unsafe { TODO: call gtk_sys:gtk_menu_attach_to_widget() }
773    //}
774
775    fn detach(&self) {
776        unsafe {
777            gtk_sys::gtk_menu_detach(self.as_ref().to_glib_none().0);
778        }
779    }
780
781    fn get_accel_group(&self) -> Option<AccelGroup> {
782        unsafe {
783            from_glib_none(gtk_sys::gtk_menu_get_accel_group(
784                self.as_ref().to_glib_none().0,
785            ))
786        }
787    }
788
789    fn get_accel_path(&self) -> Option<GString> {
790        unsafe {
791            from_glib_none(gtk_sys::gtk_menu_get_accel_path(
792                self.as_ref().to_glib_none().0,
793            ))
794        }
795    }
796
797    fn get_active(&self) -> Option<Widget> {
798        unsafe { from_glib_none(gtk_sys::gtk_menu_get_active(self.as_ref().to_glib_none().0)) }
799    }
800
801    fn get_attach_widget(&self) -> Option<Widget> {
802        unsafe {
803            from_glib_none(gtk_sys::gtk_menu_get_attach_widget(
804                self.as_ref().to_glib_none().0,
805            ))
806        }
807    }
808
809    fn get_monitor(&self) -> i32 {
810        unsafe { gtk_sys::gtk_menu_get_monitor(self.as_ref().to_glib_none().0) }
811    }
812
813    fn get_reserve_toggle_size(&self) -> bool {
814        unsafe {
815            from_glib(gtk_sys::gtk_menu_get_reserve_toggle_size(
816                self.as_ref().to_glib_none().0,
817            ))
818        }
819    }
820
821    #[cfg(any(feature = "v3_22", feature = "dox"))]
822    fn place_on_monitor(&self, monitor: &gdk::Monitor) {
823        unsafe {
824            gtk_sys::gtk_menu_place_on_monitor(
825                self.as_ref().to_glib_none().0,
826                monitor.to_glib_none().0,
827            );
828        }
829    }
830
831    fn popdown(&self) {
832        unsafe {
833            gtk_sys::gtk_menu_popdown(self.as_ref().to_glib_none().0);
834        }
835    }
836
837    //fn popup<P: IsA<Widget>, Q: IsA<Widget>>(&self, parent_menu_shell: Option<&P>, parent_menu_item: Option<&Q>, func: Option<Box<dyn FnOnce(&Menu, i32, i32, bool) + 'static>>, button: u32, activate_time: u32) {
838    //    unsafe { TODO: call gtk_sys:gtk_menu_popup() }
839    //}
840
841    #[cfg(any(feature = "v3_22", feature = "dox"))]
842    fn popup_at_pointer(&self, trigger_event: Option<&gdk::Event>) {
843        unsafe {
844            gtk_sys::gtk_menu_popup_at_pointer(
845                self.as_ref().to_glib_none().0,
846                trigger_event.to_glib_none().0,
847            );
848        }
849    }
850
851    #[cfg(any(feature = "v3_22", feature = "dox"))]
852    fn popup_at_rect<P: IsA<gdk::Window>>(
853        &self,
854        rect_window: &P,
855        rect: &gdk::Rectangle,
856        rect_anchor: gdk::Gravity,
857        menu_anchor: gdk::Gravity,
858        trigger_event: Option<&gdk::Event>,
859    ) {
860        unsafe {
861            gtk_sys::gtk_menu_popup_at_rect(
862                self.as_ref().to_glib_none().0,
863                rect_window.as_ref().to_glib_none().0,
864                rect.to_glib_none().0,
865                rect_anchor.to_glib(),
866                menu_anchor.to_glib(),
867                trigger_event.to_glib_none().0,
868            );
869        }
870    }
871
872    #[cfg(any(feature = "v3_22", feature = "dox"))]
873    fn popup_at_widget<P: IsA<Widget>>(
874        &self,
875        widget: &P,
876        widget_anchor: gdk::Gravity,
877        menu_anchor: gdk::Gravity,
878        trigger_event: Option<&gdk::Event>,
879    ) {
880        unsafe {
881            gtk_sys::gtk_menu_popup_at_widget(
882                self.as_ref().to_glib_none().0,
883                widget.as_ref().to_glib_none().0,
884                widget_anchor.to_glib(),
885                menu_anchor.to_glib(),
886                trigger_event.to_glib_none().0,
887            );
888        }
889    }
890
891    //fn popup_for_device<P: IsA<Widget>, Q: IsA<Widget>>(&self, device: Option<&gdk::Device>, parent_menu_shell: Option<&P>, parent_menu_item: Option<&Q>, func: Option<Box<dyn Fn(&Menu, i32, i32, bool) + 'static>>, button: u32, activate_time: u32) {
892    //    unsafe { TODO: call gtk_sys:gtk_menu_popup_for_device() }
893    //}
894
895    fn reorder_child<P: IsA<Widget>>(&self, child: &P, position: i32) {
896        unsafe {
897            gtk_sys::gtk_menu_reorder_child(
898                self.as_ref().to_glib_none().0,
899                child.as_ref().to_glib_none().0,
900                position,
901            );
902        }
903    }
904
905    fn reposition(&self) {
906        unsafe {
907            gtk_sys::gtk_menu_reposition(self.as_ref().to_glib_none().0);
908        }
909    }
910
911    fn set_accel_group<P: IsA<AccelGroup>>(&self, accel_group: Option<&P>) {
912        unsafe {
913            gtk_sys::gtk_menu_set_accel_group(
914                self.as_ref().to_glib_none().0,
915                accel_group.map(|p| p.as_ref()).to_glib_none().0,
916            );
917        }
918    }
919
920    fn set_accel_path(&self, accel_path: Option<&str>) {
921        unsafe {
922            gtk_sys::gtk_menu_set_accel_path(
923                self.as_ref().to_glib_none().0,
924                accel_path.to_glib_none().0,
925            );
926        }
927    }
928
929    fn set_active(&self, index: u32) {
930        unsafe {
931            gtk_sys::gtk_menu_set_active(self.as_ref().to_glib_none().0, index);
932        }
933    }
934
935    fn set_monitor(&self, monitor_num: i32) {
936        unsafe {
937            gtk_sys::gtk_menu_set_monitor(self.as_ref().to_glib_none().0, monitor_num);
938        }
939    }
940
941    fn set_reserve_toggle_size(&self, reserve_toggle_size: bool) {
942        unsafe {
943            gtk_sys::gtk_menu_set_reserve_toggle_size(
944                self.as_ref().to_glib_none().0,
945                reserve_toggle_size.to_glib(),
946            );
947        }
948    }
949
950    fn set_screen(&self, screen: Option<&gdk::Screen>) {
951        unsafe {
952            gtk_sys::gtk_menu_set_screen(self.as_ref().to_glib_none().0, screen.to_glib_none().0);
953        }
954    }
955
956    #[cfg(any(feature = "v3_22", feature = "dox"))]
957    fn get_property_anchor_hints(&self) -> gdk::AnchorHints {
958        unsafe {
959            let mut value = Value::from_type(<gdk::AnchorHints as StaticType>::static_type());
960            gobject_sys::g_object_get_property(
961                self.to_glib_none().0 as *mut gobject_sys::GObject,
962                b"anchor-hints\0".as_ptr() as *const _,
963                value.to_glib_none_mut().0,
964            );
965            value.get().unwrap()
966        }
967    }
968
969    #[cfg(any(feature = "v3_22", feature = "dox"))]
970    fn set_property_anchor_hints(&self, anchor_hints: gdk::AnchorHints) {
971        unsafe {
972            gobject_sys::g_object_set_property(
973                self.to_glib_none().0 as *mut gobject_sys::GObject,
974                b"anchor-hints\0".as_ptr() as *const _,
975                Value::from(&anchor_hints).to_glib_none().0,
976            );
977        }
978    }
979
980    fn set_property_attach_widget(&self, attach_widget: Option<&Widget>) {
981        unsafe {
982            gobject_sys::g_object_set_property(
983                self.to_glib_none().0 as *mut gobject_sys::GObject,
984                b"attach-widget\0".as_ptr() as *const _,
985                Value::from(attach_widget).to_glib_none().0,
986            );
987        }
988    }
989
990    #[cfg(any(feature = "v3_22", feature = "dox"))]
991    fn get_property_menu_type_hint(&self) -> gdk::WindowTypeHint {
992        unsafe {
993            let mut value = Value::from_type(<gdk::WindowTypeHint as StaticType>::static_type());
994            gobject_sys::g_object_get_property(
995                self.to_glib_none().0 as *mut gobject_sys::GObject,
996                b"menu-type-hint\0".as_ptr() as *const _,
997                value.to_glib_none_mut().0,
998            );
999            value.get().unwrap()
1000        }
1001    }
1002
1003    #[cfg(any(feature = "v3_22", feature = "dox"))]
1004    fn set_property_menu_type_hint(&self, menu_type_hint: gdk::WindowTypeHint) {
1005        unsafe {
1006            gobject_sys::g_object_set_property(
1007                self.to_glib_none().0 as *mut gobject_sys::GObject,
1008                b"menu-type-hint\0".as_ptr() as *const _,
1009                Value::from(&menu_type_hint).to_glib_none().0,
1010            );
1011        }
1012    }
1013
1014    #[cfg(any(feature = "v3_22", feature = "dox"))]
1015    fn get_property_rect_anchor_dx(&self) -> i32 {
1016        unsafe {
1017            let mut value = Value::from_type(<i32 as StaticType>::static_type());
1018            gobject_sys::g_object_get_property(
1019                self.to_glib_none().0 as *mut gobject_sys::GObject,
1020                b"rect-anchor-dx\0".as_ptr() as *const _,
1021                value.to_glib_none_mut().0,
1022            );
1023            value.get().unwrap()
1024        }
1025    }
1026
1027    #[cfg(any(feature = "v3_22", feature = "dox"))]
1028    fn set_property_rect_anchor_dx(&self, rect_anchor_dx: i32) {
1029        unsafe {
1030            gobject_sys::g_object_set_property(
1031                self.to_glib_none().0 as *mut gobject_sys::GObject,
1032                b"rect-anchor-dx\0".as_ptr() as *const _,
1033                Value::from(&rect_anchor_dx).to_glib_none().0,
1034            );
1035        }
1036    }
1037
1038    #[cfg(any(feature = "v3_22", feature = "dox"))]
1039    fn get_property_rect_anchor_dy(&self) -> i32 {
1040        unsafe {
1041            let mut value = Value::from_type(<i32 as StaticType>::static_type());
1042            gobject_sys::g_object_get_property(
1043                self.to_glib_none().0 as *mut gobject_sys::GObject,
1044                b"rect-anchor-dy\0".as_ptr() as *const _,
1045                value.to_glib_none_mut().0,
1046            );
1047            value.get().unwrap()
1048        }
1049    }
1050
1051    #[cfg(any(feature = "v3_22", feature = "dox"))]
1052    fn set_property_rect_anchor_dy(&self, rect_anchor_dy: i32) {
1053        unsafe {
1054            gobject_sys::g_object_set_property(
1055                self.to_glib_none().0 as *mut gobject_sys::GObject,
1056                b"rect-anchor-dy\0".as_ptr() as *const _,
1057                Value::from(&rect_anchor_dy).to_glib_none().0,
1058            );
1059        }
1060    }
1061
1062    fn get_item_bottom_attach<T: IsA<MenuItem>>(&self, item: &T) -> i32 {
1063        unsafe {
1064            let mut value = Value::from_type(<i32 as StaticType>::static_type());
1065            gtk_sys::gtk_container_child_get_property(
1066                self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
1067                item.to_glib_none().0 as *mut _,
1068                b"bottom-attach\0".as_ptr() as *const _,
1069                value.to_glib_none_mut().0,
1070            );
1071            value.get().unwrap()
1072        }
1073    }
1074
1075    fn set_item_bottom_attach<T: IsA<MenuItem>>(&self, item: &T, bottom_attach: i32) {
1076        unsafe {
1077            gtk_sys::gtk_container_child_set_property(
1078                self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
1079                item.to_glib_none().0 as *mut _,
1080                b"bottom-attach\0".as_ptr() as *const _,
1081                Value::from(&bottom_attach).to_glib_none().0,
1082            );
1083        }
1084    }
1085
1086    fn get_item_left_attach<T: IsA<MenuItem>>(&self, item: &T) -> i32 {
1087        unsafe {
1088            let mut value = Value::from_type(<i32 as StaticType>::static_type());
1089            gtk_sys::gtk_container_child_get_property(
1090                self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
1091                item.to_glib_none().0 as *mut _,
1092                b"left-attach\0".as_ptr() as *const _,
1093                value.to_glib_none_mut().0,
1094            );
1095            value.get().unwrap()
1096        }
1097    }
1098
1099    fn set_item_left_attach<T: IsA<MenuItem>>(&self, item: &T, left_attach: i32) {
1100        unsafe {
1101            gtk_sys::gtk_container_child_set_property(
1102                self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
1103                item.to_glib_none().0 as *mut _,
1104                b"left-attach\0".as_ptr() as *const _,
1105                Value::from(&left_attach).to_glib_none().0,
1106            );
1107        }
1108    }
1109
1110    fn get_item_right_attach<T: IsA<MenuItem>>(&self, item: &T) -> i32 {
1111        unsafe {
1112            let mut value = Value::from_type(<i32 as StaticType>::static_type());
1113            gtk_sys::gtk_container_child_get_property(
1114                self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
1115                item.to_glib_none().0 as *mut _,
1116                b"right-attach\0".as_ptr() as *const _,
1117                value.to_glib_none_mut().0,
1118            );
1119            value.get().unwrap()
1120        }
1121    }
1122
1123    fn set_item_right_attach<T: IsA<MenuItem>>(&self, item: &T, right_attach: i32) {
1124        unsafe {
1125            gtk_sys::gtk_container_child_set_property(
1126                self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
1127                item.to_glib_none().0 as *mut _,
1128                b"right-attach\0".as_ptr() as *const _,
1129                Value::from(&right_attach).to_glib_none().0,
1130            );
1131        }
1132    }
1133
1134    fn get_item_top_attach<T: IsA<MenuItem>>(&self, item: &T) -> i32 {
1135        unsafe {
1136            let mut value = Value::from_type(<i32 as StaticType>::static_type());
1137            gtk_sys::gtk_container_child_get_property(
1138                self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
1139                item.to_glib_none().0 as *mut _,
1140                b"top-attach\0".as_ptr() as *const _,
1141                value.to_glib_none_mut().0,
1142            );
1143            value.get().unwrap()
1144        }
1145    }
1146
1147    fn set_item_top_attach<T: IsA<MenuItem>>(&self, item: &T, top_attach: i32) {
1148        unsafe {
1149            gtk_sys::gtk_container_child_set_property(
1150                self.to_glib_none().0 as *mut gtk_sys::GtkContainer,
1151                item.to_glib_none().0 as *mut _,
1152                b"top-attach\0".as_ptr() as *const _,
1153                Value::from(&top_attach).to_glib_none().0,
1154            );
1155        }
1156    }
1157
1158    fn connect_move_scroll<F: Fn(&Self, ScrollType) + 'static>(&self, f: F) -> SignalHandlerId {
1159        unsafe extern "C" fn move_scroll_trampoline<P, F: Fn(&P, ScrollType) + 'static>(
1160            this: *mut gtk_sys::GtkMenu,
1161            scroll_type: gtk_sys::GtkScrollType,
1162            f: glib_sys::gpointer,
1163        ) where
1164            P: IsA<Menu>,
1165        {
1166            let f: &F = &*(f as *const F);
1167            f(
1168                &Menu::from_glib_borrow(this).unsafe_cast(),
1169                from_glib(scroll_type),
1170            )
1171        }
1172        unsafe {
1173            let f: Box_<F> = Box_::new(f);
1174            connect_raw(
1175                self.as_ptr() as *mut _,
1176                b"move-scroll\0".as_ptr() as *const _,
1177                Some(transmute(move_scroll_trampoline::<Self, F> as usize)),
1178                Box_::into_raw(f),
1179            )
1180        }
1181    }
1182
1183    fn emit_move_scroll(&self, scroll_type: ScrollType) {
1184        let _ = unsafe {
1185            glib::Object::from_glib_borrow(self.to_glib_none().0 as *mut gobject_sys::GObject)
1186                .emit("move-scroll", &[&scroll_type])
1187                .unwrap()
1188        };
1189    }
1190
1191    //#[cfg(any(feature = "v3_22", feature = "dox"))]
1192    //fn connect_popped_up<Unsupported or ignored types>(&self, f: F) -> SignalHandlerId {
1193    //    Unimplemented flipped_rect: *.Pointer
1194    //    Unimplemented final_rect: *.Pointer
1195    //}
1196
1197    fn connect_property_accel_group_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1198        unsafe extern "C" fn notify_accel_group_trampoline<P, F: Fn(&P) + 'static>(
1199            this: *mut gtk_sys::GtkMenu,
1200            _param_spec: glib_sys::gpointer,
1201            f: glib_sys::gpointer,
1202        ) where
1203            P: IsA<Menu>,
1204        {
1205            let f: &F = &*(f as *const F);
1206            f(&Menu::from_glib_borrow(this).unsafe_cast())
1207        }
1208        unsafe {
1209            let f: Box_<F> = Box_::new(f);
1210            connect_raw(
1211                self.as_ptr() as *mut _,
1212                b"notify::accel-group\0".as_ptr() as *const _,
1213                Some(transmute(notify_accel_group_trampoline::<Self, F> as usize)),
1214                Box_::into_raw(f),
1215            )
1216        }
1217    }
1218
1219    fn connect_property_accel_path_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1220        unsafe extern "C" fn notify_accel_path_trampoline<P, F: Fn(&P) + 'static>(
1221            this: *mut gtk_sys::GtkMenu,
1222            _param_spec: glib_sys::gpointer,
1223            f: glib_sys::gpointer,
1224        ) where
1225            P: IsA<Menu>,
1226        {
1227            let f: &F = &*(f as *const F);
1228            f(&Menu::from_glib_borrow(this).unsafe_cast())
1229        }
1230        unsafe {
1231            let f: Box_<F> = Box_::new(f);
1232            connect_raw(
1233                self.as_ptr() as *mut _,
1234                b"notify::accel-path\0".as_ptr() as *const _,
1235                Some(transmute(notify_accel_path_trampoline::<Self, F> as usize)),
1236                Box_::into_raw(f),
1237            )
1238        }
1239    }
1240
1241    fn connect_property_active_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1242        unsafe extern "C" fn notify_active_trampoline<P, F: Fn(&P) + 'static>(
1243            this: *mut gtk_sys::GtkMenu,
1244            _param_spec: glib_sys::gpointer,
1245            f: glib_sys::gpointer,
1246        ) where
1247            P: IsA<Menu>,
1248        {
1249            let f: &F = &*(f as *const F);
1250            f(&Menu::from_glib_borrow(this).unsafe_cast())
1251        }
1252        unsafe {
1253            let f: Box_<F> = Box_::new(f);
1254            connect_raw(
1255                self.as_ptr() as *mut _,
1256                b"notify::active\0".as_ptr() as *const _,
1257                Some(transmute(notify_active_trampoline::<Self, F> as usize)),
1258                Box_::into_raw(f),
1259            )
1260        }
1261    }
1262
1263    #[cfg(any(feature = "v3_22", feature = "dox"))]
1264    fn connect_property_anchor_hints_notify<F: Fn(&Self) + 'static>(
1265        &self,
1266        f: F,
1267    ) -> SignalHandlerId {
1268        unsafe extern "C" fn notify_anchor_hints_trampoline<P, F: Fn(&P) + 'static>(
1269            this: *mut gtk_sys::GtkMenu,
1270            _param_spec: glib_sys::gpointer,
1271            f: glib_sys::gpointer,
1272        ) where
1273            P: IsA<Menu>,
1274        {
1275            let f: &F = &*(f as *const F);
1276            f(&Menu::from_glib_borrow(this).unsafe_cast())
1277        }
1278        unsafe {
1279            let f: Box_<F> = Box_::new(f);
1280            connect_raw(
1281                self.as_ptr() as *mut _,
1282                b"notify::anchor-hints\0".as_ptr() as *const _,
1283                Some(transmute(
1284                    notify_anchor_hints_trampoline::<Self, F> as usize,
1285                )),
1286                Box_::into_raw(f),
1287            )
1288        }
1289    }
1290
1291    fn connect_property_attach_widget_notify<F: Fn(&Self) + 'static>(
1292        &self,
1293        f: F,
1294    ) -> SignalHandlerId {
1295        unsafe extern "C" fn notify_attach_widget_trampoline<P, F: Fn(&P) + 'static>(
1296            this: *mut gtk_sys::GtkMenu,
1297            _param_spec: glib_sys::gpointer,
1298            f: glib_sys::gpointer,
1299        ) where
1300            P: IsA<Menu>,
1301        {
1302            let f: &F = &*(f as *const F);
1303            f(&Menu::from_glib_borrow(this).unsafe_cast())
1304        }
1305        unsafe {
1306            let f: Box_<F> = Box_::new(f);
1307            connect_raw(
1308                self.as_ptr() as *mut _,
1309                b"notify::attach-widget\0".as_ptr() as *const _,
1310                Some(transmute(
1311                    notify_attach_widget_trampoline::<Self, F> as usize,
1312                )),
1313                Box_::into_raw(f),
1314            )
1315        }
1316    }
1317
1318    #[cfg(any(feature = "v3_22", feature = "dox"))]
1319    fn connect_property_menu_type_hint_notify<F: Fn(&Self) + 'static>(
1320        &self,
1321        f: F,
1322    ) -> SignalHandlerId {
1323        unsafe extern "C" fn notify_menu_type_hint_trampoline<P, F: Fn(&P) + 'static>(
1324            this: *mut gtk_sys::GtkMenu,
1325            _param_spec: glib_sys::gpointer,
1326            f: glib_sys::gpointer,
1327        ) where
1328            P: IsA<Menu>,
1329        {
1330            let f: &F = &*(f as *const F);
1331            f(&Menu::from_glib_borrow(this).unsafe_cast())
1332        }
1333        unsafe {
1334            let f: Box_<F> = Box_::new(f);
1335            connect_raw(
1336                self.as_ptr() as *mut _,
1337                b"notify::menu-type-hint\0".as_ptr() as *const _,
1338                Some(transmute(
1339                    notify_menu_type_hint_trampoline::<Self, F> as usize,
1340                )),
1341                Box_::into_raw(f),
1342            )
1343        }
1344    }
1345
1346    fn connect_property_monitor_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
1347        unsafe extern "C" fn notify_monitor_trampoline<P, F: Fn(&P) + 'static>(
1348            this: *mut gtk_sys::GtkMenu,
1349            _param_spec: glib_sys::gpointer,
1350            f: glib_sys::gpointer,
1351        ) where
1352            P: IsA<Menu>,
1353        {
1354            let f: &F = &*(f as *const F);
1355            f(&Menu::from_glib_borrow(this).unsafe_cast())
1356        }
1357        unsafe {
1358            let f: Box_<F> = Box_::new(f);
1359            connect_raw(
1360                self.as_ptr() as *mut _,
1361                b"notify::monitor\0".as_ptr() as *const _,
1362                Some(transmute(notify_monitor_trampoline::<Self, F> as usize)),
1363                Box_::into_raw(f),
1364            )
1365        }
1366    }
1367
1368    #[cfg(any(feature = "v3_22", feature = "dox"))]
1369    fn connect_property_rect_anchor_dx_notify<F: Fn(&Self) + 'static>(
1370        &self,
1371        f: F,
1372    ) -> SignalHandlerId {
1373        unsafe extern "C" fn notify_rect_anchor_dx_trampoline<P, F: Fn(&P) + 'static>(
1374            this: *mut gtk_sys::GtkMenu,
1375            _param_spec: glib_sys::gpointer,
1376            f: glib_sys::gpointer,
1377        ) where
1378            P: IsA<Menu>,
1379        {
1380            let f: &F = &*(f as *const F);
1381            f(&Menu::from_glib_borrow(this).unsafe_cast())
1382        }
1383        unsafe {
1384            let f: Box_<F> = Box_::new(f);
1385            connect_raw(
1386                self.as_ptr() as *mut _,
1387                b"notify::rect-anchor-dx\0".as_ptr() as *const _,
1388                Some(transmute(
1389                    notify_rect_anchor_dx_trampoline::<Self, F> as usize,
1390                )),
1391                Box_::into_raw(f),
1392            )
1393        }
1394    }
1395
1396    #[cfg(any(feature = "v3_22", feature = "dox"))]
1397    fn connect_property_rect_anchor_dy_notify<F: Fn(&Self) + 'static>(
1398        &self,
1399        f: F,
1400    ) -> SignalHandlerId {
1401        unsafe extern "C" fn notify_rect_anchor_dy_trampoline<P, F: Fn(&P) + 'static>(
1402            this: *mut gtk_sys::GtkMenu,
1403            _param_spec: glib_sys::gpointer,
1404            f: glib_sys::gpointer,
1405        ) where
1406            P: IsA<Menu>,
1407        {
1408            let f: &F = &*(f as *const F);
1409            f(&Menu::from_glib_borrow(this).unsafe_cast())
1410        }
1411        unsafe {
1412            let f: Box_<F> = Box_::new(f);
1413            connect_raw(
1414                self.as_ptr() as *mut _,
1415                b"notify::rect-anchor-dy\0".as_ptr() as *const _,
1416                Some(transmute(
1417                    notify_rect_anchor_dy_trampoline::<Self, F> as usize,
1418                )),
1419                Box_::into_raw(f),
1420            )
1421        }
1422    }
1423
1424    fn connect_property_reserve_toggle_size_notify<F: Fn(&Self) + 'static>(
1425        &self,
1426        f: F,
1427    ) -> SignalHandlerId {
1428        unsafe extern "C" fn notify_reserve_toggle_size_trampoline<P, F: Fn(&P) + 'static>(
1429            this: *mut gtk_sys::GtkMenu,
1430            _param_spec: glib_sys::gpointer,
1431            f: glib_sys::gpointer,
1432        ) where
1433            P: IsA<Menu>,
1434        {
1435            let f: &F = &*(f as *const F);
1436            f(&Menu::from_glib_borrow(this).unsafe_cast())
1437        }
1438        unsafe {
1439            let f: Box_<F> = Box_::new(f);
1440            connect_raw(
1441                self.as_ptr() as *mut _,
1442                b"notify::reserve-toggle-size\0".as_ptr() as *const _,
1443                Some(transmute(
1444                    notify_reserve_toggle_size_trampoline::<Self, F> as usize,
1445                )),
1446                Box_::into_raw(f),
1447            )
1448        }
1449    }
1450}
1451
1452impl fmt::Display for Menu {
1453    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
1454        write!(f, "Menu")
1455    }
1456}