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
// 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::*;

pub(crate) unsafe extern "C" fn button_group_button_clicked_trampoline_ud<T>(
    self_c: *const c_void,
    func: *const c_void,
    arg0: *const RUBase,
) {
    let f: &&(Fn(&T, &AbstractButton) + 'static) = transmute(func);
    let obj_arg0_0 = AbstractButton::new_from_temporary(*(arg0 as *const RUAbstractButton));
    let data = self_c as *const T;
    f(&*data, &obj_arg0_0);
}

#[allow(unused_variables)]
pub(crate) unsafe extern "C" fn button_group_button_clicked_trampoline(
    self_c: *const c_void,
    func: *const c_void,
    arg0: *const RUBase,
) {
    let f: &&(Fn(&AbstractButton) + 'static) = transmute(func);
    let obj_arg0_0 = AbstractButton::new_from_temporary(*(arg0 as *const RUAbstractButton));
    f(&obj_arg0_0);
}

pub(crate) unsafe extern "C" fn button_group_button_clicked_2_trampoline_ud<T>(
    self_c: *const c_void,
    func: *const c_void,
    arg0: i32,
) {
    let f: &&(Fn(&T, i32) + 'static) = transmute(func);

    let data = self_c as *const T;
    f(&*data, arg0);
}

#[allow(unused_variables)]
pub(crate) unsafe extern "C" fn button_group_button_clicked_2_trampoline(
    self_c: *const c_void,
    func: *const c_void,
    arg0: i32,
) {
    let f: &&(Fn(i32) + 'static) = transmute(func);

    f(arg0);
}

pub(crate) unsafe extern "C" fn button_group_button_pressed_trampoline_ud<T>(
    self_c: *const c_void,
    func: *const c_void,
    arg0: *const RUBase,
) {
    let f: &&(Fn(&T, &AbstractButton) + 'static) = transmute(func);
    let obj_arg0_0 = AbstractButton::new_from_temporary(*(arg0 as *const RUAbstractButton));
    let data = self_c as *const T;
    f(&*data, &obj_arg0_0);
}

#[allow(unused_variables)]
pub(crate) unsafe extern "C" fn button_group_button_pressed_trampoline(
    self_c: *const c_void,
    func: *const c_void,
    arg0: *const RUBase,
) {
    let f: &&(Fn(&AbstractButton) + 'static) = transmute(func);
    let obj_arg0_0 = AbstractButton::new_from_temporary(*(arg0 as *const RUAbstractButton));
    f(&obj_arg0_0);
}

pub(crate) unsafe extern "C" fn button_group_button_pressed_2_trampoline_ud<T>(
    self_c: *const c_void,
    func: *const c_void,
    arg0: i32,
) {
    let f: &&(Fn(&T, i32) + 'static) = transmute(func);

    let data = self_c as *const T;
    f(&*data, arg0);
}

#[allow(unused_variables)]
pub(crate) unsafe extern "C" fn button_group_button_pressed_2_trampoline(
    self_c: *const c_void,
    func: *const c_void,
    arg0: i32,
) {
    let f: &&(Fn(i32) + 'static) = transmute(func);

    f(arg0);
}

pub(crate) unsafe extern "C" fn button_group_button_released_trampoline_ud<T>(
    self_c: *const c_void,
    func: *const c_void,
    arg0: *const RUBase,
) {
    let f: &&(Fn(&T, &AbstractButton) + 'static) = transmute(func);
    let obj_arg0_0 = AbstractButton::new_from_temporary(*(arg0 as *const RUAbstractButton));
    let data = self_c as *const T;
    f(&*data, &obj_arg0_0);
}

#[allow(unused_variables)]
pub(crate) unsafe extern "C" fn button_group_button_released_trampoline(
    self_c: *const c_void,
    func: *const c_void,
    arg0: *const RUBase,
) {
    let f: &&(Fn(&AbstractButton) + 'static) = transmute(func);
    let obj_arg0_0 = AbstractButton::new_from_temporary(*(arg0 as *const RUAbstractButton));
    f(&obj_arg0_0);
}

pub(crate) unsafe extern "C" fn button_group_button_released_2_trampoline_ud<T>(
    self_c: *const c_void,
    func: *const c_void,
    arg0: i32,
) {
    let f: &&(Fn(&T, i32) + 'static) = transmute(func);

    let data = self_c as *const T;
    f(&*data, arg0);
}

#[allow(unused_variables)]
pub(crate) unsafe extern "C" fn button_group_button_released_2_trampoline(
    self_c: *const c_void,
    func: *const c_void,
    arg0: i32,
) {
    let f: &&(Fn(i32) + 'static) = transmute(func);

    f(arg0);
}

pub(crate) unsafe extern "C" fn button_group_button_toggled_trampoline_ud<T>(
    self_c: *const c_void,
    func: *const c_void,
    arg0: *const RUBase,
    arg1: bool,
) {
    let f: &&(Fn(&T, &AbstractButton, bool) + 'static) = transmute(func);
    let obj_arg0_0 = AbstractButton::new_from_temporary(*(arg0 as *const RUAbstractButton));
    let data = self_c as *const T;
    f(&*data, &obj_arg0_0, arg1);
}

#[allow(unused_variables)]
pub(crate) unsafe extern "C" fn button_group_button_toggled_trampoline(
    self_c: *const c_void,
    func: *const c_void,
    arg0: *const RUBase,
    arg1: bool,
) {
    let f: &&(Fn(&AbstractButton, bool) + 'static) = transmute(func);
    let obj_arg0_0 = AbstractButton::new_from_temporary(*(arg0 as *const RUAbstractButton));
    f(&obj_arg0_0, arg1);
}

pub(crate) unsafe extern "C" fn button_group_button_toggled_2_trampoline_ud<T>(
    self_c: *const c_void,
    func: *const c_void,
    arg0: i32,
    arg1: bool,
) {
    let f: &&(Fn(&T, i32, bool) + 'static) = transmute(func);

    let data = self_c as *const T;
    f(&*data, arg0, arg1);
}

#[allow(unused_variables)]
pub(crate) unsafe extern "C" fn button_group_button_toggled_2_trampoline(
    self_c: *const c_void,
    func: *const c_void,
    arg0: i32,
    arg1: bool,
) {
    let f: &&(Fn(i32, bool) + 'static) = transmute(func);

    f(arg0, arg1);
}

/// **Notice these docs are heavy WIP and not very relevent yet**
///
/// QButtonGroup provides an abstract container into which button widgets can
/// be placed. It does not provide a visual representation of this container
/// (see QGroupBox for a container widget), but instead manages the states of
/// each of the buttons in the group.
///
/// An [exclusive](QButtonGroup::exclusive)
/// button group switches
/// off all checkable (toggle) buttons except the one that has been
/// clicked. By default, a button group is exclusive. The buttons in a
/// button group are usually checkable [QPushButton](QPushButton)
/// s, [QCheckBox](QCheckBox)
/// es
/// (normally for non-exclusive button groups), or [QRadioButton](QRadioButton)
/// s.
/// If you create an exclusive button group, you should ensure that
/// one of the buttons in the group is initially checked; otherwise,
/// the group will initially be in a state where no buttons are
/// checked.
///
/// A button can be added to the group with addButton() and removed
/// with removeButton(). If the group is exclusive, the
/// currently checked button is available with checkedButton(). If a
/// button is clicked, the buttonClicked() signal is emitted; for a
/// checkable button in an exclusive group this means that the button
/// has been checked. The list of buttons in the group is returned by
/// buttons().
///
/// In addition, QButtonGroup can map between integers and buttons.
/// You can assign an integer id to a button with setId(), and
/// retrieve it with id(). The id of the currently checked button is
/// available with checkedId(), and there is an overloaded signal
/// buttonClicked() which emits the id of the button. The id `-1`
/// is reserved by QButtonGroup to mean . The purpose
/// of the mapping mechanism is to simplify the representation of enum
/// values in a user interface.
///
/// **See also:** [`GroupBox`]
/// [`PushButton`]
/// [`CheckBox`]
/// [`RadioButton`]
/// # 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 ButtonGroup<'a> {
    #[doc(hidden)]
    pub data: Rc<Cell<Option<*const RUBase>>>,
    #[doc(hidden)]
    pub all_funcs: *const RUButtonGroupAllFuncs,
    #[doc(hidden)]
    pub owned: bool,
    #[doc(hidden)]
    pub _marker: PhantomData<::std::cell::Cell<&'a ()>>,
}

impl<'a> ButtonGroup<'a> {
    #[allow(dead_code)]
    pub(crate) fn new_from_rc(ffi_data: RUButtonGroup) -> ButtonGroup<'a> {
        ButtonGroup {
            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: RUButtonGroup) -> ButtonGroup<'a> {
        ButtonGroup {
            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: RUButtonGroup) -> ButtonGroup<'a> {
        ButtonGroup {
            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_exclusive(&self, arg0: bool) -> &Self {
        let (obj_data, funcs) = self.get_button_group_obj_funcs();
        unsafe {
            ((*funcs).set_exclusive)(obj_data, arg0);
        }
        self
    }
    ///
    /// If this property is `true,` then only one button in the group can be checked
    /// at any given time. The user can click on any button to check it, and that
    /// button will replace the existing one as the checked button in the group.
    ///
    /// In an exclusive group, the user cannot uncheck the currently checked button
    /// by clicking on it; instead, another button in the group must be clicked
    /// to set the new checked button for that group.
    ///
    /// By default, this property is `true.`
    pub fn exclusive(&self) -> bool {
        let (obj_data, funcs) = self.get_button_group_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).exclusive)(obj_data);
            ret_val
        }
    }
    ///
    /// Adds the given *button* to the button group. If *id* is -1,
    /// an id will be assigned to the button.
    /// Automatically assigned ids are guaranteed to be negative,
    /// starting with -2. If you are assigning your own ids, use
    /// positive values to avoid conflicts.
    ///
    /// **See also:** [`remove_button()`]
    /// [`buttons()`]
    pub fn add_button<A: AbstractButtonTrait<'a>>(&self, arg0: &A, id: i32) -> &Self {
        let (obj_arg0_1, _funcs) = arg0.get_abstract_button_obj_funcs();

        let (obj_data, funcs) = self.get_button_group_obj_funcs();
        unsafe {
            ((*funcs).add_button)(obj_data, obj_arg0_1, id);
        }
        self
    }
    ///
    /// Removes the given *button* from the button group.
    ///
    /// **See also:** [`add_button()`]
    /// [`buttons()`]
    pub fn remove_button<A: AbstractButtonTrait<'a>>(&self, arg0: &A) -> &Self {
        let (obj_arg0_1, _funcs) = arg0.get_abstract_button_obj_funcs();

        let (obj_data, funcs) = self.get_button_group_obj_funcs();
        unsafe {
            ((*funcs).remove_button)(obj_data, obj_arg0_1);
        }
        self
    }
    ///
    /// Returns the button group's checked button, or 0 if no buttons are
    /// checked.
    ///
    /// **See also:** [`button_clicked()`]
    pub fn checked_button(&self) -> Option<AbstractButton> {
        let (obj_data, funcs) = self.get_button_group_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).checked_button)(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 = AbstractButton::new_from_rc(t);
            } else {
                ret_val = AbstractButton::new_from_owned(t);
            }
            Some(ret_val)
        }
    }
    ///
    /// This signal is emitted when the given *button* is clicked. A
    /// button is clicked when it is first pressed and then released, when
    /// its shortcut key is typed, or when QAbstractButton::click()
    /// or QAbstractButton::animateClick() is programmatically called.
    ///
    /// **See also:** [`checked_button()`]
    /// [`AbstractButton::clicked`]
    ///
    /// This signal is emitted when a button with the given *id* is
    /// clicked.
    ///
    /// **See also:** [`checked_button()`]
    /// [`AbstractButton::clicked`]
    ///
    /// This signal is emitted when the given *button* is pressed down.
    ///
    /// **See also:** [`AbstractButton::pressed`]
    ///
    /// This signal is emitted when a button with the given *id* is
    /// pressed down.
    ///
    /// **See also:** [`AbstractButton::pressed`]
    ///
    /// This signal is emitted when the given *button* is released.
    ///
    /// **See also:** [`AbstractButton::released`]
    ///
    /// This signal is emitted when a button with the given *id* is
    /// released.
    ///
    /// **See also:** [`AbstractButton::released`]
    ///
    /// This signal is emitted when the given *button* is toggled.
    /// *checked* is true if the button is checked, or false if the button is unchecked.
    ///
    /// **See also:** [`AbstractButton::toggled`]
    ///
    /// This signal is emitted when a button with the given *id* is toggled.
    /// *checked* is true if the button is checked, or false if the button is unchecked.
    ///
    /// **See also:** [`AbstractButton::toggled`]
    ///
    /// Returns the button group's list of buttons. This may be empty.
    ///
    /// **See also:** [`add_button()`]
    /// [`remove_button()`]
    ///
    /// Returns the button with the specified *id,* or 0 if no such button
    /// exists.
    pub fn button(&self, id: i32) -> Option<AbstractButton> {
        let (obj_data, funcs) = self.get_button_group_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).button)(obj_data, id);
            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 = AbstractButton::new_from_rc(t);
            } else {
                ret_val = AbstractButton::new_from_owned(t);
            }
            Some(ret_val)
        }
    }
    ///
    /// Sets the *id* for the specified *button.* Note that *id* cannot
    /// be -1.
    ///
    /// **See also:** [`id()`]
    pub fn set_id<A: AbstractButtonTrait<'a>>(&self, button: &A, id: i32) -> &Self {
        let (obj_button_1, _funcs) = button.get_abstract_button_obj_funcs();

        let (obj_data, funcs) = self.get_button_group_obj_funcs();
        unsafe {
            ((*funcs).set_id)(obj_data, obj_button_1, id);
        }
        self
    }
    ///
    /// Returns the id for the specified *button,* or -1 if no such button
    /// exists.
    ///
    /// **See also:** [`set_id()`]
    pub fn id<A: AbstractButtonTrait<'a>>(&self, button: &A) -> i32 {
        let (obj_button_1, _funcs) = button.get_abstract_button_obj_funcs();

        let (obj_data, funcs) = self.get_button_group_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).id)(obj_data, obj_button_1);
            ret_val
        }
    }
    ///
    /// Returns the id of the checkedButton(), or -1 if no button is checked.
    ///
    /// **See also:** [`set_id()`]
    pub fn checked_id(&self) -> i32 {
        let (obj_data, funcs) = self.get_button_group_obj_funcs();
        unsafe {
            let ret_val = ((*funcs).checked_id)(obj_data);
            ret_val
        }
    }
    ///
    /// This signal is emitted when the given *button* is clicked. A
    /// button is clicked when it is first pressed and then released, when
    /// its shortcut key is typed, or when QAbstractButton::click()
    /// or QAbstractButton::animateClick() is programmatically called.
    ///
    /// **See also:** [`checked_button()`]
    /// [`AbstractButton::clicked`]
    ///
    /// This signal is emitted when a button with the given *id* is
    /// clicked.
    ///
    /// **See also:** [`checked_button()`]
    /// [`AbstractButton::clicked`]
    pub fn set_button_clicked_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
    where
        F: Fn(&T, &AbstractButton) + 'a,
        T: 'a,
    {
        let (obj_data, funcs) = self.get_button_group_obj_funcs();

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

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

        self
    }

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

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

        self
    }
    ///
    /// This signal is emitted when the given *button* is clicked. A
    /// button is clicked when it is first pressed and then released, when
    /// its shortcut key is typed, or when QAbstractButton::click()
    /// or QAbstractButton::animateClick() is programmatically called.
    ///
    /// **See also:** [`checked_button()`]
    /// [`AbstractButton::clicked`]
    ///
    /// This signal is emitted when a button with the given *id* is
    /// clicked.
    ///
    /// **See also:** [`checked_button()`]
    /// [`AbstractButton::clicked`]
    pub fn set_button_clicked_2_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
    where
        F: Fn(&T, i32) + 'a,
        T: 'a,
    {
        let (obj_data, funcs) = self.get_button_group_obj_funcs();

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

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

        self
    }

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

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

        self
    }
    ///
    /// This signal is emitted when the given *button* is pressed down.
    ///
    /// **See also:** [`AbstractButton::pressed`]
    ///
    /// This signal is emitted when a button with the given *id* is
    /// pressed down.
    ///
    /// **See also:** [`AbstractButton::pressed`]
    pub fn set_button_pressed_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
    where
        F: Fn(&T, &AbstractButton) + 'a,
        T: 'a,
    {
        let (obj_data, funcs) = self.get_button_group_obj_funcs();

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

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

        self
    }

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

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

        self
    }
    ///
    /// This signal is emitted when the given *button* is pressed down.
    ///
    /// **See also:** [`AbstractButton::pressed`]
    ///
    /// This signal is emitted when a button with the given *id* is
    /// pressed down.
    ///
    /// **See also:** [`AbstractButton::pressed`]
    pub fn set_button_pressed_2_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
    where
        F: Fn(&T, i32) + 'a,
        T: 'a,
    {
        let (obj_data, funcs) = self.get_button_group_obj_funcs();

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

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

        self
    }

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

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

        self
    }
    ///
    /// This signal is emitted when the given *button* is released.
    ///
    /// **See also:** [`AbstractButton::released`]
    ///
    /// This signal is emitted when a button with the given *id* is
    /// released.
    ///
    /// **See also:** [`AbstractButton::released`]
    pub fn set_button_released_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
    where
        F: Fn(&T, &AbstractButton) + 'a,
        T: 'a,
    {
        let (obj_data, funcs) = self.get_button_group_obj_funcs();

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

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

        self
    }

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

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

        self
    }
    ///
    /// This signal is emitted when the given *button* is released.
    ///
    /// **See also:** [`AbstractButton::released`]
    ///
    /// This signal is emitted when a button with the given *id* is
    /// released.
    ///
    /// **See also:** [`AbstractButton::released`]
    pub fn set_button_released_2_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
    where
        F: Fn(&T, i32) + 'a,
        T: 'a,
    {
        let (obj_data, funcs) = self.get_button_group_obj_funcs();

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

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

        self
    }

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

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

        self
    }
    ///
    /// This signal is emitted when the given *button* is toggled.
    /// *checked* is true if the button is checked, or false if the button is unchecked.
    ///
    /// **See also:** [`AbstractButton::toggled`]
    ///
    /// This signal is emitted when a button with the given *id* is toggled.
    /// *checked* is true if the button is checked, or false if the button is unchecked.
    ///
    /// **See also:** [`AbstractButton::toggled`]
    pub fn set_button_toggled_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
    where
        F: Fn(&T, &AbstractButton, bool) + 'a,
        T: 'a,
    {
        let (obj_data, funcs) = self.get_button_group_obj_funcs();

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

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

        self
    }

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

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

        self
    }
    ///
    /// This signal is emitted when the given *button* is toggled.
    /// *checked* is true if the button is checked, or false if the button is unchecked.
    ///
    /// **See also:** [`AbstractButton::toggled`]
    ///
    /// This signal is emitted when a button with the given *id* is toggled.
    /// *checked* is true if the button is checked, or false if the button is unchecked.
    ///
    /// **See also:** [`AbstractButton::toggled`]
    pub fn set_button_toggled_2_event_ud<F, T>(&self, data: &'a T, func: F) -> &Self
    where
        F: Fn(&T, i32, bool) + 'a,
        T: 'a,
    {
        let (obj_data, funcs) = self.get_button_group_obj_funcs();

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

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

        self
    }

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

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

        self
    }
    #[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 ButtonGroupTrait<'a> {
    #[inline]
    #[doc(hidden)]
    fn get_button_group_obj_funcs(&self) -> (*const RUBase, *const RUButtonGroupFuncs);
}

impl<'a> ObjectTrait<'a> for ButtonGroup<'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> ButtonGroupTrait<'a> for ButtonGroup<'a> {
    #[doc(hidden)]
    fn get_button_group_obj_funcs(&self) -> (*const RUBase, *const RUButtonGroupFuncs) {
        let obj = self.data.get().unwrap();
        unsafe { (obj, (*self.all_funcs).button_group_funcs) }
    }
}