objc2_app_kit/generated/
NSMatrix.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsmatrixmode?language=objc)
11// NS_ENUM
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct NSMatrixMode(pub NSUInteger);
15impl NSMatrixMode {
16    #[doc(alias = "NSRadioModeMatrix")]
17    pub const RadioModeMatrix: Self = Self(0);
18    #[doc(alias = "NSHighlightModeMatrix")]
19    pub const HighlightModeMatrix: Self = Self(1);
20    #[doc(alias = "NSListModeMatrix")]
21    pub const ListModeMatrix: Self = Self(2);
22    #[doc(alias = "NSTrackModeMatrix")]
23    pub const TrackModeMatrix: Self = Self(3);
24}
25
26unsafe impl Encode for NSMatrixMode {
27    const ENCODING: Encoding = NSUInteger::ENCODING;
28}
29
30unsafe impl RefEncode for NSMatrixMode {
31    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
32}
33
34extern_class!(
35    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsmatrix?language=objc)
36    #[unsafe(super(NSControl, NSView, NSResponder, NSObject))]
37    #[derive(Debug, PartialEq, Eq, Hash)]
38    #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
39    pub struct NSMatrix;
40);
41
42#[cfg(all(
43    feature = "NSAccessibilityProtocols",
44    feature = "NSControl",
45    feature = "NSResponder",
46    feature = "NSView"
47))]
48extern_conformance!(
49    unsafe impl NSAccessibility for NSMatrix {}
50);
51
52#[cfg(all(
53    feature = "NSAccessibilityProtocols",
54    feature = "NSControl",
55    feature = "NSResponder",
56    feature = "NSView"
57))]
58extern_conformance!(
59    unsafe impl NSAccessibilityElementProtocol for NSMatrix {}
60);
61
62#[cfg(all(
63    feature = "NSAnimation",
64    feature = "NSControl",
65    feature = "NSResponder",
66    feature = "NSView"
67))]
68extern_conformance!(
69    unsafe impl NSAnimatablePropertyContainer for NSMatrix {}
70);
71
72#[cfg(all(
73    feature = "NSAppearance",
74    feature = "NSControl",
75    feature = "NSResponder",
76    feature = "NSView"
77))]
78extern_conformance!(
79    unsafe impl NSAppearanceCustomization for NSMatrix {}
80);
81
82#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
83extern_conformance!(
84    unsafe impl NSCoding for NSMatrix {}
85);
86
87#[cfg(all(
88    feature = "NSControl",
89    feature = "NSDragging",
90    feature = "NSResponder",
91    feature = "NSView"
92))]
93extern_conformance!(
94    unsafe impl NSDraggingDestination for NSMatrix {}
95);
96
97#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
98extern_conformance!(
99    unsafe impl NSObjectProtocol for NSMatrix {}
100);
101
102#[cfg(all(
103    feature = "NSControl",
104    feature = "NSResponder",
105    feature = "NSUserInterfaceItemIdentification",
106    feature = "NSView"
107))]
108extern_conformance!(
109    unsafe impl NSUserInterfaceItemIdentification for NSMatrix {}
110);
111
112#[cfg(all(
113    feature = "NSControl",
114    feature = "NSResponder",
115    feature = "NSUserInterfaceValidation",
116    feature = "NSView"
117))]
118extern_conformance!(
119    unsafe impl NSUserInterfaceValidations for NSMatrix {}
120);
121
122#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
123extern_conformance!(
124    unsafe impl NSViewToolTipOwner for NSMatrix {}
125);
126
127#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
128impl NSMatrix {
129    extern_methods!(
130        #[unsafe(method(initWithFrame:))]
131        #[unsafe(method_family = init)]
132        pub fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
133
134        #[cfg(feature = "NSCell")]
135        #[unsafe(method(initWithFrame:mode:prototype:numberOfRows:numberOfColumns:))]
136        #[unsafe(method_family = init)]
137        pub fn initWithFrame_mode_prototype_numberOfRows_numberOfColumns(
138            this: Allocated<Self>,
139            frame_rect: NSRect,
140            mode: NSMatrixMode,
141            cell: &NSCell,
142            rows_high: NSInteger,
143            cols_wide: NSInteger,
144        ) -> Retained<Self>;
145
146        /// # Safety
147        ///
148        /// `factory_id` probably has further requirements.
149        #[unsafe(method(initWithFrame:mode:cellClass:numberOfRows:numberOfColumns:))]
150        #[unsafe(method_family = init)]
151        pub unsafe fn initWithFrame_mode_cellClass_numberOfRows_numberOfColumns(
152            this: Allocated<Self>,
153            frame_rect: NSRect,
154            mode: NSMatrixMode,
155            factory_id: Option<&AnyClass>,
156            rows_high: NSInteger,
157            cols_wide: NSInteger,
158        ) -> Retained<Self>;
159
160        /// # Safety
161        ///
162        /// This is not retained internally, you must ensure the object is still alive.
163        #[unsafe(method(cellClass))]
164        #[unsafe(method_family = none)]
165        pub unsafe fn cellClass(&self) -> &'static AnyClass;
166
167        /// Setter for [`cellClass`][Self::cellClass].
168        ///
169        /// # Safety
170        ///
171        /// - `cell_class` probably has further requirements.
172        /// - This is unretained, you must ensure the object is kept alive while in use.
173        #[unsafe(method(setCellClass:))]
174        #[unsafe(method_family = none)]
175        pub unsafe fn setCellClass(&self, cell_class: &AnyClass);
176
177        #[cfg(feature = "NSCell")]
178        #[unsafe(method(prototype))]
179        #[unsafe(method_family = none)]
180        pub fn prototype(&self) -> Option<Retained<NSCell>>;
181
182        #[cfg(feature = "NSCell")]
183        /// Setter for [`prototype`][Self::prototype].
184        ///
185        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
186        #[unsafe(method(setPrototype:))]
187        #[unsafe(method_family = none)]
188        pub fn setPrototype(&self, prototype: Option<&NSCell>);
189
190        #[cfg(feature = "NSCell")]
191        #[unsafe(method(makeCellAtRow:column:))]
192        #[unsafe(method_family = none)]
193        pub fn makeCellAtRow_column(&self, row: NSInteger, col: NSInteger) -> Retained<NSCell>;
194
195        #[unsafe(method(mode))]
196        #[unsafe(method_family = none)]
197        pub fn mode(&self) -> NSMatrixMode;
198
199        /// Setter for [`mode`][Self::mode].
200        #[unsafe(method(setMode:))]
201        #[unsafe(method_family = none)]
202        pub fn setMode(&self, mode: NSMatrixMode);
203
204        #[unsafe(method(allowsEmptySelection))]
205        #[unsafe(method_family = none)]
206        pub fn allowsEmptySelection(&self) -> bool;
207
208        /// Setter for [`allowsEmptySelection`][Self::allowsEmptySelection].
209        #[unsafe(method(setAllowsEmptySelection:))]
210        #[unsafe(method_family = none)]
211        pub fn setAllowsEmptySelection(&self, allows_empty_selection: bool);
212
213        /// # Safety
214        ///
215        /// - `selector` must be a valid selector.
216        /// - `object` should be of the correct type.
217        #[unsafe(method(sendAction:to:forAllCells:))]
218        #[unsafe(method_family = none)]
219        pub unsafe fn sendAction_to_forAllCells(
220            &self,
221            selector: Sel,
222            object: &AnyObject,
223            flag: bool,
224        );
225
226        #[cfg(feature = "NSCell")]
227        #[unsafe(method(cells))]
228        #[unsafe(method_family = none)]
229        pub fn cells(&self) -> Retained<NSArray<NSCell>>;
230
231        /// # Safety
232        ///
233        /// `comparator` must be a valid selector.
234        #[unsafe(method(sortUsingSelector:))]
235        #[unsafe(method_family = none)]
236        pub unsafe fn sortUsingSelector(&self, comparator: Sel);
237
238        /// # Safety
239        ///
240        /// - `compare` must be implemented correctly.
241        /// - `context` must be a valid pointer or null.
242        #[unsafe(method(sortUsingFunction:context:))]
243        #[unsafe(method_family = none)]
244        pub unsafe fn sortUsingFunction_context(
245            &self,
246            compare: unsafe extern "C-unwind" fn(
247                NonNull<AnyObject>,
248                NonNull<AnyObject>,
249                *mut c_void,
250            ) -> NSInteger,
251            context: *mut c_void,
252        );
253
254        #[cfg(feature = "NSCell")]
255        #[unsafe(method(selectedCell))]
256        #[unsafe(method_family = none)]
257        pub fn selectedCell(&self) -> Option<Retained<NSCell>>;
258
259        #[cfg(feature = "NSCell")]
260        #[unsafe(method(selectedCells))]
261        #[unsafe(method_family = none)]
262        pub fn selectedCells(&self) -> Retained<NSArray<NSCell>>;
263
264        #[unsafe(method(selectedRow))]
265        #[unsafe(method_family = none)]
266        pub fn selectedRow(&self) -> NSInteger;
267
268        #[unsafe(method(selectedColumn))]
269        #[unsafe(method_family = none)]
270        pub fn selectedColumn(&self) -> NSInteger;
271
272        #[unsafe(method(isSelectionByRect))]
273        #[unsafe(method_family = none)]
274        pub fn isSelectionByRect(&self) -> bool;
275
276        /// Setter for [`isSelectionByRect`][Self::isSelectionByRect].
277        #[unsafe(method(setSelectionByRect:))]
278        #[unsafe(method_family = none)]
279        pub fn setSelectionByRect(&self, selection_by_rect: bool);
280
281        #[unsafe(method(setSelectionFrom:to:anchor:highlight:))]
282        #[unsafe(method_family = none)]
283        pub fn setSelectionFrom_to_anchor_highlight(
284            &self,
285            start_pos: NSInteger,
286            end_pos: NSInteger,
287            anchor_pos: NSInteger,
288            lit: bool,
289        );
290
291        #[unsafe(method(deselectSelectedCell))]
292        #[unsafe(method_family = none)]
293        pub fn deselectSelectedCell(&self);
294
295        #[unsafe(method(deselectAllCells))]
296        #[unsafe(method_family = none)]
297        pub fn deselectAllCells(&self);
298
299        #[unsafe(method(selectCellAtRow:column:))]
300        #[unsafe(method_family = none)]
301        pub fn selectCellAtRow_column(&self, row: NSInteger, col: NSInteger);
302
303        /// # Safety
304        ///
305        /// `sender` should be of the correct type.
306        #[unsafe(method(selectAll:))]
307        #[unsafe(method_family = none)]
308        pub unsafe fn selectAll(&self, sender: Option<&AnyObject>);
309
310        #[unsafe(method(selectCellWithTag:))]
311        #[unsafe(method_family = none)]
312        pub fn selectCellWithTag(&self, tag: NSInteger) -> bool;
313
314        #[unsafe(method(cellSize))]
315        #[unsafe(method_family = none)]
316        pub fn cellSize(&self) -> NSSize;
317
318        /// Setter for [`cellSize`][Self::cellSize].
319        #[unsafe(method(setCellSize:))]
320        #[unsafe(method_family = none)]
321        pub fn setCellSize(&self, cell_size: NSSize);
322
323        #[unsafe(method(intercellSpacing))]
324        #[unsafe(method_family = none)]
325        pub fn intercellSpacing(&self) -> NSSize;
326
327        /// Setter for [`intercellSpacing`][Self::intercellSpacing].
328        #[unsafe(method(setIntercellSpacing:))]
329        #[unsafe(method_family = none)]
330        pub fn setIntercellSpacing(&self, intercell_spacing: NSSize);
331
332        #[unsafe(method(setScrollable:))]
333        #[unsafe(method_family = none)]
334        pub fn setScrollable(&self, flag: bool);
335
336        #[cfg(feature = "NSColor")]
337        #[unsafe(method(backgroundColor))]
338        #[unsafe(method_family = none)]
339        pub fn backgroundColor(&self) -> Retained<NSColor>;
340
341        #[cfg(feature = "NSColor")]
342        /// Setter for [`backgroundColor`][Self::backgroundColor].
343        ///
344        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
345        #[unsafe(method(setBackgroundColor:))]
346        #[unsafe(method_family = none)]
347        pub fn setBackgroundColor(&self, background_color: &NSColor);
348
349        #[cfg(feature = "NSColor")]
350        #[unsafe(method(cellBackgroundColor))]
351        #[unsafe(method_family = none)]
352        pub fn cellBackgroundColor(&self) -> Option<Retained<NSColor>>;
353
354        #[cfg(feature = "NSColor")]
355        /// Setter for [`cellBackgroundColor`][Self::cellBackgroundColor].
356        ///
357        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
358        #[unsafe(method(setCellBackgroundColor:))]
359        #[unsafe(method_family = none)]
360        pub fn setCellBackgroundColor(&self, cell_background_color: Option<&NSColor>);
361
362        #[unsafe(method(drawsCellBackground))]
363        #[unsafe(method_family = none)]
364        pub fn drawsCellBackground(&self) -> bool;
365
366        /// Setter for [`drawsCellBackground`][Self::drawsCellBackground].
367        #[unsafe(method(setDrawsCellBackground:))]
368        #[unsafe(method_family = none)]
369        pub fn setDrawsCellBackground(&self, draws_cell_background: bool);
370
371        #[unsafe(method(drawsBackground))]
372        #[unsafe(method_family = none)]
373        pub fn drawsBackground(&self) -> bool;
374
375        /// Setter for [`drawsBackground`][Self::drawsBackground].
376        #[unsafe(method(setDrawsBackground:))]
377        #[unsafe(method_family = none)]
378        pub fn setDrawsBackground(&self, draws_background: bool);
379
380        #[unsafe(method(setState:atRow:column:))]
381        #[unsafe(method_family = none)]
382        pub fn setState_atRow_column(&self, value: NSInteger, row: NSInteger, col: NSInteger);
383
384        /// # Safety
385        ///
386        /// - `row_count` must be a valid pointer or null.
387        /// - `col_count` must be a valid pointer or null.
388        #[unsafe(method(getNumberOfRows:columns:))]
389        #[unsafe(method_family = none)]
390        pub unsafe fn getNumberOfRows_columns(
391            &self,
392            row_count: *mut NSInteger,
393            col_count: *mut NSInteger,
394        );
395
396        #[unsafe(method(numberOfRows))]
397        #[unsafe(method_family = none)]
398        pub fn numberOfRows(&self) -> NSInteger;
399
400        #[unsafe(method(numberOfColumns))]
401        #[unsafe(method_family = none)]
402        pub fn numberOfColumns(&self) -> NSInteger;
403
404        #[cfg(feature = "NSCell")]
405        #[unsafe(method(cellAtRow:column:))]
406        #[unsafe(method_family = none)]
407        pub fn cellAtRow_column(&self, row: NSInteger, col: NSInteger) -> Option<Retained<NSCell>>;
408
409        #[unsafe(method(cellFrameAtRow:column:))]
410        #[unsafe(method_family = none)]
411        pub fn cellFrameAtRow_column(&self, row: NSInteger, col: NSInteger) -> NSRect;
412
413        #[cfg(feature = "NSCell")]
414        /// # Safety
415        ///
416        /// - `row` must be a valid pointer.
417        /// - `col` must be a valid pointer.
418        #[unsafe(method(getRow:column:ofCell:))]
419        #[unsafe(method_family = none)]
420        pub unsafe fn getRow_column_ofCell(
421            &self,
422            row: NonNull<NSInteger>,
423            col: NonNull<NSInteger>,
424            cell: &NSCell,
425        ) -> bool;
426
427        /// # Safety
428        ///
429        /// - `row` must be a valid pointer.
430        /// - `col` must be a valid pointer.
431        #[unsafe(method(getRow:column:forPoint:))]
432        #[unsafe(method_family = none)]
433        pub unsafe fn getRow_column_forPoint(
434            &self,
435            row: NonNull<NSInteger>,
436            col: NonNull<NSInteger>,
437            point: NSPoint,
438        ) -> bool;
439
440        #[unsafe(method(renewRows:columns:))]
441        #[unsafe(method_family = none)]
442        pub fn renewRows_columns(&self, new_rows: NSInteger, new_cols: NSInteger);
443
444        #[cfg(feature = "NSCell")]
445        #[unsafe(method(putCell:atRow:column:))]
446        #[unsafe(method_family = none)]
447        pub fn putCell_atRow_column(&self, new_cell: &NSCell, row: NSInteger, col: NSInteger);
448
449        #[unsafe(method(addRow))]
450        #[unsafe(method_family = none)]
451        pub fn addRow(&self);
452
453        #[cfg(feature = "NSCell")]
454        #[unsafe(method(addRowWithCells:))]
455        #[unsafe(method_family = none)]
456        pub fn addRowWithCells(&self, new_cells: &NSArray<NSCell>);
457
458        #[unsafe(method(insertRow:))]
459        #[unsafe(method_family = none)]
460        pub fn insertRow(&self, row: NSInteger);
461
462        #[cfg(feature = "NSCell")]
463        #[unsafe(method(insertRow:withCells:))]
464        #[unsafe(method_family = none)]
465        pub fn insertRow_withCells(&self, row: NSInteger, new_cells: Option<&NSArray<NSCell>>);
466
467        #[unsafe(method(removeRow:))]
468        #[unsafe(method_family = none)]
469        pub fn removeRow(&self, row: NSInteger);
470
471        #[unsafe(method(addColumn))]
472        #[unsafe(method_family = none)]
473        pub fn addColumn(&self);
474
475        #[cfg(feature = "NSCell")]
476        #[unsafe(method(addColumnWithCells:))]
477        #[unsafe(method_family = none)]
478        pub fn addColumnWithCells(&self, new_cells: &NSArray<NSCell>);
479
480        #[unsafe(method(insertColumn:))]
481        #[unsafe(method_family = none)]
482        pub fn insertColumn(&self, column: NSInteger);
483
484        #[cfg(feature = "NSCell")]
485        #[unsafe(method(insertColumn:withCells:))]
486        #[unsafe(method_family = none)]
487        pub fn insertColumn_withCells(
488            &self,
489            column: NSInteger,
490            new_cells: Option<&NSArray<NSCell>>,
491        );
492
493        #[unsafe(method(removeColumn:))]
494        #[unsafe(method_family = none)]
495        pub fn removeColumn(&self, col: NSInteger);
496
497        #[cfg(feature = "NSCell")]
498        #[unsafe(method(cellWithTag:))]
499        #[unsafe(method_family = none)]
500        pub fn cellWithTag(&self, tag: NSInteger) -> Option<Retained<NSCell>>;
501
502        #[unsafe(method(doubleAction))]
503        #[unsafe(method_family = none)]
504        pub fn doubleAction(&self) -> Option<Sel>;
505
506        /// Setter for [`doubleAction`][Self::doubleAction].
507        ///
508        /// # Safety
509        ///
510        /// `double_action` must be a valid selector.
511        #[unsafe(method(setDoubleAction:))]
512        #[unsafe(method_family = none)]
513        pub unsafe fn setDoubleAction(&self, double_action: Option<Sel>);
514
515        #[unsafe(method(autosizesCells))]
516        #[unsafe(method_family = none)]
517        pub fn autosizesCells(&self) -> bool;
518
519        /// Setter for [`autosizesCells`][Self::autosizesCells].
520        #[unsafe(method(setAutosizesCells:))]
521        #[unsafe(method_family = none)]
522        pub fn setAutosizesCells(&self, autosizes_cells: bool);
523
524        #[unsafe(method(sizeToCells))]
525        #[unsafe(method_family = none)]
526        pub fn sizeToCells(&self);
527
528        #[unsafe(method(setValidateSize:))]
529        #[unsafe(method_family = none)]
530        pub fn setValidateSize(&self, flag: bool);
531
532        #[unsafe(method(drawCellAtRow:column:))]
533        #[unsafe(method_family = none)]
534        pub fn drawCellAtRow_column(&self, row: NSInteger, col: NSInteger);
535
536        #[unsafe(method(highlightCell:atRow:column:))]
537        #[unsafe(method_family = none)]
538        pub fn highlightCell_atRow_column(&self, flag: bool, row: NSInteger, col: NSInteger);
539
540        #[unsafe(method(isAutoscroll))]
541        #[unsafe(method_family = none)]
542        pub fn isAutoscroll(&self) -> bool;
543
544        /// Setter for [`isAutoscroll`][Self::isAutoscroll].
545        #[unsafe(method(setAutoscroll:))]
546        #[unsafe(method_family = none)]
547        pub fn setAutoscroll(&self, autoscroll: bool);
548
549        #[unsafe(method(scrollCellToVisibleAtRow:column:))]
550        #[unsafe(method_family = none)]
551        pub fn scrollCellToVisibleAtRow_column(&self, row: NSInteger, col: NSInteger);
552
553        #[unsafe(method(mouseDownFlags))]
554        #[unsafe(method_family = none)]
555        pub fn mouseDownFlags(&self) -> NSInteger;
556
557        #[cfg(feature = "NSEvent")]
558        #[unsafe(method(mouseDown:))]
559        #[unsafe(method_family = none)]
560        pub fn mouseDown(&self, event: &NSEvent);
561
562        #[cfg(feature = "NSEvent")]
563        #[unsafe(method(performKeyEquivalent:))]
564        #[unsafe(method_family = none)]
565        pub fn performKeyEquivalent(&self, event: &NSEvent) -> bool;
566
567        #[unsafe(method(sendAction))]
568        #[unsafe(method_family = none)]
569        pub fn sendAction(&self) -> bool;
570
571        #[unsafe(method(sendDoubleAction))]
572        #[unsafe(method_family = none)]
573        pub fn sendDoubleAction(&self);
574
575        #[unsafe(method(delegate))]
576        #[unsafe(method_family = none)]
577        pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSMatrixDelegate>>>;
578
579        /// Setter for [`delegate`][Self::delegate].
580        ///
581        /// This is a [weak property][objc2::topics::weak_property].
582        #[unsafe(method(setDelegate:))]
583        #[unsafe(method_family = none)]
584        pub fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn NSMatrixDelegate>>);
585
586        #[cfg(feature = "NSText")]
587        #[unsafe(method(textShouldBeginEditing:))]
588        #[unsafe(method_family = none)]
589        pub fn textShouldBeginEditing(&self, text_object: &NSText) -> bool;
590
591        #[cfg(feature = "NSText")]
592        #[unsafe(method(textShouldEndEditing:))]
593        #[unsafe(method_family = none)]
594        pub fn textShouldEndEditing(&self, text_object: &NSText) -> bool;
595
596        #[unsafe(method(textDidBeginEditing:))]
597        #[unsafe(method_family = none)]
598        pub fn textDidBeginEditing(&self, notification: &NSNotification);
599
600        #[unsafe(method(textDidEndEditing:))]
601        #[unsafe(method_family = none)]
602        pub fn textDidEndEditing(&self, notification: &NSNotification);
603
604        #[unsafe(method(textDidChange:))]
605        #[unsafe(method_family = none)]
606        pub fn textDidChange(&self, notification: &NSNotification);
607
608        /// # Safety
609        ///
610        /// `sender` should be of the correct type.
611        #[unsafe(method(selectText:))]
612        #[unsafe(method_family = none)]
613        pub unsafe fn selectText(&self, sender: Option<&AnyObject>);
614
615        #[cfg(feature = "NSCell")]
616        #[unsafe(method(selectTextAtRow:column:))]
617        #[unsafe(method_family = none)]
618        pub fn selectTextAtRow_column(
619            &self,
620            row: NSInteger,
621            col: NSInteger,
622        ) -> Option<Retained<NSCell>>;
623
624        #[cfg(feature = "NSEvent")]
625        #[unsafe(method(acceptsFirstMouse:))]
626        #[unsafe(method_family = none)]
627        pub fn acceptsFirstMouse(&self, event: Option<&NSEvent>) -> bool;
628
629        #[unsafe(method(resetCursorRects))]
630        #[unsafe(method_family = none)]
631        pub fn resetCursorRects(&self);
632
633        #[cfg(feature = "NSCell")]
634        #[unsafe(method(setToolTip:forCell:))]
635        #[unsafe(method_family = none)]
636        pub fn setToolTip_forCell(&self, tool_tip_string: Option<&NSString>, cell: &NSCell);
637
638        #[cfg(feature = "NSCell")]
639        #[unsafe(method(toolTipForCell:))]
640        #[unsafe(method_family = none)]
641        pub fn toolTipForCell(&self, cell: &NSCell) -> Option<Retained<NSString>>;
642
643        #[unsafe(method(autorecalculatesCellSize))]
644        #[unsafe(method_family = none)]
645        pub fn autorecalculatesCellSize(&self) -> bool;
646
647        /// Setter for [`autorecalculatesCellSize`][Self::autorecalculatesCellSize].
648        #[unsafe(method(setAutorecalculatesCellSize:))]
649        #[unsafe(method_family = none)]
650        pub fn setAutorecalculatesCellSize(&self, autorecalculates_cell_size: bool);
651    );
652}
653
654/// Methods declared on superclass `NSControl`.
655#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
656impl NSMatrix {
657    extern_methods!(
658        /// # Safety
659        ///
660        /// `coder` possibly has further requirements.
661        #[unsafe(method(initWithCoder:))]
662        #[unsafe(method_family = init)]
663        pub unsafe fn initWithCoder(
664            this: Allocated<Self>,
665            coder: &NSCoder,
666        ) -> Option<Retained<Self>>;
667    );
668}
669
670/// Methods declared on superclass `NSResponder`.
671#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
672impl NSMatrix {
673    extern_methods!(
674        #[unsafe(method(init))]
675        #[unsafe(method_family = init)]
676        pub fn init(this: Allocated<Self>) -> Retained<Self>;
677    );
678}
679
680/// Methods declared on superclass `NSObject`.
681#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
682impl NSMatrix {
683    extern_methods!(
684        #[unsafe(method(new))]
685        #[unsafe(method_family = new)]
686        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
687    );
688}
689
690/// NSKeyboardUI.
691#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
692impl NSMatrix {
693    extern_methods!(
694        #[unsafe(method(tabKeyTraversesCells))]
695        #[unsafe(method_family = none)]
696        pub fn tabKeyTraversesCells(&self) -> bool;
697
698        /// Setter for [`tabKeyTraversesCells`][Self::tabKeyTraversesCells].
699        #[unsafe(method(setTabKeyTraversesCells:))]
700        #[unsafe(method_family = none)]
701        pub fn setTabKeyTraversesCells(&self, tab_key_traverses_cells: bool);
702
703        #[cfg(feature = "NSCell")]
704        #[unsafe(method(keyCell))]
705        #[unsafe(method_family = none)]
706        pub fn keyCell(&self) -> Option<Retained<NSCell>>;
707
708        #[cfg(feature = "NSCell")]
709        /// Setter for [`keyCell`][Self::keyCell].
710        #[unsafe(method(setKeyCell:))]
711        #[unsafe(method_family = none)]
712        pub fn setKeyCell(&self, key_cell: Option<&NSCell>);
713    );
714}
715
716extern_protocol!(
717    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsmatrixdelegate?language=objc)
718    #[cfg(feature = "NSControl")]
719    pub unsafe trait NSMatrixDelegate: NSControlTextEditingDelegate {}
720);