![]() |
API 0.9.5
|
#import <CPOutlineView.h>
Instance Methods | |
(void) | - addTableColumn: |
(void) | - collapseItem: |
(id) | - dataSource |
(id) | - delegate |
(void) | - encodeWithCoder: |
(void) | - expandItem: |
(void) | - expandItem:expandChildren: |
(CGRect) | - frameOfDataViewAtColumn:row: |
(CGRect) | - frameOfOutlineDisclosureControlAtRow: |
(BOOL) | - indentationMarkerFollowsDataView |
(float) | - indentationPerLevel |
(id) | - initWithCoder: |
(id) | - initWithFrame: |
(BOOL) | - isExpandable: |
(BOOL) | - isItemExpanded: |
(id) | - itemAtRow: |
(void) | - keyDown: |
(CPInteger) | - levelForItem: |
(CPInteger) | - levelForRow: |
(CPTableColumn) | - outlineTableColumn |
(id) | - parentForItem: |
(void) | - reloadData |
(void) | - reloadItem: |
(void) | - reloadItem:reloadChildren: |
(void) | - removeTableColumn: |
(CPInteger) | - rowForItem: |
(void) | - setDataSource: |
(void) | - setDelegate: |
(void) | - setDisclosureControlPrototype: |
(void) | - setDropItem:dropChildIndex: |
(void) | - setIndentationMarkerFollowsDataView: |
(void) | - setIndentationPerLevel: |
(void) | - setOutlineTableColumn: |
CPOutlineView is a subclass of CPTableView that inherits the row and column format to display hierarchical data. The outlineview adds the ability to expand and collapse items. This is useful for browsing a tree like structure such as directories or a filesystem.
Like the tableview, an outlineview uses a data source to supply its data. For this reason you must implement a couple data source methods (documented in setDataSource:).
Theme states for custom data views are documented in CPTableView.
Definition at line 2 of file CPOutlineView.h.
- (void) addTableColumn: | (CPTableColumn) | aTableColumn |
Adds a new table column to the receiver. If this is the first column added it will automatically be set to the outline column.
Also see -setOutlineTableColumn:.
CPTableColumn | aTableColumn - The table column to add. |
Reimplemented from CPTableView.
Definition at line 1007 of file CPOutlineView.j.
- (void) collapseItem: | (id) | anItem |
Collapse a given item.
anItem | - The item you want to collapse. |
Definition at line 404 of file CPOutlineView.j.
- (id) dataSource |
Returns the datasource object.
Reimplemented from CPTableView.
Definition at line 270 of file CPOutlineView.j.
- (id) delegate |
Returns the delegate object for the outlineview.
Reimplemented from CPTableView.
Definition at line 967 of file CPOutlineView.j.
- (void) encodeWithCoder: | (CPCoder) | aCoder |
Archives the view to a coder.
aCoder | the object into which the view's data will be archived. |
Reimplemented from CPTableView.
Definition at line 1964 of file CPOutlineView.j.
- (void) expandItem: | (id) | anItem |
Expands a given item.
anItem | - the item to expand. |
Definition at line 320 of file CPOutlineView.j.
- (void) expandItem: | (id) | anItem | |
expandChildren: | (BOOL) | shouldExpandChildren | |
Expands a given item, and optionally all the children of that item.
anItem | - the item you want to expand. |
shouldExpandChildren | - Pass YES if you want to expand all the children of anItem, otherwise NO. |
Definition at line 331 of file CPOutlineView.j.
- (CGRect) frameOfDataViewAtColumn: | (CPInteger) | aColumn | |
row: | (CPInteger) | aRow | |
We override this because we need a special behavior for the outline column.
Reimplemented from CPTableView.
Definition at line 1029 of file CPOutlineView.j.
- (CGRect) frameOfOutlineDisclosureControlAtRow: | (CPInteger) | aRow |
Returns the frame of the disclosure button for the outline column. If the item is not expandable a CGZeroRect is returned. Subclasses can return a CGZeroRect to prevent the disclosure control from being displayed.
aRow | - The row of the receiver |
Definition at line 689 of file CPOutlineView.j.
- (BOOL) indentationMarkerFollowsDataView |
Returns the layout behavior of the disclosure buttons.
Definition at line 633 of file CPOutlineView.j.
- (float) indentationPerLevel |
Returns the width of an indentation level.
Definition at line 603 of file CPOutlineView.j.
- (id) initWithCoder: | (CPCoder) | aCoder |
Initializes the view from an archive.
aCoder | the coder from which to initialize |
Reimplemented from CPTableView.
Definition at line 1935 of file CPOutlineView.j.
- (id) initWithFrame: | (CGRect) | aFrame |
Initializes the receiver for usage with the specified bounding rectangle
Reimplemented from CPTableView.
Definition at line 128 of file CPOutlineView.j.
- (BOOL) isExpandable: | (id) | anItem |
Used to query whether an item is expandable or not.
anItem | - the item you are interested in. |
Definition at line 282 of file CPOutlineView.j.
- (BOOL) isItemExpanded: | (id) | anItem |
Used to find if an item is already expanded.
anItem | - the item you are interest in. |
Definition at line 302 of file CPOutlineView.j.
- (id) itemAtRow: | (CPInteger) | aRow |
Returns the item at a given row index. If no item exists nil is returned.
aRow | - The row index you want to find the item at. |
Definition at line 498 of file CPOutlineView.j.
- (void) keyDown: | (CPEvent) | anEvent |
Reimplemented from CPTableView.
Definition at line 1460 of file CPOutlineView.j.
- (CPInteger) levelForItem: | (id) | anItem |
Returns the indentation level of a given item. If the item is nil (the top level root item) CPNotFound is returned. Indentation levels are zero based, thus items that are not indented return 0.
anItem | - The item you want the indentation level for. |
Definition at line 557 of file CPOutlineView.j.
- (CPInteger) levelForRow: | (CPInteger) | aRow |
Returns the indentation level for a given row. If the row is invalid CPNotFound is returned. Rows that are not indented return 0.
aRow | - the row of the receiver |
Definition at line 577 of file CPOutlineView.j.
- (CPTableColumn) outlineTableColumn |
Returns the table column used to display hierarchical data.
Definition at line 544 of file CPOutlineView.j.
- (id) parentForItem: | (id) | anItem |
Returns the parent item for a given item. If the item is a top level root object nil is returned.
anItem | - The item of the receiver. |
Definition at line 645 of file CPOutlineView.j.
- (void) reloadData |
Reloads all the data of the outlineview.
Reimplemented from CPTableView.
Definition at line 992 of file CPOutlineView.j.
- (void) reloadItem: | (id) | anItem |
Reloads the data for an item.
anItem | - The item you want to reload. |
Definition at line 471 of file CPOutlineView.j.
- (void) reloadItem: | (id) | anItem | |
reloadChildren: | (BOOL) | shouldReloadChildren | |
Reloads the data for a given item and optionally the children.
anItem | - The item you want to reload. |
shouldReloadChildren | - Pass YES if you want to reload all the children, otherwise NO. |
Definition at line 482 of file CPOutlineView.j.
- (void) removeTableColumn: | (CPTableColumn) | aTableColumn |
Reimplemented from CPTableView.
Definition at line 1017 of file CPOutlineView.j.
- (CPInteger) rowForItem: | (id) | anItem |
Returns the row of a given item
anItem | - The item you want to find the row of. |
Definition at line 509 of file CPOutlineView.j.
- (void) setDataSource: | (id) | aDataSource |
In addition to standard delegation, the outline view also supports data source delegation. This method sets the data source object. Just like the TableView you have CPTableColumns but instead of rows you deal with items.
Returns the child item at an index of a given item. if item is nil you should return the appropriate root item.
- (id)outlineView:(CPOutlineView)outlineView child:(CPInteger)index ofItem:(id)item;
Returns YES if the item is expandable, otherwise NO.
- (BOOL)outlineView:(CPOutlineView)outlineView isItemExpandable:(id)item;
Returns the number of child items of a given item. If item is nil you should return the number of top level (root) items.
- (int)outlineView:(CPOutlineView)outlineView numberOfChildrenOfItem:(id)item;
Returns the object value of the item in a given column.
- (id)outlineView:(CPOutlineView)outlineView objectValueForTableColumn:(CPTableColumn)tableColumn byItem:(id)item;
---------
Sets the data object value for an item in a given column. This needs to be implemented if you want inline editing support.
- (void)outlineView:(CPOutlineView)outlineView setObjectValue:(id)object forTableColumn:(CPTableColumn)tableColumn byItem:(id)item;
The outlineview will call this method if you click the table header. You should sort the datasource based off of the new sort descriptors and reload the data
- (void)outlineView:(CPOutlineView)outlineView sortDescriptorsDidChange:(CPArray)oldDescriptors;
Return YES if the operation was successful otherwise return NO. The data source should incorporate the data from the dragging pasteboard in this method implementation. To get this data use the draggingPasteboard method on the CPDraggingInfo object.
- (BOOL)outlineView:(CPOutlineView)outlineView acceptDrop:(id < CPDraggingInfo >)info item:(id)item childIndex:(CPInteger)index;
Return the drag operation (move, copy, etc) that should be performed if a registered drag type is over the tableview The data source can retarget a drop if you want by calling
-(void)setDropItem:(id)anItem dropChildIndex:(int)anIndex;
- (CPDragOperation)outlineView:(CPOutlineView)outlineView validateDrop:(id < CPDraggingInfo >)info proposedItem:(id)item proposedChildIndex:(CPInteger)index;
Returns YES if the drop operation is allowed otherwise NO. This method is invoked by the outlineview after a drag should begin, but before it is started. If you don't want the drag to being return NO. If you want the drag to begin you should return YES and place the drag data on the pboard.
- (BOOL)outlineView:(CPOutlineView)outlineView writeItems:(CPArray)items toPasteboard:(CPPasteboard)pboard;
Reimplemented from CPTableView.
Definition at line 212 of file CPOutlineView.j.
- (void) setDelegate: | (id) | aDelegate |
Sets the delegate for the outlineview.
The following methods can be implemented:
aDelegate | - the delegate object you wish to set for the receiver. |
Called when the user moves a column in the outlineview.
- (void)outlineViewColumnDidMove:(CPNotification)notification;
Called when the user resizes a column in the outlineview.
- (void)outlineViewColumnDidResize:(CPNotification)notification;
Called when the user collapses an item in the outlineview.
- (void)outlineViewItemDidCollapse:(CPNotification)notification;
Called when the user expands an item in the outlineview.
- (void)outlineViewItemDidExpand:(CPNotification)notification;
Called when the user collapses an item in the outlineview, but before the item is actually collapsed.
- (void)outlineViewItemWillCollapse:(CPNotification)notification;
Called when the used expands an item, but before the item is actually expanded.
- (void)outlineViewItemWillExpand:(CPNotification)notification;
Called when the user changes the selection of the outlineview.
- (void)outlineViewSelectionDidChange:(CPNotification)notification;
Called when the user changes the selection of the outlineview, but before the change is made.
- (void)outlineViewSelectionIsChanging:(CPNotification)notification;
Return YES if the item should be given permission to expand, otherwise NO.
- (BOOL)outlineView:(CPOutlineView)outlineView shouldExpandItem:(id)item;
Return YES if the item should be given permission to collapse, otherwise NO.
- (BOOL)outlineView:(CPOutlineView)outlineView shouldCollapseItem:(id)item;
Return YES to allow the selection of tableColumn, otherwise NO.
- (BOOL)outlineView:(CPOutlineView)outlineView shouldSelectTableColumn:(CPTableColumn)tableColumn;
Return YES to allow the selection of an item, otherwise NO.
- (BOOL)outlineView:(CPOutlineView)outlineView shouldSelectItem:(id)item;
Return YES to allow the selection of the outlineview to be changed, otherwise NO.
- (BOOL)selectionShouldChangeInOutlineView:(CPOutlineView)outlineView;
Called when a dataView is about to be displayed. This gives you the ability to alter the dataView if needed.
- (void)outlineView:(CPOutlineView)outlineView willDisplayView:(id)dataView forTableColumn:(CPTableColumn)tableColumn item:(id)item;
Return YES to allow for editing of a dataview at given item and tableColumn, otherwise NO to prevent the edit.
- (BOOL)outlineView:(CPOutlineView)outlineView shouldEditTableColumn:(CPTableColumn)tableColumn item:(id)item;
Implement this to indicate whether a given item should be rendered using the group item style. Return YES if the item is a group item, otherwise NO.
- (BOOL)outlineView:(CPOutlineView)outlineView isGroupItem:(id)item;
Implement this method to get custom heights of rows based on the item. This delegate method will be passed your 'item' object and expects you to return an integer height.
- (int)outlineView:(CPOutlineView)outlineView heightOfRowByItem:(id)anItem;
Reimplemented from CPTableView.
Definition at line 790 of file CPOutlineView.j.
- (void) setDisclosureControlPrototype: | (CPControl) | aControl |
Sets the prototype of the disclosure control. This is used if you want to set a special type of button, instead of the default triangle. The control must implement CPCoding.
aControl | - the control to be used to expand and collapse items. |
Definition at line 979 of file CPOutlineView.j.
- (void) setDropItem: | (id) | theItem | |
dropChildIndex: | (int) | theIndex | |
Retargets the drop item for the outlineview.
To specify a drop on theItem, you specify item as theItem and index as CPOutlineViewDropOnItemIndex.
To specify a drop between child 1 and 2 of theItem, you specify item as theItem and index as 2.
To specify a drop on an item that can't be expanded theItem, you specify item as someOutlineItem and index as CPOutlineViewDropOnItemIndex.
theItem | - The item you want to retarget the drop on. |
theIndex | - The index of the child item you want to retarget the drop between. Pass CPOutlineViewDropOnItemIndex if you want to drop on theItem. |
Definition at line 1114 of file CPOutlineView.j.
- (void) setIndentationMarkerFollowsDataView: | (BOOL) | indentationMarkerShouldFollowDataView |
Sets the layout behavior of disclosure button. If you pass NO the disclosure button will always align itself to the left of the outline column.
indentationMarkerShouldFollowDataView | - Pass YES if the disclosure control should be indented along with the dataview, otherwise NO. |
Definition at line 615 of file CPOutlineView.j.
- (void) setIndentationPerLevel: | (float) | anIndentationWidth |
Sets the number of pixels to indent an item at each indentation level.
anIndentationWidth | - the width of each indentation level. |
Definition at line 587 of file CPOutlineView.j.
- (void) setOutlineTableColumn: | (CPTableColumn) | aTableColumn |
Sets the table column you want to display the disclosure button in. If you do not want an outline column pass nil.
aTableColumn | - The CPTableColumn you want to use for hierarchical data. |
Definition at line 528 of file CPOutlineView.j.