CPObjectCPTableColumn
@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. |
Method Detail |
---|
-(id)initWithIdentifier:(CPString)anIdentifier
anIdentifier
- the identifier-(CPCell)dataCell
-(CPCell)dataCellForRow:(int)aRowIndex
dataCell
. This can
be overridden by a subclass to return different cells for different
rows.aRowIndex
- the index of the row to obtain the cell for-(CPView)headerView
-(CPString)identifier
-(BOOL)isEditable
YES
if the column data is editable.-(float)minWidth
-(unsigned)resizingMask
CPTableColumnNoResizing; CPTableColumnAutoresizingMask; CPTableColumnUserResizingMask;
-(void)setDataCell:(CPCell)aDataCell
aDataCell
-(void)setEditable:(BOOL)aFlag
aFlag
- YES
means the column data is editable-(void)setHeaderView:(CPView)aHeaderView
aHeaderView
- the view that will draws the column header-(void)setIdentifier:(CPString)anIdentifier
anIdentifier
- the new identifier-(void)setMaxWidth:(float)aWidth
aWidth
- the new maximum width-(void)setMinWidth:(float)aWidth
aWidth
- the new minimum column width-(void)setResizingMask:(unsigned)aMask
CPTableColumnNoResizing; CPTableColumnAutoresizingMask; CPTableColumnUserResizingMask;
aMask
- the new resizing mask-(void)setTableView:(CPTableView)aTableView
aTableView
- the new table view-(void)setWidth:(float)aWidth
aWidth
- the new column width-(void)sizeToFit
-(CPTableView)tableView
-(float)width
Created on Sat Sep 13 14:15:43 PDT 2008