Class CPTableColumn

CPObject
    extended byCPTableColumn

@implementation CPTableColumn : CPObject

An CPTableColumn object mainly keeps information about the width of the column, its minimum and maximum width; whether the column can be edited or resized; and the cells used to draw the column header and the data in the column. You can change all these attributes of the column by calling the appropriate methods. Please note that the table column does not hold nor has access to the data to be displayed in the column; this data is maintained in the table view's data source.

Each CPTableColumn object is identified by a CPString, called the column identifier. The reason is that, after a column has been added to a table view, the user might move the columns around, so there is a need to identify the columns regardless of its position in the table.


Global Variables
CPTableColumnAutoresizingMask = 1
        
CPTableColumnUserResizingMask = 2
        
CPTableColumnNoResizing = 0
        

Method Summary
-(id)initWithIdentifier:(CPString)anIdentifier
          Initializes the table column with the specified identifier.
-(CPCell)dataCell
          Returns the data cell that draws rows in this column.
-(CPCell)dataCellForRow:(int)aRowIndex
          By default returns the value from dataCell.
-(CPView)headerView
          Return the view that draws the column's header.
-(CPString)identifier
          Returns the table column's identifier.
-(BOOL)isEditable
          Returns YES if the column data is editable.
-(float)minWidth
          The column's minimum width.
-(unsigned)resizingMask
          Returns the column's resizing mask.
-(void)setDataCell:(CPCell)aDataCell
          Sets the data cell that draws rows in this column.
-(void)setEditable:(BOOL)aFlag
          Sets whether the column in this data is editable.
-(void)setHeaderView:(CPView)aHeaderView
          Sets the view that draws the column's header.
-(void)setIdentifier:(CPString)anIdentifier
          Sets the table column's identifier.
-(void)setMaxWidth:(float)aWidth
          Sets the column's maximum width.
-(void)setMinWidth:(float)aWidth
          Sets column's minimum width.
-(void)setResizingMask:(unsigned)aMask
          Sets the resizing mask.
-(void)setTableView:(CPTableView)aTableView
          Sets the table's view.
-(void)setWidth:(float)aWidth
          Sets the column's width.
-(void)sizeToFit
          Resizes the column according to the min, max and set width.
-(CPTableView)tableView
          Returns the column's table view.
-(float)width
          Returns the column's width.

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


Method Detail

initWithIdentifier

-(id)initWithIdentifier:(CPString)anIdentifier
Initializes the table column with the specified identifier.
Parameters:
anIdentifier - the identifier
Returns:
the initialized table column

dataCell

-(CPCell)dataCell
Returns the data cell that draws rows in this column

dataCellForRow

-(CPCell)dataCellForRow:(int)aRowIndex
By default returns the value from dataCell. This can be overridden by a subclass to return different cells for different rows.
Parameters:
aRowIndex - the index of the row to obtain the cell for

headerView

-(CPView)headerView
Return the view that draws the column's header

identifier

-(CPString)identifier
Returns the table column's identifier

isEditable

-(BOOL)isEditable
Returns YES if the column data is editable.

minWidth

-(float)minWidth
The column's minimum width

resizingMask

-(unsigned)resizingMask
Returns the column's resizing mask. One of:
CPTableColumnNoResizing;
CPTableColumnAutoresizingMask;
CPTableColumnUserResizingMask;

setDataCell

-(void)setDataCell:(CPCell)aDataCell
Sets the data cell that draws rows in this column.
Parameters:
aDataCell

setEditable

-(void)setEditable:(BOOL)aFlag
Sets whether the column in this data is editable.
Parameters:
aFlag - YES means the column data is editable

setHeaderView

-(void)setHeaderView:(CPView)aHeaderView
Sets the view that draws the column's header.
Parameters:
aHeaderView - the view that will draws the column header

setIdentifier

-(void)setIdentifier:(CPString)anIdentifier
Sets the table column's identifier
Parameters:
anIdentifier - the new identifier

setMaxWidth

-(void)setMaxWidth:(float)aWidth
Sets the column's maximum width.
Parameters:
aWidth - the new maximum width

setMinWidth

-(void)setMinWidth:(float)aWidth
Sets column's minimum width.
Parameters:
aWidth - the new minimum column width

setResizingMask

-(void)setResizingMask:(unsigned)aMask
Sets the resizing mask. The mask is one of:
CPTableColumnNoResizing;
CPTableColumnAutoresizingMask;
CPTableColumnUserResizingMask;
Parameters:
aMask - the new resizing mask

setTableView

-(void)setTableView:(CPTableView)aTableView
Sets the table's view. This is called automatically by Cappuccino.
Parameters:
aTableView - the new table view

setWidth

-(void)setWidth:(float)aWidth
Sets the column's width.
Parameters:
aWidth - the new column width

sizeToFit

-(void)sizeToFit
Resizes the column according to the min, max and set width.

tableView

-(CPTableView)tableView
Returns the column's table view.

width

-(float)width
Returns the column's width

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