use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSMatrixMode(pub NSUInteger);
impl NSMatrixMode {
#[doc(alias = "NSRadioModeMatrix")]
pub const RadioModeMatrix: Self = Self(0);
#[doc(alias = "NSHighlightModeMatrix")]
pub const HighlightModeMatrix: Self = Self(1);
#[doc(alias = "NSListModeMatrix")]
pub const ListModeMatrix: Self = Self(2);
#[doc(alias = "NSTrackModeMatrix")]
pub const TrackModeMatrix: Self = Self(3);
}
unsafe impl Encode for NSMatrixMode {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSMatrixMode {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSControl, NSView, NSResponder, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
pub struct NSMatrix;
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSAccessibility for NSMatrix {}
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSAccessibilityElementProtocol for NSMatrix {}
);
#[cfg(all(
feature = "NSAnimation",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSAnimatablePropertyContainer for NSMatrix {}
);
#[cfg(all(
feature = "NSAppearance",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSAppearanceCustomization for NSMatrix {}
);
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
extern_conformance!(
unsafe impl NSCoding for NSMatrix {}
);
#[cfg(all(
feature = "NSControl",
feature = "NSDragging",
feature = "NSResponder",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSDraggingDestination for NSMatrix {}
);
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
extern_conformance!(
unsafe impl NSObjectProtocol for NSMatrix {}
);
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSUserInterfaceItemIdentification",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSUserInterfaceItemIdentification for NSMatrix {}
);
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSUserInterfaceValidation",
feature = "NSView"
))]
extern_conformance!(
unsafe impl NSUserInterfaceValidations for NSMatrix {}
);
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
extern_conformance!(
unsafe impl NSViewToolTipOwner for NSMatrix {}
);
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
impl NSMatrix {
extern_methods!(
#[unsafe(method(initWithFrame:))]
#[unsafe(method_family = init)]
pub fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
#[cfg(feature = "NSCell")]
#[unsafe(method(initWithFrame:mode:prototype:numberOfRows:numberOfColumns:))]
#[unsafe(method_family = init)]
pub fn initWithFrame_mode_prototype_numberOfRows_numberOfColumns(
this: Allocated<Self>,
frame_rect: NSRect,
mode: NSMatrixMode,
cell: &NSCell,
rows_high: NSInteger,
cols_wide: NSInteger,
) -> Retained<Self>;
#[unsafe(method(initWithFrame:mode:cellClass:numberOfRows:numberOfColumns:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithFrame_mode_cellClass_numberOfRows_numberOfColumns(
this: Allocated<Self>,
frame_rect: NSRect,
mode: NSMatrixMode,
factory_id: Option<&AnyClass>,
rows_high: NSInteger,
cols_wide: NSInteger,
) -> Retained<Self>;
#[unsafe(method(cellClass))]
#[unsafe(method_family = none)]
pub unsafe fn cellClass(&self) -> &'static AnyClass;
#[unsafe(method(setCellClass:))]
#[unsafe(method_family = none)]
pub unsafe fn setCellClass(&self, cell_class: &AnyClass);
#[cfg(feature = "NSCell")]
#[unsafe(method(prototype))]
#[unsafe(method_family = none)]
pub fn prototype(&self) -> Option<Retained<NSCell>>;
#[cfg(feature = "NSCell")]
#[unsafe(method(setPrototype:))]
#[unsafe(method_family = none)]
pub fn setPrototype(&self, prototype: Option<&NSCell>);
#[cfg(feature = "NSCell")]
#[unsafe(method(makeCellAtRow:column:))]
#[unsafe(method_family = none)]
pub fn makeCellAtRow_column(&self, row: NSInteger, col: NSInteger) -> Retained<NSCell>;
#[unsafe(method(mode))]
#[unsafe(method_family = none)]
pub fn mode(&self) -> NSMatrixMode;
#[unsafe(method(setMode:))]
#[unsafe(method_family = none)]
pub fn setMode(&self, mode: NSMatrixMode);
#[unsafe(method(allowsEmptySelection))]
#[unsafe(method_family = none)]
pub fn allowsEmptySelection(&self) -> bool;
#[unsafe(method(setAllowsEmptySelection:))]
#[unsafe(method_family = none)]
pub fn setAllowsEmptySelection(&self, allows_empty_selection: bool);
#[unsafe(method(sendAction:to:forAllCells:))]
#[unsafe(method_family = none)]
pub unsafe fn sendAction_to_forAllCells(
&self,
selector: Sel,
object: &AnyObject,
flag: bool,
);
#[cfg(feature = "NSCell")]
#[unsafe(method(cells))]
#[unsafe(method_family = none)]
pub fn cells(&self) -> Retained<NSArray<NSCell>>;
#[unsafe(method(sortUsingSelector:))]
#[unsafe(method_family = none)]
pub unsafe fn sortUsingSelector(&self, comparator: Sel);
#[unsafe(method(sortUsingFunction:context:))]
#[unsafe(method_family = none)]
pub unsafe fn sortUsingFunction_context(
&self,
compare: unsafe extern "C-unwind" fn(
NonNull<AnyObject>,
NonNull<AnyObject>,
*mut c_void,
) -> NSInteger,
context: *mut c_void,
);
#[cfg(feature = "NSCell")]
#[unsafe(method(selectedCell))]
#[unsafe(method_family = none)]
pub fn selectedCell(&self) -> Option<Retained<NSCell>>;
#[cfg(feature = "NSCell")]
#[unsafe(method(selectedCells))]
#[unsafe(method_family = none)]
pub fn selectedCells(&self) -> Retained<NSArray<NSCell>>;
#[unsafe(method(selectedRow))]
#[unsafe(method_family = none)]
pub fn selectedRow(&self) -> NSInteger;
#[unsafe(method(selectedColumn))]
#[unsafe(method_family = none)]
pub fn selectedColumn(&self) -> NSInteger;
#[unsafe(method(isSelectionByRect))]
#[unsafe(method_family = none)]
pub fn isSelectionByRect(&self) -> bool;
#[unsafe(method(setSelectionByRect:))]
#[unsafe(method_family = none)]
pub fn setSelectionByRect(&self, selection_by_rect: bool);
#[unsafe(method(setSelectionFrom:to:anchor:highlight:))]
#[unsafe(method_family = none)]
pub fn setSelectionFrom_to_anchor_highlight(
&self,
start_pos: NSInteger,
end_pos: NSInteger,
anchor_pos: NSInteger,
lit: bool,
);
#[unsafe(method(deselectSelectedCell))]
#[unsafe(method_family = none)]
pub fn deselectSelectedCell(&self);
#[unsafe(method(deselectAllCells))]
#[unsafe(method_family = none)]
pub fn deselectAllCells(&self);
#[unsafe(method(selectCellAtRow:column:))]
#[unsafe(method_family = none)]
pub fn selectCellAtRow_column(&self, row: NSInteger, col: NSInteger);
#[unsafe(method(selectAll:))]
#[unsafe(method_family = none)]
pub unsafe fn selectAll(&self, sender: Option<&AnyObject>);
#[unsafe(method(selectCellWithTag:))]
#[unsafe(method_family = none)]
pub fn selectCellWithTag(&self, tag: NSInteger) -> bool;
#[unsafe(method(cellSize))]
#[unsafe(method_family = none)]
pub fn cellSize(&self) -> NSSize;
#[unsafe(method(setCellSize:))]
#[unsafe(method_family = none)]
pub fn setCellSize(&self, cell_size: NSSize);
#[unsafe(method(intercellSpacing))]
#[unsafe(method_family = none)]
pub fn intercellSpacing(&self) -> NSSize;
#[unsafe(method(setIntercellSpacing:))]
#[unsafe(method_family = none)]
pub fn setIntercellSpacing(&self, intercell_spacing: NSSize);
#[unsafe(method(setScrollable:))]
#[unsafe(method_family = none)]
pub fn setScrollable(&self, flag: bool);
#[cfg(feature = "NSColor")]
#[unsafe(method(backgroundColor))]
#[unsafe(method_family = none)]
pub fn backgroundColor(&self) -> Retained<NSColor>;
#[cfg(feature = "NSColor")]
#[unsafe(method(setBackgroundColor:))]
#[unsafe(method_family = none)]
pub fn setBackgroundColor(&self, background_color: &NSColor);
#[cfg(feature = "NSColor")]
#[unsafe(method(cellBackgroundColor))]
#[unsafe(method_family = none)]
pub fn cellBackgroundColor(&self) -> Option<Retained<NSColor>>;
#[cfg(feature = "NSColor")]
#[unsafe(method(setCellBackgroundColor:))]
#[unsafe(method_family = none)]
pub fn setCellBackgroundColor(&self, cell_background_color: Option<&NSColor>);
#[unsafe(method(drawsCellBackground))]
#[unsafe(method_family = none)]
pub fn drawsCellBackground(&self) -> bool;
#[unsafe(method(setDrawsCellBackground:))]
#[unsafe(method_family = none)]
pub fn setDrawsCellBackground(&self, draws_cell_background: bool);
#[unsafe(method(drawsBackground))]
#[unsafe(method_family = none)]
pub fn drawsBackground(&self) -> bool;
#[unsafe(method(setDrawsBackground:))]
#[unsafe(method_family = none)]
pub fn setDrawsBackground(&self, draws_background: bool);
#[unsafe(method(setState:atRow:column:))]
#[unsafe(method_family = none)]
pub fn setState_atRow_column(&self, value: NSInteger, row: NSInteger, col: NSInteger);
#[unsafe(method(getNumberOfRows:columns:))]
#[unsafe(method_family = none)]
pub unsafe fn getNumberOfRows_columns(
&self,
row_count: *mut NSInteger,
col_count: *mut NSInteger,
);
#[unsafe(method(numberOfRows))]
#[unsafe(method_family = none)]
pub fn numberOfRows(&self) -> NSInteger;
#[unsafe(method(numberOfColumns))]
#[unsafe(method_family = none)]
pub fn numberOfColumns(&self) -> NSInteger;
#[cfg(feature = "NSCell")]
#[unsafe(method(cellAtRow:column:))]
#[unsafe(method_family = none)]
pub fn cellAtRow_column(&self, row: NSInteger, col: NSInteger) -> Option<Retained<NSCell>>;
#[unsafe(method(cellFrameAtRow:column:))]
#[unsafe(method_family = none)]
pub fn cellFrameAtRow_column(&self, row: NSInteger, col: NSInteger) -> NSRect;
#[cfg(feature = "NSCell")]
#[unsafe(method(getRow:column:ofCell:))]
#[unsafe(method_family = none)]
pub unsafe fn getRow_column_ofCell(
&self,
row: NonNull<NSInteger>,
col: NonNull<NSInteger>,
cell: &NSCell,
) -> bool;
#[unsafe(method(getRow:column:forPoint:))]
#[unsafe(method_family = none)]
pub unsafe fn getRow_column_forPoint(
&self,
row: NonNull<NSInteger>,
col: NonNull<NSInteger>,
point: NSPoint,
) -> bool;
#[unsafe(method(renewRows:columns:))]
#[unsafe(method_family = none)]
pub fn renewRows_columns(&self, new_rows: NSInteger, new_cols: NSInteger);
#[cfg(feature = "NSCell")]
#[unsafe(method(putCell:atRow:column:))]
#[unsafe(method_family = none)]
pub fn putCell_atRow_column(&self, new_cell: &NSCell, row: NSInteger, col: NSInteger);
#[unsafe(method(addRow))]
#[unsafe(method_family = none)]
pub fn addRow(&self);
#[cfg(feature = "NSCell")]
#[unsafe(method(addRowWithCells:))]
#[unsafe(method_family = none)]
pub fn addRowWithCells(&self, new_cells: &NSArray<NSCell>);
#[unsafe(method(insertRow:))]
#[unsafe(method_family = none)]
pub fn insertRow(&self, row: NSInteger);
#[cfg(feature = "NSCell")]
#[unsafe(method(insertRow:withCells:))]
#[unsafe(method_family = none)]
pub fn insertRow_withCells(&self, row: NSInteger, new_cells: Option<&NSArray<NSCell>>);
#[unsafe(method(removeRow:))]
#[unsafe(method_family = none)]
pub fn removeRow(&self, row: NSInteger);
#[unsafe(method(addColumn))]
#[unsafe(method_family = none)]
pub fn addColumn(&self);
#[cfg(feature = "NSCell")]
#[unsafe(method(addColumnWithCells:))]
#[unsafe(method_family = none)]
pub fn addColumnWithCells(&self, new_cells: &NSArray<NSCell>);
#[unsafe(method(insertColumn:))]
#[unsafe(method_family = none)]
pub fn insertColumn(&self, column: NSInteger);
#[cfg(feature = "NSCell")]
#[unsafe(method(insertColumn:withCells:))]
#[unsafe(method_family = none)]
pub fn insertColumn_withCells(
&self,
column: NSInteger,
new_cells: Option<&NSArray<NSCell>>,
);
#[unsafe(method(removeColumn:))]
#[unsafe(method_family = none)]
pub fn removeColumn(&self, col: NSInteger);
#[cfg(feature = "NSCell")]
#[unsafe(method(cellWithTag:))]
#[unsafe(method_family = none)]
pub fn cellWithTag(&self, tag: NSInteger) -> Option<Retained<NSCell>>;
#[unsafe(method(doubleAction))]
#[unsafe(method_family = none)]
pub fn doubleAction(&self) -> Option<Sel>;
#[unsafe(method(setDoubleAction:))]
#[unsafe(method_family = none)]
pub unsafe fn setDoubleAction(&self, double_action: Option<Sel>);
#[unsafe(method(autosizesCells))]
#[unsafe(method_family = none)]
pub fn autosizesCells(&self) -> bool;
#[unsafe(method(setAutosizesCells:))]
#[unsafe(method_family = none)]
pub fn setAutosizesCells(&self, autosizes_cells: bool);
#[unsafe(method(sizeToCells))]
#[unsafe(method_family = none)]
pub fn sizeToCells(&self);
#[unsafe(method(setValidateSize:))]
#[unsafe(method_family = none)]
pub fn setValidateSize(&self, flag: bool);
#[unsafe(method(drawCellAtRow:column:))]
#[unsafe(method_family = none)]
pub fn drawCellAtRow_column(&self, row: NSInteger, col: NSInteger);
#[unsafe(method(highlightCell:atRow:column:))]
#[unsafe(method_family = none)]
pub fn highlightCell_atRow_column(&self, flag: bool, row: NSInteger, col: NSInteger);
#[unsafe(method(isAutoscroll))]
#[unsafe(method_family = none)]
pub fn isAutoscroll(&self) -> bool;
#[unsafe(method(setAutoscroll:))]
#[unsafe(method_family = none)]
pub fn setAutoscroll(&self, autoscroll: bool);
#[unsafe(method(scrollCellToVisibleAtRow:column:))]
#[unsafe(method_family = none)]
pub fn scrollCellToVisibleAtRow_column(&self, row: NSInteger, col: NSInteger);
#[unsafe(method(mouseDownFlags))]
#[unsafe(method_family = none)]
pub fn mouseDownFlags(&self) -> NSInteger;
#[cfg(feature = "NSEvent")]
#[unsafe(method(mouseDown:))]
#[unsafe(method_family = none)]
pub fn mouseDown(&self, event: &NSEvent);
#[cfg(feature = "NSEvent")]
#[unsafe(method(performKeyEquivalent:))]
#[unsafe(method_family = none)]
pub fn performKeyEquivalent(&self, event: &NSEvent) -> bool;
#[unsafe(method(sendAction))]
#[unsafe(method_family = none)]
pub fn sendAction(&self) -> bool;
#[unsafe(method(sendDoubleAction))]
#[unsafe(method_family = none)]
pub fn sendDoubleAction(&self);
#[unsafe(method(delegate))]
#[unsafe(method_family = none)]
pub fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSMatrixDelegate>>>;
#[unsafe(method(setDelegate:))]
#[unsafe(method_family = none)]
pub fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn NSMatrixDelegate>>);
#[cfg(feature = "NSText")]
#[unsafe(method(textShouldBeginEditing:))]
#[unsafe(method_family = none)]
pub fn textShouldBeginEditing(&self, text_object: &NSText) -> bool;
#[cfg(feature = "NSText")]
#[unsafe(method(textShouldEndEditing:))]
#[unsafe(method_family = none)]
pub fn textShouldEndEditing(&self, text_object: &NSText) -> bool;
#[unsafe(method(textDidBeginEditing:))]
#[unsafe(method_family = none)]
pub fn textDidBeginEditing(&self, notification: &NSNotification);
#[unsafe(method(textDidEndEditing:))]
#[unsafe(method_family = none)]
pub fn textDidEndEditing(&self, notification: &NSNotification);
#[unsafe(method(textDidChange:))]
#[unsafe(method_family = none)]
pub fn textDidChange(&self, notification: &NSNotification);
#[unsafe(method(selectText:))]
#[unsafe(method_family = none)]
pub unsafe fn selectText(&self, sender: Option<&AnyObject>);
#[cfg(feature = "NSCell")]
#[unsafe(method(selectTextAtRow:column:))]
#[unsafe(method_family = none)]
pub fn selectTextAtRow_column(
&self,
row: NSInteger,
col: NSInteger,
) -> Option<Retained<NSCell>>;
#[cfg(feature = "NSEvent")]
#[unsafe(method(acceptsFirstMouse:))]
#[unsafe(method_family = none)]
pub fn acceptsFirstMouse(&self, event: Option<&NSEvent>) -> bool;
#[unsafe(method(resetCursorRects))]
#[unsafe(method_family = none)]
pub fn resetCursorRects(&self);
#[cfg(feature = "NSCell")]
#[unsafe(method(setToolTip:forCell:))]
#[unsafe(method_family = none)]
pub fn setToolTip_forCell(&self, tool_tip_string: Option<&NSString>, cell: &NSCell);
#[cfg(feature = "NSCell")]
#[unsafe(method(toolTipForCell:))]
#[unsafe(method_family = none)]
pub fn toolTipForCell(&self, cell: &NSCell) -> Option<Retained<NSString>>;
#[unsafe(method(autorecalculatesCellSize))]
#[unsafe(method_family = none)]
pub fn autorecalculatesCellSize(&self) -> bool;
#[unsafe(method(setAutorecalculatesCellSize:))]
#[unsafe(method_family = none)]
pub fn setAutorecalculatesCellSize(&self, autorecalculates_cell_size: bool);
);
}
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
impl NSMatrix {
extern_methods!(
#[unsafe(method(initWithCoder:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
);
}
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
impl NSMatrix {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
);
}
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
impl NSMatrix {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
impl NSMatrix {
extern_methods!(
#[unsafe(method(tabKeyTraversesCells))]
#[unsafe(method_family = none)]
pub fn tabKeyTraversesCells(&self) -> bool;
#[unsafe(method(setTabKeyTraversesCells:))]
#[unsafe(method_family = none)]
pub fn setTabKeyTraversesCells(&self, tab_key_traverses_cells: bool);
#[cfg(feature = "NSCell")]
#[unsafe(method(keyCell))]
#[unsafe(method_family = none)]
pub fn keyCell(&self) -> Option<Retained<NSCell>>;
#[cfg(feature = "NSCell")]
#[unsafe(method(setKeyCell:))]
#[unsafe(method_family = none)]
pub fn setKeyCell(&self, key_cell: Option<&NSCell>);
);
}
extern_protocol!(
#[cfg(feature = "NSControl")]
pub unsafe trait NSMatrixDelegate: NSControlTextEditingDelegate {}
);