Class CPTableView

CPObject
    extended byCPResponder
        extended byCPView
            extended byCPControl
                extended byCPTableView

@implementation CPTableView : CPControl

CPTableView is located within the AppKit framework and is used to display tables. It uses a delegate model for getting its data i.e. you give it an object that provides it with the data it should display.


Method Summary
-(id)initWithFrame:(CGRect)aFrame
          Initializes the receiver for usage with the specified bounding rectangle.
-(void)addTableColumn:(CPTableColumn)aTableColumn
          Adds a column to the table.
-(float)columnHeight
          Returns the table's column height.
-(id)dataSource
          Returns the object that has access to the table data.
-(CGSize)intercellSpacing
          Returns the width and height of the space between cells.
-(void)loadTableCellsInRect:(CGRect)aRect
-(void)moveColumn:(unsigned)fromIndex toColumn:(unsinged)toIndex
          Not yet implemented.
-(void)noteNumberOfRowsChanged
          Tells the table view that the number of rows in the table has changed.
-(int)numberOfColumns
          Returns the number of columns in the table.
-(int)numberOfRows
          Returns the number of rows in the table.
-(CGRect)rectOfColumn:(int)aColumnIndex
          Returns the rectangle bounding the specified column.
-(CGRect)rectOfRow:(int)aRowIndex
          Returns the rectangle bounding the specified row.
-(void)reloadData
          Reloads the data from the dataSource.
-(void)removeTableColumn:(CPTableColumn)aTableColumn
          Removes a column from the table.
-(unsigned)rowHeight
          Returns the height of a table row.
-(void)setDataSource:(id)aDataSource
          Sets the object that is used to obtain the table data.
-(void)setFrameSize:(CGSize)aSize
          Sets the receiver's frame size.
-(void)setIntercellSpacing:(CGSize)aSize
          Sets the width and height between cell.
-(void)setRowHeight:(unsigned)aRowHeight
          Sets the height of table rows.
-(void)sizeToFit
          Adjusts column widths to make them all visible at once.
-(CPArray)tableColumns
          Returns an array containing the table's CPTableColumns.
-(void)tile
          Adjusts the size of the table and it's header view.

Methods inherited from class CPObject
initialize, alloc, class, instanceMethodForSelector, instancesRespondToSelector, isSubclassOfClass, load, new, setVersion, superclass, version, init, autorelease, awakeAfterUsingCoder, class, classForCoder, classForKeyedArchiver, className, copy, dealloc, description, doesNotRecognizeSelector, forwardInvocation, hash, isEqual, isKindOfClass, isMemberOfClass, isProxy, methodForSelector, methodSignatureForSelector, mutableCopy, performSelector, performSelector, performSelector, release, replacementObjectForArchiver, replacementObjectForCoder, replacementObjectForKeyedArchiver, respondsToSelector, retain, self, superclass

Methods inherited from class CPResponder
acceptsFirstResponder, becomeFirstResponder, deleteBackward, doCommandBySelector, insertLineBreak, insertText, interpretKeyEvents, keyDown, keyUp, menu, mouseDown, mouseDragged, mouseEntered, mouseExited, mouseMoved, mouseUp, nextResponder, noResponderFor, performKeyEquivalent, resignFirstResponder, scrollWheel, setMenu, setNextResponder, tryToPerform, undoManager

Methods inherited from class CPView
initWithFrame, acceptsFirstMouse, addSubview, addSubview, adjustScroll, alphaValue, autoresizesSubviews, autoresizingMask, autoscroll, backgroundColor, bounds, convertPoint, convertPoint, convertRect, convertRect, convertSize, convertSize, didAddSubview, display, displayIfNeeded, displayIfNeededInRect, displayRect, displayRectIgnoringOpacity, dragImage, dragView, drawRect, enclosingMenuItem, enclosingScrollView, enterFullScreenMode, exitFullScreenModeWithOptions, frame, hitTest, hitTests, isDescendantOf, isFlipped, isHidden, isHiddenOrHasHiddenAncestor, isInFullScreenMode, isOpaque, lockFocus, mouseDown, mouseDownCanMoveWindow, needsDisplay, postsBoundsChangedNotifications, postsFrameChangedNotifications, reflectScrolledClipView, registerForDraggedTypes, registeredDraggedTypes, removeFromSuperview, replaceSubview, resizeSubviewsWithOldSize, resizeWithOldSuperviewSize, scrollClipView, scrollPoint, scrollRectToVisible, scrollRect, setAlphaValue, setAutoresizesSubviews, setAutoresizingMask, setBackgroundColor, setBounds, setBoundsOrigin, setBoundsSize, setFrame, setFrameOrigin, setFrameSize, setHidden, setHitTests, setNeedsDisplay, setNeedsDisplayInRect, setPostsBoundsChangedNotifications, setPostsFrameChangedNotifications, subviews, superview, unlockFocus, unregisterDraggedTypes, viewDidMoveToSuperview, viewDidMoveToWindow, viewWillMoveToSuperview, viewWillMoveToWindow, visibleRect, willRemoveSubview, window

Methods inherited from class CPControl
initWithFrame, action, alignment, backgroundColorForName, floatValue, font, isEnabled, mouseUp, sendAction, setAction, setAlignment, setBackgroundColor, setBackgroundColorWithName, setBackgroundColor, setEnabled, setFloatValue, setFont, setTarget, setTextColor, setTextShadow, target, textColor, textShadow


Method Detail

initWithFrame

-(id)initWithFrame:(CGRect)aFrame
Initializes the receiver for usage with the specified bounding rectangle
Parameters:
aFrame
Returns:
the initialized view

addTableColumn

-(void)addTableColumn:(CPTableColumn)aTableColumn
Adds a column to the table
Parameters:
aTableColumn - the column to be added

columnHeight

-(float)columnHeight
Returns the table's column height

dataSource

-(id)dataSource
Returns the object that has access to the table data

intercellSpacing

-(CGSize)intercellSpacing
Returns the width and height of the space between cells.

loadTableCellsInRect

-(void)loadTableCellsInRect:(CGRect)aRect
Parameters:
aRect

moveColumn

-(void)moveColumn:(unsigned)fromIndex toColumn:(unsinged)toIndex
Not yet implemented. Changes the position of the column in the table.
Parameters:
fromIndex - the original index of the column
toIndex - the desired index of the column

noteNumberOfRowsChanged

-(void)noteNumberOfRowsChanged
Tells the table view that the number of rows in the table has changed.

numberOfColumns

-(int)numberOfColumns
Returns the number of columns in the table

numberOfRows

-(int)numberOfRows
Returns the number of rows in the table

rectOfColumn

-(CGRect)rectOfColumn:(int)aColumnIndex
Returns the rectangle bounding the specified column
Parameters:
aColumnIndex - the column to obtain a rectangle for
Returns:
the bounding column

rectOfRow

-(CGRect)rectOfRow:(int)aRowIndex
Returns the rectangle bounding the specified row.
Parameters:
aRowIndex - the row to obtain a rectangle for
Returns:
the bounding rectangle

reloadData

-(void)reloadData
Reloads the data from the dataSource. This is an expensive method, so use it lightly.

removeTableColumn

-(void)removeTableColumn:(CPTableColumn)aTableColumn
Removes a column from the table
Parameters:
aTableColumn - the column to remove

rowHeight

-(unsigned)rowHeight
Returns the height of a table row

setDataSource

-(void)setDataSource:(id)aDataSource
Sets the object that is used to obtain the table data. The data source must implement the following methods:
- (int)numberOfRowsInTableView:(CPTableView)aTableView
- (id)tableView:(CPTableView)aTableView objectValueForTableColumn:(CPTableColumn)aTableColumn row:(int)rowIndex
Parameters:
aDataSource - the object with the table data
Throws:
CPInternalInconsistencyException - if aDataSource doesn't implement all the required methods

setFrameSize

-(void)setFrameSize:(CGSize)aSize
Sets the receiver's frame size. If aSize is the same as the frame's current dimensions, this method simply returns. The method posts a CPViewFrameDidChangeNotification to the default notification center if the receiver is configured to do so.
Parameters:
aSize - the new size for the frame

setIntercellSpacing

-(void)setIntercellSpacing:(CGSize)aSize
Sets the width and height between cell. The default is (3.0, 2.0) (width, height).
Parameters:
aSize

setRowHeight

-(void)setRowHeight:(unsigned)aRowHeight
Sets the height of table rows
Parameters:
aRowHeight - the new height of the table rows

sizeToFit

-(void)sizeToFit
Adjusts column widths to make them all visible at once. Same as tile.

tableColumns

-(CPArray)tableColumns
Returns an array containing the table's CPTableColumns.

tile

-(void)tile
Adjusts the size of the table and it's header view.

Created on Sat Sep 13 14:15:43 PDT 2008