Class Quick Reference
*********************

In this section are tables listing the methods in each class described in the manual, along with a brief description of those methods. These are referenced against the information given throughout this manual.

Also listed are some of the functions used in this manual, useful for some purposes.

Class hierarchies are also given, so that you can refer to the methods that appear in a class's superclass (methods are not listed twice, except where their meaning is substantially changed in a subclass).

NSBrowser
=========

An NSBrowser is an GUI object useful for representing hierachical data that needs be heavily navigated. It is derived from NSControl, and uses NSBrowserCell as its cell class

Class Hierarchy: NSBrowser : NSControl : NSView : NSResponder : NSObject

NSBrowserDelegate
-----------------

NSBrowserDelegate is an informal protocol used to supply data and provide dynamic behaviour in a browser object.

-(void) browser:(NSBrowser*)sender createRowsForColumn:(int)column inMatrix:(NSMatrix*)matrix
     This method is implemented by active delegates. It is called by the browser when the user clicks on a branch node and needs to populate the next column. It becomes the delegate's responsibility then to create the browser cells for COLUMN and add them to MATRIX in SENDER. This method cannot be implemented at the same time as -browser:numberOfRowsInColumn:.

-(BOOL) browser:(NSBrowser*)sender isColumnValid:(int)column
     When the user calls -validateVisibleColumn: on the browser object, it in turns checks whether a column is "valid" by calling this method on its delegate. A column that is invalid will be marked for redrawing. Use this method when you need to check internal data states or otherwise when a browser's data can become invalid.

-(int) browser:(NSBrowser*)sender numberOfRowsInColumn:(int)column
     This method is implemented by passive delegates. It is called by the browser to get the number of rows in a column. The browser object uses this information to create the browser cells for COLUMN. This method cannot be implemented at the same time as -browser:createRowsForColumn:inMatrix:.

-(BOOL) browser:(NSBrowser*)sender selectCellWithString:(NSString*)title inColumn:(int)column
     This method is called by the browser to tell the delegate to select the cell with contents TITLE in COLUMN. Return YES to indicate the cell was selected; otherwise, return NO.

-(BOOL) browser:(NSBrowser*)sender selectRow:(int)row inColumn:(int)column
     This method is called by the browser to tell the delegate to select the cell in ROW and COLUMN. Return YES to indicate teh cell was selected; otherwise, return NO.

-(NSString*) browser:(NSBrowser*)sender titleOfColumn:(int)column
     This method is called by the browser object to retrieve the title of COLUMN.

-(void) browser:(NSBrowser*)sender willDisplayCell:(id)cell atRow:(int)row column:(int)column
     This method is called just before the browser object is about to display CELL. Use it to do any modifications before the cell is displayed on the screen.

-(void) browserDidScroll:(NSBrowser*)sender
     Called by the browser object just after it has updated the screen for a user-initiated scroll operation.

-(void) browserWillScroll:(NSBrowser*)sender
     Called just before a browser object will update the screen for a scroll operation.

NSComboBox
==========

Represents a specialised text field that also has a drop-down box displaying a list of possible choices as well as letting the user enter their own. This list can be populated using the methods of NSComboBox or a data source which implements the NSComboBoxDelegate informal protocol, described below.

Class Hierarchy: NSComboBox : NSTextField : NSControl : NSView : NSResponder : NSObject

NSComboBoxDataSource
--------------------

-(NSString*) comboBox:(NSComboBox*)ACOMBOBOX completedString:(NSString*)ASTRING
     This method is used to implement a sort of "auto-complete" for combo boxes. ASTRING is what the user has typed in so far and is what you use to match against the items the in the combo box.

     You may optionally implement this method.

-(unsigned int) comboBox:(NSComboBox*)ACOMBOBOX indexOfItemWithStringValue:(NSString*)ASTRING
     This method returns the index of ASTRING within the combo box. ASTRING is what the user has typed in (or what has been auto-completed in the previous method).

     You may optionally implement this method.

-(id) comboBox:(NSComboBox*)ACOMBOBOX objectValueForItemAtIndex:(int)INDEX
     This method returns the value of the item at INDEX.

     This method is not optional.

-(int) nubmerOfItemsInComboBox:(NSComboBox*)ACOMBOBOX
     This method returns the number of items in ACOMBOBOX.

     This method is not optional.

NSControl
=========

Represents simple graphical elements (such as buttons or text fields) that use a cell to implement their internal behaviour (subclasses of NSCell).

Class Hierarchy: NSControl : NSView : NSResponder : NSObject

-(Class) cellClass
-(void) setCellClass:(Class)CLASS
     Get/Set the default class used for cell(s) in this control.

-(id) cell
-(void) setCell:(id)CELL
     Get/Set the CELL to be displayed in the receiver.

-(id) objectValue
-(int) intValue
-(float) floatValue
-(double) doubleValue
-(NSString*) stringValue
     Get the value of the control's cell in the respective form.

-(void) setObjectValue:(id)VALUE
-(void) setIntValue:(int)VALUE
-(void) setFloatValue:(float)VALUE
-(void) setDoubleValue:(double)VALUE
-(void) setStringValue:(NSString*)VALUE
     Set the value of the control's cell in the respective form.

-(void) takeDoubleValueFrom:(id)SENDER
-(void) takeFloatValueFrom:(id)SENDER
-(void) takeIntValueFrom:(id)SENDER
-(void) takeObjectValueFrom:(id)SENDER
-(void) takeStringValueFrom:(id)SENDER
     Changes the value of the receiver to that of the SENDER when the SENDER object is updated.

-(BOOL) enabled
-(void) setEnabled:(BOOL)ENABLED
     Get/Set whether the user can manipulate the control.

NSMatrix
========

Class Hierarchy: NSMatrix : NSControl : NSView : NSResponder : NSObject

Modifying cell classes
----------------------

+(Class) cellClass
     Return the default cell class used to create new cells for each new NSMatrix instance.

+(void) setCellClass:(Class)CLASS
     Sets the default cell class used to create new cells for each new NSMatrix instance.

-(Class) cellClass
     Return the default cell class used to create new cells on this particular NSMatrix instance.

-(void) setCellClass:(Class)CLASS
     Set the cell class used to create new cells on this particular NSMatrix instance.

Columns and Rows Manipulation
-----------------------------

-(void) addColumn
-(void) addRow
     Adds a column/row to the end of the matrix.

-(void) addColumnWithCells:(NSArray*)CELLS
-(void) addRowWithCells:(NSArray*)CELLS
     Adds a column/row to the end of the matrix, specifying the list of cells to add.

-(void) insertColumn:(int)COLUMN

-(void) insertRow:(int)ROW
     Inserts a blank column/row at the specified location.

-(void) insertColumn:(int)COLUMN withCells:(NSArray*)CELLS
-(void) insertRow:(int)ROW withCells:(NSArray*)CELLS
     Inserts a column/row, using the cell objects specifed by CELLS.

-(void) removeColumn:(int)COLUMN
-(void) removedRow:(int)ROW
     Removes the column/row specified by COLUMN/ROW.

-(int) numberOfColumns
-(int) numberOfRows
     Returns the number of columns/rows.

Cell Selection
--------------

Cell selection behaviour depends on what matrix mode is set (see -mode) and whether or not it permits empty selection.

-(id) selectedCell
     Returns the selected cell.

-(NSArray*) selectedCells
     Returns the array of selected cells.

-(int) selectedColumn
-(int) selectedRow
     Returns the column/row the currently selected cell is located in. It returns -1 if no cell is selected.

-(void) selectAll:(id)SENDER
     Selects all the cells within the matrix.

-(void) selectCell:(NSCell*)ACELL
     Selects the cell within the matrix that matches ACELL.

-(void) selectCellAtRow:(int)ROW column:COLUMN
     Selects the cell at ROW and COLUMN. Set either integer to -1 to deselect all the cells.

-(void) deselectAllCells
     Deselects all the cells within the matrix (if mode isn't NSRadioModeMatrix and if it permits empty cell selection).

-(void) deselectSelectedCell
     Deselects the selected cell, subject to the matrix mode behaviour.

NSTableView
===========

Class Hierarchy: NSTableView : NSControl : NSView : NSResponder : NSObject

NSTableDataSource (informal protocol)
-------------------------------------

-(int) numberOfRowsInTableView:(NSTableView*)ATABLEVIEW
     Returns the number of rows that the table view should display. This method is called frequently and is compulsory.

-(id) tableView:(NSTableView*)TABLEVIEW objectValueForTableColumn:(NSTableColumn*)ATABLECOLUMN row:(int)ROW
     Returns an object that should be displayed in TABLEVIEW, in column TABLECOLUMN and row TABLEROW. This value is usually a string object, but could be number object or similiar. This method is called frequently and is compulsory.

-(void) tableView:(NSTableView*)ATABLECOLUMN setObjectValue:(id)ANOBJECT forTableColumn:(NSTableColumn*)ATABLECOLUMN row:(int)ROWINDEX
     This is called to indicate that the value in the respective column and row has changed. The data source should update itself with the new object value. Implementation of this method is necessary for allowing your table to be modified.

-(BOOL) tableView:(NSTableView*)TABLEView writeRows:(NSArray*)ROWS toPasteboard:(NSPasteboard*)PBOARD
     This is method is usually the first stage in a drag and drop operation. It asks the data source to write the rows specified by an array of numbers (ROWS) to PBOARD. Return NO to reject the drag operation, or YES if the rows have been written to the pasteboard to begin the drag.

-(BOOL) tableView:(NSTableView*)ATABLEVIEW acceptDrop:(id)INFO row:(int)ROW dropOperation:(NSTableViewDropOperation)OPERATION
     This is called after a mouse "drag and drop" operation has been completed (and formerly authorised) to indicate what kind of drop operation has occurred, what row it has occurred in and the information associated with the drop operation (the INFO parameter). This method is optional.

NSTableViewDelegate (informal protocol)
---------------------------------------

-(BOOL) selectionShouldChangeInTableView: (NSTableView*)aTableView
     Returns YES if the user should be permitted to change their current selection (often a row) in ATABLEVIEW. Use this for the complex validation of user's changing the current selection.

-(void) tableView: (NSTableView*)tableView didClickTableColumn: (NSTableColumn*)tableColumn
     Called by TABLEVIEW after the user clicked and released anywhere in TABLECOLUMN. Does not include dragging.

-(void) tableView: (NSTableView*)tableView didDragTableColumn: (NSTableColumn*)tableColumn
     Called after the user dragged TABLECOLUMN in TABLEVIEW.

-(void) tableView: (NSTableView*)tableView mouseDownInHeaderOfTableColumn: (NSTableColumn*)tableColumn
     Called when the user specifically clicks the mouse button down in the area defined by TABLECOLUMN in TABLEVIEW

-(BOOL) tableView: (NSTableView*)aTableView shouldEditTableColumn: (NSTableColumn*)aTableColumn row: (int)rowIndex
     This is called just after the user indicates they wish to edit the cell specified by ROWINDEX and TABLECOLUMN. Return YES to allow the user to edit this cell, or return NO disallow editing.

-(BOOL) tableView: (NSTableView*)aTableView shouldSelectRow: (int)rowIndex
     This is called when the user tries to select the row indicated by ROWINDEX in ATABLEVIEW. Return YES to permit this row to be selected, or NO otherwise.

-(BOOL) tableView: (NSTableView*)aTableView shouldSelectTableColumn: (NSTableColumn*)aTableColumn
     This is called when the user tries to select the column indicated by ATABLECOLUMN. Return YES to permit this column to be selected, or NO otherwise.

-(void) tableView: (NSTableView*)aTableView willDisplayCell: (id)aCell forTableColumn: (NSTableColumn*)aTableColumn row: (int)rowIndex
     This is called by the tableview just before ACELL is displayed. Use this method to setup any display attributes about a cell just before ATABLEVIEW draws it.

-(void) tableViewColumnDidMove: (NSNotification*)aNotification
     This is called after the user moved a column. Refer to ANOTIFICATION for the information sent with the NSTableViewColumnDidMoveNotification notification.

-(void) tableViewColumnDidResize: (NSNotification*)aNotification
     This is called after the user resized a column. Refer to ANOTIFICATION for the information sent with the NSTableViewColumnDidResizeNotification notification.

-(void) tableViewSelectionDidChange: (NSNotification*)aNotification
     This is called after the user changed their selection. Refer to ANOTIFICATION for the information sent with the NSTableViewSelectionDidChangeNotification notification.

-(void) tableViewSelectionIsChanging: (NSNotification*)aNotification
     This is called while the user is in the middle of changing the current selection, often by dragging the mouse around the tableview. Refer to ANOTIFICATION for the information sent with the NSTableViewSelectionIsChangingNotification notification.

Notifications
-------------

All these notifications have the tableview which posted them as their notification object.

NSTableViewColumnDidMoveNotification
     This is posted when a column moved within a tableview as a result of a user action. It contains a userinfo dictionary with two keys: @"NSOldColumn" and @"NSNewColumn" which are NSNumber objects referring to the previous and new column indices (respectively).

NSTableViewColumnDidResizeNotification
     This is posted when a column is resized within a tableview. It's userinfo dictionary contains two keys: @"NSTableColumn" which refers to the resized column and @"NSOldWidth" which is a NSNumber object containing the columns' previous width.

NSTableViewSelectionDidChangeNotification
     This is posted when the selection within a tableview has changed. Use the tableview to discover the new selection.

NSTableViewSelectionIsChangingNotification
     This is posted as the selection in a tableview is changing, such as when the user drags their mouse over it's cells.

NSView
======

An abstract representation of a view. Should not be instantiated; instead, subclass and customise it's behaviour.

Class Hierarchy: NSView : NSResponder : NSObject

Superviews and Subviews
-----------------------

-(NSView*) superview
     Returns the superview of this view.

-(void) addSubview:(NSView*)AVIEW
     Adds AVIEW to the receiver.

Frame and Bounds manipulation
-----------------------------

-(void) setBoundsOrigin:(NSPoint)ORIGIN
     Set's the origin of the bounds rectangle

-(void) setBoundsSize:(NSSize)SIZE
     Set the size of the bounds rectangle

-(void) setFrameOrigin:(NSPoint)ORIGIN
     Frame origin

-(void) setFrameSize:(NSPoint)SIZE
     Set the frame's size.

Rotation and Scaling
--------------------

-(void) scaleUnitSquareToSize:(NSSize)SIZE
     Scales the size of each "pixel" in a view by the fraction given in SIZE.

-(void) rotateByAngle:(float)DEGREES
     Rotates the coordinate system counterclockwise in degrees. Negetive values are clockwise.

Drawing
-------

-(void) drawRect:(NSRect)RECT
     Override this method with your drawing code. Note that the origin is set at the bottom-left corner of your view when this method is called, and the clipping rectangle is set at the frame/bounds rectangle.