[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

10. Outline Views

An outline view is a specialised form of table view designed for displaying hierachical data in a tree like format. It looks alot like a Windows’ TreeView Control, but operates differently, provides much more powerful functionality and it is less tedious to programme.

The node’s in the outline view can be collapsed and expanded and display a list of sub-nodes. This makes the outline view hierachical.

It uses the NSOutlineView class, which inherits from NSTableView. This means that most of the behaviour that applies to tableviews also applies to outline views, such as changing columns/rows and their display, etc. It extends the tableview with a hierachial layout for data, in which nodes can be expanded and contracted.

Like the table view, the outline view control uses a data source object to get it’s data, as well as a delegate to modify it’s behaviour. These are objects implementing the informal protocols NSOutlineViewDataSource and NSOutlineViewDelegate. Although a delegate object is optional, outline views require a data source object.

See the GNUstep GUI Reference for more information about outline views (including class documentation).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

10.1 Using a Data Source

The data source for an outline view implements the NSOutlineViewDataSource informal protocol. Some of it’s methods are compulsory; some are not.

Note that a parameter in many of the delegate’s methods is an untyped object item. This object is supplied by you, and the outline view passes it back to your delegate as a representation of a node or leaf row.

The outline view requires you implement the following methods:

-(id) outlineView:(NSOutlineView*)outlineView child:(int)index ofItem:(id)item

Returns the item that is the child of item at index. A nil item means that you should return the children of the root item.

-(BOOL) outlineView:(NSOutlineView*)outlineView isItemExpandable:(id)item

Returns whether item is expandable.

-(int) outlineView:(NSOutlineView*)outlineView numberOfChildrenOfItem:(id)item

Returns the number of child items of item.

-(id) outlineView:(NSOutlineView*)outlineView objectValueForTableColumn: (NSTableColumn*)tableColumn byItem:(id)item

Returns the data object for item in tableColumn of the table view.

Full defintions of these (and optional methods) can be found in the GNUstep GUI Manual.


[ << ] [ >> ]           [Top] [Contents] [Index] [ ? ]

This document was generated by Adam Fedor on December 24, 2013 using texi2html 1.82.