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 
5 use crate::Actionable;
6 use crate::Align;
7 use crate::Bin;
8 use crate::Buildable;
9 use crate::Container;
10 use crate::Menu;
11 use crate::MenuItem;
12 use crate::ResizeMode;
13 use crate::Widget;
14 use glib::object::Cast;
15 use glib::object::IsA;
16 use glib::signal::connect_raw;
17 use glib::signal::SignalHandlerId;
18 use glib::translate::*;
19 use glib::StaticType;
20 use glib::ToValue;
21 use std::boxed::Box as Box_;
22 use std::fmt;
23 use std::mem::transmute;
24 
25 glib::wrapper! {
26     #[doc(alias = "GtkCheckMenuItem")]
27     pub struct CheckMenuItem(Object<ffi::GtkCheckMenuItem, ffi::GtkCheckMenuItemClass>) @extends MenuItem, Bin, Container, Widget, @implements Buildable, Actionable;
28 
29     match fn {
30         type_ => || ffi::gtk_check_menu_item_get_type(),
31     }
32 }
33 
34 impl CheckMenuItem {
35     #[doc(alias = "gtk_check_menu_item_new")]
new() -> CheckMenuItem36     pub fn new() -> CheckMenuItem {
37         assert_initialized_main_thread!();
38         unsafe { Widget::from_glib_none(ffi::gtk_check_menu_item_new()).unsafe_cast() }
39     }
40 
41     #[doc(alias = "gtk_check_menu_item_new_with_label")]
42     #[doc(alias = "new_with_label")]
with_label(label: &str) -> CheckMenuItem43     pub fn with_label(label: &str) -> CheckMenuItem {
44         assert_initialized_main_thread!();
45         unsafe {
46             Widget::from_glib_none(ffi::gtk_check_menu_item_new_with_label(
47                 label.to_glib_none().0,
48             ))
49             .unsafe_cast()
50         }
51     }
52 
53     #[doc(alias = "gtk_check_menu_item_new_with_mnemonic")]
54     #[doc(alias = "new_with_mnemonic")]
with_mnemonic(label: &str) -> CheckMenuItem55     pub fn with_mnemonic(label: &str) -> CheckMenuItem {
56         assert_initialized_main_thread!();
57         unsafe {
58             Widget::from_glib_none(ffi::gtk_check_menu_item_new_with_mnemonic(
59                 label.to_glib_none().0,
60             ))
61             .unsafe_cast()
62         }
63     }
64 
65     // rustdoc-stripper-ignore-next
66     /// Creates a new builder-pattern struct instance to construct [`CheckMenuItem`] objects.
67     ///
68     /// This method returns an instance of [`CheckMenuItemBuilder`] which can be used to create [`CheckMenuItem`] objects.
builder() -> CheckMenuItemBuilder69     pub fn builder() -> CheckMenuItemBuilder {
70         CheckMenuItemBuilder::default()
71     }
72 }
73 
74 impl Default for CheckMenuItem {
default() -> Self75     fn default() -> Self {
76         Self::new()
77     }
78 }
79 
80 #[derive(Clone, Default)]
81 // rustdoc-stripper-ignore-next
82 /// A [builder-pattern] type to construct [`CheckMenuItem`] objects.
83 ///
84 /// [builder-pattern]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html
85 pub struct CheckMenuItemBuilder {
86     active: Option<bool>,
87     draw_as_radio: Option<bool>,
88     inconsistent: Option<bool>,
89     accel_path: Option<String>,
90     label: Option<String>,
91     right_justified: Option<bool>,
92     submenu: Option<Menu>,
93     use_underline: Option<bool>,
94     border_width: Option<u32>,
95     child: Option<Widget>,
96     resize_mode: Option<ResizeMode>,
97     app_paintable: Option<bool>,
98     can_default: Option<bool>,
99     can_focus: Option<bool>,
100     events: Option<gdk::EventMask>,
101     expand: Option<bool>,
102     #[cfg(any(feature = "v3_20", feature = "dox"))]
103     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))]
104     focus_on_click: Option<bool>,
105     halign: Option<Align>,
106     has_default: Option<bool>,
107     has_focus: Option<bool>,
108     has_tooltip: Option<bool>,
109     height_request: Option<i32>,
110     hexpand: Option<bool>,
111     hexpand_set: Option<bool>,
112     is_focus: Option<bool>,
113     margin: Option<i32>,
114     margin_bottom: Option<i32>,
115     margin_end: Option<i32>,
116     margin_start: Option<i32>,
117     margin_top: Option<i32>,
118     name: Option<String>,
119     no_show_all: Option<bool>,
120     opacity: Option<f64>,
121     parent: Option<Container>,
122     receives_default: Option<bool>,
123     sensitive: Option<bool>,
124     tooltip_markup: Option<String>,
125     tooltip_text: Option<String>,
126     valign: Option<Align>,
127     vexpand: Option<bool>,
128     vexpand_set: Option<bool>,
129     visible: Option<bool>,
130     width_request: Option<i32>,
131     action_name: Option<String>,
132     action_target: Option<glib::Variant>,
133 }
134 
135 impl CheckMenuItemBuilder {
136     // rustdoc-stripper-ignore-next
137     /// Create a new [`CheckMenuItemBuilder`].
new() -> Self138     pub fn new() -> Self {
139         Self::default()
140     }
141 
142     // rustdoc-stripper-ignore-next
143     /// Build the [`CheckMenuItem`].
build(self) -> CheckMenuItem144     pub fn build(self) -> CheckMenuItem {
145         let mut properties: Vec<(&str, &dyn ToValue)> = vec![];
146         if let Some(ref active) = self.active {
147             properties.push(("active", active));
148         }
149         if let Some(ref draw_as_radio) = self.draw_as_radio {
150             properties.push(("draw-as-radio", draw_as_radio));
151         }
152         if let Some(ref inconsistent) = self.inconsistent {
153             properties.push(("inconsistent", inconsistent));
154         }
155         if let Some(ref accel_path) = self.accel_path {
156             properties.push(("accel-path", accel_path));
157         }
158         if let Some(ref label) = self.label {
159             properties.push(("label", label));
160         }
161         if let Some(ref right_justified) = self.right_justified {
162             properties.push(("right-justified", right_justified));
163         }
164         if let Some(ref submenu) = self.submenu {
165             properties.push(("submenu", submenu));
166         }
167         if let Some(ref use_underline) = self.use_underline {
168             properties.push(("use-underline", use_underline));
169         }
170         if let Some(ref border_width) = self.border_width {
171             properties.push(("border-width", border_width));
172         }
173         if let Some(ref child) = self.child {
174             properties.push(("child", child));
175         }
176         if let Some(ref resize_mode) = self.resize_mode {
177             properties.push(("resize-mode", resize_mode));
178         }
179         if let Some(ref app_paintable) = self.app_paintable {
180             properties.push(("app-paintable", app_paintable));
181         }
182         if let Some(ref can_default) = self.can_default {
183             properties.push(("can-default", can_default));
184         }
185         if let Some(ref can_focus) = self.can_focus {
186             properties.push(("can-focus", can_focus));
187         }
188         if let Some(ref events) = self.events {
189             properties.push(("events", events));
190         }
191         if let Some(ref expand) = self.expand {
192             properties.push(("expand", expand));
193         }
194         #[cfg(any(feature = "v3_20", feature = "dox"))]
195         if let Some(ref focus_on_click) = self.focus_on_click {
196             properties.push(("focus-on-click", focus_on_click));
197         }
198         if let Some(ref halign) = self.halign {
199             properties.push(("halign", halign));
200         }
201         if let Some(ref has_default) = self.has_default {
202             properties.push(("has-default", has_default));
203         }
204         if let Some(ref has_focus) = self.has_focus {
205             properties.push(("has-focus", has_focus));
206         }
207         if let Some(ref has_tooltip) = self.has_tooltip {
208             properties.push(("has-tooltip", has_tooltip));
209         }
210         if let Some(ref height_request) = self.height_request {
211             properties.push(("height-request", height_request));
212         }
213         if let Some(ref hexpand) = self.hexpand {
214             properties.push(("hexpand", hexpand));
215         }
216         if let Some(ref hexpand_set) = self.hexpand_set {
217             properties.push(("hexpand-set", hexpand_set));
218         }
219         if let Some(ref is_focus) = self.is_focus {
220             properties.push(("is-focus", is_focus));
221         }
222         if let Some(ref margin) = self.margin {
223             properties.push(("margin", margin));
224         }
225         if let Some(ref margin_bottom) = self.margin_bottom {
226             properties.push(("margin-bottom", margin_bottom));
227         }
228         if let Some(ref margin_end) = self.margin_end {
229             properties.push(("margin-end", margin_end));
230         }
231         if let Some(ref margin_start) = self.margin_start {
232             properties.push(("margin-start", margin_start));
233         }
234         if let Some(ref margin_top) = self.margin_top {
235             properties.push(("margin-top", margin_top));
236         }
237         if let Some(ref name) = self.name {
238             properties.push(("name", name));
239         }
240         if let Some(ref no_show_all) = self.no_show_all {
241             properties.push(("no-show-all", no_show_all));
242         }
243         if let Some(ref opacity) = self.opacity {
244             properties.push(("opacity", opacity));
245         }
246         if let Some(ref parent) = self.parent {
247             properties.push(("parent", parent));
248         }
249         if let Some(ref receives_default) = self.receives_default {
250             properties.push(("receives-default", receives_default));
251         }
252         if let Some(ref sensitive) = self.sensitive {
253             properties.push(("sensitive", sensitive));
254         }
255         if let Some(ref tooltip_markup) = self.tooltip_markup {
256             properties.push(("tooltip-markup", tooltip_markup));
257         }
258         if let Some(ref tooltip_text) = self.tooltip_text {
259             properties.push(("tooltip-text", tooltip_text));
260         }
261         if let Some(ref valign) = self.valign {
262             properties.push(("valign", valign));
263         }
264         if let Some(ref vexpand) = self.vexpand {
265             properties.push(("vexpand", vexpand));
266         }
267         if let Some(ref vexpand_set) = self.vexpand_set {
268             properties.push(("vexpand-set", vexpand_set));
269         }
270         if let Some(ref visible) = self.visible {
271             properties.push(("visible", visible));
272         }
273         if let Some(ref width_request) = self.width_request {
274             properties.push(("width-request", width_request));
275         }
276         if let Some(ref action_name) = self.action_name {
277             properties.push(("action-name", action_name));
278         }
279         if let Some(ref action_target) = self.action_target {
280             properties.push(("action-target", action_target));
281         }
282         glib::Object::new::<CheckMenuItem>(&properties)
283             .expect("Failed to create an instance of CheckMenuItem")
284     }
285 
active(mut self, active: bool) -> Self286     pub fn active(mut self, active: bool) -> Self {
287         self.active = Some(active);
288         self
289     }
290 
draw_as_radio(mut self, draw_as_radio: bool) -> Self291     pub fn draw_as_radio(mut self, draw_as_radio: bool) -> Self {
292         self.draw_as_radio = Some(draw_as_radio);
293         self
294     }
295 
inconsistent(mut self, inconsistent: bool) -> Self296     pub fn inconsistent(mut self, inconsistent: bool) -> Self {
297         self.inconsistent = Some(inconsistent);
298         self
299     }
300 
accel_path(mut self, accel_path: &str) -> Self301     pub fn accel_path(mut self, accel_path: &str) -> Self {
302         self.accel_path = Some(accel_path.to_string());
303         self
304     }
305 
label(mut self, label: &str) -> Self306     pub fn label(mut self, label: &str) -> Self {
307         self.label = Some(label.to_string());
308         self
309     }
310 
right_justified(mut self, right_justified: bool) -> Self311     pub fn right_justified(mut self, right_justified: bool) -> Self {
312         self.right_justified = Some(right_justified);
313         self
314     }
315 
submenu<P: IsA<Menu>>(mut self, submenu: &P) -> Self316     pub fn submenu<P: IsA<Menu>>(mut self, submenu: &P) -> Self {
317         self.submenu = Some(submenu.clone().upcast());
318         self
319     }
320 
use_underline(mut self, use_underline: bool) -> Self321     pub fn use_underline(mut self, use_underline: bool) -> Self {
322         self.use_underline = Some(use_underline);
323         self
324     }
325 
border_width(mut self, border_width: u32) -> Self326     pub fn border_width(mut self, border_width: u32) -> Self {
327         self.border_width = Some(border_width);
328         self
329     }
330 
child<P: IsA<Widget>>(mut self, child: &P) -> Self331     pub fn child<P: IsA<Widget>>(mut self, child: &P) -> Self {
332         self.child = Some(child.clone().upcast());
333         self
334     }
335 
resize_mode(mut self, resize_mode: ResizeMode) -> Self336     pub fn resize_mode(mut self, resize_mode: ResizeMode) -> Self {
337         self.resize_mode = Some(resize_mode);
338         self
339     }
340 
app_paintable(mut self, app_paintable: bool) -> Self341     pub fn app_paintable(mut self, app_paintable: bool) -> Self {
342         self.app_paintable = Some(app_paintable);
343         self
344     }
345 
can_default(mut self, can_default: bool) -> Self346     pub fn can_default(mut self, can_default: bool) -> Self {
347         self.can_default = Some(can_default);
348         self
349     }
350 
can_focus(mut self, can_focus: bool) -> Self351     pub fn can_focus(mut self, can_focus: bool) -> Self {
352         self.can_focus = Some(can_focus);
353         self
354     }
355 
events(mut self, events: gdk::EventMask) -> Self356     pub fn events(mut self, events: gdk::EventMask) -> Self {
357         self.events = Some(events);
358         self
359     }
360 
expand(mut self, expand: bool) -> Self361     pub fn expand(mut self, expand: bool) -> Self {
362         self.expand = Some(expand);
363         self
364     }
365 
366     #[cfg(any(feature = "v3_20", feature = "dox"))]
367     #[cfg_attr(feature = "dox", doc(cfg(feature = "v3_20")))]
focus_on_click(mut self, focus_on_click: bool) -> Self368     pub fn focus_on_click(mut self, focus_on_click: bool) -> Self {
369         self.focus_on_click = Some(focus_on_click);
370         self
371     }
372 
halign(mut self, halign: Align) -> Self373     pub fn halign(mut self, halign: Align) -> Self {
374         self.halign = Some(halign);
375         self
376     }
377 
has_default(mut self, has_default: bool) -> Self378     pub fn has_default(mut self, has_default: bool) -> Self {
379         self.has_default = Some(has_default);
380         self
381     }
382 
has_focus(mut self, has_focus: bool) -> Self383     pub fn has_focus(mut self, has_focus: bool) -> Self {
384         self.has_focus = Some(has_focus);
385         self
386     }
387 
has_tooltip(mut self, has_tooltip: bool) -> Self388     pub fn has_tooltip(mut self, has_tooltip: bool) -> Self {
389         self.has_tooltip = Some(has_tooltip);
390         self
391     }
392 
height_request(mut self, height_request: i32) -> Self393     pub fn height_request(mut self, height_request: i32) -> Self {
394         self.height_request = Some(height_request);
395         self
396     }
397 
hexpand(mut self, hexpand: bool) -> Self398     pub fn hexpand(mut self, hexpand: bool) -> Self {
399         self.hexpand = Some(hexpand);
400         self
401     }
402 
hexpand_set(mut self, hexpand_set: bool) -> Self403     pub fn hexpand_set(mut self, hexpand_set: bool) -> Self {
404         self.hexpand_set = Some(hexpand_set);
405         self
406     }
407 
is_focus(mut self, is_focus: bool) -> Self408     pub fn is_focus(mut self, is_focus: bool) -> Self {
409         self.is_focus = Some(is_focus);
410         self
411     }
412 
margin(mut self, margin: i32) -> Self413     pub fn margin(mut self, margin: i32) -> Self {
414         self.margin = Some(margin);
415         self
416     }
417 
margin_bottom(mut self, margin_bottom: i32) -> Self418     pub fn margin_bottom(mut self, margin_bottom: i32) -> Self {
419         self.margin_bottom = Some(margin_bottom);
420         self
421     }
422 
margin_end(mut self, margin_end: i32) -> Self423     pub fn margin_end(mut self, margin_end: i32) -> Self {
424         self.margin_end = Some(margin_end);
425         self
426     }
427 
margin_start(mut self, margin_start: i32) -> Self428     pub fn margin_start(mut self, margin_start: i32) -> Self {
429         self.margin_start = Some(margin_start);
430         self
431     }
432 
margin_top(mut self, margin_top: i32) -> Self433     pub fn margin_top(mut self, margin_top: i32) -> Self {
434         self.margin_top = Some(margin_top);
435         self
436     }
437 
name(mut self, name: &str) -> Self438     pub fn name(mut self, name: &str) -> Self {
439         self.name = Some(name.to_string());
440         self
441     }
442 
no_show_all(mut self, no_show_all: bool) -> Self443     pub fn no_show_all(mut self, no_show_all: bool) -> Self {
444         self.no_show_all = Some(no_show_all);
445         self
446     }
447 
opacity(mut self, opacity: f64) -> Self448     pub fn opacity(mut self, opacity: f64) -> Self {
449         self.opacity = Some(opacity);
450         self
451     }
452 
parent<P: IsA<Container>>(mut self, parent: &P) -> Self453     pub fn parent<P: IsA<Container>>(mut self, parent: &P) -> Self {
454         self.parent = Some(parent.clone().upcast());
455         self
456     }
457 
receives_default(mut self, receives_default: bool) -> Self458     pub fn receives_default(mut self, receives_default: bool) -> Self {
459         self.receives_default = Some(receives_default);
460         self
461     }
462 
sensitive(mut self, sensitive: bool) -> Self463     pub fn sensitive(mut self, sensitive: bool) -> Self {
464         self.sensitive = Some(sensitive);
465         self
466     }
467 
tooltip_markup(mut self, tooltip_markup: &str) -> Self468     pub fn tooltip_markup(mut self, tooltip_markup: &str) -> Self {
469         self.tooltip_markup = Some(tooltip_markup.to_string());
470         self
471     }
472 
tooltip_text(mut self, tooltip_text: &str) -> Self473     pub fn tooltip_text(mut self, tooltip_text: &str) -> Self {
474         self.tooltip_text = Some(tooltip_text.to_string());
475         self
476     }
477 
valign(mut self, valign: Align) -> Self478     pub fn valign(mut self, valign: Align) -> Self {
479         self.valign = Some(valign);
480         self
481     }
482 
vexpand(mut self, vexpand: bool) -> Self483     pub fn vexpand(mut self, vexpand: bool) -> Self {
484         self.vexpand = Some(vexpand);
485         self
486     }
487 
vexpand_set(mut self, vexpand_set: bool) -> Self488     pub fn vexpand_set(mut self, vexpand_set: bool) -> Self {
489         self.vexpand_set = Some(vexpand_set);
490         self
491     }
492 
visible(mut self, visible: bool) -> Self493     pub fn visible(mut self, visible: bool) -> Self {
494         self.visible = Some(visible);
495         self
496     }
497 
width_request(mut self, width_request: i32) -> Self498     pub fn width_request(mut self, width_request: i32) -> Self {
499         self.width_request = Some(width_request);
500         self
501     }
502 
action_name(mut self, action_name: &str) -> Self503     pub fn action_name(mut self, action_name: &str) -> Self {
504         self.action_name = Some(action_name.to_string());
505         self
506     }
507 
action_target(mut self, action_target: &glib::Variant) -> Self508     pub fn action_target(mut self, action_target: &glib::Variant) -> Self {
509         self.action_target = Some(action_target.clone());
510         self
511     }
512 }
513 
514 pub const NONE_CHECK_MENU_ITEM: Option<&CheckMenuItem> = None;
515 
516 pub trait CheckMenuItemExt: 'static {
517     #[doc(alias = "gtk_check_menu_item_get_active")]
518     #[doc(alias = "get_active")]
is_active(&self) -> bool519     fn is_active(&self) -> bool;
520 
521     #[doc(alias = "gtk_check_menu_item_get_draw_as_radio")]
522     #[doc(alias = "get_draw_as_radio")]
draws_as_radio(&self) -> bool523     fn draws_as_radio(&self) -> bool;
524 
525     #[doc(alias = "gtk_check_menu_item_get_inconsistent")]
526     #[doc(alias = "get_inconsistent")]
is_inconsistent(&self) -> bool527     fn is_inconsistent(&self) -> bool;
528 
529     #[doc(alias = "gtk_check_menu_item_set_active")]
set_active(&self, is_active: bool)530     fn set_active(&self, is_active: bool);
531 
532     #[doc(alias = "gtk_check_menu_item_set_draw_as_radio")]
set_draw_as_radio(&self, draw_as_radio: bool)533     fn set_draw_as_radio(&self, draw_as_radio: bool);
534 
535     #[doc(alias = "gtk_check_menu_item_set_inconsistent")]
set_inconsistent(&self, setting: bool)536     fn set_inconsistent(&self, setting: bool);
537 
538     #[doc(alias = "gtk_check_menu_item_toggled")]
toggled(&self)539     fn toggled(&self);
540 
541     #[doc(alias = "toggled")]
connect_toggled<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId542     fn connect_toggled<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
543 
544     #[doc(alias = "active")]
connect_active_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId545     fn connect_active_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
546 
547     #[doc(alias = "draw-as-radio")]
connect_draw_as_radio_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId548     fn connect_draw_as_radio_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
549 
550     #[doc(alias = "inconsistent")]
connect_inconsistent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId551     fn connect_inconsistent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
552 }
553 
554 impl<O: IsA<CheckMenuItem>> CheckMenuItemExt for O {
is_active(&self) -> bool555     fn is_active(&self) -> bool {
556         unsafe {
557             from_glib(ffi::gtk_check_menu_item_get_active(
558                 self.as_ref().to_glib_none().0,
559             ))
560         }
561     }
562 
draws_as_radio(&self) -> bool563     fn draws_as_radio(&self) -> bool {
564         unsafe {
565             from_glib(ffi::gtk_check_menu_item_get_draw_as_radio(
566                 self.as_ref().to_glib_none().0,
567             ))
568         }
569     }
570 
is_inconsistent(&self) -> bool571     fn is_inconsistent(&self) -> bool {
572         unsafe {
573             from_glib(ffi::gtk_check_menu_item_get_inconsistent(
574                 self.as_ref().to_glib_none().0,
575             ))
576         }
577     }
578 
set_active(&self, is_active: bool)579     fn set_active(&self, is_active: bool) {
580         unsafe {
581             ffi::gtk_check_menu_item_set_active(
582                 self.as_ref().to_glib_none().0,
583                 is_active.into_glib(),
584             );
585         }
586     }
587 
set_draw_as_radio(&self, draw_as_radio: bool)588     fn set_draw_as_radio(&self, draw_as_radio: bool) {
589         unsafe {
590             ffi::gtk_check_menu_item_set_draw_as_radio(
591                 self.as_ref().to_glib_none().0,
592                 draw_as_radio.into_glib(),
593             );
594         }
595     }
596 
set_inconsistent(&self, setting: bool)597     fn set_inconsistent(&self, setting: bool) {
598         unsafe {
599             ffi::gtk_check_menu_item_set_inconsistent(
600                 self.as_ref().to_glib_none().0,
601                 setting.into_glib(),
602             );
603         }
604     }
605 
toggled(&self)606     fn toggled(&self) {
607         unsafe {
608             ffi::gtk_check_menu_item_toggled(self.as_ref().to_glib_none().0);
609         }
610     }
611 
connect_toggled<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId612     fn connect_toggled<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
613         unsafe extern "C" fn toggled_trampoline<P: IsA<CheckMenuItem>, F: Fn(&P) + 'static>(
614             this: *mut ffi::GtkCheckMenuItem,
615             f: glib::ffi::gpointer,
616         ) {
617             let f: &F = &*(f as *const F);
618             f(CheckMenuItem::from_glib_borrow(this).unsafe_cast_ref())
619         }
620         unsafe {
621             let f: Box_<F> = Box_::new(f);
622             connect_raw(
623                 self.as_ptr() as *mut _,
624                 b"toggled\0".as_ptr() as *const _,
625                 Some(transmute::<_, unsafe extern "C" fn()>(
626                     toggled_trampoline::<Self, F> as *const (),
627                 )),
628                 Box_::into_raw(f),
629             )
630         }
631     }
632 
connect_active_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId633     fn connect_active_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
634         unsafe extern "C" fn notify_active_trampoline<
635             P: IsA<CheckMenuItem>,
636             F: Fn(&P) + 'static,
637         >(
638             this: *mut ffi::GtkCheckMenuItem,
639             _param_spec: glib::ffi::gpointer,
640             f: glib::ffi::gpointer,
641         ) {
642             let f: &F = &*(f as *const F);
643             f(CheckMenuItem::from_glib_borrow(this).unsafe_cast_ref())
644         }
645         unsafe {
646             let f: Box_<F> = Box_::new(f);
647             connect_raw(
648                 self.as_ptr() as *mut _,
649                 b"notify::active\0".as_ptr() as *const _,
650                 Some(transmute::<_, unsafe extern "C" fn()>(
651                     notify_active_trampoline::<Self, F> as *const (),
652                 )),
653                 Box_::into_raw(f),
654             )
655         }
656     }
657 
connect_draw_as_radio_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId658     fn connect_draw_as_radio_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
659         unsafe extern "C" fn notify_draw_as_radio_trampoline<
660             P: IsA<CheckMenuItem>,
661             F: Fn(&P) + 'static,
662         >(
663             this: *mut ffi::GtkCheckMenuItem,
664             _param_spec: glib::ffi::gpointer,
665             f: glib::ffi::gpointer,
666         ) {
667             let f: &F = &*(f as *const F);
668             f(CheckMenuItem::from_glib_borrow(this).unsafe_cast_ref())
669         }
670         unsafe {
671             let f: Box_<F> = Box_::new(f);
672             connect_raw(
673                 self.as_ptr() as *mut _,
674                 b"notify::draw-as-radio\0".as_ptr() as *const _,
675                 Some(transmute::<_, unsafe extern "C" fn()>(
676                     notify_draw_as_radio_trampoline::<Self, F> as *const (),
677                 )),
678                 Box_::into_raw(f),
679             )
680         }
681     }
682 
connect_inconsistent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId683     fn connect_inconsistent_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
684         unsafe extern "C" fn notify_inconsistent_trampoline<
685             P: IsA<CheckMenuItem>,
686             F: Fn(&P) + 'static,
687         >(
688             this: *mut ffi::GtkCheckMenuItem,
689             _param_spec: glib::ffi::gpointer,
690             f: glib::ffi::gpointer,
691         ) {
692             let f: &F = &*(f as *const F);
693             f(CheckMenuItem::from_glib_borrow(this).unsafe_cast_ref())
694         }
695         unsafe {
696             let f: Box_<F> = Box_::new(f);
697             connect_raw(
698                 self.as_ptr() as *mut _,
699                 b"notify::inconsistent\0".as_ptr() as *const _,
700                 Some(transmute::<_, unsafe extern "C" fn()>(
701                     notify_inconsistent_trampoline::<Self, F> as *const (),
702                 )),
703                 Box_::into_raw(f),
704             )
705         }
706     }
707 }
708 
709 impl fmt::Display for CheckMenuItem {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result710     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
711         f.write_str("CheckMenuItem")
712     }
713 }
714