1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
// This file is auto-generated by rute_gen. DO NOT EDIT.
use std::cell::Cell;
use std::rc::Rc;

#[allow(unused_imports)]
use std::marker::PhantomData;

#[allow(unused_imports)]
use std::os::raw::c_void;

#[allow(unused_imports)]
use std::mem::transmute;

#[allow(unused_imports)]
use std::ffi::{CStr, CString};

use rute_ffi_base::*;

#[allow(unused_imports)]
use auto::*;

/// **Notice these docs are heavy WIP and not very relevent yet**
///
/// QGridLayout takes the space made available to it (by its parent
/// layout or by the parentWidget()), divides it up into rows and
/// columns, and puts each widget it manages into the correct cell.
///
/// Columns and rows behave identically; we will discuss columns, but
/// there are equivalent functions for rows.
///
/// Each column has a minimum width and a stretch factor. The minimum
/// width is the greatest of that set using setColumnMinimumWidth() and the
/// minimum width of each widget in that column. The stretch factor is
/// set using setColumnStretch() and determines how much of the available
/// space the column will get over and above its necessary minimum.
///
/// Normally, each managed widget or layout is put into a cell of its
/// own using addWidget(). It is also possible for a widget to occupy
/// multiple cells using the row and column spanning overloads of
/// addItem() and addWidget(). If you do this, QGridLayout will guess
/// how to distribute the size over the columns/rows (based on the
/// stretch factors).
///
/// To remove a widget from a layout, call removeWidget(). Calling
/// QWidget::hide() on a widget also effectively removes the widget
/// from the layout until QWidget::show() is called.
///
/// This illustration shows a fragment of a dialog with a five-column,
/// three-row grid (the grid is shown overlaid in magenta):
///
/// ![A grid layout](gridlayout.png)
///
/// Columns 0, 2 and 4 in this dialog fragment are made up of a
/// QLabel, a QLineEdit, and a QListBox. Columns 1 and 3 are
/// placeholders made with setColumnMinimumWidth(). Row 0 consists of three
/// QLabel objects, row 1 of three QLineEdit objects and row 2 of
/// three QListBox objects. We used placeholder columns (1 and 3) to
/// get the right amount of space between the columns.
///
/// Note that the columns and rows are not equally wide or tall. If
/// you want two columns to have the same width, you must set their
/// minimum widths and stretch factors to be the same yourself. You do
/// this using setColumnMinimumWidth() and setColumnStretch().
///
/// If the QGridLayout is not the top-level layout (i.e. does not
/// manage all of the widget's area and children), you must add it to
/// its parent layout when you create it, but before you do anything
/// with it. The normal way to add a layout is by calling
/// addLayout() on the parent layout.
///
/// Once you have added your layout you can start putting widgets and
/// other layouts into the cells of your grid layout using
/// addWidget(), addItem(), and addLayout().
///
/// QGridLayout also includes two margin widths:
/// the [contents margin](getContentsMargins())
/// and the spacing().
/// The contents margin is the width of the reserved space along each
/// of the QGridLayout's four sides. The spacing() is the width of the
/// automatically allocated spacing between neighboring boxes.
///
/// The default contents margin values are provided by the
/// [style](QStyle::pixelMetric())
/// . The default value Qt styles specify
/// is 9 for child widgets and 11 for windows. The spacing defaults to the same as
/// the margin width for a top-level layout, or to the same as the
/// parent layout.
///
/// **See also:** [`BoxLayout`]
/// [`StackedLayout`]
/// {Layout Management}
/// {Basic Layouts Example}
/// # Licence
///
/// The documentation is an adoption of the original [Qt Documentation](http://doc.qt.io/) and provided herein is licensed under the terms of the [GNU Free Documentation License version 1.3](http://www.gnu.org/licenses/fdl.html) as published by the Free Software Foundation.
#[derive(Clone)]
pub struct GridLayout<'a> {
    #[doc(hidden)]
    pub data: Rc<Cell<Option<*const RUBase>>>,
    #[doc(hidden)]
    pub all_funcs: *const RUGridLayoutAllFuncs,
    #[doc(hidden)]
    pub owned: bool,
    #[doc(hidden)]
    pub _marker: PhantomData<::std::cell::Cell<&'a ()>>,
}

impl<'a> GridLayout<'a> {
    pub fn new() -> GridLayout<'a> {
        let data = Rc::new(Cell::new(None));

        let ffi_data = unsafe {
            ((*rute_ffi_get()).create_grid_layout)(
                ::std::ptr::null(),
                transmute(rute_object_delete_callback as usize),
                Rc::into_raw(data.clone()) as *const c_void,
            )
        };

        data.set(Some(ffi_data.qt_data));

        GridLayout {
            data,
            all_funcs: ffi_data.all_funcs,
            owned: true,
            _marker: PhantomData,
        }
    }
    #[allow(dead_code)]
    pub(crate) fn new_from_rc(ffi_data: RUGridLayout) -> GridLayout<'a> {
        GridLayout {
            data: unsafe { Rc::from_raw(ffi_data.host_data as *const Cell<Option<*const RUBase>>) },
            all_funcs: ffi_data.all_funcs,
            owned: false,
            _marker: PhantomData,
        }
    }

    #[allow(dead_code)]
    pub(crate) fn new_from_owned(ffi_data: RUGridLayout) -> GridLayout<'a> {
        GridLayout {
            data: Rc::new(Cell::new(Some(ffi_data.qt_data as *const RUBase))),
            all_funcs: ffi_data.all_funcs,
            owned: true,
            _marker: PhantomData,
        }
    }

    #[allow(dead_code)]
    pub(crate) fn new_from_temporary(ffi_data: RUGridLayout) -> GridLayout<'a> {
        GridLayout {
            data: Rc::new(Cell::new(Some(ffi_data.qt_data as *const RUBase))),
            all_funcs: ffi_data.all_funcs,
            owned: false,
            _marker: PhantomData,
        }
    }
    pub fn set_horizontal_spacing(&self, spacing: i32) -> &Self {
        let (obj_data, funcs) = self.get_grid_layout_obj_funcs();
        unsafe {
            ((*funcs).set_horizontal_spacing)(obj_data, spacing);
        }
        self
    }
    ///
    /// If no value is explicitly set, the layout's horizontal spacing is
    /// inherited from the parent layout, or from the style settings for
    /// the parent widget.
    ///
    /// **See also:** verticalSpacing
    /// [`Style::pixel_metric`]
    /// {QStyle::}{PM_LayoutHorizontalSpacing}
    pub fn horizontal_spacing(&self) -> i32 {
        let (obj_data, funcs) = self.get_grid_layout_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).horizontal_spacing)(obj_data);
            ret_val
        }
    }
    pub fn set_vertical_spacing(&self, spacing: i32) -> &Self {
        let (obj_data, funcs) = self.get_grid_layout_obj_funcs();
        unsafe {
            ((*funcs).set_vertical_spacing)(obj_data, spacing);
        }
        self
    }
    ///
    /// If no value is explicitly set, the layout's vertical spacing is
    /// inherited from the parent layout, or from the style settings for
    /// the parent widget.
    ///
    /// **See also:** horizontalSpacing
    /// [`Style::pixel_metric`]
    /// {QStyle::}{PM_LayoutHorizontalSpacing}
    pub fn vertical_spacing(&self) -> i32 {
        let (obj_data, funcs) = self.get_grid_layout_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).vertical_spacing)(obj_data);
            ret_val
        }
    }
    ///
    /// This function sets both the vertical and horizontal spacing to
    /// *spacing.*
    ///
    /// **See also:** [`set_vertical_spacing()`]
    /// [`set_horizontal_spacing()`]
    pub fn set_spacing(&self, spacing: i32) -> &Self {
        let (obj_data, funcs) = self.get_grid_layout_obj_funcs();
        unsafe {
            ((*funcs).set_spacing)(obj_data, spacing);
        }
        self
    }
    ///
    /// If the vertical spacing is equal to the horizontal spacing,
    /// this function returns that value; otherwise it return -1.
    ///
    /// **See also:** [`set_spacing()`]
    /// [`vertical_spacing()`]
    /// [`horizontal_spacing()`]
    pub fn spacing(&self) -> i32 {
        let (obj_data, funcs) = self.get_grid_layout_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).spacing)(obj_data);
            ret_val
        }
    }
    ///
    /// Sets the minimum height of row *row* to *minSize* pixels.
    ///
    /// **See also:** [`row_minimum_height()`]
    /// [`set_column_minimum_width()`]
    pub fn set_row_minimum_height(&self, row: i32, min_size: i32) -> &Self {
        let (obj_data, funcs) = self.get_grid_layout_obj_funcs();
        unsafe {
            ((*funcs).set_row_minimum_height)(obj_data, row, min_size);
        }
        self
    }
    ///
    /// Sets the minimum width of column *column* to *minSize* pixels.
    ///
    /// **See also:** [`column_minimum_width()`]
    /// [`set_row_minimum_height()`]
    pub fn set_column_minimum_width(&self, column: i32, min_size: i32) -> &Self {
        let (obj_data, funcs) = self.get_grid_layout_obj_funcs();
        unsafe {
            ((*funcs).set_column_minimum_width)(obj_data, column, min_size);
        }
        self
    }
    ///
    /// Returns the minimum width set for row *row.*
    ///
    /// **See also:** [`set_row_minimum_height()`]
    pub fn row_minimum_height(&self, row: i32) -> i32 {
        let (obj_data, funcs) = self.get_grid_layout_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).row_minimum_height)(obj_data, row);
            ret_val
        }
    }
    ///
    /// Returns the column spacing for column *column.*
    ///
    /// **See also:** [`set_column_minimum_width()`]
    pub fn column_minimum_width(&self, column: i32) -> i32 {
        let (obj_data, funcs) = self.get_grid_layout_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).column_minimum_width)(obj_data, column);
            ret_val
        }
    }
    ///
    /// Returns the number of columns in this grid.
    pub fn column_count(&self) -> i32 {
        let (obj_data, funcs) = self.get_grid_layout_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).column_count)(obj_data);
            ret_val
        }
    }
    ///
    /// Returns the number of rows in this grid.
    pub fn row_count(&self) -> i32 {
        let (obj_data, funcs) = self.get_grid_layout_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).row_count)(obj_data);
            ret_val
        }
    }
    ///
    /// Returns the geometry of the cell with row *row* and column *column*
    /// in the grid. Returns an invalid rectangle if *row* or *column* is
    /// outside the grid.
    ///
    /// **Warning**: in the current version of Qt this function does not
    /// return valid results until setGeometry() has been called, i.e.
    /// after the parentWidget() is visible.
    pub fn cell_rect(&self, row: i32, column: i32) -> Rect {
        let (obj_data, funcs) = self.get_grid_layout_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).cell_rect)(obj_data, row, column);
            let t = ret_val;
            let ret_val;
            if t.host_data != ::std::ptr::null() {
                ret_val = Rect::new_from_rc(t);
            } else {
                ret_val = Rect::new_from_owned(t);
            }
            ret_val
        }
    }
    ///
    /// Adds the given *widget* to the cell grid at *row,* *column.* The
    /// top-left position is (0, 0) by default.
    ///
    /// The alignment is specified by *alignment.* The default
    /// alignment is 0, which means that the widget fills the entire cell.
    ///
    ///
    /// **Overloads**
    /// This version adds the given *widget* to the cell grid, spanning
    /// multiple rows/columns. The cell will start at *fromRow,* *fromColumn* spanning *rowSpan* rows and *columnSpan* columns. The
    /// *widget* will have the given *alignment.*
    ///
    /// If *rowSpan* and/or *columnSpan* is -1, then the widget will
    /// extend to the bottom and/or right edge, respectively.
    ///
    pub fn add_widget<W: WidgetTrait<'a>>(&self, w: &W) -> &Self {
        let (obj_w_1, _funcs) = w.get_widget_obj_funcs();

        let (obj_data, funcs) = self.get_grid_layout_obj_funcs();
        unsafe {
            ((*funcs).add_widget)(obj_data, obj_w_1);
        }
        self
    }
    ///
    /// Adds the given *widget* to the cell grid at *row,* *column.* The
    /// top-left position is (0, 0) by default.
    ///
    /// The alignment is specified by *alignment.* The default
    /// alignment is 0, which means that the widget fills the entire cell.
    ///
    ///
    /// **Overloads**
    /// This version adds the given *widget* to the cell grid, spanning
    /// multiple rows/columns. The cell will start at *fromRow,* *fromColumn* spanning *rowSpan* rows and *columnSpan* columns. The
    /// *widget* will have the given *alignment.*
    ///
    /// If *rowSpan* and/or *columnSpan* is -1, then the widget will
    /// extend to the bottom and/or right edge, respectively.
    ///
    pub fn add_widget_row_column<W: WidgetTrait<'a>>(
        &self,
        arg0: &W,
        row: i32,
        column: i32,
        arg1: Alignment,
    ) -> &Self {
        let (obj_arg0_1, _funcs) = arg0.get_widget_obj_funcs();
        let enum_arg1_4 = arg1.bits();

        let (obj_data, funcs) = self.get_grid_layout_obj_funcs();
        unsafe {
            ((*funcs).add_widget_row_column)(obj_data, obj_arg0_1, row, column, enum_arg1_4);
        }
        self
    }
    ///
    /// Adds the given *widget* to the cell grid at *row,* *column.* The
    /// top-left position is (0, 0) by default.
    ///
    /// The alignment is specified by *alignment.* The default
    /// alignment is 0, which means that the widget fills the entire cell.
    ///
    ///
    /// **Overloads**
    /// This version adds the given *widget* to the cell grid, spanning
    /// multiple rows/columns. The cell will start at *fromRow,* *fromColumn* spanning *rowSpan* rows and *columnSpan* columns. The
    /// *widget* will have the given *alignment.*
    ///
    /// If *rowSpan* and/or *columnSpan* is -1, then the widget will
    /// extend to the bottom and/or right edge, respectively.
    ///
    pub fn add_widget_row_column_span<W: WidgetTrait<'a>>(
        &self,
        arg0: &W,
        row: i32,
        column: i32,
        row_span: i32,
        column_span: i32,
        arg1: Alignment,
    ) -> &Self {
        let (obj_arg0_1, _funcs) = arg0.get_widget_obj_funcs();
        let enum_arg1_6 = arg1.bits();

        let (obj_data, funcs) = self.get_grid_layout_obj_funcs();
        unsafe {
            ((*funcs).add_widget_row_column_span)(
                obj_data,
                obj_arg0_1,
                row,
                column,
                row_span,
                column_span,
                enum_arg1_6,
            );
        }
        self
    }
    ///
    /// Places the *layout* at position ( *row,* *column)* in the grid. The
    /// top-left position is (0, 0).
    ///
    /// The alignment is specified by *alignment.* The default
    /// alignment is 0, which means that the widget fills the entire cell.
    ///
    /// A non-zero alignment indicates that the layout should not grow to
    /// fill the available space but should be sized according to
    /// sizeHint().
    ///
    /// *layout* becomes a child of the grid layout.
    ///
    /// **Overloads**  This version adds the layout *layout* to the cell grid, spanning multiple
    /// rows/columns. The cell will start at *row,* *column* spanning *rowSpan* rows and *columnSpan* columns.
    ///
    /// If *rowSpan* and/or *columnSpan* is -1, then the layout will extend to the bottom
    /// and/or right edge, respectively.
    pub fn add_layout<L: LayoutTrait<'a>>(
        &self,
        arg0: &L,
        row: i32,
        column: i32,
        arg1: Alignment,
    ) -> &Self {
        let (obj_arg0_1, _funcs) = arg0.get_layout_obj_funcs();
        let enum_arg1_4 = arg1.bits();

        let (obj_data, funcs) = self.get_grid_layout_obj_funcs();
        unsafe {
            ((*funcs).add_layout)(obj_data, obj_arg0_1, row, column, enum_arg1_4);
        }
        self
    }
    ///
    /// Places the *layout* at position ( *row,* *column)* in the grid. The
    /// top-left position is (0, 0).
    ///
    /// The alignment is specified by *alignment.* The default
    /// alignment is 0, which means that the widget fills the entire cell.
    ///
    /// A non-zero alignment indicates that the layout should not grow to
    /// fill the available space but should be sized according to
    /// sizeHint().
    ///
    /// *layout* becomes a child of the grid layout.
    ///
    /// **Overloads**  This version adds the layout *layout* to the cell grid, spanning multiple
    /// rows/columns. The cell will start at *row,* *column* spanning *rowSpan* rows and *columnSpan* columns.
    ///
    /// If *rowSpan* and/or *columnSpan* is -1, then the layout will extend to the bottom
    /// and/or right edge, respectively.
    pub fn add_layout_2<L: LayoutTrait<'a>>(
        &self,
        arg0: &L,
        row: i32,
        column: i32,
        row_span: i32,
        column_span: i32,
        arg1: Alignment,
    ) -> &Self {
        let (obj_arg0_1, _funcs) = arg0.get_layout_obj_funcs();
        let enum_arg1_6 = arg1.bits();

        let (obj_data, funcs) = self.get_grid_layout_obj_funcs();
        unsafe {
            ((*funcs).add_layout_2)(
                obj_data,
                obj_arg0_1,
                row,
                column,
                row_span,
                column_span,
                enum_arg1_6,
            );
        }
        self
    }
    ///
    /// Sets the grid's origin corner, i.e. position (0, 0), to *corner.*
    pub fn set_origin_corner(&self, arg0: Corner) -> &Self {
        let enum_arg0_1 = arg0 as u32;

        let (obj_data, funcs) = self.get_grid_layout_obj_funcs();
        unsafe {
            ((*funcs).set_origin_corner)(obj_data, enum_arg0_1);
        }
        self
    }
    ///
    /// Returns the corner that's used for the grid's origin, i.e. for
    /// position (0, 0).
    pub fn origin_corner(&self) -> Corner {
        let (obj_data, funcs) = self.get_grid_layout_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).origin_corner)(obj_data);
            let ret_val = { transmute::<u32, Corner>(ret_val) };
            ret_val
        }
    }
    ///
    /// Returns the layout item that occupies cell ( *row,* *column),* or 0 if
    /// the cell is empty.
    ///
    /// **See also:** [`get_item_position()`]
    /// [`index_of()`]
    pub fn item_at_position(&self, row: i32, column: i32) -> Option<LayoutItem> {
        let (obj_data, funcs) = self.get_grid_layout_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).item_at_position)(obj_data, row, column);
            if ret_val.qt_data == ::std::ptr::null() {
                return None;
            }
            let t = ret_val;
            let ret_val;
            if t.host_data != ::std::ptr::null() {
                ret_val = LayoutItem::new_from_rc(t);
            } else {
                ret_val = LayoutItem::new_from_owned(t);
            }
            Some(ret_val)
        }
    }
    pub fn count(&self) -> i32 {
        let (obj_data, funcs) = self.get_grid_layout_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).count)(obj_data);
            ret_val
        }
    }
    pub fn set_default_positioning(&self, n: i32, orient: Orientation) -> &Self {
        let enum_orient_2 = orient as u32;

        let (obj_data, funcs) = self.get_grid_layout_obj_funcs();
        unsafe {
            ((*funcs).set_default_positioning)(obj_data, n, enum_orient_2);
        }
        self
    }
    #[doc(hidden)]
    pub fn margin(&self) -> i32 {
        let (obj_data, funcs) = self.get_layout_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).margin)(obj_data);
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn set_margin(&self, arg0: i32) -> &Self {
        let (obj_data, funcs) = self.get_layout_obj_funcs();
        unsafe {
            ((*funcs).set_margin)(obj_data, arg0);
        }
        self
    }
    #[doc(hidden)]
    pub fn set_contents_margins(&self, left: i32, top: i32, right: i32, bottom: i32) -> &Self {
        let (obj_data, funcs) = self.get_layout_obj_funcs();
        unsafe {
            ((*funcs).set_contents_margins)(obj_data, left, top, right, bottom);
        }
        self
    }
    #[doc(hidden)]
    pub fn set_contents_margins_2<M: MarginsTrait<'a>>(&self, margins: &M) -> &Self {
        let (obj_margins_1, _funcs) = margins.get_margins_obj_funcs();

        let (obj_data, funcs) = self.get_layout_obj_funcs();
        unsafe {
            ((*funcs).set_contents_margins_2)(obj_data, obj_margins_1);
        }
        self
    }
    #[doc(hidden)]
    pub fn contents_margins(&self) -> Margins {
        let (obj_data, funcs) = self.get_layout_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).contents_margins)(obj_data);
            let t = ret_val;
            let ret_val;
            if t.host_data != ::std::ptr::null() {
                ret_val = Margins::new_from_rc(t);
            } else {
                ret_val = Margins::new_from_owned(t);
            }
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn contents_rect(&self) -> Rect {
        let (obj_data, funcs) = self.get_layout_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).contents_rect)(obj_data);
            let t = ret_val;
            let ret_val;
            if t.host_data != ::std::ptr::null() {
                ret_val = Rect::new_from_rc(t);
            } else {
                ret_val = Rect::new_from_owned(t);
            }
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn set_alignment<W: WidgetTrait<'a>>(&self, w: &W, alignment: Alignment) -> bool {
        let (obj_w_1, _funcs) = w.get_widget_obj_funcs();
        let enum_alignment_2 = alignment.bits();

        let (obj_data, funcs) = self.get_layout_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).set_alignment)(obj_data, obj_w_1, enum_alignment_2);
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn set_alignment_2<L: LayoutTrait<'a>>(&self, l: &L, alignment: Alignment) -> bool {
        let (obj_l_1, _funcs) = l.get_layout_obj_funcs();
        let enum_alignment_2 = alignment.bits();

        let (obj_data, funcs) = self.get_layout_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).set_alignment_2)(obj_data, obj_l_1, enum_alignment_2);
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn set_menu_bar<W: WidgetTrait<'a>>(&self, w: &W) -> &Self {
        let (obj_w_1, _funcs) = w.get_widget_obj_funcs();

        let (obj_data, funcs) = self.get_layout_obj_funcs();
        unsafe {
            ((*funcs).set_menu_bar)(obj_data, obj_w_1);
        }
        self
    }
    #[doc(hidden)]
    pub fn menu_bar(&self) -> Option<Widget> {
        let (obj_data, funcs) = self.get_layout_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).menu_bar)(obj_data);
            if ret_val.qt_data == ::std::ptr::null() {
                return None;
            }
            let t = ret_val;
            let ret_val;
            if t.host_data != ::std::ptr::null() {
                ret_val = Widget::new_from_rc(t);
            } else {
                ret_val = Widget::new_from_owned(t);
            }
            Some(ret_val)
        }
    }
    #[doc(hidden)]
    pub fn parent_widget(&self) -> Option<Widget> {
        let (obj_data, funcs) = self.get_layout_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).parent_widget)(obj_data);
            if ret_val.qt_data == ::std::ptr::null() {
                return None;
            }
            let t = ret_val;
            let ret_val;
            if t.host_data != ::std::ptr::null() {
                ret_val = Widget::new_from_rc(t);
            } else {
                ret_val = Widget::new_from_owned(t);
            }
            Some(ret_val)
        }
    }
    #[doc(hidden)]
    pub fn invalidate(&self) -> &Self {
        let (obj_data, funcs) = self.get_layout_obj_funcs();
        unsafe {
            ((*funcs).invalidate)(obj_data);
        }
        self
    }
    #[doc(hidden)]
    pub fn activate(&self) -> bool {
        let (obj_data, funcs) = self.get_layout_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).activate)(obj_data);
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn update(&self) -> &Self {
        let (obj_data, funcs) = self.get_layout_obj_funcs();
        unsafe {
            ((*funcs).update)(obj_data);
        }
        self
    }
    #[doc(hidden)]
    pub fn add_item<L: LayoutItemTrait<'a>>(&self, arg0: &L) -> &Self {
        let (obj_arg0_1, _funcs) = arg0.get_layout_item_obj_funcs();

        let (obj_data, funcs) = self.get_layout_obj_funcs();
        unsafe {
            ((*funcs).add_item)(obj_data, obj_arg0_1);
        }
        self
    }
    #[doc(hidden)]
    pub fn remove_widget<W: WidgetTrait<'a>>(&self, w: &W) -> &Self {
        let (obj_w_1, _funcs) = w.get_widget_obj_funcs();

        let (obj_data, funcs) = self.get_layout_obj_funcs();
        unsafe {
            ((*funcs).remove_widget)(obj_data, obj_w_1);
        }
        self
    }
    #[doc(hidden)]
    pub fn remove_item<L: LayoutItemTrait<'a>>(&self, arg0: &L) -> &Self {
        let (obj_arg0_1, _funcs) = arg0.get_layout_item_obj_funcs();

        let (obj_data, funcs) = self.get_layout_obj_funcs();
        unsafe {
            ((*funcs).remove_item)(obj_data, obj_arg0_1);
        }
        self
    }
    #[doc(hidden)]
    pub fn expanding_directions(&self) -> Orientations {
        let (obj_data, funcs) = self.get_layout_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).expanding_directions)(obj_data);
            let ret_val = Orientations::from_bits_truncate(ret_val);
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn minimum_size(&self) -> Size {
        let (obj_data, funcs) = self.get_layout_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).minimum_size)(obj_data);
            let t = ret_val;
            let ret_val;
            if t.host_data != ::std::ptr::null() {
                ret_val = Size::new_from_rc(t);
            } else {
                ret_val = Size::new_from_owned(t);
            }
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn maximum_size(&self) -> Size {
        let (obj_data, funcs) = self.get_layout_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).maximum_size)(obj_data);
            let t = ret_val;
            let ret_val;
            if t.host_data != ::std::ptr::null() {
                ret_val = Size::new_from_rc(t);
            } else {
                ret_val = Size::new_from_owned(t);
            }
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn item_at(&self, index: i32) -> Option<LayoutItem> {
        let (obj_data, funcs) = self.get_layout_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).item_at)(obj_data, index);
            if ret_val.qt_data == ::std::ptr::null() {
                return None;
            }
            let t = ret_val;
            let ret_val;
            if t.host_data != ::std::ptr::null() {
                ret_val = LayoutItem::new_from_rc(t);
            } else {
                ret_val = LayoutItem::new_from_owned(t);
            }
            Some(ret_val)
        }
    }
    #[doc(hidden)]
    pub fn take_at(&self, index: i32) -> Option<LayoutItem> {
        let (obj_data, funcs) = self.get_layout_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).take_at)(obj_data, index);
            if ret_val.qt_data == ::std::ptr::null() {
                return None;
            }
            let t = ret_val;
            let ret_val;
            if t.host_data != ::std::ptr::null() {
                ret_val = LayoutItem::new_from_rc(t);
            } else {
                ret_val = LayoutItem::new_from_owned(t);
            }
            Some(ret_val)
        }
    }
    #[doc(hidden)]
    pub fn index_of<W: WidgetTrait<'a>>(&self, arg0: &W) -> i32 {
        let (obj_arg0_1, _funcs) = arg0.get_widget_obj_funcs();

        let (obj_data, funcs) = self.get_layout_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).index_of)(obj_data, obj_arg0_1);
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn is_empty(&self) -> bool {
        let (obj_data, funcs) = self.get_layout_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).is_empty)(obj_data);
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn replace_widget<W: WidgetTrait<'a>>(
        &self,
        from: &W,
        to: &W,
        options: FindChildOptions,
    ) -> Option<LayoutItem> {
        let (obj_from_1, _funcs) = from.get_widget_obj_funcs();
        let (obj_to_2, _funcs) = to.get_widget_obj_funcs();
        let enum_options_3 = options.bits();

        let (obj_data, funcs) = self.get_layout_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).replace_widget)(obj_data, obj_from_1, obj_to_2, enum_options_3);
            if ret_val.qt_data == ::std::ptr::null() {
                return None;
            }
            let t = ret_val;
            let ret_val;
            if t.host_data != ::std::ptr::null() {
                ret_val = LayoutItem::new_from_rc(t);
            } else {
                ret_val = LayoutItem::new_from_owned(t);
            }
            Some(ret_val)
        }
    }
    #[doc(hidden)]
    pub fn total_height_for_width(&self, w: i32) -> i32 {
        let (obj_data, funcs) = self.get_layout_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).total_height_for_width)(obj_data, w);
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn total_minimum_size(&self) -> Size {
        let (obj_data, funcs) = self.get_layout_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).total_minimum_size)(obj_data);
            let t = ret_val;
            let ret_val;
            if t.host_data != ::std::ptr::null() {
                ret_val = Size::new_from_rc(t);
            } else {
                ret_val = Size::new_from_owned(t);
            }
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn total_maximum_size(&self) -> Size {
        let (obj_data, funcs) = self.get_layout_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).total_maximum_size)(obj_data);
            let t = ret_val;
            let ret_val;
            if t.host_data != ::std::ptr::null() {
                ret_val = Size::new_from_rc(t);
            } else {
                ret_val = Size::new_from_owned(t);
            }
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn total_size_hint(&self) -> Size {
        let (obj_data, funcs) = self.get_layout_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).total_size_hint)(obj_data);
            let t = ret_val;
            let ret_val;
            if t.host_data != ::std::ptr::null() {
                ret_val = Size::new_from_rc(t);
            } else {
                ret_val = Size::new_from_owned(t);
            }
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn layout(&self) -> Option<Layout> {
        let (obj_data, funcs) = self.get_layout_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).layout)(obj_data);
            if ret_val.qt_data == ::std::ptr::null() {
                return None;
            }
            let t = ret_val;
            let ret_val;
            if t.host_data != ::std::ptr::null() {
                ret_val = Layout::new_from_rc(t);
            } else {
                ret_val = Layout::new_from_owned(t);
            }
            Some(ret_val)
        }
    }
    #[doc(hidden)]
    pub fn set_size_constraint(&self, constraint: SizeConstraint) -> &Self {
        let enum_constraint_1 = constraint as u32;

        let (obj_data, funcs) = self.get_layout_obj_funcs();
        unsafe {
            ((*funcs).set_size_constraint)(obj_data, enum_constraint_1);
        }
        self
    }
    #[doc(hidden)]
    pub fn size_constraint(&self) -> SizeConstraint {
        let (obj_data, funcs) = self.get_layout_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).size_constraint)(obj_data);
            let ret_val = { transmute::<u32, SizeConstraint>(ret_val) };
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn set_enabled(&self, arg0: bool) -> &Self {
        let (obj_data, funcs) = self.get_layout_obj_funcs();
        unsafe {
            ((*funcs).set_enabled)(obj_data, arg0);
        }
        self
    }
    #[doc(hidden)]
    pub fn is_enabled(&self) -> bool {
        let (obj_data, funcs) = self.get_layout_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).is_enabled)(obj_data);
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn size_hint(&self) -> Size {
        let (obj_data, funcs) = self.get_layout_item_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).size_hint)(obj_data);
            let t = ret_val;
            let ret_val;
            if t.host_data != ::std::ptr::null() {
                ret_val = Size::new_from_rc(t);
            } else {
                ret_val = Size::new_from_owned(t);
            }
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn has_height_for_width(&self) -> bool {
        let (obj_data, funcs) = self.get_layout_item_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).has_height_for_width)(obj_data);
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn height_for_width(&self, arg0: i32) -> i32 {
        let (obj_data, funcs) = self.get_layout_item_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).height_for_width)(obj_data, arg0);
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn minimum_height_for_width(&self, arg0: i32) -> i32 {
        let (obj_data, funcs) = self.get_layout_item_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).minimum_height_for_width)(obj_data, arg0);
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn widget(&self) -> Option<Widget> {
        let (obj_data, funcs) = self.get_layout_item_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).widget)(obj_data);
            if ret_val.qt_data == ::std::ptr::null() {
                return None;
            }
            let t = ret_val;
            let ret_val;
            if t.host_data != ::std::ptr::null() {
                ret_val = Widget::new_from_rc(t);
            } else {
                ret_val = Widget::new_from_owned(t);
            }
            Some(ret_val)
        }
    }
    #[doc(hidden)]
    pub fn spacer_item(&self) -> Option<SpacerItem> {
        let (obj_data, funcs) = self.get_layout_item_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).spacer_item)(obj_data);
            if ret_val.qt_data == ::std::ptr::null() {
                return None;
            }
            let t = ret_val;
            let ret_val;
            if t.host_data != ::std::ptr::null() {
                ret_val = SpacerItem::new_from_rc(t);
            } else {
                ret_val = SpacerItem::new_from_owned(t);
            }
            Some(ret_val)
        }
    }
    #[doc(hidden)]
    pub fn alignment(&self) -> Alignment {
        let (obj_data, funcs) = self.get_layout_item_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).alignment)(obj_data);
            let ret_val = Alignment::from_bits_truncate(ret_val);
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn object_name(&self) -> String {
        let (obj_data, funcs) = self.get_object_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).object_name)(obj_data);
            let ret_val = CStr::from_ptr(ret_val).to_string_lossy().into_owned();
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn set_object_name(&self, name: &str) -> &Self {
        let str_in_name_1 = CString::new(name).unwrap();

        let (obj_data, funcs) = self.get_object_obj_funcs();
        unsafe {
            ((*funcs).set_object_name)(obj_data, str_in_name_1.as_ptr());
        }
        self
    }
    #[doc(hidden)]
    pub fn is_widget_type(&self) -> bool {
        let (obj_data, funcs) = self.get_object_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).is_widget_type)(obj_data);
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn is_window_type(&self) -> bool {
        let (obj_data, funcs) = self.get_object_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).is_window_type)(obj_data);
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn signals_blocked(&self) -> bool {
        let (obj_data, funcs) = self.get_object_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).signals_blocked)(obj_data);
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn block_signals(&self, b: bool) -> bool {
        let (obj_data, funcs) = self.get_object_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).block_signals)(obj_data, b);
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn start_timer(&self, interval: i32, timer_type: TimerType) -> i32 {
        let enum_timer_type_2 = timer_type as u32;

        let (obj_data, funcs) = self.get_object_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).start_timer)(obj_data, interval, enum_timer_type_2);
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn start_timer_2(&self, time: u32, timer_type: TimerType) -> i32 {
        let enum_timer_type_2 = timer_type as u32;

        let (obj_data, funcs) = self.get_object_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).start_timer_2)(obj_data, time, enum_timer_type_2);
            ret_val
        }
    }
    #[doc(hidden)]
    pub fn kill_timer(&self, id: i32) -> &Self {
        let (obj_data, funcs) = self.get_object_obj_funcs();
        unsafe {
            ((*funcs).kill_timer)(obj_data, id);
        }
        self
    }
    #[doc(hidden)]
    pub fn set_parent<O: ObjectTrait<'a>>(&self, parent: &O) -> &Self {
        let (obj_parent_1, _funcs) = parent.get_object_obj_funcs();

        let (obj_data, funcs) = self.get_object_obj_funcs();
        unsafe {
            ((*funcs).set_parent)(obj_data, obj_parent_1);
        }
        self
    }
    #[doc(hidden)]
    pub fn install_event_filter<O: ObjectTrait<'a>>(&self, filter_obj: &O) -> &Self {
        let (obj_filter_obj_1, _funcs) = filter_obj.get_object_obj_funcs();

        let (obj_data, funcs) = self.get_object_obj_funcs();
        unsafe {
            ((*funcs).install_event_filter)(obj_data, obj_filter_obj_1);
        }
        self
    }
    #[doc(hidden)]
    pub fn dump_object_tree(&self) -> &Self {
        let (obj_data, funcs) = self.get_object_obj_funcs();
        unsafe {
            ((*funcs).dump_object_tree)(obj_data);
        }
        self
    }
    #[doc(hidden)]
    pub fn dump_object_info(&self) -> &Self {
        let (obj_data, funcs) = self.get_object_obj_funcs();
        unsafe {
            ((*funcs).dump_object_info)(obj_data);
        }
        self
    }
    #[doc(hidden)]
    pub fn dump_object_tree_2(&self) -> &Self {
        let (obj_data, funcs) = self.get_object_obj_funcs();
        unsafe {
            ((*funcs).dump_object_tree_2)(obj_data);
        }
        self
    }
    #[doc(hidden)]
    pub fn dump_object_info_2(&self) -> &Self {
        let (obj_data, funcs) = self.get_object_obj_funcs();
        unsafe {
            ((*funcs).dump_object_info_2)(obj_data);
        }
        self
    }
    #[doc(hidden)]
    pub fn parent(&self) -> Option<Object> {
        let (obj_data, funcs) = self.get_object_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).parent)(obj_data);
            if ret_val.qt_data == ::std::ptr::null() {
                return None;
            }
            let t = ret_val;
            let ret_val;
            if t.host_data != ::std::ptr::null() {
                ret_val = Object::new_from_rc(t);
            } else {
                ret_val = Object::new_from_owned(t);
            }
            Some(ret_val)
        }
    }
    #[doc(hidden)]
    pub fn delete_later(&self) -> &Self {
        let (obj_data, funcs) = self.get_object_obj_funcs();
        unsafe {
            ((*funcs).delete_later)(obj_data);
        }
        self
    }
    #[doc(hidden)]
    pub fn set_custom_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
    where
        F: Fn(&T, &Event) + 'a,
        T: 'a,
    {
        let (obj_data, funcs) = self.get_object_obj_funcs();

        let f: Box<Box<Fn(&T, &Event) + 'a>> = Box::new(Box::new(func));
        let user_data = data as *const _ as *const c_void;

        unsafe {
            ((*funcs).set_custom_event)(
                obj_data,
                user_data,
                Box::into_raw(f) as *const _,
                transmute(object_custom_trampoline_ud::<T> as usize),
            );
        }

        self
    }

    pub fn set_custom_event<F>(&self, func: F) -> &Self
    where
        F: Fn(&Event) + 'a,
    {
        let (obj_data, funcs) = self.get_object_obj_funcs();
        let f: Box<Box<Fn(&Event) + 'a>> = Box::new(Box::new(func));

        unsafe {
            ((*funcs).set_custom_event)(
                obj_data,
                ::std::ptr::null(),
                Box::into_raw(f) as *const _,
                transmute(object_custom_trampoline as usize),
            );
        }

        self
    }

    pub fn build(&self) -> Self {
        self.clone()
    }
}
pub trait GridLayoutTrait<'a> {
    #[inline]
    #[doc(hidden)]
    fn get_grid_layout_obj_funcs(&self) -> (*const RUBase, *const RUGridLayoutFuncs);
}

impl<'a> ObjectTrait<'a> for GridLayout<'a> {
    #[doc(hidden)]
    fn get_object_obj_funcs(&self) -> (*const RUBase, *const RUObjectFuncs) {
        let obj = self.data.get().unwrap();
        unsafe { (obj, (*self.all_funcs).object_funcs) }
    }
}

impl<'a> LayoutItemTrait<'a> for GridLayout<'a> {
    #[doc(hidden)]
    fn get_layout_item_obj_funcs(&self) -> (*const RUBase, *const RULayoutItemFuncs) {
        let obj = self.data.get().unwrap();
        unsafe { (obj, (*self.all_funcs).layout_item_funcs) }
    }
}

impl<'a> LayoutTrait<'a> for GridLayout<'a> {
    #[doc(hidden)]
    fn get_layout_obj_funcs(&self) -> (*const RUBase, *const RULayoutFuncs) {
        let obj = self.data.get().unwrap();
        unsafe { (obj, (*self.all_funcs).layout_funcs) }
    }
}

impl<'a> GridLayoutTrait<'a> for GridLayout<'a> {
    #[doc(hidden)]
    fn get_grid_layout_obj_funcs(&self) -> (*const RUBase, *const RUGridLayoutFuncs) {
        let obj = self.data.get().unwrap();
        unsafe { (obj, (*self.all_funcs).grid_layout_funcs) }
    }
}