summaryrefslogtreecommitdiff
path: root/fpcsrc/packages/cocoaint/src/appkit/NSMatrix.inc
blob: a70b87955e2c6a60baa7309a8846f6c5f6977720 (plain)
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
{ Parsed from Appkit.framework NSMatrix.h }

{$ifdef TYPES}
{$ifndef NSMATRIX_PAS_T}
{$define NSMATRIX_PAS_T}

{ Constants }

const
  NSRadioModeMatrix = 0;
  NSHighlightModeMatrix = 1;
  NSListModeMatrix = 2;
  NSTrackModeMatrix = 3;

{ Types }
type
  NSMatrixMode = NSUInteger;
  NSMatrixModePtr = ^NSMatrixMode;

{ Callbacks }
type
  NSMatrixCompare = function (param1: id; param2: id; param3: Pointer): NSInteger; cdecl;


{$endif}
{$endif}

{$ifdef RECORDS}
{$ifndef NSMATRIX_PAS_R}
{$define NSMATRIX_PAS_R}

{ Records }
type
  __MFlags = record
    case byte of
    0: (_anonbitfield_NSMatrix0: cuint);
    1: (data: bitpacked record
{$ifdef fpc_big_endian}
          highlightMode: 0..1;
          radioMode: 0..1;
          listMode: 0..1;
          allowEmptySel: 0..1;
          autoscroll: 0..1;
          selectionByRect: 0..1;
          drawsCellBackground: 0..1;
          drawsBackground: 0..1;
          autosizeCells: 0..1;
          drawingAncestor: 0..1;
          tabKeyTraversesCells: 0..1;
          tabKeyTraversesCellsExplicitlySet: 0..1;
          allowsIncrementalSearching: 0..1;
          currentlySelectingCell: 0..1;
          onlySetKeyCell: 0..1;
          changingSelectionWithKeyboard: 0..1;
          dontScroll: 0..1;
          refusesFirstResponder: 0..1;
          useSimpleTrackingMode: 0..1;
          checkForSimpleTrackingMode: 0..1;
          liveResizeImageCacheingEnabled: 0..1;
          hasCachedSubclassIsSafeForLiveResize: 0..1;
          subclassIsSafeForLiveResize: 0..1;
          tmpAllowNonVisibleCellsToBecomeFirstResponder: 0..1;
          needsRedrawBeforeFirstLiveResizeCache: 0..1;
          browserOptimizationsEnabled: 0..1;
          drawingContextMenuHighlight: 0..1;
          drawingContextMenuHighlightOnAllSelectedRows: 0..1;
          reservedMatrix: 0..((1 shl 4)-1);
{$else}
          reservedMatrix: 0..((1 shl 4)-1);
          drawingContextMenuHighlightOnAllSelectedRows: 0..1;
          drawingContextMenuHighlight: 0..1;
          browserOptimizationsEnabled: 0..1;
          needsRedrawBeforeFirstLiveResizeCache: 0..1;
          tmpAllowNonVisibleCellsToBecomeFirstResponder: 0..1;
          subclassIsSafeForLiveResize: 0..1;
          hasCachedSubclassIsSafeForLiveResize: 0..1;
          liveResizeImageCacheingEnabled: 0..1;
          checkForSimpleTrackingMode: 0..1;
          useSimpleTrackingMode: 0..1;
          refusesFirstResponder: 0..1;
          dontScroll: 0..1;
          changingSelectionWithKeyboard: 0..1;
          onlySetKeyCell: 0..1;
          currentlySelectingCell: 0..1;
          allowsIncrementalSearching: 0..1;
          tabKeyTraversesCellsExplicitlySet: 0..1;
          tabKeyTraversesCells: 0..1;
          drawingAncestor: 0..1;
          autosizeCells: 0..1;
          drawsBackground: 0..1;
          drawsCellBackground: 0..1;
          selectionByRect: 0..1;
          autoscroll: 0..1;
          allowEmptySel: 0..1;
          listMode: 0..1;
          radioMode: 0..1;
          highlightMode: 0..1;
{$endif}
         end;
       );
  end;
_MFlags = __MFlags;
__MFlagsPtr = ^__MFlags;


{$endif}
{$endif}

{$ifdef FUNCTIONS}
{$ifndef NSMATRIX_PAS_F}
{$define NSMATRIX_PAS_F}

{$endif}
{$endif}

{$ifdef EXTERNAL_SYMBOLS}
{$ifndef NSMATRIX_PAS_S}
{$define NSMATRIX_PAS_S}

{$endif}
{$endif}

{$ifdef FORWARD}
  NSMatrixDelegateProtocol = objcprotocol;
  NSMatrix = objcclass;
  NSMatrixPointer = ^NSMatrix;
  NSMatrixPtr = NSMatrixPointer;

{$endif}

{$ifdef CLASSES}
{$ifndef NSMATRIX_PAS_C}
{$define NSMATRIX_PAS_C}

{ NSMatrix }
  NSMatrix = objcclass external (NSControl, NSUserInterfaceValidationsProtocol)
  private
    _target: id;
    _action: SEL;
    _doubleAction: SEL;
    _errorAction: SEL;
    _delegate: id;
    _selectedCell: id;
    _selectedRow: NSInteger;
    _selectedCol: NSInteger;
    _numRows: NSInteger;
    _numCols: NSInteger;
    _cellSize: NSSize;
    _intercell: NSSize;
    _font: id;
    _protoCell: id;
    _cellClass: id;
    _backgroundColor: NSColor;
    _private: id;
    _cells: NSMutableArray;
    _mFlags: _MFlags;
    
  public
    function initWithFrame(frameRect: NSRect): id; message 'initWithFrame:';
    function initWithFrame_mode_prototype_numberOfRows_numberOfColumns(frameRect: NSRect; aMode: NSMatrixMode; aCell: NSCell; rowsHigh: NSInteger; colsWide: NSInteger): id; message 'initWithFrame:mode:prototype:numberOfRows:numberOfColumns:';
    function initWithFrame_mode_cellClass_numberOfRows_numberOfColumns(frameRect: NSRect; aMode: NSMatrixMode; factoryId: Pobjc_class; rowsHigh: NSInteger; colsWide: NSInteger): id; message 'initWithFrame:mode:cellClass:numberOfRows:numberOfColumns:';
    procedure setCellClass(factoryId: Pobjc_class); message 'setCellClass:';
    function cellClass: Pobjc_class; message 'cellClass';
    function prototype: id; message 'prototype';
    procedure setPrototype(aCell: NSCell); message 'setPrototype:';
    function makeCellAtRow_column(row: NSInteger; col: NSInteger): NSCell; message 'makeCellAtRow:column:';
    function mode: NSMatrixMode; message 'mode';
    procedure setMode(aMode: NSMatrixMode); message 'setMode:';
    procedure setAllowsEmptySelection(flag: Boolean); message 'setAllowsEmptySelection:';
    function allowsEmptySelection: Boolean; message 'allowsEmptySelection';
    procedure sendAction_to_forAllCells(aSelector: SEL; anObject: id; flag: Boolean); message 'sendAction:to:forAllCells:';
    function cells: NSArray; message 'cells';
    procedure sortUsingSelector(comparator: SEL); message 'sortUsingSelector:';
    procedure sortUsingFunction_context(compare: NSMatrixCompare; context: Pointer); message 'sortUsingFunction:context:';
    function selectedCell: id; message 'selectedCell';
    function selectedCells: NSArray; message 'selectedCells';
    function selectedRow: NSInteger; message 'selectedRow';
    function selectedColumn: NSInteger; message 'selectedColumn';
    procedure setSelectionByRect(flag: Boolean); message 'setSelectionByRect:';
    function isSelectionByRect: Boolean; message 'isSelectionByRect';
    procedure setSelectionFrom_to_anchor_highlight(startPos: NSInteger; endPos: NSInteger; anchorPos: NSInteger; lit: Boolean); message 'setSelectionFrom:to:anchor:highlight:';
    procedure deselectSelectedCell; message 'deselectSelectedCell';
    procedure deselectAllCells; message 'deselectAllCells';
    procedure selectCellAtRow_column(row: NSInteger; col: NSInteger); message 'selectCellAtRow:column:';
    procedure selectAll(sender: id); message 'selectAll:';
    function selectCellWithTag(anInt: NSInteger): Boolean; message 'selectCellWithTag:';
    function cellSize: NSSize; message 'cellSize';
    procedure setCellSize(aSize: NSSize); message 'setCellSize:';
    function intercellSpacing: NSSize; message 'intercellSpacing';
    procedure setIntercellSpacing(aSize: NSSize); message 'setIntercellSpacing:';
    procedure setScrollable(flag: Boolean); message 'setScrollable:';
    procedure setBackgroundColor(color: NSColor); message 'setBackgroundColor:';
    function backgroundColor: NSColor; message 'backgroundColor';
    procedure setCellBackgroundColor(color: NSColor); message 'setCellBackgroundColor:';
    function cellBackgroundColor: NSColor; message 'cellBackgroundColor';
    procedure setDrawsCellBackground(flag: Boolean); message 'setDrawsCellBackground:';
    function drawsCellBackground: Boolean; message 'drawsCellBackground';
    procedure setDrawsBackground(flag: Boolean); message 'setDrawsBackground:';
    function drawsBackground: Boolean; message 'drawsBackground';
    procedure setState_atRow_column(value: NSInteger; row: NSInteger; col: NSInteger); message 'setState:atRow:column:';
    procedure getNumberOfRows_columns(rowCount: NSIntegerPtr; colCount: NSIntegerPtr); message 'getNumberOfRows:columns:';
    function numberOfRows: NSInteger; message 'numberOfRows';
    function numberOfColumns: NSInteger; message 'numberOfColumns';
    function cellAtRow_column(row: NSInteger; col: NSInteger): id; message 'cellAtRow:column:';
    function cellFrameAtRow_column(row: NSInteger; col: NSInteger): NSRect; message 'cellFrameAtRow:column:';
    function getRow_column_ofCell(row: NSIntegerPtr; col: NSIntegerPtr; aCell: NSCell): Boolean; message 'getRow:column:ofCell:';
    function getRow_column_forPoint(row: NSIntegerPtr; col: NSIntegerPtr; aPoint: NSPoint): Boolean; message 'getRow:column:forPoint:';
    procedure renewRows_columns(newRows: NSInteger; newCols: NSInteger); message 'renewRows:columns:';
    procedure putCell_atRow_column(newCell: NSCell; row: NSInteger; col: NSInteger); message 'putCell:atRow:column:';
    procedure addRow; message 'addRow';
    procedure addRowWithCells(newCells: NSArray); message 'addRowWithCells:';
    procedure insertRow(row: NSInteger); message 'insertRow:';
    procedure insertRow_withCells(row: NSInteger; newCells: NSArray); message 'insertRow:withCells:';
    procedure removeRow(row: NSInteger); message 'removeRow:';
    procedure addColumn; message 'addColumn';
    procedure addColumnWithCells(newCells: NSArray); message 'addColumnWithCells:';
    procedure insertColumn(column: NSInteger); message 'insertColumn:';
    procedure insertColumn_withCells(column: NSInteger; newCells: NSArray); message 'insertColumn:withCells:';
    procedure removeColumn(col: NSInteger); message 'removeColumn:';
    function cellWithTag(anInt: NSInteger): id; message 'cellWithTag:';
    function doubleAction: SEL; message 'doubleAction';
    procedure setDoubleAction(aSelector: SEL); message 'setDoubleAction:';
    procedure setAutosizesCells(flag: Boolean); message 'setAutosizesCells:';
    function autosizesCells: Boolean; message 'autosizesCells';
    procedure sizeToCells; message 'sizeToCells';
    procedure setValidateSize(flag: Boolean); message 'setValidateSize:';
    procedure drawCellAtRow_column(row: NSInteger; col: NSInteger); message 'drawCellAtRow:column:';
    procedure highlightCell_atRow_column(flag: Boolean; row: NSInteger; col: NSInteger); message 'highlightCell:atRow:column:';
    procedure setAutoscroll(flag: Boolean); message 'setAutoscroll:';
    function isAutoscroll: Boolean; message 'isAutoscroll';
    procedure scrollCellToVisibleAtRow_column(row: NSInteger; col: NSInteger); message 'scrollCellToVisibleAtRow:column:';
    function mouseDownFlags: NSInteger; message 'mouseDownFlags';
    procedure mouseDown(theEvent: NSEvent); message 'mouseDown:';
    function performKeyEquivalent(theEvent: NSEvent): Boolean; message 'performKeyEquivalent:';
    function sendAction: Boolean; message 'sendAction';
    procedure sendDoubleAction; message 'sendDoubleAction';
    function delegate: NSMatrixDelegateProtocol; message 'delegate';
    procedure setDelegate(anObject: NSMatrixDelegateProtocol); message 'setDelegate:';
    function textShouldBeginEditing(textObject: NSText): Boolean; message 'textShouldBeginEditing:';
    function textShouldEndEditing(textObject: NSText): Boolean; message 'textShouldEndEditing:';
    procedure textDidBeginEditing(notification: NSNotification); message 'textDidBeginEditing:';
    procedure textDidEndEditing(notification: NSNotification); message 'textDidEndEditing:';
    procedure textDidChange(notification: NSNotification); message 'textDidChange:';
    procedure selectText(sender: id); message 'selectText:';
    function selectTextAtRow_column(row: NSInteger; col: NSInteger): id; message 'selectTextAtRow:column:';
    function acceptsFirstMouse(theEvent: NSEvent): Boolean; message 'acceptsFirstMouse:';
    procedure resetCursorRects; message 'resetCursorRects';
    procedure setToolTip_forCell(toolTipString: NSString; cell_: NSCell); message 'setToolTip:forCell:';
    function toolTipForCell(cell_: NSCell): NSString; message 'toolTipForCell:';

    { Adopted Protocols }
    function validateUserInterfaceItem(anItem: NSValidatedUserInterfaceItemProtocol): Boolean;
  end;

{ NSKeyboardUI_NSMatrixCategory }
  NSKeyboardUI_NSMatrixCategory = objccategory external name 'NSKeyboardUI' (NSMatrix)
    procedure setTabKeyTraversesCells(flag: Boolean); message 'setTabKeyTraversesCells:';
    function tabKeyTraversesCells: Boolean; message 'tabKeyTraversesCells';
    procedure setKeyCell(keyCell_: NSCell); message 'setKeyCell:';
    function keyCell: id; message 'keyCell';
  end;

{$endif}
{$endif}
{$ifdef PROTOCOLS}
{$ifndef NSMATRIX_PAS_P}
{$define NSMATRIX_PAS_P}
  
{ NSMatrixDelegate Protocol }
  NSMatrixDelegateProtocol = objcprotocol external name 'NSMatrixDelegate'
  end;
{$endif}
{$endif}