gtk/auto/
box_.rs

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