![]() |
API 0.9.5
|
#import <CPTableColumn.h>
Instance Methods | |
(void) | - bind:toObject:withKeyPath:options: |
(CPView) | - dataCell |
(id) | - dataCellForRow: |
(CPView) | - dataView |
(id) | - dataViewForRow: |
(BOOL) | - disableResizingPosting |
(void) | - encodeWithCoder: |
(CPView) | - headerCell |
(CPString) | - headerToolTip |
(CPView) | - headerView |
(id) | - identifier |
(id) | - init |
(id) | - initWithCoder: |
(id) | - initWithIdentifier: |
(BOOL) | - isEditable |
(BOOL) | - isHidden |
(float) | - maxWidth |
(float) | - minWidth |
(unsigned) | - resizingMask |
(void) | - setDataCell: |
(void) | - setDataView: |
(void) | - setDisableResizingPosting: |
(void) | - setEditable: |
(void) | - setHeaderCell: |
(void) | - setHeaderToolTip: |
(void) | - setHeaderView: |
(void) | - setHidden: |
(void) | - setIdentifier: |
(void) | - setMaxWidth: |
(void) | - setMinWidth: |
(void) | - setResizingMask: |
(void) | - setSortDescriptorPrototype: |
(void) | - setTableView: |
(void) | - setWidth: |
(void) | - sizeToFit |
(CPSortDescriptor) | - sortDescriptorPrototype |
(CPTableView) | - tableView |
(float) | - width |
A CPTableColumn contains a dataview to display for its column of the CPTableView. A CPTableColumn determines its own size constrains and resizing behavior.
The default dataview is a CPTextField but you can set it to any view you'd like. See -setDataView: for documentation including theme states.
To customize the text of the column header you can simply call setStringValue: on the headerview of a table column. For example: [[myTableColumn headerView] setStringValue:"My Title"];
Definition at line 2 of file CPTableColumn.h.
- (void) bind: | (CPString) | aBinding | |
toObject: | (id) | anObject | |
withKeyPath: | (CPString) | aKeyPath | |
options: | (CPDictionary) | options | |
Binds the receiver to an object.
CPString | aBinding - The binding you wish to make. Typically CPValueBinding. |
id | anObject - The object to bind the receiver to. |
CPString | aKeyPath - The key path you wish to bind the receiver to. |
CPDictionary | options - A dictionary of options for the binding. This parameter is optional, pass nil if you do not wish to use it. |
Reimplemented from CPObject.
Definition at line 586 of file CPTableColumn.j.
- (CPView) dataCell |
Definition at line 797 of file CPTableColumn.j.
- (id) dataCellForRow: | (int) | row |
Definition at line 806 of file CPTableColumn.j.
- (CPView) dataView |
Definition at line 397 of file CPTableColumn.j.
- (id) dataViewForRow: | (int) | aRowIndex |
Definition at line 410 of file CPTableColumn.j.
- (BOOL) disableResizingPosting |
Synthesized accessor method.
Definition at line 819 of file CPTableColumn.j.
- (void) encodeWithCoder: | (CPCoder) | aCoder |
Definition at line 746 of file CPTableColumn.j.
- (CPView) headerCell |
Definition at line 779 of file CPTableColumn.j.
- (CPString) headerToolTip |
Returns the tooltip for the column header
Definition at line 532 of file CPTableColumn.j.
- (CPView) headerView |
Returns the headerview for the column.
In order to change the text of the headerview for a column you should call setStringValue: on the headerview. For example: [[myTableColumn headerView] setStringValue:"My Column"];
Definition at line 317 of file CPTableColumn.j.
- (id) identifier |
Returns the object used by the data source to identify the attribute corresponding to the receiver.
Definition at line 454 of file CPTableColumn.j.
- (id) init |
Definition at line 65 of file CPTableColumn.j.
- (id) initWithCoder: | (CPCoder) | aCoder |
Definition at line 716 of file CPTableColumn.j.
- (id) initWithIdentifier: | (id) | anIdentifier |
Initializes a newly created CPTableColumn with a given identifier.
Definition at line 74 of file CPTableColumn.j.
- (BOOL) isEditable |
Returns YES if the user can edit cells associated with the receiver by double-clicking the column in the CPTableView, NO otherwise.
Definition at line 473 of file CPTableColumn.j.
- (BOOL) isHidden |
Returns the visibility status of the column.
Definition at line 513 of file CPTableColumn.j.
- (float) maxWidth |
Returns the maximum width of the column
Definition at line 242 of file CPTableColumn.j.
- (float) minWidth |
Returns the minimum width of the column.
Definition at line 214 of file CPTableColumn.j.
- (unsigned) resizingMask |
Returns the resizing mask of the column
Definition at line 267 of file CPTableColumn.j.
- (void) setDataCell: | (CPView) | aView |
Definition at line 788 of file CPTableColumn.j.
- (void) setDataView: | (CPView) | aView |
This method sets the "prototype" view which will be used to create all table cells in this column.
It creates a snapshot of aView, using keyed archiving, which is then copied over and over for each individual cell that is shown. As a result, changes made after calling this method won't be reflected.
Example:
[tableColumn setDataView:someView]; // snapshot taken [[tableColumn dataView] setSomething:x]; //won't work
This doesn't work because the snapshot is taken before the new property is applied. Instead, do:
[someView setSomething:x]; [tableColumn setDataView:someView];
Example: Say you have two instance variables in your object that need to be set up each time an object is create. We will call these instance variables "image" and "text". Your CPCoding methods will look like the following:
- (id)initWithCoder:(CPCoder)aCoder { self = [super initWithCoder:aCoder]; if (self) { image = [aCoder decodeObjectForKey:"MyDataViewImage"]; text = [aCoder decodeObjectForKey:"MyDataViewText"]; } return self; } - (void)encodeWithCoder:(CPCoder)aCoder { [super encodeWithCoder:aCoder]; [aCoder encodeObject:image forKey:"MyDataViewImage"]; [aCoder encodeObject:text forKey:"MyDataViewText"]; }
When you set a dataview and it is added to the tableview the theme state will be set to CPThemeStateTableDataView
When the dataview becomes selected the theme state will be set to CPThemeStateSelectedDataView
.
If the dataview shows up in a group row of the tableview the theme state will be set to CPThemeStateGroupRow
.
You should overide setThemeState:
and unsetThemeState:
to handle these theme state changes in your dataview.
Definition at line 386 of file CPTableColumn.j.
- (void) setDisableResizingPosting: | (BOOL) | aValue |
Synthesized accessor method.
Definition at line 827 of file CPTableColumn.j.
- (void) setEditable: | (BOOL) | shouldBeEditable |
Controls whether the user can edit cells in the receiver by double-clicking them.
Definition at line 464 of file CPTableColumn.j.
- (void) setHeaderCell: | (CPView) | aView |
Definition at line 770 of file CPTableColumn.j.
- (void) setHeaderToolTip: | (CPString) | aToolTip |
Sets the tooltip string that is displayed when the cursor pauses over the header cell of the receiver.
Definition at line 524 of file CPTableColumn.j.
- (void) setHeaderView: | (CPView) | aView |
Sets the header view for the column. The headerview handles the display of sort indicators, text, etc.
If you do not want a headerview for you table you should call setHeaderView: on your CPTableView instance. Passing nil here will throw an exception.
In order to customize the text of the column header see - (CPView)headerView;
Definition at line 298 of file CPTableColumn.j.
- (void) setHidden: | (BOOL) | shouldBeHidden |
If NO the tablecolumn will no longer be visible in the tableview If YES the tablecolumn will be visible in the tableview.
Definition at line 498 of file CPTableColumn.j.
- (void) setIdentifier: | (id) | anIdentifier |
Sets the receiver identifier to anIdentifier.
Definition at line 446 of file CPTableColumn.j.
- (void) setMaxWidth: | (float) | aMaxWidth |
Sets the maximum width of the table column. Default value is: 1000000
Definition at line 223 of file CPTableColumn.j.
- (void) setMinWidth: | (float) | aMinWidth |
Sets the minimum width of the column. Default value is 10.
Definition at line 195 of file CPTableColumn.j.
- (void) setResizingMask: | (unsigned) | aResizingMask |
Set the resizing mask of the column. By default the column can be resized automatically with the tableview and manually by the user
Possible masking values are: CPTableColumnNoResizing CPTableColumnAutoresizingMask CPTableColumnUserResizingMask
Definition at line 258 of file CPTableColumn.j.
- (void) setSortDescriptorPrototype: | (CPSortDescriptor) | aSortDescriptor |
Sets the sort descriptor prototype for the column.
Definition at line 481 of file CPTableColumn.j.
- (void) setTableView: | (CPTableView) | aTableView |
Set the columns's parent tableview
Definition at line 102 of file CPTableColumn.j.
- (void) setWidth: | (float) | aWidth |
Set the width of the column Default value is: 100
If the value is greater than the maxWidth the maxWidth will be reset with the supplied width here If the value is less than the minWidth the minWidth will be reset with the supplied width.
Definition at line 143 of file CPTableColumn.j.
- (void) sizeToFit |
Sizes the column to fix the column header text.
Definition at line 275 of file CPTableColumn.j.
- (CPSortDescriptor) sortDescriptorPrototype |
Returns the sort descriptor prototype for the column.
Definition at line 489 of file CPTableColumn.j.
- (CPTableView) tableView |
Return the column's parent tableview
Definition at line 110 of file CPTableColumn.j.
- (float) width |
Returns the column's width
Definition at line 186 of file CPTableColumn.j.