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