gtk4/subclass/
cell_area.rs

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
// Take a look at the license at the top of the repository in the LICENSE file.

// rustdoc-stripper-ignore-next
//! Traits intended for subclassing [`CellArea`](crate::CellArea).

use std::mem;

use glib::{translate::*, ParamSpec, Value};

use crate::{
    ffi, prelude::*, subclass::prelude::*, CellArea, CellAreaContext, CellRenderer,
    CellRendererState, DirectionType, SizeRequestMode, Snapshot, TreeIter, TreeModel, Widget,
};

#[derive(Debug)]
pub struct CellCallback {
    callback: ffi::GtkCellCallback,
    user_data: glib::ffi::gpointer,
}

impl CellCallback {
    pub fn call<R: IsA<CellRenderer>>(&self, cell_renderer: &R) -> glib::ControlFlow {
        unsafe {
            if let Some(callback) = self.callback {
                from_glib(callback(
                    cell_renderer.as_ref().to_glib_none().0,
                    self.user_data,
                ))
            } else {
                glib::ControlFlow::Break
            }
        }
    }
}

#[derive(Debug)]
pub struct CellCallbackAllocate {
    callback: ffi::GtkCellAllocCallback,
    user_data: glib::ffi::gpointer,
}

impl CellCallbackAllocate {
    pub fn call<R: IsA<CellRenderer>>(
        &self,
        cell_renderer: &R,
        cell_area: &gdk::Rectangle,
        cell_background: &gdk::Rectangle,
    ) -> glib::ControlFlow {
        unsafe {
            if let Some(callback) = self.callback {
                from_glib(callback(
                    cell_renderer.as_ref().to_glib_none().0,
                    cell_area.to_glib_none().0,
                    cell_background.to_glib_none().0,
                    self.user_data,
                ))
            } else {
                glib::ControlFlow::Break
            }
        }
    }
}

#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
pub trait CellAreaImpl: CellAreaImplExt + ObjectImpl {
    fn cell_properties() -> &'static [ParamSpec] {
        &[]
    }

    /// This should be implemented to handle changes in child
    ///   cell properties for a given [`CellRenderer`][crate::CellRenderer] that were previously
    ///   installed on the [`CellAreaClass`][crate::CellAreaClass] with gtk_cell_area_class_install_cell_property().
    fn set_cell_property<R: IsA<CellRenderer>>(
        &self,
        _renderer: &R,
        _id: usize,
        _value: &Value,
        _pspec: &ParamSpec,
    ) {
        unimplemented!()
    }

    /// This should be implemented to report the values of
    ///   child cell properties for a given child [`CellRenderer`][crate::CellRenderer].
    fn cell_property<R: IsA<CellRenderer>>(
        &self,
        _renderer: &R,
        _id: usize,
        _pspec: &ParamSpec,
    ) -> Value {
        unimplemented!()
    }

    /// Activates @self, usually by activating the currently focused
    /// cell, however some subclasses which embed widgets in the area
    /// can also activate a widget if it currently has the focus.
    ///
    /// # Deprecated since 4.10
    ///
    /// ## `context`
    /// the [`CellArea`][crate::CellArea]Context in context with the current row data
    /// ## `widget`
    /// the [`Widget`][crate::Widget] that @self is rendering on
    /// ## `cell_area`
    /// the size and location of @self relative to @widget’s allocation
    /// ## `flags`
    /// the [`CellRenderer`][crate::CellRenderer]State flags for @self for this row of data.
    /// ## `edit_only`
    /// if [`true`] then only cell renderers that are [`CellRendererMode::Editable`][crate::CellRendererMode::Editable]
    ///             will be activated.
    ///
    /// # Returns
    ///
    /// Whether @self was successfully activated.
    fn activate<P: IsA<CellAreaContext>, W: IsA<Widget>>(
        &self,
        context: &P,
        widget: &W,
        area: &gdk::Rectangle,
        flags: CellRendererState,
        edit_only: bool,
    ) -> bool {
        self.parent_activate(context, widget, area, flags, edit_only)
    }

    /// Adds @renderer to @self with the default child cell properties.
    ///
    /// # Deprecated since 4.10
    ///
    /// ## `renderer`
    /// the [`CellRenderer`][crate::CellRenderer] to add to @self
    fn add<R: IsA<CellRenderer>>(&self, renderer: &R) {
        self.parent_add(renderer)
    }

    /// Applies any connected attributes to the renderers in
    /// @self by pulling the values from @tree_model.
    ///
    /// # Deprecated since 4.10
    ///
    /// ## `tree_model`
    /// the [`TreeModel`][crate::TreeModel] to pull values from
    /// ## `iter`
    /// the [`TreeIter`][crate::TreeIter] in @tree_model to apply values for
    /// ## `is_expander`
    /// whether @iter has children
    /// ## `is_expanded`
    /// whether @iter is expanded in the view and
    ///               children are visible
    fn apply_attributes<M: IsA<TreeModel>>(
        &self,
        tree_model: &M,
        iter: &TreeIter,
        is_expander: bool,
        is_expanded: bool,
    ) {
        self.parent_apply_attributes(tree_model, iter, is_expander, is_expanded)
    }

    /// Creates a [`CellArea`][crate::CellArea]Context to be used with @self for
    /// all purposes. [`CellArea`][crate::CellArea]Context stores geometry information
    /// for rows for which it was operated on, it is important to use
    /// the same context for the same row of data at all times (i.e.
    /// one should render and handle events with the same [`CellArea`][crate::CellArea]Context
    /// which was used to request the size of those rows of data).
    ///
    /// # Deprecated since 4.10
    ///
    ///
    /// # Returns
    ///
    /// a newly created [`CellArea`][crate::CellArea]Context which can be used with @self.
    fn create_context(&self) -> Option<CellAreaContext> {
        self.parent_create_context()
    }

    /// This is sometimes needed for cases where rows need to share
    /// alignments in one orientation but may be separately grouped
    /// in the opposing orientation.
    ///
    /// For instance, [`IconView`][crate::IconView] creates all icons (rows) to have
    /// the same width and the cells theirin to have the same
    /// horizontal alignments. However each row of icons may have
    /// a separate collective height. [`IconView`][crate::IconView] uses this to
    /// request the heights of each row based on a context which
    /// was already used to request all the row widths that are
    /// to be displayed.
    ///
    /// # Deprecated since 4.10
    ///
    /// ## `context`
    /// the [`CellArea`][crate::CellArea]Context to copy
    ///
    /// # Returns
    ///
    /// a newly created [`CellArea`][crate::CellArea]Context copy of @context.
    fn copy_context<P: IsA<CellAreaContext>>(&self, context: &P) -> Option<CellAreaContext> {
        self.parent_copy_context(context)
    }

    /// Delegates event handling to a [`CellArea`][crate::CellArea].
    ///
    /// # Deprecated since 4.10
    ///
    /// ## `context`
    /// the [`CellArea`][crate::CellArea]Context for this row of data.
    /// ## `widget`
    /// the [`Widget`][crate::Widget] that @self is rendering to
    /// ## `event`
    /// the [`gdk::Event`][crate::gdk::Event] to handle
    /// ## `cell_area`
    /// the @widget relative coordinates for @self
    /// ## `flags`
    /// the [`CellRenderer`][crate::CellRenderer]State for @self in this row.
    ///
    /// # Returns
    ///
    /// [`true`] if the event was handled by @self.
    fn event<W: IsA<Widget>, P: IsA<CellAreaContext>>(
        &self,
        context: &P,
        widget: &W,
        event: &gdk::Event,
        area: &gdk::Rectangle,
        flags: CellRendererState,
    ) -> bool {
        self.parent_event(context, widget, event, area, flags)
    }

    /// Calls @callback for every [`CellRenderer`][crate::CellRenderer] in @self.
    ///
    /// # Deprecated since 4.10
    ///
    /// ## `callback`
    /// the `GtkCellCallback` to call
    /// ## `callback_data`
    /// user provided data pointer
    fn foreach(&self, callback: &CellCallback) {
        self.parent_foreach(callback);
    }

    /// Calls @callback for every [`CellRenderer`][crate::CellRenderer] in @self with the
    /// allocated rectangle inside @cell_area.
    /// ## `context`
    /// the [`CellArea`][crate::CellArea]Context for this row of data.
    /// ## `widget`
    /// the [`Widget`][crate::Widget] that @self is rendering to
    /// ## `cell_area`
    /// the @widget relative coordinates and size for @self
    /// ## `background_area`
    /// the @widget relative coordinates of the background area
    /// ## `callback`
    /// the `GtkCellAllocCallback` to call
    /// ## `callback_data`
    /// user provided data pointer
    fn foreach_alloc<P: IsA<CellAreaContext>, W: IsA<Widget>>(
        &self,
        context: &P,
        widget: &W,
        area: &gdk::Rectangle,
        bg_area: &gdk::Rectangle,
        callback: &CellCallbackAllocate,
    ) {
        self.parent_foreach_alloc(context, widget, area, bg_area, callback)
    }

    /// Removes @renderer from @self.
    ///
    /// # Deprecated since 4.10
    ///
    /// ## `renderer`
    /// the [`CellRenderer`][crate::CellRenderer] to remove from @self
    fn remove<R: IsA<CellRenderer>>(&self, renderer: &R) {
        self.parent_remove(renderer)
    }

    /// Returns whether the area can do anything when activated,
    /// after applying new attributes to @self.
    ///
    /// # Deprecated since 4.10
    ///
    ///
    /// # Returns
    ///
    /// whether @self can do anything when activated.
    fn is_activatable(&self) -> bool {
        self.parent_is_activatable()
    }

    /// This should be called by the @self’s owning layout widget
    /// when focus is to be passed to @self, or moved within @self
    /// for a given @direction and row data.
    ///
    /// Implementing [`CellArea`][crate::CellArea] classes should implement this
    /// method to receive and navigate focus in its own way particular
    /// to how it lays out cells.
    ///
    /// # Deprecated since 4.10
    ///
    /// ## `direction`
    /// the [`DirectionType`][crate::DirectionType]
    ///
    /// # Returns
    ///
    /// [`true`] if focus remains inside @self as a result of this call.
    fn focus(&self, direction_type: DirectionType) -> bool {
        self.parent_focus(direction_type)
    }

    /// Gets whether the area prefers a height-for-width layout
    /// or a width-for-height layout.
    ///
    /// # Returns
    ///
    /// The [`SizeRequestMode`][crate::SizeRequestMode] preferred by @self.
    fn request_mode(&self) -> SizeRequestMode {
        self.parent_request_mode()
    }

    /// Retrieves a cell area’s initial minimum and natural width.
    ///
    /// @self will store some geometrical information in @context along the way;
    /// when requesting sizes over an arbitrary number of rows, it’s not important
    /// to check the @minimum_width and @natural_width of this call but rather to
    /// consult gtk_cell_area_context_get_preferred_width() after a series of
    /// requests.
    ///
    /// # Deprecated since 4.10
    ///
    /// ## `context`
    /// the [`CellArea`][crate::CellArea]Context to perform this request with
    /// ## `widget`
    /// the [`Widget`][crate::Widget] where @self will be rendering
    ///
    /// # Returns
    ///
    ///
    /// ## `minimum_width`
    /// location to store the minimum width
    ///
    /// ## `natural_width`
    /// location to store the natural width
    fn preferred_width<P: IsA<CellAreaContext>, W: IsA<Widget>>(
        &self,
        context: &P,
        widget: &W,
    ) -> (i32, i32) {
        self.parent_preferred_width(context, widget)
    }

    /// Retrieves a cell area’s minimum and natural width if it would be given
    /// the specified @height.
    ///
    /// @self stores some geometrical information in @context along the way
    /// while calling gtk_cell_area_get_preferred_height(). It’s important to
    /// perform a series of gtk_cell_area_get_preferred_height() requests with
    /// @context first and then call gtk_cell_area_get_preferred_width_for_height()
    /// on each cell area individually to get the height for width of each
    /// fully requested row.
    ///
    /// If at some point, the height of a single row changes, it should be
    /// requested with gtk_cell_area_get_preferred_height() again and then
    /// the full height of the requested rows checked again with
    /// gtk_cell_area_context_get_preferred_height().
    ///
    /// # Deprecated since 4.10
    ///
    /// ## `context`
    /// the [`CellArea`][crate::CellArea]Context which has already been requested for widths.
    /// ## `widget`
    /// the [`Widget`][crate::Widget] where @self will be rendering
    /// ## `height`
    /// the height for which to check the width of this area
    ///
    /// # Returns
    ///
    ///
    /// ## `minimum_width`
    /// location to store the minimum width
    ///
    /// ## `natural_width`
    /// location to store the natural width
    fn preferred_width_for_height<P: IsA<CellAreaContext>, W: IsA<Widget>>(
        &self,
        context: &P,
        widget: &W,
        height: i32,
    ) -> (i32, i32) {
        self.parent_preferred_width_for_height(context, widget, height)
    }

    /// Retrieves a cell area’s initial minimum and natural height.
    ///
    /// @self will store some geometrical information in @context along the way;
    /// when requesting sizes over an arbitrary number of rows, it’s not important
    /// to check the @minimum_height and @natural_height of this call but rather to
    /// consult gtk_cell_area_context_get_preferred_height() after a series of
    /// requests.
    ///
    /// # Deprecated since 4.10
    ///
    /// ## `context`
    /// the [`CellArea`][crate::CellArea]Context to perform this request with
    /// ## `widget`
    /// the [`Widget`][crate::Widget] where @self will be rendering
    ///
    /// # Returns
    ///
    ///
    /// ## `minimum_height`
    /// location to store the minimum height
    ///
    /// ## `natural_height`
    /// location to store the natural height
    fn preferred_height<P: IsA<CellAreaContext>, W: IsA<Widget>>(
        &self,
        context: &P,
        widget: &W,
    ) -> (i32, i32) {
        self.parent_preferred_height(context, widget)
    }

    /// Retrieves a cell area’s minimum and natural height if it would be given
    /// the specified @width.
    ///
    /// @self stores some geometrical information in @context along the way
    /// while calling gtk_cell_area_get_preferred_width(). It’s important to
    /// perform a series of gtk_cell_area_get_preferred_width() requests with
    /// @context first and then call gtk_cell_area_get_preferred_height_for_width()
    /// on each cell area individually to get the height for width of each
    /// fully requested row.
    ///
    /// If at some point, the width of a single row changes, it should be
    /// requested with gtk_cell_area_get_preferred_width() again and then
    /// the full width of the requested rows checked again with
    /// gtk_cell_area_context_get_preferred_width().
    ///
    /// # Deprecated since 4.10
    ///
    /// ## `context`
    /// the [`CellArea`][crate::CellArea]Context which has already been requested for widths.
    /// ## `widget`
    /// the [`Widget`][crate::Widget] where @self will be rendering
    /// ## `width`
    /// the width for which to check the height of this area
    ///
    /// # Returns
    ///
    ///
    /// ## `minimum_height`
    /// location to store the minimum height
    ///
    /// ## `natural_height`
    /// location to store the natural height
    fn preferred_height_for_width<P: IsA<CellAreaContext>, W: IsA<Widget>>(
        &self,
        context: &P,
        widget: &W,
        width: i32,
    ) -> (i32, i32) {
        self.parent_preferred_height_for_width(context, widget, width)
    }

    /// Snapshots @self’s cells according to @self’s layout onto at
    /// the given coordinates.
    ///
    /// # Deprecated since 4.10
    ///
    /// ## `context`
    /// the [`CellArea`][crate::CellArea]Context for this row of data.
    /// ## `widget`
    /// the [`Widget`][crate::Widget] that @self is rendering to
    /// ## `snapshot`
    /// the [`Snapshot`][crate::Snapshot] to draw to
    /// ## `background_area`
    /// the @widget relative coordinates for @self’s background
    /// ## `cell_area`
    /// the @widget relative coordinates for @self
    /// ## `flags`
    /// the [`CellRenderer`][crate::CellRenderer]State for @self in this row.
    /// ## `paint_focus`
    /// whether @self should paint focus on focused cells for focused rows or not.
    #[allow(clippy::too_many_arguments)]
    fn snapshot<P: IsA<CellAreaContext>, W: IsA<Widget>>(
        &self,
        context: &P,
        snapshot: &Snapshot,
        widget: &W,
        background_area: &gdk::Rectangle,
        cellarea: &gdk::Rectangle,
        flags: CellRendererState,
        paint_focus: bool,
    ) {
        self.parent_snapshot(
            context,
            snapshot,
            widget,
            background_area,
            cellarea,
            flags,
            paint_focus,
        );
    }
}

mod sealed {
    pub trait Sealed {}
    impl<T: super::CellAreaImplExt> Sealed for T {}
}

#[cfg_attr(feature = "v4_10", deprecated = "Since 4.10")]
#[allow(deprecated)]
pub trait CellAreaImplExt: sealed::Sealed + ObjectSubclass {
    // Returns true if the area was successfully activated
    fn parent_activate<P: IsA<CellAreaContext>, W: IsA<Widget>>(
        &self,
        context: &P,
        widget: &W,
        area: &gdk::Rectangle,
        flags: CellRendererState,
        edit_only: bool,
    ) -> bool {
        unsafe {
            let data = Self::type_data();
            let parent_class = data.as_ref().parent_class() as *mut ffi::GtkCellAreaClass;
            if let Some(f) = (*parent_class).activate {
                from_glib(f(
                    self.obj().unsafe_cast_ref::<CellArea>().to_glib_none().0,
                    context.as_ref().to_glib_none().0,
                    widget.as_ref().to_glib_none().0,
                    area.to_glib_none().0,
                    flags.into_glib(),
                    edit_only.into_glib(),
                ))
            } else {
                false
            }
        }
    }

    fn parent_add<R: IsA<CellRenderer>>(&self, renderer: &R) {
        unsafe {
            let data = Self::type_data();
            let parent_class = data.as_ref().parent_class() as *mut ffi::GtkCellAreaClass;
            if let Some(f) = (*parent_class).add {
                f(
                    self.obj().unsafe_cast_ref::<CellArea>().to_glib_none().0,
                    renderer.as_ref().to_glib_none().0,
                )
            }
        }
    }

    fn parent_apply_attributes<M: IsA<TreeModel>>(
        &self,
        tree_model: &M,
        iter: &TreeIter,
        is_expander: bool,
        is_expanded: bool,
    ) {
        unsafe {
            let data = Self::type_data();
            let parent_class = data.as_ref().parent_class() as *mut ffi::GtkCellAreaClass;
            if let Some(f) = (*parent_class).apply_attributes {
                f(
                    self.obj().unsafe_cast_ref::<CellArea>().to_glib_none().0,
                    tree_model.as_ref().to_glib_none().0,
                    iter.to_glib_none().0 as *mut _,
                    is_expander.into_glib(),
                    is_expanded.into_glib(),
                )
            }
        }
    }

    fn parent_create_context(&self) -> Option<CellAreaContext> {
        unsafe {
            let data = Self::type_data();
            let parent_class = data.as_ref().parent_class() as *mut ffi::GtkCellAreaClass;
            let f = (*parent_class)
                .create_context
                .expect("No parent class impl for \"create_context\"");

            let ret = f(self.obj().unsafe_cast_ref::<CellArea>().to_glib_none().0);
            Some(from_glib_full(ret))
        }
    }

    fn parent_copy_context<P: IsA<CellAreaContext>>(&self, context: &P) -> Option<CellAreaContext> {
        unsafe {
            let data = Self::type_data();
            let parent_class = data.as_ref().parent_class() as *mut ffi::GtkCellAreaClass;
            let f = (*parent_class)
                .copy_context
                .expect("No parent class impl for \"copy_context\"");

            let ret = f(
                self.obj().unsafe_cast_ref::<CellArea>().to_glib_none().0,
                context.as_ref().to_glib_none().0,
            );
            Some(from_glib_full(ret))
        }
    }

    // returns true only if the event is handled
    fn parent_event<W: IsA<Widget>, P: IsA<CellAreaContext>>(
        &self,
        context: &P,
        widget: &W,
        event: &gdk::Event,
        area: &gdk::Rectangle,
        flags: CellRendererState,
    ) -> bool {
        unsafe {
            let data = Self::type_data();
            let parent_class = data.as_ref().parent_class() as *mut ffi::GtkCellAreaClass;
            if let Some(f) = (*parent_class).event {
                from_glib(f(
                    self.obj().unsafe_cast_ref::<CellArea>().to_glib_none().0,
                    context.as_ref().to_glib_none().0,
                    widget.as_ref().to_glib_none().0,
                    event.to_glib_none().0,
                    area.to_glib_none().0,
                    flags.into_glib(),
                ))
            } else {
                false
            }
        }
    }

    fn parent_foreach(&self, callback: &CellCallback) {
        unsafe {
            let data = Self::type_data();
            let parent_class = data.as_ref().parent_class() as *mut ffi::GtkCellAreaClass;
            if let Some(f) = (*parent_class).foreach {
                f(
                    self.obj().unsafe_cast_ref::<CellArea>().to_glib_none().0,
                    callback.callback,
                    callback.user_data,
                )
            }
        }
    }

    fn parent_foreach_alloc<P: IsA<CellAreaContext>, W: IsA<Widget>>(
        &self,
        context: &P,
        widget: &W,
        area: &gdk::Rectangle,
        bg_area: &gdk::Rectangle,
        callback: &CellCallbackAllocate,
    ) {
        unsafe {
            let data = Self::type_data();
            let parent_class = data.as_ref().parent_class() as *mut ffi::GtkCellAreaClass;
            if let Some(f) = (*parent_class).foreach_alloc {
                f(
                    self.obj().unsafe_cast_ref::<CellArea>().to_glib_none().0,
                    context.as_ref().to_glib_none().0,
                    widget.as_ref().to_glib_none().0,
                    area.to_glib_none().0,
                    bg_area.to_glib_none().0,
                    callback.callback,
                    callback.user_data,
                )
            }
        }
    }

    fn parent_remove<R: IsA<CellRenderer>>(&self, renderer: &R) {
        unsafe {
            let data = Self::type_data();
            let parent_class = data.as_ref().parent_class() as *mut ffi::GtkCellAreaClass;
            if let Some(f) = (*parent_class).remove {
                f(
                    self.obj().unsafe_cast_ref::<CellArea>().to_glib_none().0,
                    renderer.as_ref().to_glib_none().0,
                )
            }
        }
    }

    // Whether the cell is activatable
    fn parent_is_activatable(&self) -> bool {
        unsafe {
            let data = Self::type_data();
            let parent_class = data.as_ref().parent_class() as *mut ffi::GtkCellAreaClass;
            if let Some(f) = (*parent_class).is_activatable {
                from_glib(f(self.obj().unsafe_cast_ref::<CellArea>().to_glib_none().0))
            } else {
                false
            }
        }
    }

    // TRUE if focus remains inside area as a result of this call.
    fn parent_focus(&self, direction_type: DirectionType) -> bool {
        unsafe {
            let data = Self::type_data();
            let parent_class = data.as_ref().parent_class() as *mut ffi::GtkCellAreaClass;
            if let Some(f) = (*parent_class).focus {
                from_glib(f(
                    self.obj().unsafe_cast_ref::<CellArea>().to_glib_none().0,
                    direction_type.into_glib(),
                ))
            } else {
                false
            }
        }
    }

    fn parent_request_mode(&self) -> SizeRequestMode {
        unsafe {
            let data = Self::type_data();
            let parent_class = data.as_ref().parent_class() as *mut ffi::GtkCellAreaClass;
            let f = (*parent_class)
                .get_request_mode
                .expect("No parent class impl for \"get_request_mode\"");
            from_glib(f(self.obj().unsafe_cast_ref::<CellArea>().to_glib_none().0))
        }
    }

    fn parent_preferred_width<P: IsA<CellAreaContext>, W: IsA<Widget>>(
        &self,
        cell_area_context: &P,
        widget: &W,
    ) -> (i32, i32) {
        unsafe {
            let data = Self::type_data();
            let parent_class = data.as_ref().parent_class() as *mut ffi::GtkCellAreaClass;
            let f = (*parent_class).get_preferred_width.unwrap();

            let mut minimum_size = mem::MaybeUninit::uninit();
            let mut natural_size = mem::MaybeUninit::uninit();
            f(
                self.obj().unsafe_cast_ref::<CellArea>().to_glib_none().0,
                cell_area_context.as_ref().to_glib_none().0,
                widget.as_ref().to_glib_none().0,
                minimum_size.as_mut_ptr(),
                natural_size.as_mut_ptr(),
            );
            (minimum_size.assume_init(), natural_size.assume_init())
        }
    }

    fn parent_preferred_height<P: IsA<CellAreaContext>, W: IsA<Widget>>(
        &self,
        cell_area_context: &P,
        widget: &W,
    ) -> (i32, i32) {
        unsafe {
            let data = Self::type_data();
            let parent_class = data.as_ref().parent_class() as *mut ffi::GtkCellAreaClass;
            let f = (*parent_class).get_preferred_height.unwrap();

            let mut minimum_size = mem::MaybeUninit::uninit();
            let mut natural_size = mem::MaybeUninit::uninit();
            f(
                self.obj().unsafe_cast_ref::<CellArea>().to_glib_none().0,
                cell_area_context.as_ref().to_glib_none().0,
                widget.as_ref().to_glib_none().0,
                minimum_size.as_mut_ptr(),
                natural_size.as_mut_ptr(),
            );
            (minimum_size.assume_init(), natural_size.assume_init())
        }
    }

    fn parent_preferred_width_for_height<P: IsA<CellAreaContext>, W: IsA<Widget>>(
        &self,
        cell_area_context: &P,
        widget: &W,
        height: i32,
    ) -> (i32, i32) {
        unsafe {
            let data = Self::type_data();
            let parent_class = data.as_ref().parent_class() as *mut ffi::GtkCellAreaClass;
            let f = (*parent_class).get_preferred_width_for_height.unwrap();

            let mut minimum_size = mem::MaybeUninit::uninit();
            let mut natural_size = mem::MaybeUninit::uninit();
            f(
                self.obj().unsafe_cast_ref::<CellArea>().to_glib_none().0,
                cell_area_context.as_ref().to_glib_none().0,
                widget.as_ref().to_glib_none().0,
                height,
                minimum_size.as_mut_ptr(),
                natural_size.as_mut_ptr(),
            );
            (minimum_size.assume_init(), natural_size.assume_init())
        }
    }

    fn parent_preferred_height_for_width<P: IsA<CellAreaContext>, W: IsA<Widget>>(
        &self,
        cell_area_context: &P,
        widget: &W,
        width: i32,
    ) -> (i32, i32) {
        unsafe {
            let data = Self::type_data();
            let parent_class = data.as_ref().parent_class() as *mut ffi::GtkCellAreaClass;
            let f = (*parent_class).get_preferred_height_for_width.unwrap();
            let mut minimum_size = mem::MaybeUninit::uninit();
            let mut natural_size = mem::MaybeUninit::uninit();
            f(
                self.obj().unsafe_cast_ref::<CellArea>().to_glib_none().0,
                cell_area_context.as_ref().to_glib_none().0,
                widget.as_ref().to_glib_none().0,
                width,
                minimum_size.as_mut_ptr(),
                natural_size.as_mut_ptr(),
            );
            (minimum_size.assume_init(), natural_size.assume_init())
        }
    }

    #[allow(clippy::too_many_arguments)]
    fn parent_snapshot<P: IsA<CellAreaContext>, W: IsA<Widget>>(
        &self,
        context: &P,
        snapshot: &Snapshot,
        widget: &W,
        background_area: &gdk::Rectangle,
        cellarea: &gdk::Rectangle,
        flags: CellRendererState,
        paint_focus: bool,
    ) {
        unsafe {
            let data = Self::type_data();
            let parent_class = data.as_ref().parent_class() as *mut ffi::GtkCellAreaClass;
            if let Some(f) = (*parent_class).snapshot {
                f(
                    self.obj().unsafe_cast_ref::<CellArea>().to_glib_none().0,
                    context.as_ref().to_glib_none().0,
                    widget.as_ref().to_glib_none().0,
                    snapshot.to_glib_none().0,
                    background_area.to_glib_none().0,
                    cellarea.to_glib_none().0,
                    flags.into_glib(),
                    paint_focus.into_glib(),
                )
            }
        }
    }
}

impl<T: CellAreaImpl> CellAreaImplExt for T {}

unsafe impl<T: CellAreaImpl> IsSubclassable<T> for CellArea {
    fn class_init(class: &mut glib::Class<Self>) {
        Self::parent_class_init::<T>(class);
        let klass = class.as_mut();

        assert_initialized_main_thread!();

        let pspecs = <T as CellAreaImpl>::cell_properties();
        if !pspecs.is_empty() {
            unsafe {
                for (prop_id, pspec) in pspecs.iter().enumerate() {
                    ffi::gtk_cell_area_class_install_cell_property(
                        klass,
                        prop_id as u32,
                        pspec.to_glib_none().0,
                    );
                }
            }
        }
        klass.activate = Some(cell_area_activate::<T>);
        klass.add = Some(cell_area_add::<T>);
        klass.apply_attributes = Some(cell_area_apply_attributes::<T>);
        klass.create_context = Some(cell_area_create_context::<T>);
        klass.copy_context = Some(cell_area_copy_context::<T>);
        klass.event = Some(cell_area_event::<T>);
        klass.foreach = Some(cell_area_foreach::<T>);
        klass.foreach_alloc = Some(cell_area_foreach_alloc::<T>);
        klass.remove = Some(cell_area_remove::<T>);
        klass.is_activatable = Some(cell_area_is_activatable::<T>);
        klass.focus = Some(cell_area_focus::<T>);
        klass.get_request_mode = Some(cell_area_get_request_mode::<T>);
        klass.get_preferred_width = Some(cell_area_get_preferred_width::<T>);
        klass.get_preferred_width_for_height = Some(cell_area_get_preferred_width_for_height::<T>);
        klass.get_preferred_height = Some(cell_area_get_preferred_height::<T>);
        klass.get_preferred_height_for_width = Some(cell_area_get_preferred_height_for_width::<T>);
        klass.snapshot = Some(cell_area_snapshot::<T>);
        klass.set_cell_property = Some(cell_area_set_cell_property::<T>);
        klass.get_cell_property = Some(cell_area_get_cell_property::<T>);
    }
}

unsafe extern "C" fn cell_area_set_cell_property<T: CellAreaImpl>(
    ptr: *mut ffi::GtkCellArea,
    rendererptr: *mut ffi::GtkCellRenderer,
    id: u32,
    valueptr: *mut glib::gobject_ffi::GValue,
    pspecptr: *mut glib::gobject_ffi::GParamSpec,
) {
    let instance = &*(ptr as *mut T::Instance);
    let imp = instance.imp();
    imp.set_cell_property(
        &*from_glib_borrow::<_, CellRenderer>(rendererptr),
        id as usize,
        &*(valueptr as *mut Value),
        &from_glib_borrow(pspecptr),
    );
}

unsafe extern "C" fn cell_area_get_cell_property<T: CellAreaImpl>(
    ptr: *mut ffi::GtkCellArea,
    rendererptr: *mut ffi::GtkCellRenderer,
    id: u32,
    valueptr: *mut glib::gobject_ffi::GValue,
    pspecptr: *mut glib::gobject_ffi::GParamSpec,
) {
    let instance = &*(ptr as *mut T::Instance);
    let imp = instance.imp();

    let value = imp.cell_property(
        &*from_glib_borrow::<_, CellRenderer>(rendererptr),
        id as usize,
        &from_glib_borrow(pspecptr),
    );

    // See glib::subclass::ObjectImpl::property for the reasoning behind
    glib::gobject_ffi::g_value_unset(valueptr);
    let value = mem::ManuallyDrop::new(value);
    std::ptr::write(valueptr, std::ptr::read(value.to_glib_none().0));
}

unsafe extern "C" fn cell_area_add<T: CellAreaImpl>(
    ptr: *mut ffi::GtkCellArea,
    rendererptr: *mut ffi::GtkCellRenderer,
) {
    let instance = &*(ptr as *mut T::Instance);
    let imp = instance.imp();
    let renderer: Borrowed<CellRenderer> = from_glib_borrow(rendererptr);

    imp.add(&*renderer)
}

unsafe extern "C" fn cell_area_apply_attributes<T: CellAreaImpl>(
    ptr: *mut ffi::GtkCellArea,
    modelptr: *mut ffi::GtkTreeModel,
    iterptr: *mut ffi::GtkTreeIter,
    is_expander: glib::ffi::gboolean,
    is_expanded: glib::ffi::gboolean,
) {
    let instance = &*(ptr as *mut T::Instance);
    let imp = instance.imp();
    let model: Borrowed<TreeModel> = from_glib_borrow(modelptr);
    let iter: Borrowed<TreeIter> = from_glib_borrow(iterptr);

    imp.apply_attributes(
        &*model,
        &iter,
        from_glib(is_expander),
        from_glib(is_expanded),
    )
}

unsafe extern "C" fn cell_area_remove<T: CellAreaImpl>(
    ptr: *mut ffi::GtkCellArea,
    rendererptr: *mut ffi::GtkCellRenderer,
) {
    let instance = &*(ptr as *mut T::Instance);
    let imp = instance.imp();
    let renderer: Borrowed<CellRenderer> = from_glib_borrow(rendererptr);

    imp.remove(&*renderer)
}

unsafe extern "C" fn cell_area_is_activatable<T: CellAreaImpl>(
    ptr: *mut ffi::GtkCellArea,
) -> glib::ffi::gboolean {
    let instance = &*(ptr as *mut T::Instance);
    let imp = instance.imp();

    imp.is_activatable().into_glib()
}

unsafe extern "C" fn cell_area_focus<T: CellAreaImpl>(
    ptr: *mut ffi::GtkCellArea,
    directionptr: ffi::GtkDirectionType,
) -> glib::ffi::gboolean {
    let instance = &*(ptr as *mut T::Instance);
    let imp = instance.imp();

    imp.focus(from_glib(directionptr)).into_glib()
}

unsafe extern "C" fn cell_area_get_request_mode<T: CellAreaImpl>(
    ptr: *mut ffi::GtkCellArea,
) -> ffi::GtkSizeRequestMode {
    let instance = &*(ptr as *mut T::Instance);
    let imp = instance.imp();

    imp.request_mode().into_glib()
}

unsafe extern "C" fn cell_area_get_preferred_height<T: CellAreaImpl>(
    ptr: *mut ffi::GtkCellArea,
    contextptr: *mut ffi::GtkCellAreaContext,
    wdgtptr: *mut ffi::GtkWidget,
    minptr: *mut libc::c_int,
    natptr: *mut libc::c_int,
) {
    let instance = &*(ptr as *mut T::Instance);
    let imp = instance.imp();
    let context: Borrowed<CellAreaContext> = from_glib_borrow(contextptr);
    let widget: Borrowed<Widget> = from_glib_borrow(wdgtptr);

    let (min_size, nat_size) = imp.preferred_height(&*context, &*widget);
    if !minptr.is_null() {
        *minptr = min_size;
    }
    if !natptr.is_null() {
        *natptr = nat_size;
    }
}

unsafe extern "C" fn cell_area_get_preferred_width<T: CellAreaImpl>(
    ptr: *mut ffi::GtkCellArea,
    contextptr: *mut ffi::GtkCellAreaContext,
    wdgtptr: *mut ffi::GtkWidget,
    minptr: *mut libc::c_int,
    natptr: *mut libc::c_int,
) {
    let instance = &*(ptr as *mut T::Instance);
    let imp = instance.imp();
    let context: Borrowed<CellAreaContext> = from_glib_borrow(contextptr);
    let widget: Borrowed<Widget> = from_glib_borrow(wdgtptr);

    let (min_size, nat_size) = imp.preferred_width(&*context, &*widget);
    if !minptr.is_null() {
        *minptr = min_size;
    }
    if !natptr.is_null() {
        *natptr = nat_size;
    }
}

unsafe extern "C" fn cell_area_get_preferred_width_for_height<T: CellAreaImpl>(
    ptr: *mut ffi::GtkCellArea,
    contextptr: *mut ffi::GtkCellAreaContext,
    wdgtptr: *mut ffi::GtkWidget,
    height: i32,
    min_width_ptr: *mut libc::c_int,
    nat_width_ptr: *mut libc::c_int,
) {
    let instance = &*(ptr as *mut T::Instance);
    let imp = instance.imp();
    let context: Borrowed<CellAreaContext> = from_glib_borrow(contextptr);
    let widget: Borrowed<Widget> = from_glib_borrow(wdgtptr);

    let (min_width, nat_width) = imp.preferred_width_for_height(&*context, &*widget, height);
    if !min_width_ptr.is_null() {
        *min_width_ptr = min_width;
    }
    if !nat_width_ptr.is_null() {
        *nat_width_ptr = nat_width;
    }
}

unsafe extern "C" fn cell_area_get_preferred_height_for_width<T: CellAreaImpl>(
    ptr: *mut ffi::GtkCellArea,
    contextptr: *mut ffi::GtkCellAreaContext,
    wdgtptr: *mut ffi::GtkWidget,
    width: i32,
    min_height_ptr: *mut libc::c_int,
    nat_height_ptr: *mut libc::c_int,
) {
    let instance = &*(ptr as *mut T::Instance);
    let imp = instance.imp();
    let context: Borrowed<CellAreaContext> = from_glib_borrow(contextptr);
    let widget: Borrowed<Widget> = from_glib_borrow(wdgtptr);

    let (min_height, nat_height) = imp.preferred_height_for_width(&*context, &*widget, width);
    if !min_height_ptr.is_null() {
        *min_height_ptr = min_height;
    }
    if !nat_height_ptr.is_null() {
        *nat_height_ptr = nat_height;
    }
}

unsafe extern "C" fn cell_area_activate<T: CellAreaImpl>(
    ptr: *mut ffi::GtkCellArea,
    contextptr: *mut ffi::GtkCellAreaContext,
    wdgtptr: *mut ffi::GtkWidget,
    cellptr: *const gdk::ffi::GdkRectangle,
    flags: ffi::GtkCellRendererState,
    edit_only: glib::ffi::gboolean,
) -> glib::ffi::gboolean {
    let instance = &*(ptr as *mut T::Instance);
    let imp = instance.imp();
    let context: Borrowed<CellAreaContext> = from_glib_borrow(contextptr);
    let widget: Borrowed<Widget> = from_glib_borrow(wdgtptr);

    imp.activate(
        &*context,
        &*widget,
        &from_glib_borrow(cellptr),
        from_glib(flags),
        from_glib(edit_only),
    )
    .into_glib()
}

unsafe extern "C" fn cell_area_snapshot<T: CellAreaImpl>(
    ptr: *mut ffi::GtkCellArea,
    contextptr: *mut ffi::GtkCellAreaContext,
    wdgtptr: *mut ffi::GtkWidget,
    snapshotptr: *mut ffi::GtkSnapshot,
    bgptr: *const gdk::ffi::GdkRectangle,
    cellptr: *const gdk::ffi::GdkRectangle,
    flags: ffi::GtkCellRendererState,
    paint_focus: glib::ffi::gboolean,
) {
    let instance = &*(ptr as *mut T::Instance);
    let imp = instance.imp();
    let context: Borrowed<CellAreaContext> = from_glib_borrow(contextptr);
    let widget: Borrowed<Widget> = from_glib_borrow(wdgtptr);
    let snapshot: Borrowed<Snapshot> = from_glib_borrow(snapshotptr);

    imp.snapshot(
        &*context,
        &snapshot,
        &*widget,
        &from_glib_borrow(bgptr),
        &from_glib_borrow(cellptr),
        from_glib(flags),
        from_glib(paint_focus),
    )
}

unsafe extern "C" fn cell_area_create_context<T: CellAreaImpl>(
    ptr: *mut ffi::GtkCellArea,
) -> *mut ffi::GtkCellAreaContext {
    let instance = &*(ptr as *mut T::Instance);
    let imp = instance.imp();

    imp.create_context().into_glib_ptr()
}

unsafe extern "C" fn cell_area_copy_context<T: CellAreaImpl>(
    ptr: *mut ffi::GtkCellArea,
    contextptr: *mut ffi::GtkCellAreaContext,
) -> *mut ffi::GtkCellAreaContext {
    let instance = &*(ptr as *mut T::Instance);
    let imp = instance.imp();
    let context: Borrowed<CellAreaContext> = from_glib_borrow(contextptr);

    imp.copy_context(&*context).into_glib_ptr()
}

unsafe extern "C" fn cell_area_event<T: CellAreaImpl>(
    ptr: *mut ffi::GtkCellArea,
    contextptr: *mut ffi::GtkCellAreaContext,
    widgetptr: *mut ffi::GtkWidget,
    eventptr: *mut gdk::ffi::GdkEvent,
    rectangleptr: *const gdk::ffi::GdkRectangle,
    flags: ffi::GtkCellRendererState,
) -> glib::ffi::gboolean {
    let instance = &*(ptr as *mut T::Instance);
    let imp = instance.imp();
    let context: Borrowed<CellAreaContext> = from_glib_borrow(contextptr);
    let widget: Borrowed<Widget> = from_glib_borrow(widgetptr);
    let event: Borrowed<gdk::Event> = from_glib_borrow(eventptr);
    let rectangle: Borrowed<gdk::Rectangle> = from_glib_borrow(rectangleptr);

    imp.event(&*context, &*widget, &event, &rectangle, from_glib(flags))
        .into_glib()
}

unsafe extern "C" fn cell_area_foreach<T: CellAreaImpl>(
    ptr: *mut ffi::GtkCellArea,
    callback: ffi::GtkCellCallback,
    user_data: glib::ffi::gpointer,
) {
    let instance = &*(ptr as *mut T::Instance);
    let imp = instance.imp();

    let callback = CellCallback {
        callback,
        user_data,
    };

    imp.foreach(&callback)
}

unsafe extern "C" fn cell_area_foreach_alloc<T: CellAreaImpl>(
    ptr: *mut ffi::GtkCellArea,
    contextptr: *mut ffi::GtkCellAreaContext,
    widgetptr: *mut ffi::GtkWidget,
    areaptr: *const gdk::ffi::GdkRectangle,
    rectangleptr: *const gdk::ffi::GdkRectangle,
    callback: ffi::GtkCellAllocCallback,
    user_data: glib::ffi::gpointer,
) {
    let instance = &*(ptr as *mut T::Instance);
    let imp = instance.imp();
    let context: Borrowed<CellAreaContext> = from_glib_borrow(contextptr);
    let widget: Borrowed<Widget> = from_glib_borrow(widgetptr);
    let rectangle: Borrowed<gdk::Rectangle> = from_glib_borrow(rectangleptr);
    let area: Borrowed<gdk::Rectangle> = from_glib_borrow(areaptr);

    let callback = CellCallbackAllocate {
        callback,
        user_data,
    };

    imp.foreach_alloc(&*context, &*widget, &area, &rectangle, &callback)
}

#[allow(clippy::missing_safety_doc)]
pub unsafe trait CellAreaClassExt: ClassStruct {
    /// Finds a cell property of a cell area class by name.
    ///
    /// # Deprecated since 4.10
    ///
    /// ## `property_name`
    /// the name of the child property to find
    ///
    /// # Returns
    ///
    /// the `GParamSpec` of the child property
    #[doc(alias = "gtk_cell_area_class_find_cell_property")]
    fn find_cell_property(&self, property_name: &str) -> Option<ParamSpec> {
        unsafe {
            let cell_area_class = self as *const _ as *mut ffi::GtkCellAreaClass;
            from_glib_none(ffi::gtk_cell_area_class_find_cell_property(
                cell_area_class,
                property_name.to_glib_none().0,
            ))
        }
    }

    /// Returns all cell properties of a cell area class.
    ///
    /// # Deprecated since 4.10
    ///
    ///
    /// # Returns
    ///
    /// a newly
    ///     allocated [`None`]-terminated array of `GParamSpec`*.  The array
    ///     must be freed with g_free().
    #[doc(alias = "gtk_cell_area_class_list_cell_properties")]
    fn list_cell_properties(&self) -> Vec<ParamSpec> {
        unsafe {
            let cell_area_class = self as *const _ as *mut ffi::GtkCellAreaClass;
            let mut n_properties = std::mem::MaybeUninit::uninit();
            let props = ffi::gtk_cell_area_class_list_cell_properties(
                cell_area_class,
                n_properties.as_mut_ptr(),
            );
            FromGlibContainer::from_glib_none_num(props, n_properties.assume_init() as usize)
        }
    }
}

unsafe impl<T: ClassStruct> CellAreaClassExt for T where T::Type: CellAreaImpl {}