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
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;

use crate::*;

#[cfg(feature = "NSApplication")]
pub static NSAppKitVersionNumberWithContinuousScrollingBrowser: NSAppKitVersion = 680.0 as _;

#[cfg(feature = "NSApplication")]
pub static NSAppKitVersionNumberWithColumnResizingBrowser: NSAppKitVersion = 685.0 as _;

pub type NSBrowserColumnsAutosaveName = NSString;

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSBrowserColumnResizingType(pub NSUInteger);
impl NSBrowserColumnResizingType {
    pub const NSBrowserNoColumnResizing: Self = Self(0);
    pub const NSBrowserAutoColumnResizing: Self = Self(1);
    pub const NSBrowserUserColumnResizing: Self = Self(2);
}

unsafe impl Encode for NSBrowserColumnResizingType {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSBrowserColumnResizingType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSBrowserDropOperation(pub NSUInteger);
impl NSBrowserDropOperation {
    pub const NSBrowserDropOn: Self = Self(0);
    pub const NSBrowserDropAbove: Self = Self(1);
}

unsafe impl Encode for NSBrowserDropOperation {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSBrowserDropOperation {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

extern_class!(
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
    pub struct NSBrowser;

    #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
    unsafe impl ClassType for NSBrowser {
        #[inherits(NSView, NSResponder, NSObject)]
        type Super = NSControl;
        type Mutability = MainThreadOnly;
    }
);

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSControl",
    feature = "NSResponder",
    feature = "NSView"
))]
unsafe impl NSAccessibility for NSBrowser {}

#[cfg(all(
    feature = "NSAccessibilityProtocols",
    feature = "NSControl",
    feature = "NSResponder",
    feature = "NSView"
))]
unsafe impl NSAccessibilityElementProtocol for NSBrowser {}

#[cfg(all(
    feature = "NSAnimation",
    feature = "NSControl",
    feature = "NSResponder",
    feature = "NSView"
))]
unsafe impl NSAnimatablePropertyContainer for NSBrowser {}

#[cfg(all(
    feature = "NSAppearance",
    feature = "NSControl",
    feature = "NSResponder",
    feature = "NSView"
))]
unsafe impl NSAppearanceCustomization for NSBrowser {}

#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSCoding for NSBrowser {}

#[cfg(all(
    feature = "NSControl",
    feature = "NSDragging",
    feature = "NSResponder",
    feature = "NSView"
))]
unsafe impl NSDraggingDestination for NSBrowser {}

#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSObjectProtocol for NSBrowser {}

#[cfg(all(
    feature = "NSControl",
    feature = "NSResponder",
    feature = "NSUserInterfaceItemIdentification",
    feature = "NSView"
))]
unsafe impl NSUserInterfaceItemIdentification for NSBrowser {}

extern_methods!(
    #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
    unsafe impl NSBrowser {
        #[method(cellClass)]
        pub unsafe fn cellClass(mtm: MainThreadMarker) -> &'static AnyClass;

        #[method(loadColumnZero)]
        pub unsafe fn loadColumnZero(&self);

        #[method(isLoaded)]
        pub unsafe fn isLoaded(&self) -> bool;

        #[method(doubleAction)]
        pub unsafe fn doubleAction(&self) -> Option<Sel>;

        #[method(setDoubleAction:)]
        pub unsafe fn setDoubleAction(&self, double_action: Option<Sel>);

        #[method(setCellClass:)]
        pub unsafe fn setCellClass(&self, factory_id: &AnyClass);

        #[method_id(@__retain_semantics Other cellPrototype)]
        pub unsafe fn cellPrototype(&self) -> Option<Id<AnyObject>>;

        #[method(setCellPrototype:)]
        pub unsafe fn setCellPrototype(&self, cell_prototype: Option<&AnyObject>);

        #[method_id(@__retain_semantics Other delegate)]
        pub unsafe fn delegate(&self) -> Option<Id<ProtocolObject<dyn NSBrowserDelegate>>>;

        #[method(setDelegate:)]
        pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn NSBrowserDelegate>>);

        #[method(reusesColumns)]
        pub unsafe fn reusesColumns(&self) -> bool;

        #[method(setReusesColumns:)]
        pub unsafe fn setReusesColumns(&self, reuses_columns: bool);

        #[method(hasHorizontalScroller)]
        pub unsafe fn hasHorizontalScroller(&self) -> bool;

        #[method(setHasHorizontalScroller:)]
        pub unsafe fn setHasHorizontalScroller(&self, has_horizontal_scroller: bool);

        #[method(autohidesScroller)]
        pub unsafe fn autohidesScroller(&self) -> bool;

        #[method(setAutohidesScroller:)]
        pub unsafe fn setAutohidesScroller(&self, autohides_scroller: bool);

        #[method(separatesColumns)]
        pub unsafe fn separatesColumns(&self) -> bool;

        #[method(setSeparatesColumns:)]
        pub unsafe fn setSeparatesColumns(&self, separates_columns: bool);

        #[method(isTitled)]
        pub unsafe fn isTitled(&self) -> bool;

        #[method(setTitled:)]
        pub unsafe fn setTitled(&self, titled: bool);

        #[method(minColumnWidth)]
        pub unsafe fn minColumnWidth(&self) -> CGFloat;

        #[method(setMinColumnWidth:)]
        pub unsafe fn setMinColumnWidth(&self, min_column_width: CGFloat);

        #[method(maxVisibleColumns)]
        pub unsafe fn maxVisibleColumns(&self) -> NSInteger;

        #[method(setMaxVisibleColumns:)]
        pub unsafe fn setMaxVisibleColumns(&self, max_visible_columns: NSInteger);

        #[method(allowsMultipleSelection)]
        pub unsafe fn allowsMultipleSelection(&self) -> bool;

        #[method(setAllowsMultipleSelection:)]
        pub unsafe fn setAllowsMultipleSelection(&self, allows_multiple_selection: bool);

        #[method(allowsBranchSelection)]
        pub unsafe fn allowsBranchSelection(&self) -> bool;

        #[method(setAllowsBranchSelection:)]
        pub unsafe fn setAllowsBranchSelection(&self, allows_branch_selection: bool);

        #[method(allowsEmptySelection)]
        pub unsafe fn allowsEmptySelection(&self) -> bool;

        #[method(setAllowsEmptySelection:)]
        pub unsafe fn setAllowsEmptySelection(&self, allows_empty_selection: bool);

        #[method(takesTitleFromPreviousColumn)]
        pub unsafe fn takesTitleFromPreviousColumn(&self) -> bool;

        #[method(setTakesTitleFromPreviousColumn:)]
        pub unsafe fn setTakesTitleFromPreviousColumn(
            &self,
            takes_title_from_previous_column: bool,
        );

        #[method(sendsActionOnArrowKeys)]
        pub unsafe fn sendsActionOnArrowKeys(&self) -> bool;

        #[method(setSendsActionOnArrowKeys:)]
        pub unsafe fn setSendsActionOnArrowKeys(&self, sends_action_on_arrow_keys: bool);

        #[method_id(@__retain_semantics Other itemAtIndexPath:)]
        pub unsafe fn itemAtIndexPath(&self, index_path: &NSIndexPath) -> Option<Id<AnyObject>>;

        #[method_id(@__retain_semantics Other itemAtRow:inColumn:)]
        pub unsafe fn itemAtRow_inColumn(
            &self,
            row: NSInteger,
            column: NSInteger,
        ) -> Option<Id<AnyObject>>;

        #[method_id(@__retain_semantics Other indexPathForColumn:)]
        pub unsafe fn indexPathForColumn(&self, column: NSInteger) -> Id<NSIndexPath>;

        #[method(isLeafItem:)]
        pub unsafe fn isLeafItem(&self, item: Option<&AnyObject>) -> bool;

        #[method(reloadDataForRowIndexes:inColumn:)]
        pub unsafe fn reloadDataForRowIndexes_inColumn(
            &self,
            row_indexes: &NSIndexSet,
            column: NSInteger,
        );

        #[method_id(@__retain_semantics Other parentForItemsInColumn:)]
        pub unsafe fn parentForItemsInColumn(&self, column: NSInteger) -> Option<Id<AnyObject>>;

        #[method(scrollRowToVisible:inColumn:)]
        pub unsafe fn scrollRowToVisible_inColumn(&self, row: NSInteger, column: NSInteger);

        #[method(setTitle:ofColumn:)]
        pub unsafe fn setTitle_ofColumn(&self, string: &NSString, column: NSInteger);

        #[method_id(@__retain_semantics Other titleOfColumn:)]
        pub unsafe fn titleOfColumn(&self, column: NSInteger) -> Option<Id<NSString>>;

        #[method_id(@__retain_semantics Other pathSeparator)]
        pub unsafe fn pathSeparator(&self) -> Id<NSString>;

        #[method(setPathSeparator:)]
        pub unsafe fn setPathSeparator(&self, path_separator: &NSString);

        #[method(setPath:)]
        pub unsafe fn setPath(&self, path: &NSString) -> bool;

        #[method_id(@__retain_semantics Other path)]
        pub unsafe fn path(&self) -> Id<NSString>;

        #[method_id(@__retain_semantics Other pathToColumn:)]
        pub unsafe fn pathToColumn(&self, column: NSInteger) -> Id<NSString>;

        #[method(clickedColumn)]
        pub unsafe fn clickedColumn(&self) -> NSInteger;

        #[method(clickedRow)]
        pub unsafe fn clickedRow(&self) -> NSInteger;

        #[method(selectedColumn)]
        pub unsafe fn selectedColumn(&self) -> NSInteger;

        #[method_id(@__retain_semantics Other selectedCell)]
        pub unsafe fn selectedCell(&self) -> Option<Id<AnyObject>>;

        #[method_id(@__retain_semantics Other selectedCellInColumn:)]
        pub unsafe fn selectedCellInColumn(&self, column: NSInteger) -> Option<Id<AnyObject>>;

        #[cfg(feature = "NSCell")]
        #[method_id(@__retain_semantics Other selectedCells)]
        pub unsafe fn selectedCells(&self) -> Option<Id<NSArray<NSCell>>>;

        #[method(selectRow:inColumn:)]
        pub unsafe fn selectRow_inColumn(&self, row: NSInteger, column: NSInteger);

        #[method(selectedRowInColumn:)]
        pub unsafe fn selectedRowInColumn(&self, column: NSInteger) -> NSInteger;

        #[method_id(@__retain_semantics Other selectionIndexPath)]
        pub unsafe fn selectionIndexPath(&self) -> Option<Id<NSIndexPath>>;

        #[method(setSelectionIndexPath:)]
        pub unsafe fn setSelectionIndexPath(&self, selection_index_path: Option<&NSIndexPath>);

        #[method_id(@__retain_semantics Other selectionIndexPaths)]
        pub unsafe fn selectionIndexPaths(&self) -> Id<NSArray<NSIndexPath>>;

        #[method(setSelectionIndexPaths:)]
        pub unsafe fn setSelectionIndexPaths(&self, selection_index_paths: &NSArray<NSIndexPath>);

        #[method(selectRowIndexes:inColumn:)]
        pub unsafe fn selectRowIndexes_inColumn(&self, indexes: &NSIndexSet, column: NSInteger);

        #[method_id(@__retain_semantics Other selectedRowIndexesInColumn:)]
        pub unsafe fn selectedRowIndexesInColumn(
            &self,
            column: NSInteger,
        ) -> Option<Id<NSIndexSet>>;

        #[method(reloadColumn:)]
        pub unsafe fn reloadColumn(&self, column: NSInteger);

        #[method(validateVisibleColumns)]
        pub unsafe fn validateVisibleColumns(&self);

        #[method(scrollColumnsRightBy:)]
        pub unsafe fn scrollColumnsRightBy(&self, shift_amount: NSInteger);

        #[method(scrollColumnsLeftBy:)]
        pub unsafe fn scrollColumnsLeftBy(&self, shift_amount: NSInteger);

        #[method(scrollColumnToVisible:)]
        pub unsafe fn scrollColumnToVisible(&self, column: NSInteger);

        #[method(lastColumn)]
        pub unsafe fn lastColumn(&self) -> NSInteger;

        #[method(setLastColumn:)]
        pub unsafe fn setLastColumn(&self, last_column: NSInteger);

        #[method(addColumn)]
        pub unsafe fn addColumn(&self);

        #[method(numberOfVisibleColumns)]
        pub unsafe fn numberOfVisibleColumns(&self) -> NSInteger;

        #[method(firstVisibleColumn)]
        pub unsafe fn firstVisibleColumn(&self) -> NSInteger;

        #[method(lastVisibleColumn)]
        pub unsafe fn lastVisibleColumn(&self) -> NSInteger;

        #[method_id(@__retain_semantics Other loadedCellAtRow:column:)]
        pub unsafe fn loadedCellAtRow_column(
            &self,
            row: NSInteger,
            col: NSInteger,
        ) -> Option<Id<AnyObject>>;

        #[method(selectAll:)]
        pub unsafe fn selectAll(&self, sender: Option<&AnyObject>);

        #[method(tile)]
        pub unsafe fn tile(&self);

        #[method(doClick:)]
        pub unsafe fn doClick(&self, sender: Option<&AnyObject>);

        #[method(doDoubleClick:)]
        pub unsafe fn doDoubleClick(&self, sender: Option<&AnyObject>);

        #[method(sendAction)]
        pub unsafe fn sendAction(&self) -> bool;

        #[method(titleFrameOfColumn:)]
        pub unsafe fn titleFrameOfColumn(&self, column: NSInteger) -> NSRect;

        #[method(drawTitleOfColumn:inRect:)]
        pub unsafe fn drawTitleOfColumn_inRect(&self, column: NSInteger, rect: NSRect);

        #[method(titleHeight)]
        pub unsafe fn titleHeight(&self) -> CGFloat;

        #[method(frameOfColumn:)]
        pub unsafe fn frameOfColumn(&self, column: NSInteger) -> NSRect;

        #[method(frameOfInsideOfColumn:)]
        pub unsafe fn frameOfInsideOfColumn(&self, column: NSInteger) -> NSRect;

        #[method(frameOfRow:inColumn:)]
        pub unsafe fn frameOfRow_inColumn(&self, row: NSInteger, column: NSInteger) -> NSRect;

        #[method(getRow:column:forPoint:)]
        pub unsafe fn getRow_column_forPoint(
            &self,
            row: *mut NSInteger,
            column: *mut NSInteger,
            point: NSPoint,
        ) -> bool;

        #[method(columnWidthForColumnContentWidth:)]
        pub unsafe fn columnWidthForColumnContentWidth(
            &self,
            column_content_width: CGFloat,
        ) -> CGFloat;

        #[method(columnContentWidthForColumnWidth:)]
        pub unsafe fn columnContentWidthForColumnWidth(&self, column_width: CGFloat) -> CGFloat;

        #[method(columnResizingType)]
        pub unsafe fn columnResizingType(&self) -> NSBrowserColumnResizingType;

        #[method(setColumnResizingType:)]
        pub unsafe fn setColumnResizingType(
            &self,
            column_resizing_type: NSBrowserColumnResizingType,
        );

        #[method(prefersAllColumnUserResizing)]
        pub unsafe fn prefersAllColumnUserResizing(&self) -> bool;

        #[method(setPrefersAllColumnUserResizing:)]
        pub unsafe fn setPrefersAllColumnUserResizing(
            &self,
            prefers_all_column_user_resizing: bool,
        );

        #[method(setWidth:ofColumn:)]
        pub unsafe fn setWidth_ofColumn(&self, column_width: CGFloat, column_index: NSInteger);

        #[method(widthOfColumn:)]
        pub unsafe fn widthOfColumn(&self, column: NSInteger) -> CGFloat;

        #[method(rowHeight)]
        pub unsafe fn rowHeight(&self) -> CGFloat;

        #[method(setRowHeight:)]
        pub unsafe fn setRowHeight(&self, row_height: CGFloat);

        #[method(noteHeightOfRowsWithIndexesChanged:inColumn:)]
        pub unsafe fn noteHeightOfRowsWithIndexesChanged_inColumn(
            &self,
            index_set: &NSIndexSet,
            column_index: NSInteger,
        );

        #[method(setDefaultColumnWidth:)]
        pub unsafe fn setDefaultColumnWidth(&self, column_width: CGFloat);

        #[method(defaultColumnWidth)]
        pub unsafe fn defaultColumnWidth(&self) -> CGFloat;

        #[method_id(@__retain_semantics Other columnsAutosaveName)]
        pub unsafe fn columnsAutosaveName(&self) -> Id<NSBrowserColumnsAutosaveName>;

        #[method(setColumnsAutosaveName:)]
        pub unsafe fn setColumnsAutosaveName(
            &self,
            columns_autosave_name: &NSBrowserColumnsAutosaveName,
        );

        #[method(removeSavedColumnsWithAutosaveName:)]
        pub unsafe fn removeSavedColumnsWithAutosaveName(
            name: &NSBrowserColumnsAutosaveName,
            mtm: MainThreadMarker,
        );

        #[cfg(feature = "NSEvent")]
        #[method(canDragRowsWithIndexes:inColumn:withEvent:)]
        pub unsafe fn canDragRowsWithIndexes_inColumn_withEvent(
            &self,
            row_indexes: &NSIndexSet,
            column: NSInteger,
            event: &NSEvent,
        ) -> bool;

        #[cfg(all(feature = "NSEvent", feature = "NSImage"))]
        #[method_id(@__retain_semantics Other draggingImageForRowsWithIndexes:inColumn:withEvent:offset:)]
        pub unsafe fn draggingImageForRowsWithIndexes_inColumn_withEvent_offset(
            &self,
            row_indexes: &NSIndexSet,
            column: NSInteger,
            event: &NSEvent,
            drag_image_offset: NSPointPointer,
        ) -> Option<Id<NSImage>>;

        #[cfg(feature = "NSDragging")]
        #[method(setDraggingSourceOperationMask:forLocal:)]
        pub unsafe fn setDraggingSourceOperationMask_forLocal(
            &self,
            mask: NSDragOperation,
            is_local: bool,
        );

        #[method(allowsTypeSelect)]
        pub unsafe fn allowsTypeSelect(&self) -> bool;

        #[method(setAllowsTypeSelect:)]
        pub unsafe fn setAllowsTypeSelect(&self, allows_type_select: bool);

        #[cfg(feature = "NSColor")]
        #[method_id(@__retain_semantics Other backgroundColor)]
        pub unsafe fn backgroundColor(&self) -> Id<NSColor>;

        #[cfg(feature = "NSColor")]
        #[method(setBackgroundColor:)]
        pub unsafe fn setBackgroundColor(&self, background_color: &NSColor);

        #[cfg(feature = "NSEvent")]
        #[method(editItemAtIndexPath:withEvent:select:)]
        pub unsafe fn editItemAtIndexPath_withEvent_select(
            &self,
            index_path: &NSIndexPath,
            event: Option<&NSEvent>,
            select: bool,
        );
    }
);

extern_methods!(
    /// Methods declared on superclass `NSControl`
    #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
    unsafe impl NSBrowser {
        #[method_id(@__retain_semantics Init initWithFrame:)]
        pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Id<Self>;

        #[method_id(@__retain_semantics Init initWithCoder:)]
        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Option<Id<Self>>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSResponder`
    #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
    unsafe impl NSBrowser {
        #[method_id(@__retain_semantics Init init)]
        pub unsafe fn init(this: Allocated<Self>) -> Id<Self>;
    }
);

extern_methods!(
    /// Methods declared on superclass `NSObject`
    #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
    unsafe impl NSBrowser {
        #[method_id(@__retain_semantics New new)]
        pub unsafe fn new(mtm: MainThreadMarker) -> Id<Self>;
    }
);

extern "C" {
    pub static NSBrowserColumnConfigurationDidChangeNotification: &'static NSNotificationName;
}

extern_protocol!(
    pub unsafe trait NSBrowserDelegate: NSObjectProtocol + IsMainThreadOnly {
        #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
        #[optional]
        #[method(browser:numberOfRowsInColumn:)]
        unsafe fn browser_numberOfRowsInColumn(
            &self,
            sender: &NSBrowser,
            column: NSInteger,
        ) -> NSInteger;

        #[cfg(all(
            feature = "NSControl",
            feature = "NSMatrix",
            feature = "NSResponder",
            feature = "NSView"
        ))]
        #[optional]
        #[method(browser:createRowsForColumn:inMatrix:)]
        unsafe fn browser_createRowsForColumn_inMatrix(
            &self,
            sender: &NSBrowser,
            column: NSInteger,
            matrix: &NSMatrix,
        );

        #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
        #[optional]
        #[method(browser:numberOfChildrenOfItem:)]
        unsafe fn browser_numberOfChildrenOfItem(
            &self,
            browser: &NSBrowser,
            item: Option<&AnyObject>,
        ) -> NSInteger;

        #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
        #[optional]
        #[method_id(@__retain_semantics Other browser:child:ofItem:)]
        unsafe fn browser_child_ofItem(
            &self,
            browser: &NSBrowser,
            index: NSInteger,
            item: Option<&AnyObject>,
        ) -> Id<AnyObject>;

        #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
        #[optional]
        #[method(browser:isLeafItem:)]
        unsafe fn browser_isLeafItem(&self, browser: &NSBrowser, item: Option<&AnyObject>) -> bool;

        #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
        #[optional]
        #[method_id(@__retain_semantics Other browser:objectValueForItem:)]
        unsafe fn browser_objectValueForItem(
            &self,
            browser: &NSBrowser,
            item: Option<&AnyObject>,
        ) -> Option<Id<AnyObject>>;

        #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
        #[optional]
        #[method(browser:heightOfRow:inColumn:)]
        unsafe fn browser_heightOfRow_inColumn(
            &self,
            browser: &NSBrowser,
            row: NSInteger,
            column_index: NSInteger,
        ) -> CGFloat;

        #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
        #[optional]
        #[method_id(@__retain_semantics Other rootItemForBrowser:)]
        unsafe fn rootItemForBrowser(&self, browser: &NSBrowser) -> Option<Id<AnyObject>>;

        #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
        #[optional]
        #[method(browser:setObjectValue:forItem:)]
        unsafe fn browser_setObjectValue_forItem(
            &self,
            browser: &NSBrowser,
            object: Option<&AnyObject>,
            item: Option<&AnyObject>,
        );

        #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
        #[optional]
        #[method(browser:shouldEditItem:)]
        unsafe fn browser_shouldEditItem(
            &self,
            browser: &NSBrowser,
            item: Option<&AnyObject>,
        ) -> bool;

        #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
        #[optional]
        #[method(browser:willDisplayCell:atRow:column:)]
        unsafe fn browser_willDisplayCell_atRow_column(
            &self,
            sender: &NSBrowser,
            cell: &AnyObject,
            row: NSInteger,
            column: NSInteger,
        );

        #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
        #[optional]
        #[method_id(@__retain_semantics Other browser:titleOfColumn:)]
        unsafe fn browser_titleOfColumn(
            &self,
            sender: &NSBrowser,
            column: NSInteger,
        ) -> Option<Id<NSString>>;

        #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
        #[optional]
        #[method(browser:selectCellWithString:inColumn:)]
        unsafe fn browser_selectCellWithString_inColumn(
            &self,
            sender: &NSBrowser,
            title: &NSString,
            column: NSInteger,
        ) -> bool;

        #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
        #[optional]
        #[method(browser:selectRow:inColumn:)]
        unsafe fn browser_selectRow_inColumn(
            &self,
            sender: &NSBrowser,
            row: NSInteger,
            column: NSInteger,
        ) -> bool;

        #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
        #[optional]
        #[method(browser:isColumnValid:)]
        unsafe fn browser_isColumnValid(&self, sender: &NSBrowser, column: NSInteger) -> bool;

        #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
        #[optional]
        #[method(browserWillScroll:)]
        unsafe fn browserWillScroll(&self, sender: &NSBrowser);

        #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
        #[optional]
        #[method(browserDidScroll:)]
        unsafe fn browserDidScroll(&self, sender: &NSBrowser);

        #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
        #[optional]
        #[method(browser:shouldSizeColumn:forUserResize:toWidth:)]
        unsafe fn browser_shouldSizeColumn_forUserResize_toWidth(
            &self,
            browser: &NSBrowser,
            column_index: NSInteger,
            for_user_resize: bool,
            suggested_width: CGFloat,
        ) -> CGFloat;

        #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
        #[optional]
        #[method(browser:sizeToFitWidthOfColumn:)]
        unsafe fn browser_sizeToFitWidthOfColumn(
            &self,
            browser: &NSBrowser,
            column_index: NSInteger,
        ) -> CGFloat;

        #[optional]
        #[method(browserColumnConfigurationDidChange:)]
        unsafe fn browserColumnConfigurationDidChange(&self, notification: &NSNotification);

        #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
        #[optional]
        #[method(browser:shouldShowCellExpansionForRow:column:)]
        unsafe fn browser_shouldShowCellExpansionForRow_column(
            &self,
            browser: &NSBrowser,
            row: NSInteger,
            column: NSInteger,
        ) -> bool;

        #[cfg(all(
            feature = "NSControl",
            feature = "NSPasteboard",
            feature = "NSResponder",
            feature = "NSView"
        ))]
        #[optional]
        #[method(browser:writeRowsWithIndexes:inColumn:toPasteboard:)]
        unsafe fn browser_writeRowsWithIndexes_inColumn_toPasteboard(
            &self,
            browser: &NSBrowser,
            row_indexes: &NSIndexSet,
            column: NSInteger,
            pasteboard: &NSPasteboard,
        ) -> bool;

        #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
        #[deprecated = "Use NSFilePromiseReceiver objects instead"]
        #[optional]
        #[method_id(@__retain_semantics Other browser:namesOfPromisedFilesDroppedAtDestination:forDraggedRowsWithIndexes:inColumn:)]
        unsafe fn browser_namesOfPromisedFilesDroppedAtDestination_forDraggedRowsWithIndexes_inColumn(
            &self,
            browser: &NSBrowser,
            drop_destination: &NSURL,
            row_indexes: &NSIndexSet,
            column: NSInteger,
        ) -> Id<NSArray<NSString>>;

        #[cfg(all(
            feature = "NSControl",
            feature = "NSEvent",
            feature = "NSResponder",
            feature = "NSView"
        ))]
        #[optional]
        #[method(browser:canDragRowsWithIndexes:inColumn:withEvent:)]
        unsafe fn browser_canDragRowsWithIndexes_inColumn_withEvent(
            &self,
            browser: &NSBrowser,
            row_indexes: &NSIndexSet,
            column: NSInteger,
            event: &NSEvent,
        ) -> bool;

        #[cfg(all(
            feature = "NSControl",
            feature = "NSEvent",
            feature = "NSImage",
            feature = "NSResponder",
            feature = "NSView"
        ))]
        #[optional]
        #[method_id(@__retain_semantics Other browser:draggingImageForRowsWithIndexes:inColumn:withEvent:offset:)]
        unsafe fn browser_draggingImageForRowsWithIndexes_inColumn_withEvent_offset(
            &self,
            browser: &NSBrowser,
            row_indexes: &NSIndexSet,
            column: NSInteger,
            event: &NSEvent,
            drag_image_offset: NSPointPointer,
        ) -> Option<Id<NSImage>>;

        #[cfg(all(
            feature = "NSControl",
            feature = "NSDragging",
            feature = "NSResponder",
            feature = "NSView"
        ))]
        #[optional]
        #[method(browser:validateDrop:proposedRow:column:dropOperation:)]
        unsafe fn browser_validateDrop_proposedRow_column_dropOperation(
            &self,
            browser: &NSBrowser,
            info: &ProtocolObject<dyn NSDraggingInfo>,
            row: NonNull<NSInteger>,
            column: NonNull<NSInteger>,
            drop_operation: NonNull<NSBrowserDropOperation>,
        ) -> NSDragOperation;

        #[cfg(all(
            feature = "NSControl",
            feature = "NSDragging",
            feature = "NSResponder",
            feature = "NSView"
        ))]
        #[optional]
        #[method(browser:acceptDrop:atRow:column:dropOperation:)]
        unsafe fn browser_acceptDrop_atRow_column_dropOperation(
            &self,
            browser: &NSBrowser,
            info: &ProtocolObject<dyn NSDraggingInfo>,
            row: NSInteger,
            column: NSInteger,
            drop_operation: NSBrowserDropOperation,
        ) -> bool;

        #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
        #[optional]
        #[method_id(@__retain_semantics Other browser:typeSelectStringForRow:inColumn:)]
        unsafe fn browser_typeSelectStringForRow_inColumn(
            &self,
            browser: &NSBrowser,
            row: NSInteger,
            column: NSInteger,
        ) -> Option<Id<NSString>>;

        #[cfg(all(
            feature = "NSControl",
            feature = "NSEvent",
            feature = "NSResponder",
            feature = "NSView"
        ))]
        #[optional]
        #[method(browser:shouldTypeSelectForEvent:withCurrentSearchString:)]
        unsafe fn browser_shouldTypeSelectForEvent_withCurrentSearchString(
            &self,
            browser: &NSBrowser,
            event: &NSEvent,
            search_string: Option<&NSString>,
        ) -> bool;

        #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
        #[optional]
        #[method(browser:nextTypeSelectMatchFromRow:toRow:inColumn:forString:)]
        unsafe fn browser_nextTypeSelectMatchFromRow_toRow_inColumn_forString(
            &self,
            browser: &NSBrowser,
            start_row: NSInteger,
            end_row: NSInteger,
            column: NSInteger,
            search_string: Option<&NSString>,
        ) -> NSInteger;

        #[cfg(all(
            feature = "NSControl",
            feature = "NSResponder",
            feature = "NSView",
            feature = "NSViewController"
        ))]
        #[optional]
        #[method_id(@__retain_semantics Other browser:previewViewControllerForLeafItem:)]
        unsafe fn browser_previewViewControllerForLeafItem(
            &self,
            browser: &NSBrowser,
            item: &AnyObject,
        ) -> Option<Id<NSViewController>>;

        #[cfg(all(
            feature = "NSControl",
            feature = "NSResponder",
            feature = "NSView",
            feature = "NSViewController"
        ))]
        #[optional]
        #[method_id(@__retain_semantics Other browser:headerViewControllerForItem:)]
        unsafe fn browser_headerViewControllerForItem(
            &self,
            browser: &NSBrowser,
            item: Option<&AnyObject>,
        ) -> Option<Id<NSViewController>>;

        #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
        #[optional]
        #[method(browser:didChangeLastColumn:toColumn:)]
        unsafe fn browser_didChangeLastColumn_toColumn(
            &self,
            browser: &NSBrowser,
            old_last_column: NSInteger,
            column: NSInteger,
        );

        #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
        #[optional]
        #[method_id(@__retain_semantics Other browser:selectionIndexesForProposedSelection:inColumn:)]
        unsafe fn browser_selectionIndexesForProposedSelection_inColumn(
            &self,
            browser: &NSBrowser,
            proposed_selection_indexes: &NSIndexSet,
            column: NSInteger,
        ) -> Id<NSIndexSet>;
    }

    unsafe impl ProtocolType for dyn NSBrowserDelegate {}
);

extern_methods!(
    /// NSDeprecated
    #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
    unsafe impl NSBrowser {
        #[deprecated]
        #[method(setAcceptsArrowKeys:)]
        pub unsafe fn setAcceptsArrowKeys(&self, flag: bool);

        #[deprecated]
        #[method(acceptsArrowKeys)]
        pub unsafe fn acceptsArrowKeys(&self) -> bool;

        #[deprecated]
        #[method(displayColumn:)]
        pub unsafe fn displayColumn(&self, column: NSInteger);

        #[deprecated]
        #[method(displayAllColumns)]
        pub unsafe fn displayAllColumns(&self);

        #[cfg(feature = "NSScroller")]
        #[deprecated]
        #[method(scrollViaScroller:)]
        pub unsafe fn scrollViaScroller(&self, sender: Option<&NSScroller>);

        #[deprecated]
        #[method(updateScroller)]
        pub unsafe fn updateScroller(&self);

        #[deprecated = "Use the item based NSBrowser instead"]
        #[method(setMatrixClass:)]
        pub unsafe fn setMatrixClass(&self, factory_id: &AnyClass);

        #[deprecated = "Use the item based NSBrowser instead"]
        #[method(matrixClass)]
        pub unsafe fn matrixClass(&self) -> &'static AnyClass;

        #[cfg(feature = "NSMatrix")]
        #[deprecated = "Use the item based NSBrowser instead"]
        #[method(columnOfMatrix:)]
        pub unsafe fn columnOfMatrix(&self, matrix: &NSMatrix) -> NSInteger;

        #[cfg(feature = "NSMatrix")]
        #[deprecated = "Use the item based NSBrowser instead"]
        #[method_id(@__retain_semantics Other matrixInColumn:)]
        pub unsafe fn matrixInColumn(&self, column: NSInteger) -> Option<Id<NSMatrix>>;
    }
);