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::Adjustment;
6 use crate::Buildable;
7 use crate::ResizeMode;
8 use crate::Widget;
9 use crate::WidgetPath;
10 use glib::object::Cast;
11 use glib::object::IsA;
12 use glib::signal::connect_raw;
13 use glib::signal::SignalHandlerId;
14 use glib::translate::*;
15 use glib::StaticType;
16 use glib::ToValue;
17 use std::boxed::Box as Box_;
18 use std::fmt;
19 use std::mem::transmute;
20 
21 glib::wrapper! {
22     #[doc(alias = "GtkContainer")]
23     pub struct Container(Object<ffi::GtkContainer, ffi::GtkContainerClass>) @extends Widget, @implements Buildable;
24 
25     match fn {
26         type_ => || ffi::gtk_container_get_type(),
27     }
28 }
29 
30 pub const NONE_CONTAINER: Option<&Container> = None;
31 
32 pub trait ContainerExt: 'static {
33     #[doc(alias = "gtk_container_add")]
add<P: IsA<Widget>>(&self, widget: &P)34     fn add<P: IsA<Widget>>(&self, widget: &P);
35 
36     //#[doc(alias = "gtk_container_add_with_properties")]
37     //fn add_with_properties<P: IsA<Widget>>(&self, widget: &P, first_prop_name: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs);
38 
39     #[doc(alias = "gtk_container_check_resize")]
check_resize(&self)40     fn check_resize(&self);
41 
42     //#[doc(alias = "gtk_container_child_get")]
43     //fn child_get<P: IsA<Widget>>(&self, child: &P, first_prop_name: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs);
44 
45     //#[doc(alias = "gtk_container_child_get_valist")]
46     //fn child_get_valist<P: IsA<Widget>>(&self, child: &P, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported);
47 
48     #[doc(alias = "gtk_container_child_notify")]
child_notify<P: IsA<Widget>>(&self, child: &P, child_property: &str)49     fn child_notify<P: IsA<Widget>>(&self, child: &P, child_property: &str);
50 
51     #[doc(alias = "gtk_container_child_notify_by_pspec")]
child_notify_by_pspec<P: IsA<Widget>>(&self, child: &P, pspec: &glib::ParamSpec)52     fn child_notify_by_pspec<P: IsA<Widget>>(&self, child: &P, pspec: &glib::ParamSpec);
53 
54     //#[doc(alias = "gtk_container_child_set")]
55     //fn child_set<P: IsA<Widget>>(&self, child: &P, first_prop_name: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs);
56 
57     //#[doc(alias = "gtk_container_child_set_valist")]
58     //fn child_set_valist<P: IsA<Widget>>(&self, child: &P, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported);
59 
60     #[doc(alias = "gtk_container_child_type")]
child_type(&self) -> glib::types::Type61     fn child_type(&self) -> glib::types::Type;
62 
63     #[doc(alias = "gtk_container_forall")]
forall<P: FnMut(&Widget)>(&self, callback: P)64     fn forall<P: FnMut(&Widget)>(&self, callback: P);
65 
66     #[doc(alias = "gtk_container_foreach")]
foreach<P: FnMut(&Widget)>(&self, callback: P)67     fn foreach<P: FnMut(&Widget)>(&self, callback: P);
68 
69     #[doc(alias = "gtk_container_get_border_width")]
70     #[doc(alias = "get_border_width")]
border_width(&self) -> u3271     fn border_width(&self) -> u32;
72 
73     #[doc(alias = "gtk_container_get_children")]
74     #[doc(alias = "get_children")]
children(&self) -> Vec<Widget>75     fn children(&self) -> Vec<Widget>;
76 
77     //#[cfg_attr(feature = "v3_24", deprecated = "Since 3.24")]
78     //#[doc(alias = "gtk_container_get_focus_chain")]
79     //#[doc(alias = "get_focus_chain")]
80     //fn focus_chain(&self, focusable_widgets: /*Unimplemented*/Vec<Widget>) -> bool;
81 
82     #[doc(alias = "gtk_container_get_focus_child")]
83     #[doc(alias = "get_focus_child")]
focus_child(&self) -> Option<Widget>84     fn focus_child(&self) -> Option<Widget>;
85 
86     #[doc(alias = "gtk_container_get_focus_hadjustment")]
87     #[doc(alias = "get_focus_hadjustment")]
focus_hadjustment(&self) -> Option<Adjustment>88     fn focus_hadjustment(&self) -> Option<Adjustment>;
89 
90     #[doc(alias = "gtk_container_get_focus_vadjustment")]
91     #[doc(alias = "get_focus_vadjustment")]
focus_vadjustment(&self) -> Option<Adjustment>92     fn focus_vadjustment(&self) -> Option<Adjustment>;
93 
94     #[doc(alias = "gtk_container_get_path_for_child")]
95     #[doc(alias = "get_path_for_child")]
path_for_child<P: IsA<Widget>>(&self, child: &P) -> Option<WidgetPath>96     fn path_for_child<P: IsA<Widget>>(&self, child: &P) -> Option<WidgetPath>;
97 
98     #[doc(alias = "gtk_container_propagate_draw")]
propagate_draw<P: IsA<Widget>>(&self, child: &P, cr: &cairo::Context)99     fn propagate_draw<P: IsA<Widget>>(&self, child: &P, cr: &cairo::Context);
100 
101     #[doc(alias = "gtk_container_remove")]
remove<P: IsA<Widget>>(&self, widget: &P)102     fn remove<P: IsA<Widget>>(&self, widget: &P);
103 
104     #[doc(alias = "gtk_container_set_border_width")]
set_border_width(&self, border_width: u32)105     fn set_border_width(&self, border_width: u32);
106 
107     #[cfg_attr(feature = "v3_24", deprecated = "Since 3.24")]
108     #[doc(alias = "gtk_container_set_focus_chain")]
set_focus_chain(&self, focusable_widgets: &[Widget])109     fn set_focus_chain(&self, focusable_widgets: &[Widget]);
110 
111     #[doc(alias = "gtk_container_set_focus_child")]
set_focus_child<P: IsA<Widget>>(&self, child: Option<&P>)112     fn set_focus_child<P: IsA<Widget>>(&self, child: Option<&P>);
113 
114     #[doc(alias = "gtk_container_set_focus_hadjustment")]
set_focus_hadjustment<P: IsA<Adjustment>>(&self, adjustment: &P)115     fn set_focus_hadjustment<P: IsA<Adjustment>>(&self, adjustment: &P);
116 
117     #[doc(alias = "gtk_container_set_focus_vadjustment")]
set_focus_vadjustment<P: IsA<Adjustment>>(&self, adjustment: &P)118     fn set_focus_vadjustment<P: IsA<Adjustment>>(&self, adjustment: &P);
119 
120     #[cfg_attr(feature = "v3_24", deprecated = "Since 3.24")]
121     #[doc(alias = "gtk_container_unset_focus_chain")]
unset_focus_chain(&self)122     fn unset_focus_chain(&self);
123 
set_child<P: IsA<Widget>>(&self, child: Option<&P>)124     fn set_child<P: IsA<Widget>>(&self, child: Option<&P>);
125 
126     #[doc(alias = "resize-mode")]
resize_mode(&self) -> ResizeMode127     fn resize_mode(&self) -> ResizeMode;
128 
129     #[doc(alias = "resize-mode")]
set_resize_mode(&self, resize_mode: ResizeMode)130     fn set_resize_mode(&self, resize_mode: ResizeMode);
131 
132     #[doc(alias = "add")]
connect_add<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId133     fn connect_add<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId;
134 
135     #[doc(alias = "check-resize")]
connect_check_resize<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId136     fn connect_check_resize<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
137 
138     #[doc(alias = "remove")]
connect_remove<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId139     fn connect_remove<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId;
140 
141     #[doc(alias = "set-focus-child")]
connect_set_focus_child<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId142     fn connect_set_focus_child<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId;
143 
144     #[doc(alias = "border-width")]
connect_border_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId145     fn connect_border_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
146 
147     #[doc(alias = "child")]
connect_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId148     fn connect_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
149 
150     #[doc(alias = "resize-mode")]
connect_resize_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId151     fn connect_resize_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId;
152 }
153 
154 impl<O: IsA<Container>> ContainerExt for O {
add<P: IsA<Widget>>(&self, widget: &P)155     fn add<P: IsA<Widget>>(&self, widget: &P) {
156         unsafe {
157             ffi::gtk_container_add(
158                 self.as_ref().to_glib_none().0,
159                 widget.as_ref().to_glib_none().0,
160             );
161         }
162     }
163 
164     //fn add_with_properties<P: IsA<Widget>>(&self, widget: &P, first_prop_name: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) {
165     //    unsafe { TODO: call ffi:gtk_container_add_with_properties() }
166     //}
167 
check_resize(&self)168     fn check_resize(&self) {
169         unsafe {
170             ffi::gtk_container_check_resize(self.as_ref().to_glib_none().0);
171         }
172     }
173 
174     //fn child_get<P: IsA<Widget>>(&self, child: &P, first_prop_name: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) {
175     //    unsafe { TODO: call ffi:gtk_container_child_get() }
176     //}
177 
178     //fn child_get_valist<P: IsA<Widget>>(&self, child: &P, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) {
179     //    unsafe { TODO: call ffi:gtk_container_child_get_valist() }
180     //}
181 
child_notify<P: IsA<Widget>>(&self, child: &P, child_property: &str)182     fn child_notify<P: IsA<Widget>>(&self, child: &P, child_property: &str) {
183         unsafe {
184             ffi::gtk_container_child_notify(
185                 self.as_ref().to_glib_none().0,
186                 child.as_ref().to_glib_none().0,
187                 child_property.to_glib_none().0,
188             );
189         }
190     }
191 
child_notify_by_pspec<P: IsA<Widget>>(&self, child: &P, pspec: &glib::ParamSpec)192     fn child_notify_by_pspec<P: IsA<Widget>>(&self, child: &P, pspec: &glib::ParamSpec) {
193         unsafe {
194             ffi::gtk_container_child_notify_by_pspec(
195                 self.as_ref().to_glib_none().0,
196                 child.as_ref().to_glib_none().0,
197                 pspec.to_glib_none().0,
198             );
199         }
200     }
201 
202     //fn child_set<P: IsA<Widget>>(&self, child: &P, first_prop_name: &str, : /*Unknown conversion*//*Unimplemented*/Fundamental: VarArgs) {
203     //    unsafe { TODO: call ffi:gtk_container_child_set() }
204     //}
205 
206     //fn child_set_valist<P: IsA<Widget>>(&self, child: &P, first_property_name: &str, var_args: /*Unknown conversion*//*Unimplemented*/Unsupported) {
207     //    unsafe { TODO: call ffi:gtk_container_child_set_valist() }
208     //}
209 
child_type(&self) -> glib::types::Type210     fn child_type(&self) -> glib::types::Type {
211         unsafe {
212             from_glib(ffi::gtk_container_child_type(
213                 self.as_ref().to_glib_none().0,
214             ))
215         }
216     }
217 
forall<P: FnMut(&Widget)>(&self, callback: P)218     fn forall<P: FnMut(&Widget)>(&self, callback: P) {
219         let callback_data: P = callback;
220         unsafe extern "C" fn callback_func<P: FnMut(&Widget)>(
221             widget: *mut ffi::GtkWidget,
222             data: glib::ffi::gpointer,
223         ) {
224             let widget = from_glib_borrow(widget);
225             let callback: *mut P = data as *const _ as usize as *mut P;
226             (*callback)(&widget);
227         }
228         let callback = Some(callback_func::<P> as _);
229         let super_callback0: &P = &callback_data;
230         unsafe {
231             ffi::gtk_container_forall(
232                 self.as_ref().to_glib_none().0,
233                 callback,
234                 super_callback0 as *const _ as usize as *mut _,
235             );
236         }
237     }
238 
foreach<P: FnMut(&Widget)>(&self, callback: P)239     fn foreach<P: FnMut(&Widget)>(&self, callback: P) {
240         let callback_data: P = callback;
241         unsafe extern "C" fn callback_func<P: FnMut(&Widget)>(
242             widget: *mut ffi::GtkWidget,
243             data: glib::ffi::gpointer,
244         ) {
245             let widget = from_glib_borrow(widget);
246             let callback: *mut P = data as *const _ as usize as *mut P;
247             (*callback)(&widget);
248         }
249         let callback = Some(callback_func::<P> as _);
250         let super_callback0: &P = &callback_data;
251         unsafe {
252             ffi::gtk_container_foreach(
253                 self.as_ref().to_glib_none().0,
254                 callback,
255                 super_callback0 as *const _ as usize as *mut _,
256             );
257         }
258     }
259 
border_width(&self) -> u32260     fn border_width(&self) -> u32 {
261         unsafe { ffi::gtk_container_get_border_width(self.as_ref().to_glib_none().0) }
262     }
263 
children(&self) -> Vec<Widget>264     fn children(&self) -> Vec<Widget> {
265         unsafe {
266             FromGlibPtrContainer::from_glib_container(ffi::gtk_container_get_children(
267                 self.as_ref().to_glib_none().0,
268             ))
269         }
270     }
271 
272     //fn focus_chain(&self, focusable_widgets: /*Unimplemented*/Vec<Widget>) -> bool {
273     //    unsafe { TODO: call ffi:gtk_container_get_focus_chain() }
274     //}
275 
focus_child(&self) -> Option<Widget>276     fn focus_child(&self) -> Option<Widget> {
277         unsafe {
278             from_glib_none(ffi::gtk_container_get_focus_child(
279                 self.as_ref().to_glib_none().0,
280             ))
281         }
282     }
283 
focus_hadjustment(&self) -> Option<Adjustment>284     fn focus_hadjustment(&self) -> Option<Adjustment> {
285         unsafe {
286             from_glib_none(ffi::gtk_container_get_focus_hadjustment(
287                 self.as_ref().to_glib_none().0,
288             ))
289         }
290     }
291 
focus_vadjustment(&self) -> Option<Adjustment>292     fn focus_vadjustment(&self) -> Option<Adjustment> {
293         unsafe {
294             from_glib_none(ffi::gtk_container_get_focus_vadjustment(
295                 self.as_ref().to_glib_none().0,
296             ))
297         }
298     }
299 
path_for_child<P: IsA<Widget>>(&self, child: &P) -> Option<WidgetPath>300     fn path_for_child<P: IsA<Widget>>(&self, child: &P) -> Option<WidgetPath> {
301         unsafe {
302             from_glib_full(ffi::gtk_container_get_path_for_child(
303                 self.as_ref().to_glib_none().0,
304                 child.as_ref().to_glib_none().0,
305             ))
306         }
307     }
308 
propagate_draw<P: IsA<Widget>>(&self, child: &P, cr: &cairo::Context)309     fn propagate_draw<P: IsA<Widget>>(&self, child: &P, cr: &cairo::Context) {
310         unsafe {
311             ffi::gtk_container_propagate_draw(
312                 self.as_ref().to_glib_none().0,
313                 child.as_ref().to_glib_none().0,
314                 mut_override(cr.to_glib_none().0),
315             );
316         }
317     }
318 
remove<P: IsA<Widget>>(&self, widget: &P)319     fn remove<P: IsA<Widget>>(&self, widget: &P) {
320         unsafe {
321             ffi::gtk_container_remove(
322                 self.as_ref().to_glib_none().0,
323                 widget.as_ref().to_glib_none().0,
324             );
325         }
326     }
327 
set_border_width(&self, border_width: u32)328     fn set_border_width(&self, border_width: u32) {
329         unsafe {
330             ffi::gtk_container_set_border_width(self.as_ref().to_glib_none().0, border_width);
331         }
332     }
333 
set_focus_chain(&self, focusable_widgets: &[Widget])334     fn set_focus_chain(&self, focusable_widgets: &[Widget]) {
335         unsafe {
336             ffi::gtk_container_set_focus_chain(
337                 self.as_ref().to_glib_none().0,
338                 focusable_widgets.to_glib_none().0,
339             );
340         }
341     }
342 
set_focus_child<P: IsA<Widget>>(&self, child: Option<&P>)343     fn set_focus_child<P: IsA<Widget>>(&self, child: Option<&P>) {
344         unsafe {
345             ffi::gtk_container_set_focus_child(
346                 self.as_ref().to_glib_none().0,
347                 child.map(|p| p.as_ref()).to_glib_none().0,
348             );
349         }
350     }
351 
set_focus_hadjustment<P: IsA<Adjustment>>(&self, adjustment: &P)352     fn set_focus_hadjustment<P: IsA<Adjustment>>(&self, adjustment: &P) {
353         unsafe {
354             ffi::gtk_container_set_focus_hadjustment(
355                 self.as_ref().to_glib_none().0,
356                 adjustment.as_ref().to_glib_none().0,
357             );
358         }
359     }
360 
set_focus_vadjustment<P: IsA<Adjustment>>(&self, adjustment: &P)361     fn set_focus_vadjustment<P: IsA<Adjustment>>(&self, adjustment: &P) {
362         unsafe {
363             ffi::gtk_container_set_focus_vadjustment(
364                 self.as_ref().to_glib_none().0,
365                 adjustment.as_ref().to_glib_none().0,
366             );
367         }
368     }
369 
unset_focus_chain(&self)370     fn unset_focus_chain(&self) {
371         unsafe {
372             ffi::gtk_container_unset_focus_chain(self.as_ref().to_glib_none().0);
373         }
374     }
375 
set_child<P: IsA<Widget>>(&self, child: Option<&P>)376     fn set_child<P: IsA<Widget>>(&self, child: Option<&P>) {
377         unsafe {
378             glib::gobject_ffi::g_object_set_property(
379                 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
380                 b"child\0".as_ptr() as *const _,
381                 child.to_value().to_glib_none().0,
382             );
383         }
384     }
385 
resize_mode(&self) -> ResizeMode386     fn resize_mode(&self) -> ResizeMode {
387         unsafe {
388             let mut value = glib::Value::from_type(<ResizeMode as StaticType>::static_type());
389             glib::gobject_ffi::g_object_get_property(
390                 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
391                 b"resize-mode\0".as_ptr() as *const _,
392                 value.to_glib_none_mut().0,
393             );
394             value
395                 .get()
396                 .expect("Return Value for property `resize-mode` getter")
397         }
398     }
399 
set_resize_mode(&self, resize_mode: ResizeMode)400     fn set_resize_mode(&self, resize_mode: ResizeMode) {
401         unsafe {
402             glib::gobject_ffi::g_object_set_property(
403                 self.to_glib_none().0 as *mut glib::gobject_ffi::GObject,
404                 b"resize-mode\0".as_ptr() as *const _,
405                 resize_mode.to_value().to_glib_none().0,
406             );
407         }
408     }
409 
connect_add<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId410     fn connect_add<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId {
411         unsafe extern "C" fn add_trampoline<P: IsA<Container>, F: Fn(&P, &Widget) + 'static>(
412             this: *mut ffi::GtkContainer,
413             object: *mut ffi::GtkWidget,
414             f: glib::ffi::gpointer,
415         ) {
416             let f: &F = &*(f as *const F);
417             f(
418                 Container::from_glib_borrow(this).unsafe_cast_ref(),
419                 &from_glib_borrow(object),
420             )
421         }
422         unsafe {
423             let f: Box_<F> = Box_::new(f);
424             connect_raw(
425                 self.as_ptr() as *mut _,
426                 b"add\0".as_ptr() as *const _,
427                 Some(transmute::<_, unsafe extern "C" fn()>(
428                     add_trampoline::<Self, F> as *const (),
429                 )),
430                 Box_::into_raw(f),
431             )
432         }
433     }
434 
connect_check_resize<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId435     fn connect_check_resize<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
436         unsafe extern "C" fn check_resize_trampoline<P: IsA<Container>, F: Fn(&P) + 'static>(
437             this: *mut ffi::GtkContainer,
438             f: glib::ffi::gpointer,
439         ) {
440             let f: &F = &*(f as *const F);
441             f(Container::from_glib_borrow(this).unsafe_cast_ref())
442         }
443         unsafe {
444             let f: Box_<F> = Box_::new(f);
445             connect_raw(
446                 self.as_ptr() as *mut _,
447                 b"check-resize\0".as_ptr() as *const _,
448                 Some(transmute::<_, unsafe extern "C" fn()>(
449                     check_resize_trampoline::<Self, F> as *const (),
450                 )),
451                 Box_::into_raw(f),
452             )
453         }
454     }
455 
connect_remove<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId456     fn connect_remove<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId {
457         unsafe extern "C" fn remove_trampoline<P: IsA<Container>, F: Fn(&P, &Widget) + 'static>(
458             this: *mut ffi::GtkContainer,
459             object: *mut ffi::GtkWidget,
460             f: glib::ffi::gpointer,
461         ) {
462             let f: &F = &*(f as *const F);
463             f(
464                 Container::from_glib_borrow(this).unsafe_cast_ref(),
465                 &from_glib_borrow(object),
466             )
467         }
468         unsafe {
469             let f: Box_<F> = Box_::new(f);
470             connect_raw(
471                 self.as_ptr() as *mut _,
472                 b"remove\0".as_ptr() as *const _,
473                 Some(transmute::<_, unsafe extern "C" fn()>(
474                     remove_trampoline::<Self, F> as *const (),
475                 )),
476                 Box_::into_raw(f),
477             )
478         }
479     }
480 
connect_set_focus_child<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId481     fn connect_set_focus_child<F: Fn(&Self, &Widget) + 'static>(&self, f: F) -> SignalHandlerId {
482         unsafe extern "C" fn set_focus_child_trampoline<
483             P: IsA<Container>,
484             F: Fn(&P, &Widget) + 'static,
485         >(
486             this: *mut ffi::GtkContainer,
487             object: *mut ffi::GtkWidget,
488             f: glib::ffi::gpointer,
489         ) {
490             let f: &F = &*(f as *const F);
491             f(
492                 Container::from_glib_borrow(this).unsafe_cast_ref(),
493                 &from_glib_borrow(object),
494             )
495         }
496         unsafe {
497             let f: Box_<F> = Box_::new(f);
498             connect_raw(
499                 self.as_ptr() as *mut _,
500                 b"set-focus-child\0".as_ptr() as *const _,
501                 Some(transmute::<_, unsafe extern "C" fn()>(
502                     set_focus_child_trampoline::<Self, F> as *const (),
503                 )),
504                 Box_::into_raw(f),
505             )
506         }
507     }
508 
connect_border_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId509     fn connect_border_width_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
510         unsafe extern "C" fn notify_border_width_trampoline<
511             P: IsA<Container>,
512             F: Fn(&P) + 'static,
513         >(
514             this: *mut ffi::GtkContainer,
515             _param_spec: glib::ffi::gpointer,
516             f: glib::ffi::gpointer,
517         ) {
518             let f: &F = &*(f as *const F);
519             f(Container::from_glib_borrow(this).unsafe_cast_ref())
520         }
521         unsafe {
522             let f: Box_<F> = Box_::new(f);
523             connect_raw(
524                 self.as_ptr() as *mut _,
525                 b"notify::border-width\0".as_ptr() as *const _,
526                 Some(transmute::<_, unsafe extern "C" fn()>(
527                     notify_border_width_trampoline::<Self, F> as *const (),
528                 )),
529                 Box_::into_raw(f),
530             )
531         }
532     }
533 
connect_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId534     fn connect_child_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
535         unsafe extern "C" fn notify_child_trampoline<P: IsA<Container>, F: Fn(&P) + 'static>(
536             this: *mut ffi::GtkContainer,
537             _param_spec: glib::ffi::gpointer,
538             f: glib::ffi::gpointer,
539         ) {
540             let f: &F = &*(f as *const F);
541             f(Container::from_glib_borrow(this).unsafe_cast_ref())
542         }
543         unsafe {
544             let f: Box_<F> = Box_::new(f);
545             connect_raw(
546                 self.as_ptr() as *mut _,
547                 b"notify::child\0".as_ptr() as *const _,
548                 Some(transmute::<_, unsafe extern "C" fn()>(
549                     notify_child_trampoline::<Self, F> as *const (),
550                 )),
551                 Box_::into_raw(f),
552             )
553         }
554     }
555 
connect_resize_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId556     fn connect_resize_mode_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId {
557         unsafe extern "C" fn notify_resize_mode_trampoline<
558             P: IsA<Container>,
559             F: Fn(&P) + 'static,
560         >(
561             this: *mut ffi::GtkContainer,
562             _param_spec: glib::ffi::gpointer,
563             f: glib::ffi::gpointer,
564         ) {
565             let f: &F = &*(f as *const F);
566             f(Container::from_glib_borrow(this).unsafe_cast_ref())
567         }
568         unsafe {
569             let f: Box_<F> = Box_::new(f);
570             connect_raw(
571                 self.as_ptr() as *mut _,
572                 b"notify::resize-mode\0".as_ptr() as *const _,
573                 Some(transmute::<_, unsafe extern "C" fn()>(
574                     notify_resize_mode_trampoline::<Self, F> as *const (),
575                 )),
576                 Box_::into_raw(f),
577             )
578         }
579     }
580 }
581 
582 impl fmt::Display for Container {
fmt(&self, f: &mut fmt::Formatter) -> fmt::Result583     fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
584         f.write_str("Container")
585     }
586 }
587